✨ add codebase context provider to config.json

This commit is contained in:
Nate Sesti 2024-01-09 22:26:13 -08:00
parent cdbe5692db
commit 2a2ce80577
2 changed files with 30 additions and 2 deletions

5
core/index.d.ts vendored
View file

@ -334,7 +334,8 @@ type ContextProviderName =
| "search"
| "url"
| "tree"
| "http";
| "http"
| "codebase";
type TemplateType =
| "llama2"
@ -461,7 +462,7 @@ export type EmbeddingsProviderName = "transformers.js" | "ollama" | "openai";
export interface EmbedOptions {
apiBase?: string;
apiKey?: string;
model: string;
model?: string;
}
export interface EmbeddingsProviderDescription extends EmbedOptions {

View file

@ -75,6 +75,33 @@ class VsCodeIde implements IDE {
fs.writeFileSync(configPath, contents, "utf8");
});
migrate("codebaseContextProvider", () => {
if (
!config.contextProviders?.filter((cp) => cp.name === "codebase")
?.length
) {
config.contextProviders = [
...(config.contextProviders || []),
{
name: "codebase",
params: {},
},
];
}
if (!config.embeddingsProvider) {
config.embeddingsProvider = {
provider: "transformers.js",
};
}
fs.writeFileSync(
configPath,
JSON.stringify(config, undefined, 2),
"utf8"
);
});
for (const workspacePath of await this.getWorkspaceDirs()) {
const continueRcPath = path.join(workspacePath, ".continuerc.json");
if (fs.existsSync(continueRcPath)) {