🎨 tell users transformers.js not supported

This commit is contained in:
Nate Sesti 2024-05-23 11:33:52 -07:00
parent a364ceb607
commit 4e5b116cc1
5 changed files with 26 additions and 8 deletions

View file

@ -15,7 +15,7 @@ fs.mkdirSync(bin);
fs.mkdirSync(out);
const esbuildOutputFile = "out/index.js";
const targets = [
let targets = [
"darwin-x64",
"darwin-arm64",
"linux-x64",

View file

@ -49,7 +49,7 @@
"@types/node-fetch": "^2.6.11",
"@typescript-eslint/eslint-plugin": "^7.8.0",
"@typescript-eslint/parser": "^7.8.0",
"@xenova/transformers": "^2.14.0",
"@xenova/transformers": "2.14.0",
"adf-to-md": "^1.1.0",
"axios": "^1.6.7",
"cheerio": "^1.0.0-rc.12",
@ -64,11 +64,12 @@
"ignore": "^5.3.1",
"js-tiktoken": "^1.0.8",
"jsdom": "^24.0.0",
"launchdarkly-node-client-sdk": "^3.2.0",
"llm-code-highlighter": "^0.0.14",
"node-fetch": "^3.3.2",
"node-html-markdown": "^1.3.0",
"ollama": "^0.4.6",
"onnxruntime-node": "1.17.3-rev.1",
"onnxruntime-node": "1.14.0",
"openai": "^4.20.1",
"pg": "^8.11.3",
"posthog-node": "^3.6.3",
@ -95,8 +96,8 @@
"eslint-plugin-import": "^2.29.1",
"eslint-plugin-require-extensions": "^0.1.3",
"jest": "^29.7.0",
"onnxruntime-common": "^1.17.3",
"onnxruntime-web": "^1.17.3",
"onnxruntime-common": "1.14.0",
"onnxruntime-web": "1.14.0",
"ts-jest": "^29.1.1"
},
"engines": {

View file

@ -23,6 +23,13 @@ class DocsContextProvider extends BaseContextProvider {
query: string,
extras: ContextProviderExtras,
): Promise<ContextItem[]> {
// Not supported in JetBrains IDEs right now
if ((await extras.ide.getIdeInfo()).ideType === "jetbrains") {
throw new Error(
"The @docs context provider is not currently supported in JetBrains IDEs. We'll have an update soon!",
);
}
const { retrieveDocs } = await import("../../indexing/docs/db");
const embeddingsProvider = new TransformersJsEmbeddingsProvider();
const [vector] = await embeddingsProvider.embed([extras.fullInput]);
@ -118,7 +125,7 @@ class DocsContextProvider extends BaseContextProvider {
return 1;
} else {
// Secondary criterion: Alphabetical order when both items are in the same category
return a.title.toString().localeCompare(b.title.toString());
return a.title.toString().localeCompare(b.title.toString());
}
});

View file

@ -29,6 +29,16 @@ export async function retrieveContextItemsFromEmbeddings(
return [];
}
// transformers.js not supported in JetBrains IDEs right now
if (
extras.embeddingsProvider.id === "all-MiniLM-L6-v2" &&
(await extras.ide.getIdeInfo()).ideType === "jetbrains"
) {
throw new Error(
"The transformers.js context provider is not currently supported in JetBrains. For now, you can use Ollama to set up local embeddings, or use our 'free-trial' embeddings provider. See here to learn more: https://docs.continue.dev/walkthroughs/codebase-embeddings#embeddings-providers",
);
}
const nFinal = options?.nFinal || RETRIEVAL_PARAMS.nFinal;
const useReranking = extras.reranker !== undefined;
const nRetrieve =

View file

@ -310,7 +310,7 @@ class IdeProtocolClient (
Position(endLine, 0)
)
),
data["color"] as String
data["color"] as String?
)
respond(null)
}
@ -841,7 +841,7 @@ class IdeProtocolClient (
)
}
fun highlightCode(rangeInFile: RangeInFile, color: String) {
fun highlightCode(rangeInFile: RangeInFile, color: String?) {
val file =
LocalFileSystem.getInstance().findFileByPath(rangeInFile.filepath)