🐛 small bug fixes

This commit is contained in:
Nate Sesti 2024-02-13 09:48:45 -08:00
parent 4524c8d1f6
commit fbce8c3080
3 changed files with 29 additions and 48 deletions

View file

@ -81,11 +81,16 @@ export async function constructAutocompletePrompt(
// Find external snippets
const snippets: AutocompleteSnippet[] = [];
const treePath = await getTreePathAtCursor(
filepath,
fullPrefix + fullSuffix,
fullPrefix.length
);
let treePath;
try {
treePath = await getTreePathAtCursor(
filepath,
fullPrefix + fullSuffix,
fullPrefix.length
);
} catch (e) {
console.error("Failed to parse AST", e);
}
// Get function def when inside call expression
if (treePath) {

View file

@ -21,6 +21,21 @@ const NON_CHAT_MODELS = [
"ada",
];
const CHAT_ONLY_MODELS = [
"gpt-3.5-turbo",
"gpt-3.5-turbo-0613",
"gpt-3.5-turbo-16k",
"gpt-4",
"gpt-35-turbo-16k",
"gpt-35-turbo-0613",
"gpt-35-turbo",
"gpt-4-32k",
"gpt-4-turbo-preview",
"gpt-4-vision",
"gpt-4-0125-preview",
"gpt-4-1106-preview",
];
class OpenAI extends BaseLLM {
public useLegacyCompletionsEndpoint = false;
@ -142,8 +157,9 @@ class OpenAI extends BaseLLM {
options: CompletionOptions
): AsyncGenerator<ChatMessage> {
if (
NON_CHAT_MODELS.includes(options.model) ||
this.useLegacyCompletionsEndpoint
!CHAT_ONLY_MODELS.includes(options.model) &&
(NON_CHAT_MODELS.includes(options.model) ||
this.useLegacyCompletionsEndpoint)
) {
for await (const content of this._legacystreamComplete(
stripImages(messages[messages.length - 1]?.content || ""),

View file

@ -14,7 +14,7 @@ import {
setupStatusBar,
} from "../lang-server/completionProvider";
import { vsCodeIndexCodebase } from "../util/indexCodebase";
import { getExtensionVersion, getPlatform } from "../util/util";
import { getExtensionVersion } from "../util/util";
import { getExtensionUri } from "../util/vscode";
import { setupInlineTips } from "./inlineTips";
@ -149,46 +149,6 @@ export async function activateExtension(context: vscode.ExtensionContext) {
// });
// })();
if (getPlatform() === "mac") {
// Icon is too large and distracting on other platforms
try {
// Add icon theme for .continueignore
const iconTheme = vscode.workspace
.getConfiguration("workbench")
.get("iconTheme");
let found = false;
for (let i = vscode.extensions.all.length - 1; i >= 0; i--) {
if (found) {
break;
}
const extension = vscode.extensions.all[i];
if (extension.packageJSON?.contributes?.iconThemes?.length > 0) {
for (const theme of extension.packageJSON.contributes.iconThemes) {
if (theme.id === iconTheme) {
const themePath = path.join(extension.extensionPath, theme.path);
const themeJson = JSON.parse(
fs.readFileSync(themePath).toString()
);
themeJson.iconDefinitions["_f_continue"] = {
fontCharacter: "⚙️",
fontColor: "#fff",
};
themeJson.fileNames[".continueignore"] = "_f_continue";
themeJson.fileNames[".continuerc.json"] = "_f_continue";
themeJson.fileNames["config.json"] = "_f_continue";
fs.writeFileSync(themePath, JSON.stringify(themeJson));
found = true;
break;
}
}
}
}
} catch (e) {
console.log("Error adding .continueignore file icon: ", e);
}
}
// Load Continue configuration
if (!context.globalState.get("hasBeenInstalled")) {
context.globalState.update("hasBeenInstalled", true);