🩹 fix bug causing stop words to be duplicated

This commit is contained in:
Nate Sesti 2024-02-05 20:51:57 -08:00
parent f825509ca6
commit a02c4bd534
5 changed files with 24 additions and 8 deletions

View file

@ -1,6 +1,8 @@
type JsonObject = { [key: string]: any };
export function mergeJson(first: JsonObject, second: JsonObject): any {
first = { ...first };
try {
for (var key in second) {
let secondValue = second[key];

View file

@ -10,7 +10,6 @@
"license": "Apache-2.0",
"dependencies": {
"@electron/rebuild": "^3.2.10",
"@lancedb/vectordb-darwin-arm64": "^0.4.8",
"@reduxjs/toolkit": "^1.9.3",
"@types/jest": "^29.5.11",
"@types/node-fetch": "^2.6.11",
@ -90,7 +89,7 @@
"fastest-levenshtein": "^1.0.16",
"handlebars": "^4.7.8",
"js-tiktoken": "^1.0.8",
"llm-code-highlighter": "^0.0.1",
"llm-code-highlighter": "^0.0.3",
"node-fetch": "^3.3.2",
"node-html-markdown": "^1.3.0",
"openai": "^4.20.1",
@ -1851,6 +1850,7 @@
"cpu": [
"arm64"
],
"optional": true,
"os": [
"darwin"
]

View file

@ -20,10 +20,23 @@ const statusBarItemTooltip = (enabled: boolean | undefined) =>
enabled ? "Tab autocomplete is enabled" : "Click to enable tab autocomplete";
let lastStatusBar: vscode.StatusBarItem | undefined = undefined;
let statusBarFalseTimeout: NodeJS.Timeout | undefined = undefined;
function stopStatusBarLoading() {
statusBarFalseTimeout = setTimeout(() => {
setupStatusBar(true, false);
}, 100);
}
export function setupStatusBar(
enabled: boolean | undefined,
loading?: boolean
) {
if (loading !== false) {
clearTimeout(statusBarFalseTimeout);
statusBarFalseTimeout = undefined;
}
const statusBarItem = vscode.window.createStatusBarItem(
vscode.StatusBarAlignment.Right
);
@ -140,8 +153,8 @@ class ListenableGenerator<T> {
let resolve: (value: any) => void;
let promise = new Promise<T>((res) => {
resolve = res;
this._listeners.add(resolve!);
});
this._listeners.add(resolve!);
const value = await promise;
this._listeners.delete(resolve!);
@ -296,6 +309,7 @@ async function getTabCompletion(
for await (const update of generator) {
completion += update;
if (token.isCancellationRequested) {
stopStatusBarLoading();
return undefined;
}
@ -441,7 +455,7 @@ export class ContinueCompletionProvider
} catch (e: any) {
console.warn("Error getting autocompletion: ", e.message);
} finally {
setupStatusBar(true, false);
stopStatusBarLoading();
}
}
}

View file

@ -696,7 +696,7 @@
resolved "https://registry.npmjs.org/@jsdevtools/ono/-/ono-7.1.3.tgz"
integrity sha512-4JQNk+3mVzK3xh2rqd6RB4J46qUR19azEHBneZyTZM+c456qOrbbM/5xcR8huNCCcbVt7+UmizG6GuUvPvKUYg==
"@lancedb/vectordb-darwin-arm64@^0.4.8", "@lancedb/vectordb-darwin-arm64@0.4.8":
"@lancedb/vectordb-darwin-arm64@*", "@lancedb/vectordb-darwin-arm64@0.4.8":
version "0.4.8"
resolved "https://registry.npmjs.org/@lancedb/vectordb-darwin-arm64/-/vectordb-darwin-arm64-0.4.8.tgz"
integrity sha512-FpnJaw7KmNdD/FtOw9AcmPL5P+L04AcnfPj9ZyEjN8iCwB/qaOGYgdfBv+EbEtfHIsqA12q/1BRduu9KdB6BIA==
@ -2303,7 +2303,7 @@ core-util-is@1.0.2:
fastest-levenshtein "^1.0.16"
handlebars "^4.7.8"
js-tiktoken "^1.0.8"
llm-code-highlighter "^0.0.1"
llm-code-highlighter "^0.0.3"
node-fetch "^3.3.2"
node-html-markdown "^1.3.0"
openai "^4.20.1"

4
gui/package-lock.json generated
View file

@ -82,7 +82,7 @@
"fastest-levenshtein": "^1.0.16",
"handlebars": "^4.7.8",
"js-tiktoken": "^1.0.8",
"llm-code-highlighter": "^0.0.1",
"llm-code-highlighter": "^0.0.3",
"node-fetch": "^3.3.2",
"node-html-markdown": "^1.3.0",
"openai": "^4.20.1",
@ -8676,7 +8676,7 @@
"handlebars": "^4.7.8",
"jest": "^29.7.0",
"js-tiktoken": "^1.0.8",
"llm-code-highlighter": "^0.0.1",
"llm-code-highlighter": "^0.0.3",
"node-fetch": "^3.3.2",
"node-html-markdown": "^1.3.0",
"openai": "^4.20.1",