Merge branch 'main' into pe/unsupported-cpu-check-pt-2
This commit is contained in:
commit
2001dc94d4
296 changed files with 10086 additions and 5906 deletions
|
|
@ -4,7 +4,7 @@ description: Generate unit tests for core utilities
|
|||
Write jest tests for the provided code.
|
||||
Use jest version ^29 (e.g. jest 29.7.0)
|
||||
|
||||
Use best practices. Be clear and consise.
|
||||
Use best practices. Be clear and concise.
|
||||
Aim for 100% code coverage where reasonable.
|
||||
Multiple tests can be written, split up tests for best clarity and readability.
|
||||
Only use typescript, and if the file/code is not typescript, warn the user.
|
||||
|
|
@ -15,7 +15,7 @@ Use double quotes (or backticks if needed) for strings
|
|||
The code being tested is used in IDE extensions, and it:
|
||||
- accesses code workspaces through the IDE ("workspace directories")
|
||||
- persists extension-related data to the the local machine of the user ("global directory"), and
|
||||
- uses configuration via a `ConfigHandler`, which is stored in either the global directory (default) or accesed via a remote "control plane" using the `ControlPlaneClient`
|
||||
- uses configuration via a `ConfigHandler`, which is stored in either the global directory (default) or accessed via a remote "control plane" using the `ControlPlaneClient`
|
||||
|
||||
Jest testing setup includes
|
||||
- @core/test/jest.global-setup.ts initializes a temporary global directory, which is where files that store persisted extension data live.
|
||||
|
|
@ -31,7 +31,7 @@ Jest testing setup includes
|
|||
|
||||
Do NOT write tests for any files in `core/test`, only use them as helpers for testing other files. If no other files are provided, warn the user and write no tests.
|
||||
|
||||
IMPORTANT: Do NOT mock the fixtures above other than using `jest.spyOn`. DO mock 3rd party modules, etc. when sensible.
|
||||
IMPORTANT: Do NOT mock the fixtures above other than using `jest.spyOn`. DO mock 3rd party modules, etc. when sensible.
|
||||
Instead, generate actual mock files and data for operations
|
||||
Pure mocks should only be used to emulate specific network responses/error or hard-to-duplicate errors, or to prevent long-duration tests
|
||||
|
||||
|
|
|
|||
7
.github/ISSUE_TEMPLATE/bug_report.yml
vendored
7
.github/ISSUE_TEMPLATE/bug_report.yml
vendored
|
|
@ -27,14 +27,15 @@ body:
|
|||
- **Continue version**: v0.9.4
|
||||
- **IDE version**: VSCode 1.85.1
|
||||
- Model: Claude Sonnet 3.5
|
||||
- config.json: `{ "models": ... }`
|
||||
- config.yaml: `models: ...`
|
||||
- OR config.json: `{ "models": ... }`
|
||||
value: |
|
||||
- OS:
|
||||
- Continue version:
|
||||
- IDE version:
|
||||
- Model:
|
||||
- config.json:
|
||||
```json
|
||||
- config:
|
||||
```yaml
|
||||
|
||||
```
|
||||
render: Markdown
|
||||
|
|
|
|||
16
.github/workflows/jetbrains-release.yaml
vendored
16
.github/workflows/jetbrains-release.yaml
vendored
|
|
@ -6,11 +6,11 @@ name: JetBrains Release
|
|||
|
||||
on:
|
||||
release:
|
||||
types: [ prereleased ]
|
||||
types: [prereleased]
|
||||
workflow_dispatch:
|
||||
inputs:
|
||||
publish_build:
|
||||
description: 'Whether or not to publish the built extension to the JetBrains marketplace'
|
||||
description: "Whether or not to publish the built extension to the JetBrains marketplace"
|
||||
required: true
|
||||
default: false
|
||||
|
||||
|
|
@ -241,6 +241,12 @@ jobs:
|
|||
name: continue-binary-win32-x64
|
||||
path: ./binary/bin/win32-x64/
|
||||
|
||||
- name: Upload artifact (win32-arm64)
|
||||
uses: actions/upload-artifact@v4
|
||||
with:
|
||||
name: continue-binary-win32-arm64
|
||||
path: ./binary/bin/win32-arm64/
|
||||
|
||||
- name: Upload artifact (linux-arm64)
|
||||
uses: actions/upload-artifact@v4
|
||||
with:
|
||||
|
|
@ -345,7 +351,7 @@ jobs:
|
|||
# Run tests and upload a code coverage report
|
||||
test:
|
||||
name: Test
|
||||
needs: [ build ]
|
||||
needs: [build]
|
||||
runs-on: ubuntu-latest
|
||||
steps:
|
||||
# Check out current repository
|
||||
|
|
@ -387,7 +393,7 @@ jobs:
|
|||
inspectCode:
|
||||
if: false
|
||||
name: Inspect code
|
||||
needs: [ build ]
|
||||
needs: [build]
|
||||
runs-on: ubuntu-latest
|
||||
permissions:
|
||||
contents: write
|
||||
|
|
@ -422,7 +428,7 @@ jobs:
|
|||
verify:
|
||||
if: false
|
||||
name: Verify plugin
|
||||
needs: [ build ]
|
||||
needs: [build]
|
||||
runs-on: ubuntu-latest
|
||||
steps:
|
||||
# Free GitHub Actions Environment Disk Space
|
||||
|
|
|
|||
15
.github/workflows/pr_checks.yaml
vendored
15
.github/workflows/pr_checks.yaml
vendored
|
|
@ -4,23 +4,10 @@ on:
|
|||
pull_request:
|
||||
branches:
|
||||
- main
|
||||
paths:
|
||||
- "extensions/intellij/**"
|
||||
- "extensions/vscode/**"
|
||||
- "core/**"
|
||||
- "gui/**"
|
||||
- ".github/workflows/**"
|
||||
- "docs/**"
|
||||
|
||||
push:
|
||||
branches:
|
||||
- main
|
||||
paths:
|
||||
- "extensions/intellij/**"
|
||||
- "extensions/vscode/**"
|
||||
- "core/**"
|
||||
- "gui/**"
|
||||
- ".github/workflows/**"
|
||||
|
||||
jobs:
|
||||
install-root:
|
||||
|
|
@ -291,6 +278,8 @@ jobs:
|
|||
ANTHROPIC_API_KEY: ${{ secrets.ANTHROPIC_API_KEY }}
|
||||
GEMINI_API_KEY: ${{ secrets.GEMINI_API_KEY }}
|
||||
MISTRAL_API_KEY: ${{ secrets.MISTRAL_API_KEY }}
|
||||
AZURE_OPENAI_API_KEY: ${{ secrets.AZURE_OPENAI_API_KEY }}
|
||||
AZURE_FOUNDRY_API_KEY: ${{ secrets.AZURE_FOUNDRY_API_KEY }}
|
||||
|
||||
vscode-get-test-file-matrix:
|
||||
runs-on: ubuntu-latest
|
||||
|
|
|
|||
85
.vscode/tasks.json
vendored
85
.vscode/tasks.json
vendored
|
|
@ -6,16 +6,14 @@
|
|||
"type": "npm",
|
||||
"script": "tsc:watch",
|
||||
"isBackground": true,
|
||||
"problemMatcher": {
|
||||
"base": "$tsc-watch",
|
||||
"background": {
|
||||
"activeOnStart": true,
|
||||
"beginsPattern": "Starting compilation in watch mode...",
|
||||
"endsPattern": "Found 0 errors"
|
||||
}
|
||||
"problemMatcher": ["$tsc-watch"],
|
||||
"group": {
|
||||
"kind": "build",
|
||||
"isDefault": true
|
||||
},
|
||||
"presentation": {
|
||||
"revealProblems": "onProblem"
|
||||
"reveal": "always",
|
||||
"panel": "new"
|
||||
}
|
||||
},
|
||||
// Compile and bundle the extension
|
||||
|
|
@ -73,7 +71,27 @@
|
|||
}
|
||||
]
|
||||
},
|
||||
// Build the React app. It gets bundled into the extension as a file resource and has a seprate build step
|
||||
{
|
||||
"label": "vscode-extension:package",
|
||||
"dependsOn": ["vscode-extension:esbuild"],
|
||||
"type": "npm",
|
||||
"script": "package",
|
||||
"path": "extensions/vscode",
|
||||
"problemMatcher": [
|
||||
{
|
||||
"pattern": [
|
||||
{
|
||||
"regexp": "> (.*?):([0-9]+):([0-9]+): (warning|error): (.+)$",
|
||||
"file": 1,
|
||||
"line": 2,
|
||||
"column": 3,
|
||||
"severity": 4,
|
||||
"message": 5
|
||||
}
|
||||
]
|
||||
}
|
||||
]
|
||||
},
|
||||
{
|
||||
"label": "vscode-extension:continue-ui:build",
|
||||
"type": "shell",
|
||||
|
|
@ -186,6 +204,55 @@
|
|||
"command": "node",
|
||||
"args": ["${workspaceFolder}/scripts/uninstall.js"],
|
||||
"problemMatcher": []
|
||||
},
|
||||
{
|
||||
"label": "refresh-dependencies:core",
|
||||
"type": "shell",
|
||||
"command": "npm",
|
||||
"args": ["install"],
|
||||
"problemMatcher": [],
|
||||
"options": {
|
||||
"cwd": "${workspaceFolder}/core"
|
||||
},
|
||||
"presentation": {
|
||||
"close": true
|
||||
}
|
||||
},
|
||||
{
|
||||
"label": "refresh-dependencies:vscode",
|
||||
"type": "shell",
|
||||
"command": "npm",
|
||||
"args": ["install"],
|
||||
"problemMatcher": [],
|
||||
"options": {
|
||||
"cwd": "${workspaceFolder}/extensions/vscode"
|
||||
},
|
||||
"presentation": {
|
||||
"close": true
|
||||
}
|
||||
},
|
||||
{
|
||||
"label": "refresh-dependencies:gui",
|
||||
"type": "shell",
|
||||
"command": "npm",
|
||||
"args": ["install"],
|
||||
"problemMatcher": [],
|
||||
"options": {
|
||||
"cwd": "${workspaceFolder}/gui"
|
||||
},
|
||||
"presentation": {
|
||||
"close": true
|
||||
}
|
||||
},
|
||||
{
|
||||
"label": "refresh-dependencies:all",
|
||||
"dependsOn": [
|
||||
"refresh-dependencies:core",
|
||||
"refresh-dependencies:gui",
|
||||
"refresh-dependencies:vscode"
|
||||
],
|
||||
"type": "shell",
|
||||
"problemMatcher": []
|
||||
}
|
||||
]
|
||||
}
|
||||
|
|
|
|||
|
|
@ -128,7 +128,7 @@ nvm use
|
|||
1. The new VS Code window with the extension is referred to as the _Host VS Code_
|
||||
2. The window you started debugging from is referred to as the _Main VS Code_
|
||||
|
||||
3. To package the extension, run `npm run package` in the `extensions/vscode` directory. This will generate `extensions/vscode/build/continue-{VERSION}.vsix`, which you can install by right-clicking and selecting "Install Extension VSIX".
|
||||
3. To package the extension, run `npm run package` in the `extensions/vscode` directory, select `Tasks: Run Task` and then select `vscode-extension:package`. This will generate `extensions/vscode/build/continue-{VERSION}.vsix`, which you can install by right-clicking and selecting "Install Extension VSIX".
|
||||
|
||||
##### Debugging
|
||||
|
||||
|
|
|
|||
|
|
@ -53,7 +53,7 @@ const targetToLanceDb = {
|
|||
"linux-arm64": "@lancedb/vectordb-linux-arm64-gnu",
|
||||
"linux-x64": "@lancedb/vectordb-linux-x64-gnu",
|
||||
"win32-x64": "@lancedb/vectordb-win32-x64-msvc",
|
||||
"win32-arm64": "@lancedb/vectordb-win32-x64-msvc", // they don't have a win32-arm64 build
|
||||
"win32-arm64": "@lancedb/vectordb-win32-arm64-msvc",
|
||||
};
|
||||
|
||||
async function installNodeModuleInTempDirAndCopyToCurrent(packageName, toCopy) {
|
||||
|
|
@ -248,9 +248,15 @@ async function installNodeModuleInTempDirAndCopyToCurrent(packageName, toCopy) {
|
|||
|
||||
// Download and unzip prebuilt sqlite3 binary for the target
|
||||
console.log("[info] Downloading node-sqlite3");
|
||||
const downloadUrl = `https://github.com/TryGhost/node-sqlite3/releases/download/v5.1.7/sqlite3-v5.1.7-napi-v6-${
|
||||
target === "win32-arm64" ? "win32-ia32" : target
|
||||
}.tar.gz`;
|
||||
|
||||
const downloadUrl =
|
||||
// node-sqlite3 doesn't have a pre-built binary for win32-arm64
|
||||
target === "win32-arm64"
|
||||
? "https://continue-server-binaries.s3.us-west-1.amazonaws.com/win32-arm64/node_sqlite3.tar.gz"
|
||||
: `https://github.com/TryGhost/node-sqlite3/releases/download/v5.1.7/sqlite3-v5.1.7-napi-v6-${
|
||||
target
|
||||
}.tar.gz`;
|
||||
|
||||
execCmdSync(`curl -L -o ${targetDir}/build.tar.gz ${downloadUrl}`);
|
||||
execCmdSync(`cd ${targetDir} && tar -xvzf build.tar.gz`);
|
||||
|
||||
|
|
|
|||
6
binary/package-lock.json
generated
6
binary/package-lock.json
generated
|
|
@ -48,11 +48,11 @@
|
|||
"@aws-sdk/client-sagemaker-runtime": "^3.621.0",
|
||||
"@aws-sdk/credential-providers": "^3.620.1",
|
||||
"@continuedev/config-types": "^1.0.13",
|
||||
"@continuedev/config-yaml": "^1.0.26",
|
||||
"@continuedev/config-yaml": "^1.0.28",
|
||||
"@continuedev/fetch": "^1.0.4",
|
||||
"@continuedev/llm-info": "^1.0.2",
|
||||
"@continuedev/openai-adapters": "^1.0.10",
|
||||
"@modelcontextprotocol/sdk": "^1.4.1",
|
||||
"@modelcontextprotocol/sdk": "^1.5.0",
|
||||
"@mozilla/readability": "^0.5.0",
|
||||
"@octokit/rest": "^20.0.2",
|
||||
"@typescript-eslint/eslint-plugin": "^7.8.0",
|
||||
|
|
@ -128,7 +128,7 @@
|
|||
"@types/uuid": "^9.0.7",
|
||||
"@types/win-ca": "^3.5.4",
|
||||
"cross-env": "^7.0.3",
|
||||
"esbuild": "0.17.19",
|
||||
"esbuild": "0.24.0",
|
||||
"eslint": "^8",
|
||||
"jest": "^29.7.0",
|
||||
"jest-environment-jsdom": "^29.7.0",
|
||||
|
|
|
|||
|
|
@ -240,6 +240,14 @@ export const Solidity = {
|
|||
endOfLine: [";"],
|
||||
};
|
||||
|
||||
// Lua
|
||||
export const Lua = {
|
||||
name: "Lua",
|
||||
topLevelKeywords: ["function"],
|
||||
singleLineComment: "--",
|
||||
endOfLine: [],
|
||||
};
|
||||
|
||||
// YAML
|
||||
export const YAML: AutocompleteLanguageInfo = {
|
||||
name: "YAML",
|
||||
|
|
@ -367,6 +375,8 @@ export const LANGUAGES: { [extension: string]: AutocompleteLanguageInfo } = {
|
|||
yaml: YAML,
|
||||
yml: YAML,
|
||||
md: Markdown,
|
||||
lua: Lua,
|
||||
luau: Lua,
|
||||
};
|
||||
|
||||
export function languageForFilepath(fileUri: string): AutocompleteLanguageInfo {
|
||||
|
|
|
|||
|
|
@ -11,6 +11,8 @@ import {
|
|||
AutocompleteSnippetType,
|
||||
} from "./types";
|
||||
|
||||
const IDE_SNIPPETS_ENABLED = false; // ideSnippets is not used, so it's temporarily disabled
|
||||
|
||||
export interface SnippetPayload {
|
||||
rootPathSnippets: AutocompleteCodeSnippet[];
|
||||
importDefinitionSnippets: AutocompleteCodeSnippet[];
|
||||
|
|
@ -29,6 +31,27 @@ function racePromise<T>(promise: Promise<T[]>): Promise<T[]> {
|
|||
return Promise.race([promise, timeoutPromise]);
|
||||
}
|
||||
|
||||
class DiffSnippetsCache {
|
||||
private cache: Map<number, any> = new Map();
|
||||
private lastTimestamp: number = 0;
|
||||
|
||||
public set<T>(timestamp: number, value: T): T {
|
||||
// Clear old cache entry if exists
|
||||
if (this.lastTimestamp !== timestamp) {
|
||||
this.cache.clear();
|
||||
}
|
||||
this.lastTimestamp = timestamp;
|
||||
this.cache.set(timestamp, value);
|
||||
return value;
|
||||
}
|
||||
|
||||
public get(timestamp: number): any | undefined {
|
||||
return this.cache.get(timestamp);
|
||||
}
|
||||
}
|
||||
|
||||
const diffSnippetsCache = new DiffSnippetsCache();
|
||||
|
||||
// Some IDEs might have special ways of finding snippets (e.g. JetBrains and VS Code have different "LSP-equivalent" systems,
|
||||
// or they might separately track recently edited ranges)
|
||||
async function getIdeSnippets(
|
||||
|
|
@ -90,6 +113,17 @@ const getClipboardSnippets = async (
|
|||
const getDiffSnippets = async (
|
||||
ide: IDE,
|
||||
): Promise<AutocompleteDiffSnippet[]> => {
|
||||
const currentTimestamp = ide.getLastFileSaveTimestamp ?
|
||||
ide.getLastFileSaveTimestamp() :
|
||||
Math.floor(Date.now() / 10000) * 10000; // Defaults to update once in every 10 seconds
|
||||
|
||||
// Check cache first
|
||||
const cached = diffSnippetsCache.get(currentTimestamp) as AutocompleteDiffSnippet[];
|
||||
|
||||
if (cached) {
|
||||
return cached;
|
||||
}
|
||||
|
||||
let diff: string[] = [];
|
||||
try {
|
||||
diff = await ide.getDiff(true);
|
||||
|
|
@ -97,12 +131,13 @@ const getDiffSnippets = async (
|
|||
console.error("Error getting diff for autocomplete", e);
|
||||
}
|
||||
|
||||
return diff.map((item) => {
|
||||
return diffSnippetsCache.set(currentTimestamp, diff.map((item) => {
|
||||
return {
|
||||
content: item,
|
||||
type: AutocompleteSnippetType.Diff,
|
||||
};
|
||||
});
|
||||
}));
|
||||
|
||||
};
|
||||
|
||||
export const getAllSnippets = async ({
|
||||
|
|
@ -127,10 +162,8 @@ export const getAllSnippets = async ({
|
|||
clipboardSnippets,
|
||||
] = await Promise.all([
|
||||
racePromise(contextRetrievalService.getRootPathSnippets(helper)),
|
||||
racePromise(
|
||||
contextRetrievalService.getSnippetsFromImportDefinitions(helper),
|
||||
),
|
||||
racePromise(getIdeSnippets(helper, ide, getDefinitionsFromLsp)),
|
||||
racePromise(contextRetrievalService.getSnippetsFromImportDefinitions(helper)),
|
||||
IDE_SNIPPETS_ENABLED ? racePromise(getIdeSnippets(helper, ide, getDefinitionsFromLsp)) : [],
|
||||
racePromise(getDiffSnippets(ide)),
|
||||
racePromise(getClipboardSnippets(ide)),
|
||||
]);
|
||||
|
|
|
|||
|
|
@ -51,6 +51,8 @@ const stableCodeFimTemplate: AutocompleteTemplate = {
|
|||
};
|
||||
|
||||
// https://github.com/QwenLM/Qwen2.5-Coder?tab=readme-ov-file#3-file-level-code-completion-fill-in-the-middle
|
||||
// This issue asks about the use of <|repo_name|> and <|file_sep|> together with <|fim_prefix|>, <|fim_suffix|> and <|fim_middle|>
|
||||
// https://github.com/QwenLM/Qwen2.5-Coder/issues/343
|
||||
const qwenCoderFimTemplate: AutocompleteTemplate = {
|
||||
template:
|
||||
"<|fim_prefix|>{{{prefix}}}<|fim_suffix|>{{{suffix}}}<|fim_middle|>",
|
||||
|
|
@ -85,6 +87,11 @@ const codestralMultifileFimTemplate: AutocompleteTemplate = {
|
|||
snippets,
|
||||
workspaceUris,
|
||||
): [string, string] => {
|
||||
|
||||
function getFileName(snippet: { uri: string, uniquePath: string }) {
|
||||
return snippet.uri.startsWith("file://") ? snippet.uniquePath : snippet.uri
|
||||
}
|
||||
|
||||
if (snippets.length === 0) {
|
||||
if (suffix.trim().length === 0 && prefix.trim().length === 0) {
|
||||
return [
|
||||
|
|
@ -111,14 +118,12 @@ const codestralMultifileFimTemplate: AutocompleteTemplate = {
|
|||
return snippet.content;
|
||||
}
|
||||
|
||||
return `+++++ ${relativePaths[i].uri} \n${snippet.content}`;
|
||||
return `+++++ ${getFileName(relativePaths[i])} \n${snippet.content}`;
|
||||
})
|
||||
.join("\n\n");
|
||||
|
||||
return [
|
||||
`${otherFiles}\n\n+++++ ${
|
||||
relativePaths[relativePaths.length - 1].uri
|
||||
}\n${prefix}`,
|
||||
`${otherFiles}\n\n+++++ ${getFileName(relativePaths[relativePaths.length - 1])}\n${prefix}`,
|
||||
suffix,
|
||||
];
|
||||
},
|
||||
|
|
@ -126,7 +131,7 @@ const codestralMultifileFimTemplate: AutocompleteTemplate = {
|
|||
return `[SUFFIX]${suffix}[PREFIX]${prefix}`;
|
||||
},
|
||||
completionOptions: {
|
||||
stop: ["[PREFIX]", "[SUFFIX]"],
|
||||
stop: ["[PREFIX]", "[SUFFIX]", "\n+++++ "],
|
||||
},
|
||||
};
|
||||
|
||||
|
|
@ -218,9 +223,8 @@ const codegeexFimTemplate: AutocompleteTemplate = {
|
|||
[...snippets.map((snippet) => snippet.filepath), filepath],
|
||||
workspaceUris,
|
||||
);
|
||||
const baseTemplate = `###PATH:${
|
||||
relativePaths[relativePaths.length - 1]
|
||||
}\n###LANGUAGE:${language}\n###MODE:BLOCK\n<|code_suffix|>${suffix}<|code_prefix|>${prefix}<|code_middle|>`;
|
||||
const baseTemplate = `###PATH:${relativePaths[relativePaths.length - 1]
|
||||
}\n###LANGUAGE:${language}\n###MODE:BLOCK\n<|code_suffix|>${suffix}<|code_prefix|>${prefix}<|code_middle|>`;
|
||||
if (snippets.length === 0) {
|
||||
return `<|user|>\n${baseTemplate}<|assistant|>\n`;
|
||||
}
|
||||
|
|
@ -395,7 +399,8 @@ export function getTemplateForModel(model: string): AutocompleteTemplate {
|
|||
lowerCaseModel.includes("gpt") ||
|
||||
lowerCaseModel.includes("davinci-002") ||
|
||||
lowerCaseModel.includes("claude") ||
|
||||
lowerCaseModel.includes("granite3")
|
||||
lowerCaseModel.includes("granite3") ||
|
||||
lowerCaseModel.includes("granite-3")
|
||||
) {
|
||||
return holeFillerTemplate;
|
||||
}
|
||||
|
|
|
|||
|
|
@ -42,24 +42,100 @@ export const getSnippets = (
|
|||
helper: HelperVars,
|
||||
payload: SnippetPayload,
|
||||
): AutocompleteSnippet[] => {
|
||||
const snippets = [
|
||||
...payload.diffSnippets,
|
||||
...payload.clipboardSnippets,
|
||||
...payload.recentlyVisitedRangesSnippets,
|
||||
...shuffleArray(
|
||||
filterSnippetsAlreadyInCaretWindow(
|
||||
[...payload.rootPathSnippets, ...payload.importDefinitionSnippets],
|
||||
helper.prunedCaretWindow,
|
||||
),
|
||||
),
|
||||
];
|
||||
|
||||
const snippets = {
|
||||
"clipboard": payload.clipboardSnippets,
|
||||
"recentlyVisitedRanges": payload.recentlyVisitedRangesSnippets,
|
||||
"recentlyEditedRanges": payload.recentlyEditedRangeSnippets,
|
||||
"diff": payload.diffSnippets,
|
||||
"base": shuffleArray(filterSnippetsAlreadyInCaretWindow(
|
||||
[...payload.rootPathSnippets, ...payload.importDefinitionSnippets],
|
||||
helper.prunedCaretWindow,
|
||||
)),
|
||||
}
|
||||
|
||||
// Define snippets with their priorities
|
||||
const snippetConfigs: {
|
||||
key: keyof typeof snippets;
|
||||
enabledOrPriority: boolean | number;
|
||||
defaultPriority: number;
|
||||
snippets: AutocompleteSnippet[];
|
||||
}[] = [
|
||||
{
|
||||
key: "clipboard",
|
||||
enabledOrPriority: helper.options.experimental_includeClipboard,
|
||||
defaultPriority: 1,
|
||||
snippets: payload.clipboardSnippets,
|
||||
},
|
||||
{
|
||||
key: "recentlyVisitedRanges",
|
||||
enabledOrPriority: helper.options.experimental_includeRecentlyVisitedRanges,
|
||||
defaultPriority: 2,
|
||||
snippets: payload.recentlyVisitedRangesSnippets,
|
||||
/* TODO: recentlyVisitedRanges also contain contents from other windows like terminal or output
|
||||
if they are visible. We should handle them separately so that we can control their priority
|
||||
and whether they should be included or not. */
|
||||
},
|
||||
{
|
||||
key: "recentlyEditedRanges",
|
||||
enabledOrPriority: helper.options.experimental_includeRecentlyEditedRanges,
|
||||
defaultPriority: 3,
|
||||
snippets: payload.recentlyEditedRangeSnippets,
|
||||
},
|
||||
{
|
||||
key: "diff",
|
||||
enabledOrPriority: helper.options.experimental_includeDiff,
|
||||
defaultPriority: 4,
|
||||
snippets: payload.diffSnippets,
|
||||
// TODO: diff is commonly too large, thus anything lower in priority is not included.
|
||||
},
|
||||
{
|
||||
key: "base",
|
||||
enabledOrPriority: true,
|
||||
defaultPriority: 99, // make sure it's the last one to be processed, but still possible to override
|
||||
snippets: shuffleArray(filterSnippetsAlreadyInCaretWindow(
|
||||
[...payload.rootPathSnippets, ...payload.importDefinitionSnippets],
|
||||
helper.prunedCaretWindow,
|
||||
)),
|
||||
// TODO: Add this too to experimental config, maybe move upper in the order, since it's almost
|
||||
// always not inlucded due to diff being commonly large
|
||||
},
|
||||
];
|
||||
|
||||
// Create a readable order of enabled snippets
|
||||
const snippetOrder = snippetConfigs
|
||||
.filter(({ enabledOrPriority }) => enabledOrPriority)
|
||||
.map(({ key, enabledOrPriority, defaultPriority }) => ({
|
||||
key,
|
||||
priority: typeof enabledOrPriority === 'number' ? enabledOrPriority : defaultPriority,
|
||||
}))
|
||||
.sort((a, b) => a.priority - b.priority);
|
||||
|
||||
// Log the snippet order for debugging - uncomment if needed
|
||||
/* console.log(
|
||||
'Snippet processing order:',
|
||||
snippetOrder
|
||||
.map(({ key, priority }) => `${key} (priority: ${priority})`).join("\n")
|
||||
); */
|
||||
|
||||
// Convert configs to prioritized snippets
|
||||
let prioritizedSnippets = snippetOrder
|
||||
.flatMap(({ key, priority }) =>
|
||||
snippets[key].map(snippet => ({ snippet, priority }))
|
||||
)
|
||||
.sort((a, b) => a.priority - b.priority)
|
||||
.map(({ snippet }) => snippet);
|
||||
|
||||
// Exclude Continue's own output as it makes it super-hard for users to test the autocomplete feature
|
||||
// while looking at the prompts in the Continue's output
|
||||
prioritizedSnippets = prioritizedSnippets.filter((snippet) =>
|
||||
!(snippet as AutocompleteCodeSnippet).filepath?.startsWith("output:extension-output-Continue.continue"));
|
||||
|
||||
const finalSnippets = [];
|
||||
|
||||
let remainingTokenCount = getRemainingTokenCount(helper);
|
||||
|
||||
while (remainingTokenCount > 0 && snippets.length > 0) {
|
||||
const snippet = snippets.shift();
|
||||
while (remainingTokenCount > 0 && prioritizedSnippets.length > 0) {
|
||||
const snippet = prioritizedSnippets.shift();
|
||||
if (!snippet || !isValidSnippet(snippet)) {
|
||||
continue;
|
||||
}
|
||||
|
|
|
|||
|
|
@ -113,6 +113,7 @@ export class AutocompleteLoggingService {
|
|||
multilineCompletions: restOfOutcome.multilineCompletions,
|
||||
time: restOfOutcome.time,
|
||||
useRecentlyEdited: restOfOutcome.useRecentlyEdited,
|
||||
numLines: restOfOutcome.numLines,
|
||||
},
|
||||
true,
|
||||
);
|
||||
|
|
|
|||
|
|
@ -10,11 +10,11 @@ import { defaultConfig } from "./default";
|
|||
describe.skip("Test the ConfigHandler and E2E config loading", () => {
|
||||
test("should show only local profile", () => {
|
||||
const profiles = testConfigHandler.listProfiles();
|
||||
expect(profiles.length).toBe(1);
|
||||
expect(profiles[0].id).toBe("local");
|
||||
expect(profiles?.length).toBe(1);
|
||||
expect(profiles?.[0].id).toBe("local");
|
||||
|
||||
const currentProfile = testConfigHandler.currentProfile;
|
||||
expect(currentProfile.profileDescription.id).toBe("local");
|
||||
expect(currentProfile?.profileDescription.id).toBe("local");
|
||||
});
|
||||
|
||||
test("should load the default config successfully", async () => {
|
||||
|
|
|
|||
|
|
@ -47,71 +47,94 @@ type ConfigUpdateFunction = (payload: ConfigResult<ContinueConfig>) => void;
|
|||
export class ConfigHandler {
|
||||
private readonly globalContext = new GlobalContext();
|
||||
private additionalContextProviders: IContextProvider[] = [];
|
||||
private profiles: ProfileLifecycleManager[];
|
||||
private selectedProfileId: string;
|
||||
private selectedOrgId: string | null;
|
||||
private profiles: ProfileLifecycleManager[] | null = null; // null until profiles are loaded
|
||||
private selectedProfileId: string | null = null;
|
||||
private localProfileManager: ProfileLifecycleManager;
|
||||
private controlPlaneClient: ControlPlaneClient;
|
||||
|
||||
initializedPromise: Promise<void>;
|
||||
|
||||
constructor(
|
||||
private readonly ide: IDE,
|
||||
private ideSettingsPromise: Promise<IdeSettings>,
|
||||
private readonly writeLog: (text: string) => Promise<void>,
|
||||
private controlPlaneClient: ControlPlaneClient,
|
||||
sessionInfoPromise: Promise<ControlPlaneSessionInfo | undefined>,
|
||||
) {
|
||||
this.ide = ide;
|
||||
this.ideSettingsPromise = ideSettingsPromise;
|
||||
this.writeLog = writeLog;
|
||||
this.controlPlaneClient = new ControlPlaneClient(
|
||||
sessionInfoPromise,
|
||||
ideSettingsPromise,
|
||||
);
|
||||
|
||||
// Set local profile as default
|
||||
const localProfileLoader = new LocalProfileLoader(
|
||||
ide,
|
||||
ideSettingsPromise,
|
||||
controlPlaneClient,
|
||||
this.controlPlaneClient,
|
||||
writeLog,
|
||||
);
|
||||
this.profiles = [new ProfileLifecycleManager(localProfileLoader, this.ide)];
|
||||
this.selectedProfileId = localProfileLoader.description.id;
|
||||
this.selectedOrgId = null;
|
||||
this.localProfileManager = new ProfileLifecycleManager(
|
||||
localProfileLoader,
|
||||
this.ide,
|
||||
);
|
||||
|
||||
// Always load local profile immediately in case control plane doesn't load
|
||||
try {
|
||||
void this.loadConfig();
|
||||
} catch (e) {
|
||||
console.error("Failed to load config: ", e);
|
||||
}
|
||||
// Profiles are loaded asynchronously
|
||||
this.initializedPromise = new Promise((resolve, reject) => {
|
||||
this.init()
|
||||
.then(() => {
|
||||
resolve();
|
||||
})
|
||||
.catch((e) => {
|
||||
reject(e);
|
||||
});
|
||||
});
|
||||
}
|
||||
|
||||
void this.init();
|
||||
/**
|
||||
* Retrieves the titles of additional context providers that are of type "submenu".
|
||||
*
|
||||
* @returns {string[]} An array of titles of the additional context providers that have a description type of "submenu".
|
||||
*/
|
||||
getAdditionalSubmenuContextProviders(): string[] {
|
||||
return this.additionalContextProviders
|
||||
.filter(provider => provider.description.type === "submenu")
|
||||
.map(provider => provider.description.title);
|
||||
}
|
||||
|
||||
private async init() {
|
||||
const workspaceId = await this.getWorkspaceId();
|
||||
const lastSelectedOrgIds =
|
||||
this.globalContext.get("lastSelectedOrgIdForWorkspace") ?? {};
|
||||
const selectedOrgId = lastSelectedOrgIds[workspaceId];
|
||||
|
||||
// We want to set the org ID before fetching control plane profiles
|
||||
if (selectedOrgId) {
|
||||
this.selectedOrgId = selectedOrgId;
|
||||
try {
|
||||
await this.fetchControlPlaneProfiles();
|
||||
} catch (e) {
|
||||
// If this fails, make sure at least local profile is loaded
|
||||
console.error("Failed to fetch control plane profiles: ", e);
|
||||
await this.updateAvailableProfiles([this.localProfileManager]);
|
||||
}
|
||||
try {
|
||||
const configResult = await this.loadConfig();
|
||||
this.notifyConfigListeners(configResult);
|
||||
} catch (e) {
|
||||
console.error("Failed to load config: ", e);
|
||||
}
|
||||
|
||||
// Load control plane profiles
|
||||
void this.fetchControlPlaneProfiles();
|
||||
}
|
||||
|
||||
// This will be the local profile
|
||||
private get fallbackProfile() {
|
||||
return this.profiles[0];
|
||||
}
|
||||
|
||||
get currentProfile() {
|
||||
if (!this.selectedProfileId) {
|
||||
return null;
|
||||
}
|
||||
// IMPORTANT
|
||||
// We must fall back to null, not the first or local profiles
|
||||
// Because GUI must be the source of truth for selected profile
|
||||
return (
|
||||
this.profiles.find(
|
||||
this.profiles?.find(
|
||||
(p) => p.profileDescription.id === this.selectedProfileId,
|
||||
) ?? this.fallbackProfile
|
||||
) ?? null
|
||||
);
|
||||
}
|
||||
|
||||
get inactiveProfiles() {
|
||||
return this.profiles.filter(
|
||||
return (this.profiles ?? []).filter(
|
||||
(p) => p.profileDescription.id !== this.selectedProfileId,
|
||||
);
|
||||
}
|
||||
|
|
@ -132,71 +155,83 @@ export class ConfigHandler {
|
|||
}
|
||||
}
|
||||
|
||||
private async loadPlatformProfiles() {
|
||||
async listOrganizations() {
|
||||
return await this.controlPlaneClient.listOrganizations();
|
||||
}
|
||||
|
||||
async loadAssistantsForSelectedOrg() {
|
||||
// Get the profiles and create their lifecycle managers
|
||||
this.controlPlaneClient
|
||||
.listAssistants(this.selectedOrgId)
|
||||
.then(async (assistants) => {
|
||||
const hubProfiles = await Promise.all(
|
||||
assistants.map(async (assistant) => {
|
||||
let renderedConfig: AssistantUnrolled | undefined = undefined;
|
||||
if (assistant.configResult.config) {
|
||||
renderedConfig = await clientRenderHelper(
|
||||
YAML.stringify(assistant.configResult.config),
|
||||
this.ide,
|
||||
this.controlPlaneClient,
|
||||
);
|
||||
}
|
||||
const userId = await this.controlPlaneClient.userId;
|
||||
const selectedOrgId = await this.getSelectedOrgId();
|
||||
|
||||
const profileLoader = new PlatformProfileLoader(
|
||||
{ ...assistant.configResult, config: renderedConfig },
|
||||
assistant.ownerSlug,
|
||||
assistant.packageSlug,
|
||||
assistant.iconUrl,
|
||||
assistant.configResult.config?.version ?? "latest",
|
||||
this.controlPlaneClient,
|
||||
let profiles: ProfileLifecycleManager[] | null = null;
|
||||
if (!userId) {
|
||||
// Not logged in
|
||||
profiles = [this.localProfileManager];
|
||||
} else {
|
||||
// Logged in
|
||||
const assistants =
|
||||
await this.controlPlaneClient.listAssistants(selectedOrgId);
|
||||
const hubProfiles = await Promise.all(
|
||||
assistants.map(async (assistant) => {
|
||||
let renderedConfig: AssistantUnrolled | undefined = undefined;
|
||||
if (assistant.configResult.config) {
|
||||
renderedConfig = await clientRenderHelper(
|
||||
{
|
||||
ownerSlug: assistant.ownerSlug,
|
||||
packageSlug: assistant.packageSlug,
|
||||
},
|
||||
YAML.stringify(assistant.configResult.config),
|
||||
this.ide,
|
||||
this.ideSettingsPromise,
|
||||
this.writeLog,
|
||||
this.reloadConfig.bind(this),
|
||||
this.controlPlaneClient,
|
||||
);
|
||||
}
|
||||
|
||||
return new ProfileLifecycleManager(profileLoader, this.ide);
|
||||
}),
|
||||
);
|
||||
|
||||
this.profiles = [
|
||||
...this.profiles.filter(
|
||||
(profile) => profile.profileDescription.id === "local",
|
||||
),
|
||||
...hubProfiles,
|
||||
];
|
||||
|
||||
this.notifyProfileListeners(
|
||||
this.profiles.map((profile) => profile.profileDescription),
|
||||
);
|
||||
|
||||
// Check the last selected workspace, and reload if it isn't local
|
||||
const workspaceId = await this.getWorkspaceId();
|
||||
const lastSelectedWorkspaceIds =
|
||||
this.globalContext.get("lastSelectedProfileForWorkspace") ?? {};
|
||||
|
||||
const selectedWorkspaceId = lastSelectedWorkspaceIds[workspaceId];
|
||||
if (selectedWorkspaceId) {
|
||||
this.selectedProfileId = selectedWorkspaceId;
|
||||
await this.loadConfig();
|
||||
} else {
|
||||
// Otherwise we stick with local profile, and record choice
|
||||
lastSelectedWorkspaceIds[workspaceId] = this.selectedProfileId;
|
||||
this.globalContext.update(
|
||||
"lastSelectedProfileForWorkspace",
|
||||
lastSelectedWorkspaceIds,
|
||||
const profileLoader = new PlatformProfileLoader(
|
||||
{ ...assistant.configResult, config: renderedConfig },
|
||||
assistant.ownerSlug,
|
||||
assistant.packageSlug,
|
||||
assistant.iconUrl,
|
||||
assistant.configResult.config?.version ?? "latest",
|
||||
this.controlPlaneClient,
|
||||
this.ide,
|
||||
this.ideSettingsPromise,
|
||||
this.writeLog,
|
||||
this.reloadConfig.bind(this),
|
||||
);
|
||||
}
|
||||
})
|
||||
.catch((e) => {
|
||||
console.error("Failed to list assistants: ", e);
|
||||
});
|
||||
|
||||
return new ProfileLifecycleManager(profileLoader, this.ide);
|
||||
}),
|
||||
);
|
||||
|
||||
if (selectedOrgId === null) {
|
||||
// Personal
|
||||
profiles = [...hubProfiles, this.localProfileManager];
|
||||
} else {
|
||||
// Organization
|
||||
profiles = hubProfiles;
|
||||
}
|
||||
}
|
||||
|
||||
await this.updateAvailableProfiles(profiles);
|
||||
}
|
||||
|
||||
private async updateAvailableProfiles(profiles: ProfileLifecycleManager[]) {
|
||||
this.profiles = profiles;
|
||||
|
||||
// If the last selected profile is in the list choose that
|
||||
// Otherwise, choose the first profile
|
||||
const previouslySelectedProfileId =
|
||||
await this.getPersistedSelectedProfileId();
|
||||
const selectedProfileId =
|
||||
previouslySelectedProfileId ?? profiles[0].profileDescription.id ?? null;
|
||||
|
||||
// Notify listeners
|
||||
const profileDescriptions = profiles.map(
|
||||
(profile) => profile.profileDescription,
|
||||
);
|
||||
this.notifyProfileListeners(profileDescriptions, selectedProfileId);
|
||||
await this.setSelectedProfile(selectedProfileId);
|
||||
}
|
||||
|
||||
private platformProfilesRefreshInterval: NodeJS.Timeout | undefined;
|
||||
|
|
@ -221,88 +256,81 @@ export class ConfigHandler {
|
|||
return false;
|
||||
}
|
||||
|
||||
private async fetchControlPlaneProfiles() {
|
||||
if (await useHub(this.ideSettingsPromise)) {
|
||||
clearInterval(this.platformProfilesRefreshInterval);
|
||||
await this.loadPlatformProfiles();
|
||||
private async reloadHubAssistants() {
|
||||
const selectedOrgId = await this.getSelectedOrgId();
|
||||
const newFullSlugsList =
|
||||
await this.controlPlaneClient.listAssistantFullSlugs(selectedOrgId);
|
||||
|
||||
// Every 5 seconds we ask the platform whether there are any assistant updates in the last 5 seconds
|
||||
// If so, we do the full (more expensive) reload
|
||||
this.platformProfilesRefreshInterval = setInterval(async () => {
|
||||
const newFullSlugsList =
|
||||
await this.controlPlaneClient.listAssistantFullSlugs(
|
||||
this.selectedOrgId,
|
||||
);
|
||||
|
||||
if (newFullSlugsList) {
|
||||
const shouldReload = this.fullSlugsListsDiffer(
|
||||
newFullSlugsList,
|
||||
this.lastFullSlugsList,
|
||||
);
|
||||
if (shouldReload) {
|
||||
await this.loadPlatformProfiles();
|
||||
}
|
||||
this.lastFullSlugsList = newFullSlugsList;
|
||||
}
|
||||
}, PlatformProfileLoader.RELOAD_INTERVAL);
|
||||
} else {
|
||||
this.controlPlaneClient
|
||||
.listWorkspaces()
|
||||
.then(async (workspaces) => {
|
||||
this.profiles = this.profiles.filter(
|
||||
(profile) => profile.profileDescription.id === "local",
|
||||
);
|
||||
workspaces.forEach((workspace) => {
|
||||
const profileLoader = new ControlPlaneProfileLoader(
|
||||
workspace.id,
|
||||
workspace.name,
|
||||
this.controlPlaneClient,
|
||||
this.ide,
|
||||
this.ideSettingsPromise,
|
||||
this.writeLog,
|
||||
this.reloadConfig.bind(this),
|
||||
);
|
||||
this.profiles.push(
|
||||
new ProfileLifecycleManager(profileLoader, this.ide),
|
||||
);
|
||||
});
|
||||
|
||||
this.notifyProfileListeners(
|
||||
this.profiles.map((profile) => profile.profileDescription),
|
||||
);
|
||||
|
||||
// Check the last selected workspace, and reload if it isn't local
|
||||
const workspaceId = await this.getWorkspaceId();
|
||||
const lastSelectedWorkspaceIds =
|
||||
this.globalContext.get("lastSelectedProfileForWorkspace") ?? {};
|
||||
const selectedWorkspaceId = lastSelectedWorkspaceIds[workspaceId];
|
||||
if (selectedWorkspaceId) {
|
||||
this.selectedProfileId = selectedWorkspaceId;
|
||||
await this.loadConfig();
|
||||
} else {
|
||||
// Otherwise we stick with local profile, and record choice
|
||||
lastSelectedWorkspaceIds[workspaceId] = this.selectedProfileId;
|
||||
this.globalContext.update(
|
||||
"lastSelectedProfileForWorkspace",
|
||||
lastSelectedWorkspaceIds,
|
||||
);
|
||||
}
|
||||
})
|
||||
.catch((e) => {
|
||||
console.error(e);
|
||||
});
|
||||
if (newFullSlugsList) {
|
||||
const shouldReload = this.fullSlugsListsDiffer(
|
||||
newFullSlugsList,
|
||||
this.lastFullSlugsList,
|
||||
);
|
||||
if (shouldReload) {
|
||||
await this.loadAssistantsForSelectedOrg();
|
||||
}
|
||||
this.lastFullSlugsList = newFullSlugsList;
|
||||
}
|
||||
}
|
||||
|
||||
private async fetchControlPlaneProfiles() {
|
||||
if (await useHub(this.ideSettingsPromise)) {
|
||||
clearInterval(this.platformProfilesRefreshInterval);
|
||||
await this.loadAssistantsForSelectedOrg();
|
||||
|
||||
// Every 5 seconds we ask the platform whether there are any assistant updates in the last 5 seconds
|
||||
// If so, we do the full (more expensive) reload
|
||||
this.platformProfilesRefreshInterval = setInterval(
|
||||
this.reloadHubAssistants.bind(this),
|
||||
PlatformProfileLoader.RELOAD_INTERVAL,
|
||||
);
|
||||
} else {
|
||||
try {
|
||||
const workspaces = await this.controlPlaneClient.listWorkspaces();
|
||||
const profiles = [this.localProfileManager];
|
||||
workspaces.forEach((workspace) => {
|
||||
const profileLoader = new ControlPlaneProfileLoader(
|
||||
workspace.id,
|
||||
workspace.name,
|
||||
this.controlPlaneClient,
|
||||
this.ide,
|
||||
this.ideSettingsPromise,
|
||||
this.writeLog,
|
||||
this.reloadConfig.bind(this),
|
||||
);
|
||||
|
||||
profiles.push(new ProfileLifecycleManager(profileLoader, this.ide));
|
||||
});
|
||||
|
||||
await this.updateAvailableProfiles(profiles);
|
||||
} catch (e: any) {
|
||||
console.error("Failed to load profiles: ", e);
|
||||
await this.updateAvailableProfiles([this.localProfileManager]);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
async getPersistedSelectedProfileId(): Promise<string | null> {
|
||||
const workspaceId = await this.getWorkspaceId();
|
||||
const lastSelectedIds =
|
||||
this.globalContext.get("lastSelectedProfileForWorkspace") ?? {};
|
||||
return lastSelectedIds[workspaceId] ?? null;
|
||||
}
|
||||
|
||||
async getSelectedOrgId(): Promise<string | null> {
|
||||
const selectedOrgs =
|
||||
this.globalContext.get("lastSelectedOrgIdForWorkspace") ?? {};
|
||||
return selectedOrgs[await this.getWorkspaceId()] ?? null;
|
||||
}
|
||||
|
||||
async setSelectedOrgId(orgId: string | null) {
|
||||
this.selectedOrgId = orgId;
|
||||
const selectedOrgs =
|
||||
this.globalContext.get("lastSelectedOrgIdForWorkspace") ?? {};
|
||||
selectedOrgs[await this.getWorkspaceId()] = orgId;
|
||||
this.globalContext.update("lastSelectedOrgIdForWorkspace", selectedOrgs);
|
||||
}
|
||||
|
||||
async setSelectedProfile(profileId: string) {
|
||||
async setSelectedProfile(profileId: string | null) {
|
||||
this.selectedProfileId = profileId;
|
||||
const result = await this.loadConfig();
|
||||
this.notifyConfigListeners(result);
|
||||
|
|
@ -339,16 +367,25 @@ export class ConfigHandler {
|
|||
});
|
||||
}
|
||||
|
||||
private profilesListeners: ((profiles: ProfileDescription[]) => void)[] = [];
|
||||
private profilesListeners: ((
|
||||
profiles: ProfileDescription[],
|
||||
selectedProfileId: string | null,
|
||||
) => void)[] = [];
|
||||
onDidChangeAvailableProfiles(
|
||||
listener: (profiles: ProfileDescription[]) => void,
|
||||
listener: (
|
||||
profiles: ProfileDescription[],
|
||||
selectedProfileId: string | null,
|
||||
) => void,
|
||||
) {
|
||||
this.profilesListeners.push(listener);
|
||||
}
|
||||
|
||||
private notifyProfileListeners(profiles: ProfileDescription[]) {
|
||||
private notifyProfileListeners(
|
||||
profiles: ProfileDescription[],
|
||||
selectedProfileId: string | null,
|
||||
) {
|
||||
for (const listener of this.profilesListeners) {
|
||||
listener(profiles);
|
||||
listener(profiles, selectedProfileId);
|
||||
}
|
||||
}
|
||||
|
||||
|
|
@ -365,8 +402,15 @@ export class ConfigHandler {
|
|||
this.updateListeners.push(listener);
|
||||
}
|
||||
|
||||
// TODO: this isn't right, there are two different senses in which you want to "reload"
|
||||
async reloadConfig() {
|
||||
// TODO: this isn't right, there are two different senses in which you want to "reload"
|
||||
if (!this.currentProfile) {
|
||||
return {
|
||||
config: undefined,
|
||||
errors: [],
|
||||
configLoadInterrupted: true,
|
||||
};
|
||||
}
|
||||
|
||||
const { config, errors, configLoadInterrupted } =
|
||||
await this.currentProfile.reloadConfig(this.additionalContextProviders);
|
||||
|
|
@ -376,22 +420,36 @@ export class ConfigHandler {
|
|||
}
|
||||
|
||||
this.notifyConfigListeners({ config, errors, configLoadInterrupted });
|
||||
return { config, errors };
|
||||
return { config, errors, configLoadInterrupted };
|
||||
}
|
||||
|
||||
getSerializedConfig(): Promise<
|
||||
async getSerializedConfig(): Promise<
|
||||
ConfigResult<BrowserSerializedContinueConfig>
|
||||
> {
|
||||
return this.currentProfile.getSerializedConfig(
|
||||
if (!this.currentProfile) {
|
||||
return {
|
||||
config: undefined,
|
||||
errors: [],
|
||||
configLoadInterrupted: true,
|
||||
};
|
||||
}
|
||||
return await this.currentProfile.getSerializedConfig(
|
||||
this.additionalContextProviders,
|
||||
);
|
||||
}
|
||||
|
||||
listProfiles(): ProfileDescription[] {
|
||||
return this.profiles.map((p) => p.profileDescription);
|
||||
listProfiles(): ProfileDescription[] | null {
|
||||
return this.profiles?.map((p) => p.profileDescription) ?? null;
|
||||
}
|
||||
|
||||
async loadConfig(): Promise<ConfigResult<ContinueConfig>> {
|
||||
if (!this.currentProfile) {
|
||||
return {
|
||||
config: undefined,
|
||||
errors: [],
|
||||
configLoadInterrupted: true,
|
||||
};
|
||||
}
|
||||
return await this.currentProfile.loadConfig(
|
||||
this.additionalContextProviders,
|
||||
);
|
||||
|
|
|
|||
|
|
@ -320,6 +320,7 @@ async function intermediateToFinalConfig(
|
|||
...model.requestOptions,
|
||||
...config.requestOptions,
|
||||
};
|
||||
model.roles = model.roles ?? ["chat"]; // Default to chat role if not specified
|
||||
}
|
||||
|
||||
if (allowFreeTrial) {
|
||||
|
|
@ -553,6 +554,7 @@ async function finalToBrowserConfig(
|
|||
requestOptions: m.requestOptions,
|
||||
promptTemplates: m.promptTemplates as any,
|
||||
capabilities: m.capabilities,
|
||||
roles: m.roles,
|
||||
})),
|
||||
systemMessage: final.systemMessage,
|
||||
completionOptions: final.completionOptions,
|
||||
|
|
|
|||
|
|
@ -1,5 +1,4 @@
|
|||
import { ConfigResult } from "@continuedev/config-yaml";
|
||||
import { AssistantUnrolled } from "@continuedev/config-yaml/dist/schemas/index.js";
|
||||
import { ConfigResult, AssistantUnrolled } from "@continuedev/config-yaml";
|
||||
|
||||
import { ControlPlaneClient } from "../../control-plane/client.js";
|
||||
import { ContinueConfig, IDE, IdeSettings } from "../../index.js";
|
||||
|
|
|
|||
|
|
@ -956,7 +956,7 @@ declare global {
|
|||
fixGrammar?: string;
|
||||
}
|
||||
|
||||
interface ModelRoles {
|
||||
interface ExperimentalModelRoles {
|
||||
inlineEdit?: string;
|
||||
applyCodeBlock?: string;
|
||||
repoMapFileSelection?: string;
|
||||
|
|
@ -1024,7 +1024,7 @@ declare global {
|
|||
|
||||
interface ExperimentalConfig {
|
||||
contextMenuPrompts?: ContextMenuConfig;
|
||||
modelRoles?: ModelRoles;
|
||||
modelRoles?: ExperimentalModelRoles;
|
||||
defaultContext?: DefaultContextProvider[];
|
||||
promptPath?: string;
|
||||
|
||||
|
|
|
|||
|
|
@ -7,11 +7,13 @@ import {
|
|||
IDE,
|
||||
ILLM,
|
||||
ModelDescription,
|
||||
ModelRoles,
|
||||
ExperimentalModelRoles,
|
||||
} from "../";
|
||||
import { GlobalContext } from "../util/GlobalContext";
|
||||
import { editConfigJson } from "../util/paths";
|
||||
|
||||
import { ConfigHandler } from "./ConfigHandler";
|
||||
|
||||
function stringify(obj: any, indentation?: number): string {
|
||||
return JSON.stringify(
|
||||
obj,
|
||||
|
|
@ -22,19 +24,30 @@ function stringify(obj: any, indentation?: number): string {
|
|||
);
|
||||
}
|
||||
|
||||
export function addContextProvider(provider: ContextProviderWithParams) {
|
||||
export function addContextProvider(provider: ContextProviderWithParams, configHandler?: ConfigHandler) {
|
||||
let isAdded = false;
|
||||
editConfigJson((config) => {
|
||||
|
||||
if (!config.contextProviders) {
|
||||
config.contextProviders = [provider];
|
||||
} else {
|
||||
config.contextProviders = [];
|
||||
}
|
||||
if (!config.contextProviders.some((p) => p.name === provider.name)) {
|
||||
config.contextProviders.push(provider);
|
||||
isAdded = true;
|
||||
}
|
||||
|
||||
return config;
|
||||
});
|
||||
|
||||
if (isAdded && configHandler) {
|
||||
void configHandler.reloadConfig();
|
||||
}
|
||||
}
|
||||
|
||||
export function addModel(model: ModelDescription, role?: keyof ModelRoles) {
|
||||
export function addModel(
|
||||
model: ModelDescription,
|
||||
role?: keyof ExperimentalModelRoles,
|
||||
) {
|
||||
editConfigJson((config) => {
|
||||
if (config.models?.some((m: any) => stringify(m) === stringify(model))) {
|
||||
return config;
|
||||
|
|
@ -85,7 +98,7 @@ export function deleteModel(title: string) {
|
|||
});
|
||||
}
|
||||
|
||||
export function getModelByRole<T extends keyof ModelRoles>(
|
||||
export function getModelByRole<T extends keyof ExperimentalModelRoles>(
|
||||
config: ContinueConfig,
|
||||
role: T,
|
||||
): ILLM | undefined {
|
||||
|
|
|
|||
|
|
@ -1,5 +1,6 @@
|
|||
import {
|
||||
clientRender,
|
||||
PackageSlug,
|
||||
PlatformClient,
|
||||
SecretStore,
|
||||
} from "@continuedev/config-yaml";
|
||||
|
|
@ -8,6 +9,7 @@ import { IDE } from "../..";
|
|||
import { ControlPlaneClient } from "../../control-plane/client";
|
||||
|
||||
export async function clientRenderHelper(
|
||||
packageSlug: PackageSlug,
|
||||
unrolledAssistant: string,
|
||||
ide: IDE,
|
||||
controlPlaneClient: ControlPlaneClient,
|
||||
|
|
@ -33,6 +35,7 @@ export async function clientRenderHelper(
|
|||
|
||||
const userId = await controlPlaneClient.userId;
|
||||
return await clientRender(
|
||||
packageSlug,
|
||||
unrolledAssistant,
|
||||
ideSecretStore,
|
||||
userId ? platformClient : undefined,
|
||||
|
|
|
|||
|
|
@ -1,5 +1,4 @@
|
|||
import { ModelConfig } from "@continuedev/config-yaml";
|
||||
import { AssistantUnrolled } from "@continuedev/config-yaml/dist/schemas";
|
||||
import { ModelConfig, AssistantUnrolled } from "@continuedev/config-yaml";
|
||||
|
||||
import { SerializedContinueConfig } from "../..";
|
||||
|
||||
|
|
|
|||
|
|
@ -1,4 +1,4 @@
|
|||
import { AssistantUnrolled } from "@continuedev/config-yaml/dist/schemas";
|
||||
import { AssistantUnrolled } from "@continuedev/config-yaml";
|
||||
|
||||
// TODO
|
||||
export const defaultConfigYaml: AssistantUnrolled = {
|
||||
|
|
|
|||
|
|
@ -4,13 +4,13 @@ import {
|
|||
AssistantUnrolled,
|
||||
ConfigResult,
|
||||
ConfigValidationError,
|
||||
ModelRole,
|
||||
parseAssistantUnrolled,
|
||||
validateConfigYaml,
|
||||
} from "@continuedev/config-yaml";
|
||||
import { fetchwithRequestOptions } from "@continuedev/fetch";
|
||||
|
||||
import {
|
||||
BrowserSerializedContinueConfig,
|
||||
ContinueConfig,
|
||||
IContextProvider,
|
||||
IDE,
|
||||
|
|
@ -18,9 +18,11 @@ import {
|
|||
IdeType,
|
||||
SlashCommand,
|
||||
} from "../..";
|
||||
import { slashFromCustomCommand } from "../../commands";
|
||||
import { AllRerankers } from "../../context/allRerankers";
|
||||
import { MCPManagerSingleton } from "../../context/mcp";
|
||||
import CodebaseContextProvider from "../../context/providers/CodebaseContextProvider";
|
||||
import DocsContextProvider from "../../context/providers/DocsContextProvider";
|
||||
import FileContextProvider from "../../context/providers/FileContextProvider";
|
||||
import { contextProviderClassFromName } from "../../context/providers/index";
|
||||
import PromptFilesContextProvider from "../../context/providers/PromptFilesContextProvider";
|
||||
|
|
@ -30,16 +32,13 @@ import FreeTrial from "../../llm/llms/FreeTrial";
|
|||
import TransformersJsEmbeddingsProvider from "../../llm/llms/TransformersJsEmbeddingsProvider";
|
||||
import { slashCommandFromPromptFileV1 } from "../../promptFiles/v1/slashCommandFromPromptFile";
|
||||
import { getAllPromptFiles } from "../../promptFiles/v2/getPromptFiles";
|
||||
import { allTools } from "../../tools";
|
||||
import { GlobalContext } from "../../util/GlobalContext";
|
||||
import { getConfigYamlPath } from "../../util/paths";
|
||||
import { getSystemPromptDotFile } from "../getSystemPromptDotFile";
|
||||
import { PlatformConfigMetadata } from "../profile/PlatformProfileLoader";
|
||||
|
||||
import { slashFromCustomCommand } from "../../commands";
|
||||
import DocsContextProvider from "../../context/providers/DocsContextProvider";
|
||||
import { allTools } from "../../tools";
|
||||
import { GlobalContext } from "../../util/GlobalContext";
|
||||
import { modifyContinueConfigWithSharedConfig } from "../sharedConfig";
|
||||
import { clientRenderHelper } from "./clientRender";
|
||||
|
||||
import { llmsFromModelConfig } from "./models";
|
||||
|
||||
async function loadConfigYaml(
|
||||
|
|
@ -52,9 +51,11 @@ async function loadConfigYaml(
|
|||
const ideSettings = await ide.getIdeSettings();
|
||||
let config =
|
||||
overrideConfigYaml ??
|
||||
(ideSettings.continueTestEnvironment === "production"
|
||||
? await clientRenderHelper(rawYaml, ide, controlPlaneClient)
|
||||
: parseAssistantUnrolled(rawYaml));
|
||||
// (ideSettings.continueTestEnvironment === "production"
|
||||
// ? await clientRenderHelper(rawYaml, ide, controlPlaneClient)
|
||||
// :
|
||||
parseAssistantUnrolled(rawYaml);
|
||||
// );
|
||||
const errors = validateConfigYaml(config);
|
||||
|
||||
if (errors?.some((error) => error.fatal)) {
|
||||
|
|
@ -134,12 +135,10 @@ async function configYamlToContinueConfig(
|
|||
};
|
||||
|
||||
// Models
|
||||
const modelsArrayRoles: ModelRole[] = ["chat", "summarize", "apply", "edit"];
|
||||
for (const model of config.models ?? []) {
|
||||
if (
|
||||
["chat", "summarize", "apply", "edit"].some((role: any) =>
|
||||
model.roles?.includes(role),
|
||||
)
|
||||
) {
|
||||
model.roles = model.roles ?? ["chat"]; // Default to chat role if not specified
|
||||
if (modelsArrayRoles.some((role) => model.roles?.includes(role))) {
|
||||
// Main model array
|
||||
const llms = await llmsFromModelConfig(
|
||||
model,
|
||||
|
|
@ -166,6 +165,24 @@ async function configYamlToContinueConfig(
|
|||
);
|
||||
continueConfig.tabAutocompleteModels?.push(...llms);
|
||||
}
|
||||
|
||||
if (
|
||||
model.roles?.includes("apply") &&
|
||||
!continueConfig.experimental?.modelRoles?.applyCodeBlock
|
||||
) {
|
||||
continueConfig.experimental ??= {};
|
||||
continueConfig.experimental!.modelRoles ??= {};
|
||||
continueConfig.experimental!.modelRoles!.applyCodeBlock = model.name;
|
||||
}
|
||||
|
||||
if (
|
||||
model.roles?.includes("edit") &&
|
||||
!continueConfig.experimental?.modelRoles?.inlineEdit
|
||||
) {
|
||||
continueConfig.experimental ??= {};
|
||||
continueConfig.experimental!.modelRoles ??= {};
|
||||
continueConfig.experimental!.modelRoles!.inlineEdit = model.name;
|
||||
}
|
||||
}
|
||||
|
||||
if (allowFreeTrial) {
|
||||
|
|
@ -227,6 +244,7 @@ async function configYamlToContinueConfig(
|
|||
}
|
||||
|
||||
// Embeddings Provider
|
||||
// IMPORTANT this currently will grab the first model found with an embed role
|
||||
const embedConfig = config.models?.find((model) =>
|
||||
model.roles?.includes("embed"),
|
||||
);
|
||||
|
|
@ -251,6 +269,7 @@ async function configYamlToContinueConfig(
|
|||
}
|
||||
|
||||
// Reranker
|
||||
// IMPORTANT this currently will grab the first model found with a rerank role
|
||||
const rerankConfig = config.models?.find((model) =>
|
||||
model.roles?.includes("rerank"),
|
||||
);
|
||||
|
|
@ -384,5 +403,3 @@ export async function loadContinueConfigFromYaml(
|
|||
configLoadInterrupted: false,
|
||||
};
|
||||
}
|
||||
|
||||
export { type BrowserSerializedContinueConfig };
|
||||
|
|
|
|||
|
|
@ -35,15 +35,6 @@ async function modelConfigToBaseLLM(
|
|||
return undefined;
|
||||
}
|
||||
|
||||
const usingContinueProxy = model.provider === "continue-proxy";
|
||||
const modelName = usingContinueProxy
|
||||
? getContinueProxyModelName(
|
||||
platformConfigMetadata!.ownerSlug,
|
||||
platformConfigMetadata!.packageSlug,
|
||||
model,
|
||||
)
|
||||
: model.model;
|
||||
|
||||
let options: LLMOptions = {
|
||||
...model,
|
||||
completionOptions: {
|
||||
|
|
@ -56,8 +47,8 @@ async function modelConfigToBaseLLM(
|
|||
writeLog,
|
||||
uniqueId,
|
||||
title: model.name,
|
||||
model: modelName,
|
||||
systemMessage,
|
||||
promptTemplates: model.promptTemplates,
|
||||
};
|
||||
|
||||
const llm = new cls(options);
|
||||
|
|
|
|||
|
|
@ -164,6 +164,7 @@ class MCPConnection {
|
|||
config.contextProviders.push(
|
||||
new MCPContextProvider({
|
||||
submenuItems,
|
||||
mcpId,
|
||||
}),
|
||||
);
|
||||
}
|
||||
|
|
|
|||
|
|
@ -9,6 +9,7 @@ import {
|
|||
import { MCPManagerSingleton } from "../mcp";
|
||||
|
||||
interface MCPContextProviderOptions {
|
||||
mcpId: string;
|
||||
submenuItems: ContextSubmenuItem[];
|
||||
}
|
||||
|
||||
|
|
@ -74,10 +75,10 @@ class MCPContextProvider extends BaseContextProvider {
|
|||
args: LoadSubmenuItemsArgs,
|
||||
): Promise<ContextSubmenuItem[]> {
|
||||
return (this.options as MCPContextProviderOptions).submenuItems.map(
|
||||
(item, index) => ({
|
||||
(item) => ({
|
||||
...item,
|
||||
id: JSON.stringify({
|
||||
mcpId: String(index),
|
||||
mcpId: (this.options as MCPContextProviderOptions).mcpId,
|
||||
uri: item.id,
|
||||
}),
|
||||
}),
|
||||
|
|
|
|||
|
|
@ -7,7 +7,6 @@ import {
|
|||
IContextProvider,
|
||||
} from "../..";
|
||||
import { ConfigHandler } from "../../config/ConfigHandler";
|
||||
import { ControlPlaneClient } from "../../control-plane/client";
|
||||
import { TEST_DIR } from "../../test/testDir";
|
||||
import FileSystemIde from "../../util/filesystem";
|
||||
|
||||
|
|
@ -31,8 +30,9 @@ async function getContextProviderExtras(
|
|||
ide,
|
||||
ideSettingsPromise,
|
||||
async (text) => {},
|
||||
new ControlPlaneClient(Promise.resolve(undefined), ideSettingsPromise),
|
||||
Promise.resolve(undefined),
|
||||
);
|
||||
await configHandler.initializedPromise;
|
||||
const { config } = await configHandler.loadConfig();
|
||||
if (!config) {
|
||||
throw new Error("Config not found");
|
||||
|
|
|
|||
|
|
@ -119,7 +119,7 @@ export async function retrieveContextItemsFromEmbeddings(
|
|||
}
|
||||
|
||||
return {
|
||||
name: `${baseName} (${r.startLine}-${r.endLine})`,
|
||||
name: `${baseName} (${r.startLine + 1}-${r.endLine + 1})`,
|
||||
description: last2Parts,
|
||||
content: `\`\`\`${relativePathOrBasename}\n${r.content}\n\`\`\``,
|
||||
uri: {
|
||||
|
|
|
|||
|
|
@ -4,13 +4,14 @@ import { getControlPlaneEnv } from "../env";
|
|||
|
||||
export async function getAuthUrlForTokenPage(
|
||||
ideSettingsPromise: Promise<IdeSettings>,
|
||||
useOnboarding: boolean,
|
||||
): Promise<string> {
|
||||
const env = await getControlPlaneEnv(ideSettingsPromise);
|
||||
const url = new URL("https://api.workos.com/user_management/authorize");
|
||||
const params = {
|
||||
response_type: "code",
|
||||
client_id: env.WORKOS_CLIENT_ID,
|
||||
redirect_uri: `${env.APP_URL}tokens/callback`,
|
||||
redirect_uri: `${env.APP_URL}tokens/${useOnboarding ? "onboarding-" : ""}callback`,
|
||||
// redirect_uri: "http://localhost:3000/tokens/callback",
|
||||
state: uuidv4(),
|
||||
provider: "authkit",
|
||||
|
|
|
|||
|
|
@ -1,4 +1,7 @@
|
|||
import fetch from "node-fetch";
|
||||
import * as fs from "node:fs";
|
||||
import { IdeSettings } from "..";
|
||||
import { getStagingEnvironmentDotFilePath } from "../util/paths";
|
||||
|
||||
export interface ControlPlaneEnv {
|
||||
DEFAULT_CONTROL_PLANE_PROXY_URL: string;
|
||||
|
|
@ -35,13 +38,11 @@ const PRODUCTION_HUB_ENV: ControlPlaneEnv = {
|
|||
};
|
||||
|
||||
const STAGING_ENV: ControlPlaneEnv = {
|
||||
DEFAULT_CONTROL_PLANE_PROXY_URL:
|
||||
"https://control-plane-api-service-537175798139.us-central1.run.app/",
|
||||
CONTROL_PLANE_URL:
|
||||
"https://control-plane-api-service-537175798139.us-central1.run.app/",
|
||||
AUTH_TYPE: WORKOS_CLIENT_ID_STAGING,
|
||||
DEFAULT_CONTROL_PLANE_PROXY_URL: "https://api.continue-stage.tools/",
|
||||
CONTROL_PLANE_URL: "https://api.continue-stage.tools/",
|
||||
AUTH_TYPE: WORKOS_ENV_ID_STAGING,
|
||||
WORKOS_CLIENT_ID: WORKOS_CLIENT_ID_STAGING,
|
||||
APP_URL: "https://app-preview.continue.dev/",
|
||||
APP_URL: "https://hub.continue-stage.tools/",
|
||||
};
|
||||
|
||||
const TEST_ENV: ControlPlaneEnv = {
|
||||
|
|
@ -60,6 +61,17 @@ const LOCAL_ENV: ControlPlaneEnv = {
|
|||
APP_URL: "http://localhost:3000/",
|
||||
};
|
||||
|
||||
export async function enableHubContinueDev() {
|
||||
try {
|
||||
const resp = await fetch("https://api.continue.dev/features/hub");
|
||||
const data = (await resp.json()) as any;
|
||||
if ("enabled" in data && data.enabled === true) {
|
||||
return true;
|
||||
}
|
||||
} catch (e: any) {}
|
||||
return false;
|
||||
}
|
||||
|
||||
export async function getControlPlaneEnv(
|
||||
ideSettingsPromise: Promise<IdeSettings>,
|
||||
): Promise<ControlPlaneEnv> {
|
||||
|
|
@ -70,11 +82,15 @@ export async function getControlPlaneEnv(
|
|||
export function getControlPlaneEnvSync(
|
||||
ideTestEnvironment: IdeSettings["continueTestEnvironment"],
|
||||
): ControlPlaneEnv {
|
||||
if (fs.existsSync(getStagingEnvironmentDotFilePath())) {
|
||||
return STAGING_ENV;
|
||||
}
|
||||
|
||||
const env =
|
||||
ideTestEnvironment === "production"
|
||||
? "hub"
|
||||
: ideTestEnvironment === "test"
|
||||
? "test"
|
||||
: ideTestEnvironment === "staging"
|
||||
? "staging"
|
||||
: ideTestEnvironment === "local"
|
||||
? "local"
|
||||
: process.env.CONTROL_PLANE_ENV;
|
||||
|
|
|
|||
100
core/core.ts
100
core/core.ts
|
|
@ -17,7 +17,6 @@ import { addContextProvider, addModel, deleteModel } from "./config/util";
|
|||
import { recentlyEditedFilesCache } from "./context/retrieval/recentlyEditedFilesCache";
|
||||
import { ContinueServerClient } from "./continueServer/stubs/client";
|
||||
import { getAuthUrlForTokenPage } from "./control-plane/auth/index";
|
||||
import { ControlPlaneClient } from "./control-plane/client";
|
||||
import { getControlPlaneEnv } from "./control-plane/env";
|
||||
import { streamDiffLines } from "./edit/streamDiffLines";
|
||||
import { CodebaseIndexer, PauseToken } from "./indexing/CodebaseIndexer";
|
||||
|
|
@ -63,7 +62,6 @@ export class Core {
|
|||
completionProvider: CompletionProvider;
|
||||
continueServerClientPromise: Promise<ContinueServerClient>;
|
||||
codebaseIndexingState: IndexingProgressUpdate;
|
||||
controlPlaneClient: ControlPlaneClient;
|
||||
private docsService: DocsService;
|
||||
private globalContext = new GlobalContext();
|
||||
|
||||
|
|
@ -73,10 +71,6 @@ export class Core {
|
|||
|
||||
private abortedMessageIds: Set<string> = new Set();
|
||||
|
||||
private async config() {
|
||||
return (await this.configHandler.loadConfig()).config;
|
||||
}
|
||||
|
||||
invoke<T extends keyof ToCoreProtocol>(
|
||||
messageType: T,
|
||||
data: ToCoreProtocol[T][0],
|
||||
|
|
@ -114,16 +108,11 @@ export class Core {
|
|||
useOnboarding: false,
|
||||
});
|
||||
|
||||
this.controlPlaneClient = new ControlPlaneClient(
|
||||
sessionInfoPromise,
|
||||
ideSettingsPromise,
|
||||
);
|
||||
|
||||
this.configHandler = new ConfigHandler(
|
||||
this.ide,
|
||||
ideSettingsPromise,
|
||||
this.onWrite,
|
||||
this.controlPlaneClient,
|
||||
sessionInfoPromise,
|
||||
);
|
||||
|
||||
this.docsService = DocsService.createSingleton(
|
||||
|
|
@ -136,12 +125,25 @@ export class Core {
|
|||
const serializedResult = await this.configHandler.getSerializedConfig();
|
||||
this.messenger.send("configUpdate", {
|
||||
result: serializedResult,
|
||||
profileId: this.configHandler.currentProfile.profileDescription.id,
|
||||
profileId:
|
||||
this.configHandler.currentProfile?.profileDescription.id ?? null,
|
||||
});
|
||||
|
||||
// update additional submenu context providers registered via VSCode API
|
||||
const additionalProviders = this.configHandler.getAdditionalSubmenuContextProviders();
|
||||
if (additionalProviders.length > 0) {
|
||||
this.messenger.send("refreshSubmenuItems", {
|
||||
providers: additionalProviders,
|
||||
});
|
||||
}
|
||||
});
|
||||
|
||||
this.configHandler.onDidChangeAvailableProfiles((profiles) =>
|
||||
this.messenger.send("didChangeAvailableProfiles", { profiles }),
|
||||
this.configHandler.onDidChangeAvailableProfiles(
|
||||
(profiles, selectedProfileId) =>
|
||||
this.messenger.send("didChangeAvailableProfiles", {
|
||||
profiles,
|
||||
selectedProfileId,
|
||||
}),
|
||||
);
|
||||
|
||||
// Codebase Indexer and ContinueServerClient depend on IdeSettings
|
||||
|
|
@ -281,10 +283,8 @@ export class Core {
|
|||
});
|
||||
|
||||
on("config/newPromptFile", async (msg) => {
|
||||
await createNewPromptFileV2(
|
||||
this.ide,
|
||||
(await this.config())?.experimental?.promptPath,
|
||||
);
|
||||
const { config } = await this.configHandler.loadConfig();
|
||||
await createNewPromptFileV2(this.ide, config?.experimental?.promptPath);
|
||||
await this.configHandler.reloadConfig();
|
||||
});
|
||||
|
||||
|
|
@ -306,7 +306,7 @@ export class Core {
|
|||
});
|
||||
|
||||
on("config/addContextProvider", async (msg) => {
|
||||
addContextProvider(msg.data);
|
||||
addContextProvider(msg.data, this.configHandler);
|
||||
});
|
||||
|
||||
on("config/updateSharedConfig", async (msg) => {
|
||||
|
|
@ -324,7 +324,7 @@ export class Core {
|
|||
});
|
||||
|
||||
on("controlPlane/listOrganizations", async (msg) => {
|
||||
return await this.controlPlaneClient.listOrganizations();
|
||||
return await this.configHandler.listOrganizations();
|
||||
});
|
||||
|
||||
// Context providers
|
||||
|
|
@ -341,7 +341,7 @@ export class Core {
|
|||
});
|
||||
|
||||
on("context/loadSubmenuItems", async (msg) => {
|
||||
const config = await this.config();
|
||||
const { config } = await this.configHandler.loadConfig();
|
||||
if (!config) {
|
||||
return [];
|
||||
}
|
||||
|
|
@ -358,13 +358,14 @@ export class Core {
|
|||
});
|
||||
|
||||
on("context/getContextItems", async (msg) => {
|
||||
const { name, query, fullInput, selectedCode, selectedModelTitle } =
|
||||
msg.data;
|
||||
const config = await this.config();
|
||||
const { config } = await this.configHandler.loadConfig();
|
||||
if (!config) {
|
||||
return [];
|
||||
}
|
||||
|
||||
const { name, query, fullInput, selectedCode, selectedModelTitle } =
|
||||
msg.data;
|
||||
|
||||
const llm = await this.configHandler.llmFromTitle(selectedModelTitle);
|
||||
const provider =
|
||||
config.contextProviders?.find(
|
||||
|
|
@ -412,10 +413,36 @@ export class Core {
|
|||
id,
|
||||
}));
|
||||
} catch (e) {
|
||||
void this.ide.showToast(
|
||||
"error",
|
||||
`Error getting context items from ${name}: ${e}`,
|
||||
);
|
||||
let knownError = false;
|
||||
|
||||
if (e instanceof Error) {
|
||||
// A specific error where we're forcing the presence of embeddings provider on the config
|
||||
// But Jetbrains doesn't support transformers JS
|
||||
// So if a context provider needs it it will throw this error when the file isn't found
|
||||
if (e.message.includes("all-MiniLM-L6-v2")) {
|
||||
knownError = true;
|
||||
const toastOption = "See Docs";
|
||||
void this.ide
|
||||
.showToast(
|
||||
"error",
|
||||
`Set up an embeddings model to use @${name}`,
|
||||
toastOption,
|
||||
)
|
||||
.then((userSelection) => {
|
||||
if (userSelection === toastOption) {
|
||||
void this.ide.openUrl(
|
||||
"https://docs.continue.dev/customize/model-types/embeddings",
|
||||
);
|
||||
}
|
||||
});
|
||||
}
|
||||
}
|
||||
if (!knownError) {
|
||||
void this.ide.showToast(
|
||||
"error",
|
||||
`Error getting context items from ${name}: ${e}`,
|
||||
);
|
||||
}
|
||||
return [];
|
||||
}
|
||||
});
|
||||
|
|
@ -428,7 +455,8 @@ export class Core {
|
|||
on("config/getSerializedProfileInfo", async (msg) => {
|
||||
return {
|
||||
result: await this.configHandler.getSerializedConfig(),
|
||||
profileId: this.configHandler.currentProfile.profileDescription.id,
|
||||
profileId:
|
||||
this.configHandler.currentProfile?.profileDescription.id ?? null,
|
||||
};
|
||||
});
|
||||
|
||||
|
|
@ -716,6 +744,8 @@ export class Core {
|
|||
llm,
|
||||
data.input,
|
||||
data.language,
|
||||
false,
|
||||
undefined,
|
||||
)) {
|
||||
if (abortedMessageIds.has(msg.messageId)) {
|
||||
abortedMessageIds.delete(msg.messageId);
|
||||
|
|
@ -911,13 +941,19 @@ export class Core {
|
|||
on("didChangeSelectedOrg", (msg) => {
|
||||
void this.configHandler.setSelectedOrgId(msg.data.id);
|
||||
void this.configHandler.reloadConfig();
|
||||
void this.configHandler.loadAssistantsForSelectedOrg();
|
||||
});
|
||||
|
||||
on("didChangeControlPlaneSessionInfo", async (msg) => {
|
||||
this.configHandler.updateControlPlaneSessionInfo(msg.data.sessionInfo);
|
||||
await this.configHandler.updateControlPlaneSessionInfo(
|
||||
msg.data.sessionInfo,
|
||||
);
|
||||
});
|
||||
on("auth/getAuthUrl", async (msg) => {
|
||||
const url = await getAuthUrlForTokenPage(ideSettingsPromise);
|
||||
const url = await getAuthUrlForTokenPage(
|
||||
ideSettingsPromise,
|
||||
msg.data.useOnboarding,
|
||||
);
|
||||
return { url };
|
||||
});
|
||||
|
||||
|
|
|
|||
|
|
@ -54,7 +54,8 @@ export async function* streamDiffLines(
|
|||
llm: ILLM,
|
||||
input: string,
|
||||
language: string | undefined,
|
||||
onlyOneInsertion?: boolean,
|
||||
onlyOneInsertion: boolean,
|
||||
overridePrompt: ChatMessage[] | undefined,
|
||||
): AsyncGenerator<DiffLine> {
|
||||
void Telemetry.capture(
|
||||
"inlineEdit",
|
||||
|
|
@ -80,14 +81,9 @@ export async function* streamDiffLines(
|
|||
// Trim end of oldLines, otherwise we have trailing \r on every line for CRLF files
|
||||
oldLines = oldLines.map((line) => line.trimEnd());
|
||||
|
||||
const prompt = constructPrompt(
|
||||
prefix,
|
||||
highlighted,
|
||||
suffix,
|
||||
llm,
|
||||
input,
|
||||
language,
|
||||
);
|
||||
const prompt =
|
||||
overridePrompt ??
|
||||
constructPrompt(prefix, highlighted, suffix, llm, input, language);
|
||||
const inept = modelIsInept(llm.model);
|
||||
|
||||
const prediction: Prediction = {
|
||||
|
|
|
|||
72
core/index.d.ts
vendored
72
core/index.d.ts
vendored
|
|
@ -1,6 +1,6 @@
|
|||
import { ModelRole } from "@continuedev/config-yaml";
|
||||
import Parser from "web-tree-sitter";
|
||||
import { GetGhTokenArgs } from "./protocol/ide";
|
||||
|
||||
declare global {
|
||||
interface Window {
|
||||
ide?: "vscode";
|
||||
|
|
@ -43,13 +43,13 @@ export interface IndexingProgressUpdate {
|
|||
desc: string;
|
||||
shouldClearIndexes?: boolean;
|
||||
status:
|
||||
| "loading"
|
||||
| "indexing"
|
||||
| "done"
|
||||
| "failed"
|
||||
| "paused"
|
||||
| "disabled"
|
||||
| "cancelled";
|
||||
| "loading"
|
||||
| "indexing"
|
||||
| "done"
|
||||
| "failed"
|
||||
| "paused"
|
||||
| "disabled"
|
||||
| "cancelled";
|
||||
debugInfo?: string;
|
||||
}
|
||||
|
||||
|
|
@ -94,6 +94,8 @@ export interface ILLM extends LLMOptions {
|
|||
apiKey?: string;
|
||||
apiBase?: string;
|
||||
cacheBehavior?: CacheBehavior;
|
||||
capabilities?: ModelCapability;
|
||||
roles?: ModelRole[];
|
||||
|
||||
deployment?: string;
|
||||
apiVersion?: string;
|
||||
|
|
@ -480,6 +482,8 @@ export interface LLMOptions {
|
|||
aiGatewaySlug?: string;
|
||||
apiBase?: string;
|
||||
cacheBehavior?: CacheBehavior;
|
||||
capabilities?: ModelCapability;
|
||||
roles?: ModelRole[];
|
||||
|
||||
useLegacyCompletionsEndpoint?: boolean;
|
||||
|
||||
|
|
@ -503,9 +507,6 @@ export interface LLMOptions {
|
|||
// AWS and GCP Options
|
||||
region?: string;
|
||||
|
||||
// GCP Options
|
||||
capabilities?: ModelCapability;
|
||||
|
||||
// GCP and Watsonx Options
|
||||
projectId?: string;
|
||||
|
||||
|
|
@ -599,7 +600,7 @@ export interface IdeSettings {
|
|||
remoteConfigSyncPeriod: number;
|
||||
userToken: string;
|
||||
enableControlServerBeta: boolean;
|
||||
continueTestEnvironment: "none" | "production" | "test" | "local";
|
||||
continueTestEnvironment: "none" | "production" | "staging" | "local";
|
||||
pauseCodebaseIndexOnStart: boolean;
|
||||
}
|
||||
|
||||
|
|
@ -666,12 +667,16 @@ export interface IDE {
|
|||
getCurrentFile(): Promise<
|
||||
| undefined
|
||||
| {
|
||||
isUntitled: boolean;
|
||||
path: string;
|
||||
contents: string;
|
||||
}
|
||||
isUntitled: boolean;
|
||||
path: string;
|
||||
contents: string;
|
||||
}
|
||||
>;
|
||||
|
||||
getLastFileSaveTimestamp?(): number;
|
||||
|
||||
updateLastFileSaveTimestamp?(): void;
|
||||
|
||||
getPinnedFiles(): Promise<string[]>;
|
||||
|
||||
getSearchResults(query: string): Promise<string>;
|
||||
|
|
@ -848,11 +853,11 @@ export interface CustomCommand {
|
|||
export interface Prediction {
|
||||
type: "content";
|
||||
content:
|
||||
| string
|
||||
| {
|
||||
type: "text";
|
||||
text: string;
|
||||
}[];
|
||||
| string
|
||||
| {
|
||||
type: "text";
|
||||
text: string;
|
||||
}[];
|
||||
}
|
||||
|
||||
export interface ToolExtras {
|
||||
|
|
@ -907,6 +912,7 @@ export interface BaseCompletionOptions {
|
|||
|
||||
export interface ModelCapability {
|
||||
uploadImage?: boolean;
|
||||
tools?: boolean;
|
||||
}
|
||||
|
||||
export interface ModelDescription {
|
||||
|
|
@ -923,8 +929,9 @@ export interface ModelDescription {
|
|||
systemMessage?: string;
|
||||
requestOptions?: RequestOptions;
|
||||
promptTemplates?: { [key: string]: string };
|
||||
capabilities?: ModelCapability;
|
||||
cacheBehavior?: CacheBehavior;
|
||||
capabilities?: ModelCapability;
|
||||
roles?: ModelRole[];
|
||||
}
|
||||
|
||||
export interface EmbedOptions {
|
||||
|
|
@ -973,6 +980,11 @@ export interface TabAutocompleteOptions {
|
|||
disableInFiles?: string[];
|
||||
useImports?: boolean;
|
||||
showWhateverWeHaveAtXMs?: number;
|
||||
// true = enabled, false = disabled, number = enabled with priority
|
||||
experimental_includeClipboard: boolean | number;
|
||||
experimental_includeRecentlyVisitedRanges: boolean | number;
|
||||
experimental_includeRecentlyEditedRanges: boolean | number;
|
||||
experimental_includeDiff: boolean | number;
|
||||
}
|
||||
|
||||
export interface StdioOptions {
|
||||
|
|
@ -1015,7 +1027,7 @@ export interface ContextMenuConfig {
|
|||
fixGrammar?: string;
|
||||
}
|
||||
|
||||
export interface ModelRoles {
|
||||
export interface ExperimentalModelRoles {
|
||||
inlineEdit?: string;
|
||||
applyCodeBlock?: string;
|
||||
repoMapFileSelection?: string;
|
||||
|
|
@ -1083,7 +1095,7 @@ export type DefaultContextProvider = ContextProviderWithParams & {
|
|||
|
||||
export interface ExperimentalConfig {
|
||||
contextMenuPrompts?: ContextMenuConfig;
|
||||
modelRoles?: ModelRoles;
|
||||
modelRoles?: ExperimentalModelRoles;
|
||||
defaultContext?: DefaultContextProvider[];
|
||||
promptPath?: string;
|
||||
|
||||
|
|
@ -1174,9 +1186,9 @@ export interface Config {
|
|||
embeddingsProvider?: EmbeddingsProviderDescription | ILLM;
|
||||
/** The model that Continue will use for tab autocompletions. */
|
||||
tabAutocompleteModel?:
|
||||
| CustomLLM
|
||||
| ModelDescription
|
||||
| (CustomLLM | ModelDescription)[];
|
||||
| CustomLLM
|
||||
| ModelDescription
|
||||
| (CustomLLM | ModelDescription)[];
|
||||
/** Options for tab autocomplete */
|
||||
tabAutocompleteOptions?: Partial<TabAutocompleteOptions>;
|
||||
/** UI styles customization */
|
||||
|
|
@ -1267,9 +1279,9 @@ export type PackageDetailsSuccess = PackageDetails & {
|
|||
export type PackageDocsResult = {
|
||||
packageInfo: ParsedPackageInfo;
|
||||
} & (
|
||||
| { error: string; details?: never }
|
||||
| { details: PackageDetailsSuccess; error?: never }
|
||||
);
|
||||
| { error: string; details?: never }
|
||||
| { details: PackageDetailsSuccess; error?: never }
|
||||
);
|
||||
|
||||
export interface TerminalOptions {
|
||||
reuseTerminal?: boolean;
|
||||
|
|
|
|||
|
|
@ -2,7 +2,6 @@
|
|||
* @jest-environment jsdom
|
||||
*/
|
||||
import { ConfigHandler } from "../../config/ConfigHandler.js";
|
||||
import { ControlPlaneClient } from "../../control-plane/client.js";
|
||||
import { SiteIndexingConfig } from "../../index.js";
|
||||
import FileSystemIde from "../../util/filesystem.js";
|
||||
import { editConfigJson } from "../../util/paths.js";
|
||||
|
|
@ -50,16 +49,7 @@ describe.skip("DocsService Integration Tests", () => {
|
|||
ide,
|
||||
ideSettingsPromise,
|
||||
async () => {},
|
||||
new ControlPlaneClient(
|
||||
Promise.resolve({
|
||||
accessToken: "",
|
||||
account: {
|
||||
id: "",
|
||||
label: "",
|
||||
},
|
||||
}),
|
||||
ideSettingsPromise,
|
||||
),
|
||||
Promise.resolve(undefined),
|
||||
);
|
||||
|
||||
docsService = DocsService.createSingleton(configHandler, ide);
|
||||
|
|
|
|||
|
|
@ -1,4 +1,5 @@
|
|||
import { ConfigResult } from "@continuedev/config-yaml";
|
||||
import { ConfigResult } from "@continuedev/config-yaml";
|
||||
import { open, type Database } from "sqlite";
|
||||
import sqlite3 from "sqlite3";
|
||||
|
||||
|
|
@ -23,6 +24,7 @@ import { FromCoreProtocol, ToCoreProtocol } from "../../protocol";
|
|||
import { IMessenger } from "../../protocol/messenger";
|
||||
import { fetchFavicon, getFaviconBase64 } from "../../util/fetchFavicon";
|
||||
import { GlobalContext } from "../../util/GlobalContext";
|
||||
import { GlobalContext } from "../../util/GlobalContext";
|
||||
import {
|
||||
editConfigJson,
|
||||
getDocsSqlitePath,
|
||||
|
|
@ -178,7 +180,8 @@ export default class DocsService {
|
|||
|
||||
const currentStatus = this.statuses.get(doc.startUrl);
|
||||
if (currentStatus) {
|
||||
return currentStatus;
|
||||
this.handleStatusUpdate(currentStatus);
|
||||
return;
|
||||
}
|
||||
|
||||
const sharedStatus = {
|
||||
|
|
@ -232,11 +235,7 @@ export default class DocsService {
|
|||
if (isAborted) {
|
||||
return true;
|
||||
}
|
||||
// // Handle indexing disabled change mid-indexing
|
||||
// if (this.config.disableIndexing) {
|
||||
// this.abort(startUrl);
|
||||
// return true;
|
||||
// }
|
||||
|
||||
// Handle embeddings provider change mid-indexing
|
||||
if (this.config.embeddingsProvider.embeddingId !== startedWithEmbedder) {
|
||||
this.abort(startUrl);
|
||||
|
|
@ -298,10 +297,6 @@ export default class DocsService {
|
|||
const oldConfig = this.config;
|
||||
this.config = newConfig; // IMPORTANT - need to set up top, other methods below use this without passing it in
|
||||
|
||||
// if (this.config.disableIndexing) {
|
||||
// return;
|
||||
// }
|
||||
|
||||
// No point in indexing if no docs context provider
|
||||
const hasDocsContextProvider = this.hasDocsContextProvider();
|
||||
if (!hasDocsContextProvider) {
|
||||
|
|
@ -389,25 +384,25 @@ export default class DocsService {
|
|||
siteIndexingConfig: SiteIndexingConfig,
|
||||
forceReindex: boolean = false,
|
||||
): Promise<void> {
|
||||
// if (this.config.disableIndexing) {
|
||||
// console.warn("Attempting to add/index docs when indexing is disabled");
|
||||
// return;
|
||||
// }
|
||||
const { startUrl, useLocalCrawling, maxDepth } = siteIndexingConfig;
|
||||
|
||||
// First, if indexing is already in process, don't attempt
|
||||
// This queue is necessary because indexAndAdd is invoked circularly by config edits
|
||||
// TODO shouldn't really be a gap between adding and checking in queue but probably fine
|
||||
if (this.docsIndexingQueue.has(startUrl)) {
|
||||
return;
|
||||
}
|
||||
|
||||
const { isPreindexed, provider } =
|
||||
await this.getEmbeddingsProvider(startUrl);
|
||||
if (isPreindexed) {
|
||||
console.warn("Attempted to indexAndAdd pre-indexed doc");
|
||||
return;
|
||||
}
|
||||
|
||||
// Queue - indexAndAdd is invoked circularly by config edits. This prevents duplicate runs
|
||||
if (this.docsIndexingQueue.has(startUrl)) {
|
||||
return;
|
||||
}
|
||||
|
||||
const startedWithEmbedder = provider.embeddingId;
|
||||
|
||||
// Check if doc has been successfully indexed with the given embedder
|
||||
// Note at this point we know it's not a pre-indexed doc
|
||||
const indexExists = await this.hasMetadata(startUrl);
|
||||
|
||||
// Build status update - most of it is fixed values
|
||||
|
|
@ -425,22 +420,6 @@ export default class DocsService {
|
|||
url: siteIndexingConfig.startUrl,
|
||||
};
|
||||
|
||||
// Clear current indexes if reIndexing
|
||||
if (indexExists) {
|
||||
if (forceReindex) {
|
||||
await this.deleteIndexes(startUrl);
|
||||
} else {
|
||||
this.handleStatusUpdate({
|
||||
...fixedStatus,
|
||||
progress: 1,
|
||||
description: "Complete",
|
||||
status: "complete",
|
||||
debugInfo: "Already indexed",
|
||||
});
|
||||
return;
|
||||
}
|
||||
}
|
||||
|
||||
// If not force-reindexing and has failed with same config, don't reattempt
|
||||
if (!forceReindex) {
|
||||
const globalContext = new GlobalContext();
|
||||
|
|
@ -462,6 +441,27 @@ export default class DocsService {
|
|||
}
|
||||
}
|
||||
|
||||
if (indexExists && !forceReindex) {
|
||||
this.handleStatusUpdate({
|
||||
...fixedStatus,
|
||||
progress: 1,
|
||||
description: "Complete",
|
||||
status: "complete",
|
||||
debugInfo: "Already indexed",
|
||||
});
|
||||
return;
|
||||
}
|
||||
|
||||
// Do a test run on the embedder
|
||||
// This particular failure will not mark as a failed config in global context
|
||||
// Since SiteIndexingConfig is likely to be valid
|
||||
try {
|
||||
await provider.embed(["continue-test-run"]);
|
||||
} catch (e) {
|
||||
console.error("Failed to test embeddings connection", e);
|
||||
return;
|
||||
}
|
||||
|
||||
const markFailedInGlobalContext = () => {
|
||||
const globalContext = new GlobalContext();
|
||||
const failedDocs = globalContext.get("failedDocs") ?? [];
|
||||
|
|
@ -484,6 +484,11 @@ export default class DocsService {
|
|||
try {
|
||||
this.docsIndexingQueue.add(startUrl);
|
||||
|
||||
// Clear current indexes if reIndexing
|
||||
if (indexExists && forceReindex) {
|
||||
await this.deleteIndexes(startUrl);
|
||||
}
|
||||
|
||||
this.addToConfig(siteIndexingConfig);
|
||||
|
||||
this.handleStatusUpdate({
|
||||
|
|
@ -585,9 +590,10 @@ export default class DocsService {
|
|||
});
|
||||
|
||||
try {
|
||||
const subpathEmbeddings = await provider.embed(
|
||||
article.chunks.map((c) => c.content),
|
||||
);
|
||||
const subpathEmbeddings =
|
||||
article.chunks.length > 0
|
||||
? await provider.embed(article.chunks.map((c) => c.content))
|
||||
: [];
|
||||
chunks.push(...article.chunks);
|
||||
embeddings.push(...subpathEmbeddings);
|
||||
const toWait = 100 * this.docsIndexingQueue.size + 50;
|
||||
|
|
@ -613,7 +619,6 @@ export default class DocsService {
|
|||
});
|
||||
|
||||
void this.ide.showToast("info", `Failed to index ${startUrl}`);
|
||||
this.docsIndexingQueue.delete(startUrl);
|
||||
markFailedInGlobalContext();
|
||||
return;
|
||||
}
|
||||
|
|
@ -656,11 +661,6 @@ export default class DocsService {
|
|||
favicon,
|
||||
});
|
||||
|
||||
this.docsIndexingQueue.delete(startUrl);
|
||||
|
||||
if (this.shouldCancel(startUrl, startedWithEmbedder)) {
|
||||
return;
|
||||
}
|
||||
this.handleStatusUpdate({
|
||||
...fixedStatus,
|
||||
description: "Complete",
|
||||
|
|
@ -676,7 +676,11 @@ export default class DocsService {
|
|||
|
||||
removeFromFailedGlobalContext();
|
||||
} catch (e) {
|
||||
let description = `Error getting docs from: ${siteIndexingConfig.startUrl}`;
|
||||
console.error(
|
||||
`Error indexing docs at: ${siteIndexingConfig.startUrl}`,
|
||||
e,
|
||||
);
|
||||
let description = `Error indexing docs at: ${siteIndexingConfig.startUrl}`;
|
||||
if (e instanceof Error) {
|
||||
if (
|
||||
e.message.includes("github.com") &&
|
||||
|
|
@ -685,7 +689,6 @@ export default class DocsService {
|
|||
description = "Github rate limit exceeded"; // This text is used verbatim elsewhere
|
||||
}
|
||||
}
|
||||
console.error("Error indexing docs", e);
|
||||
this.handleStatusUpdate({
|
||||
...fixedStatus,
|
||||
description,
|
||||
|
|
@ -937,7 +940,7 @@ export default class DocsService {
|
|||
// Anything found in old config, new config, AND sqlite that doesn't match should be reindexed
|
||||
// TODO if only favicon and title change, only update, don't embed
|
||||
// Otherwise anything found in new config that isn't in sqlite should be added/indexed
|
||||
const newDocs: SiteIndexingConfig[] = [];
|
||||
const addedDocs: SiteIndexingConfig[] = [];
|
||||
const changedDocs: SiteIndexingConfig[] = [];
|
||||
for (const doc of newConfigDocs) {
|
||||
const currentIndexedDoc = currentStartUrls.includes(doc.startUrl);
|
||||
|
|
@ -974,14 +977,14 @@ export default class DocsService {
|
|||
}
|
||||
}
|
||||
} else {
|
||||
newDocs.push(doc);
|
||||
addedDocs.push(doc);
|
||||
void Telemetry.capture("add_docs_config", { url: doc.startUrl });
|
||||
}
|
||||
}
|
||||
|
||||
await Promise.allSettled([
|
||||
...changedDocs.map((doc) => this.indexAndAdd(doc, true)),
|
||||
...newDocs.map((doc) => this.indexAndAdd(doc)),
|
||||
...addedDocs.map((doc) => this.indexAndAdd(doc)),
|
||||
]);
|
||||
|
||||
for (const doc of deletedDocs) {
|
||||
|
|
|
|||
|
|
@ -139,24 +139,35 @@ export async function htmlPageToArticleWithChunks(
|
|||
return undefined;
|
||||
}
|
||||
|
||||
const title = readability.title || subpath;
|
||||
|
||||
const titles = Array.from(dom.window.document.querySelectorAll("h2"));
|
||||
const article_components = titles.map((titleElement) => {
|
||||
const title = titleElement.textContent || "";
|
||||
let body = "";
|
||||
let nextSibling = titleElement.nextElementSibling;
|
||||
|
||||
while (nextSibling && nextSibling.tagName !== "H2") {
|
||||
body += nextSibling.textContent || "";
|
||||
nextSibling = nextSibling.nextElementSibling;
|
||||
}
|
||||
const article_components =
|
||||
titles.length > 0
|
||||
? titles.map((titleElement) => {
|
||||
const title = titleElement.textContent || "";
|
||||
let body = "";
|
||||
let nextSibling = titleElement.nextElementSibling;
|
||||
|
||||
return { title, body };
|
||||
});
|
||||
while (nextSibling && nextSibling.tagName !== "H2") {
|
||||
body += nextSibling.textContent || "";
|
||||
nextSibling = nextSibling.nextElementSibling;
|
||||
}
|
||||
|
||||
return { title, body };
|
||||
})
|
||||
: [
|
||||
{
|
||||
title: title,
|
||||
body: readability.textContent,
|
||||
},
|
||||
];
|
||||
|
||||
const article = {
|
||||
url,
|
||||
subpath,
|
||||
title: readability.title,
|
||||
title: title,
|
||||
article_components,
|
||||
};
|
||||
return {
|
||||
|
|
|
|||
|
|
@ -353,6 +353,16 @@ const preIndexedDocs: Record<
|
|||
startUrl: "https://docs.asksage.ai/",
|
||||
rootUrl: "https://docs.asksage.ai/",
|
||||
},
|
||||
"https://angular.dev/": {
|
||||
title: "Angular",
|
||||
startUrl: "https://angular.dev/",
|
||||
rootUrl: "https://angular.dev/",
|
||||
},
|
||||
"https://docs.djangoproject.com/": {
|
||||
title: "Django",
|
||||
startUrl: "https://docs.djangoproject.com/",
|
||||
rootUrl: "https://docs.djangoproject.com/",
|
||||
}
|
||||
};
|
||||
|
||||
export default preIndexedDocs;
|
||||
|
|
|
|||
|
|
@ -1,4 +1,9 @@
|
|||
import { ChatMessage, ModelCapability, TemplateType } from "../index.js";
|
||||
import {
|
||||
ChatMessage,
|
||||
ModelCapability,
|
||||
ModelDescription,
|
||||
TemplateType,
|
||||
} from "../index.js";
|
||||
|
||||
import {
|
||||
anthropicTemplateMessages,
|
||||
|
|
@ -52,6 +57,7 @@ const PROVIDER_HANDLES_TEMPLATING: string[] = [
|
|||
"sambanova",
|
||||
"vertexai",
|
||||
"watsonx",
|
||||
"nebius",
|
||||
];
|
||||
|
||||
const PROVIDER_SUPPORTS_IMAGES: string[] = [
|
||||
|
|
@ -68,6 +74,7 @@ const PROVIDER_SUPPORTS_IMAGES: string[] = [
|
|||
"vertexai",
|
||||
"azure",
|
||||
"scaleway",
|
||||
"nebius",
|
||||
];
|
||||
|
||||
const MODEL_SUPPORTS_IMAGES: string[] = [
|
||||
|
|
@ -87,12 +94,15 @@ const MODEL_SUPPORTS_IMAGES: string[] = [
|
|||
"llama3.2",
|
||||
];
|
||||
|
||||
function modelSupportsTools(modelName: string, provider: string) {
|
||||
const providerSupport = PROVIDER_TOOL_SUPPORT[provider];
|
||||
function modelSupportsTools(modelDescription: ModelDescription) {
|
||||
if (modelDescription.capabilities?.tools !== undefined) {
|
||||
return modelDescription.capabilities.tools;
|
||||
}
|
||||
const providerSupport = PROVIDER_TOOL_SUPPORT[modelDescription.provider];
|
||||
if (!providerSupport) {
|
||||
return false;
|
||||
}
|
||||
return providerSupport(modelName) ?? false;
|
||||
return providerSupport(modelDescription.model) ?? false;
|
||||
}
|
||||
|
||||
function modelSupportsImages(
|
||||
|
|
|
|||
|
|
@ -1,4 +1,9 @@
|
|||
import { ChatHistoryItem, ChatMessage, MessagePart } from "../";
|
||||
import {
|
||||
ChatHistoryItem,
|
||||
ChatMessage,
|
||||
MessagePart,
|
||||
ModelDescription,
|
||||
} from "../";
|
||||
import { normalizeToMessageParts } from "../util/messageContent";
|
||||
|
||||
import { modelSupportsTools } from "./autodetect";
|
||||
|
|
@ -67,15 +72,18 @@ const TOOL_USE_RULES = `When using tools, follow the following guidelines:
|
|||
- Avoid calling tools unless they are absolutely necessary. For example, if you are asked a simple programming question you do not need web search. As another example, if the user asks you to explain something about code, do not create a new file.`;
|
||||
|
||||
function constructSystemPrompt(
|
||||
model: string,
|
||||
provider: string,
|
||||
modelDescription: ModelDescription,
|
||||
useTools: boolean,
|
||||
): string | null {
|
||||
let systemMessage = "";
|
||||
if (CUSTOM_SYS_MSG_MODEL_FAMILIES.some((family) => model.includes(family))) {
|
||||
if (
|
||||
CUSTOM_SYS_MSG_MODEL_FAMILIES.some((family) =>
|
||||
modelDescription.model.includes(family),
|
||||
)
|
||||
) {
|
||||
systemMessage = SYSTEM_MESSAGE;
|
||||
}
|
||||
if (useTools && modelSupportsTools(model, provider)) {
|
||||
if (useTools && modelSupportsTools(modelDescription)) {
|
||||
if (systemMessage) {
|
||||
systemMessage += "\n\n";
|
||||
}
|
||||
|
|
@ -89,8 +97,7 @@ const CANCELED_TOOL_CALL_MESSAGE =
|
|||
|
||||
export function constructMessages(
|
||||
history: ChatHistoryItem[],
|
||||
model: string,
|
||||
provider: string,
|
||||
modelDescription: ModelDescription,
|
||||
useTools: boolean,
|
||||
): ChatMessage[] {
|
||||
const filteredHistory = history.filter(
|
||||
|
|
@ -98,7 +105,7 @@ export function constructMessages(
|
|||
);
|
||||
const msgs: ChatMessage[] = [];
|
||||
|
||||
const systemMessage = constructSystemPrompt(model, provider, useTools);
|
||||
const systemMessage = constructSystemPrompt(modelDescription, useTools);
|
||||
if (systemMessage) {
|
||||
msgs.push({
|
||||
role: "system",
|
||||
|
|
|
|||
|
|
@ -56,6 +56,7 @@ import {
|
|||
toCompleteBody,
|
||||
toFimBody,
|
||||
} from "./openaiTypeConverters.js";
|
||||
import { ModelRole } from "@continuedev/config-yaml";
|
||||
|
||||
export abstract class BaseLLM implements ILLM {
|
||||
static providerName: string;
|
||||
|
|
@ -121,6 +122,7 @@ export abstract class BaseLLM implements ILLM {
|
|||
apiBase?: string;
|
||||
cacheBehavior?: CacheBehavior;
|
||||
capabilities?: ModelCapability;
|
||||
roles?: ModelRole[];
|
||||
|
||||
deployment?: string;
|
||||
apiVersion?: string;
|
||||
|
|
@ -209,6 +211,7 @@ export abstract class BaseLLM implements ILLM {
|
|||
}
|
||||
this.accountId = options.accountId;
|
||||
this.capabilities = options.capabilities;
|
||||
this.roles = options.roles;
|
||||
|
||||
this.deployment = options.deployment;
|
||||
this.apiVersion = options.apiVersion;
|
||||
|
|
|
|||
|
|
@ -2,12 +2,14 @@ import * as dotenv from "dotenv";
|
|||
|
||||
import { AssistantChatMessage, CompletionOptions } from "..";
|
||||
|
||||
import { BaseLLM } from ".";
|
||||
import Anthropic from "./llms/Anthropic";
|
||||
import Azure from "./llms/Azure";
|
||||
import Gemini from "./llms/Gemini";
|
||||
import Mistral from "./llms/Mistral";
|
||||
import OpenAI from "./llms/OpenAI";
|
||||
|
||||
import { BaseLLM } from ".";
|
||||
|
||||
dotenv.config();
|
||||
|
||||
const COMPLETION_OPTIONS: Partial<CompletionOptions> = {
|
||||
|
|
@ -222,4 +224,25 @@ describe("LLM", () => {
|
|||
}),
|
||||
{ testFim: true, skip: false },
|
||||
);
|
||||
testLLM(
|
||||
new Azure({
|
||||
apiKey: process.env.AZURE_OPENAI_API_KEY,
|
||||
model: "gpt-4o",
|
||||
apiVersion: "2024-05-01-preview",
|
||||
apiBase: "https://continue-azure-openai-instance.openai.azure.com",
|
||||
deployment: "azure-openai-deployment",
|
||||
apiType: "azure-openai",
|
||||
}),
|
||||
{ testFim: false, skip: false, timeout: 20000 },
|
||||
);
|
||||
testLLM(
|
||||
new Azure({
|
||||
apiKey: process.env.AZURE_FOUNDRY_API_KEY,
|
||||
model: "codestral-latest",
|
||||
apiBase:
|
||||
"https://codestral-2501-continue-testing.eastus.models.ai.azure.com",
|
||||
apiType: "azure-foundry",
|
||||
}),
|
||||
{ testFim: false, skip: false, timeout: 20000 },
|
||||
);
|
||||
});
|
||||
|
|
|
|||
|
|
@ -14,7 +14,7 @@ class Azure extends OpenAI {
|
|||
|
||||
static defaultOptions: Partial<LLMOptions> = {
|
||||
apiVersion: "2024-02-15-preview",
|
||||
apiType: "azure",
|
||||
apiType: "azure-openai",
|
||||
};
|
||||
|
||||
constructor(options: LLMOptions) {
|
||||
|
|
|
|||
|
|
@ -1,4 +1,3 @@
|
|||
import { r } from "tar";
|
||||
import {
|
||||
AssistantChatMessage,
|
||||
ChatMessage,
|
||||
|
|
@ -7,6 +6,7 @@ import {
|
|||
MessagePart,
|
||||
ToolCallDelta,
|
||||
} from "../../index.js";
|
||||
import { findLast } from "../../util/findLast.js";
|
||||
import { renderChatMessage } from "../../util/messageContent.js";
|
||||
import { BaseLLM } from "../index.js";
|
||||
import { streamResponse } from "../stream.js";
|
||||
|
|
@ -17,7 +17,6 @@ import {
|
|||
GeminiGenerationConfig,
|
||||
GeminiToolFunctionDeclaration,
|
||||
} from "./gemini-types.js";
|
||||
import { findLast } from "../../util/findLast.js";
|
||||
|
||||
class Gemini extends BaseLLM {
|
||||
static providerName = "gemini";
|
||||
|
|
@ -253,7 +252,7 @@ class Gemini extends BaseLLM {
|
|||
}
|
||||
// Helper function to recursively clean JSON Schema objects
|
||||
const cleanJsonSchema = (schema: any): any => {
|
||||
if (!schema || typeof schema !== 'object') return schema;
|
||||
if (!schema || typeof schema !== "object") return schema;
|
||||
|
||||
if (Array.isArray(schema)) {
|
||||
return schema.map(cleanJsonSchema);
|
||||
|
|
@ -273,7 +272,7 @@ class Gemini extends BaseLLM {
|
|||
...acc,
|
||||
[key]: cleanJsonSchema(value),
|
||||
}),
|
||||
{}
|
||||
{},
|
||||
);
|
||||
}
|
||||
|
||||
|
|
@ -349,8 +348,8 @@ class Gemini extends BaseLLM {
|
|||
|
||||
// Process all parts first to maintain order
|
||||
const processedParts: Array<{
|
||||
type: 'content' | 'tool' | 'toolCall',
|
||||
data: any
|
||||
type: "content" | "tool" | "toolCall";
|
||||
data: any;
|
||||
}> = [];
|
||||
|
||||
for (const part of content.parts) {
|
||||
|
|
@ -366,7 +365,7 @@ class Gemini extends BaseLLM {
|
|||
} else if ("functionCall" in part) {
|
||||
// Queue function call
|
||||
processedParts.push({
|
||||
type: 'toolCall',
|
||||
type: "toolCall",
|
||||
data: {
|
||||
type: "function",
|
||||
id: "", // Not supported by gemini
|
||||
|
|
@ -377,17 +376,17 @@ class Gemini extends BaseLLM {
|
|||
? part.functionCall.args
|
||||
: JSON.stringify(part.functionCall.args),
|
||||
},
|
||||
}
|
||||
},
|
||||
});
|
||||
} else if ("functionResponse" in part) {
|
||||
// Queue function response
|
||||
processedParts.push({
|
||||
type: 'tool',
|
||||
type: "tool",
|
||||
data: {
|
||||
role: "tool",
|
||||
content: part.functionResponse.response.output as string,
|
||||
toolCallId: part.functionResponse.name,
|
||||
}
|
||||
},
|
||||
});
|
||||
} else {
|
||||
console.warn("Unsupported gemini part type received", part);
|
||||
|
|
@ -404,13 +403,13 @@ class Gemini extends BaseLLM {
|
|||
|
||||
// Then process tool calls and responses in order
|
||||
for (const part of processedParts) {
|
||||
if (part.type === 'toolCall') {
|
||||
if (part.type === "toolCall") {
|
||||
yield {
|
||||
role: "assistant",
|
||||
content: "",
|
||||
toolCalls: [part.data],
|
||||
};
|
||||
} else if (part.type === 'tool') {
|
||||
} else if (part.type === "tool") {
|
||||
yield part.data;
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -10,6 +10,10 @@ class Nebius extends OpenAI {
|
|||
};
|
||||
|
||||
private static MODEL_IDS: { [name: string]: string } = {
|
||||
"deepseek/deepseek_v3": "deepseek-ai/DeepSeek-V3",
|
||||
"deepseek/deepseek-r1": "deepseek-ai/DeepSeek-R1",
|
||||
"qwen2.5-coder-32b": "Qwen/Qwen2.5-Coder-32B-Instruct-fast",
|
||||
"Qwen/QwQ-32B-Preview": "Qwen/QwQ-32B-Preview",
|
||||
"llama3.1-70b-nemotron": "nvidia/Llama-3.1-Nemotron-70B-Instruct-HF-fast",
|
||||
"llama3.1-8b": "meta-llama/Meta-Llama-3.1-70B-Instruct-fast",
|
||||
"llama3.1-70b": "meta-llama/Meta-Llama-3.1-70B-Instruct-fast",
|
||||
|
|
|
|||
|
|
@ -49,7 +49,7 @@ const CHAT_ONLY_MODELS = [
|
|||
"gpt-4o-mini",
|
||||
"o1-preview",
|
||||
"o1-mini",
|
||||
"o3-mini"
|
||||
"o3-mini",
|
||||
];
|
||||
|
||||
const formatMessageForO1 = (messages: ChatCompletionMessageParam[]) => {
|
||||
|
|
@ -206,18 +206,25 @@ class OpenAI extends BaseLLM {
|
|||
protected _getEndpoint(
|
||||
endpoint: "chat/completions" | "completions" | "models",
|
||||
) {
|
||||
if (this.apiType === "azure") {
|
||||
return new URL(
|
||||
`openai/deployments/${this.deployment}/${endpoint}?api-version=${this.apiVersion}`,
|
||||
this.apiBase,
|
||||
);
|
||||
}
|
||||
if (!this.apiBase) {
|
||||
throw new Error(
|
||||
"No API base URL provided. Please set the 'apiBase' option in config.json",
|
||||
);
|
||||
}
|
||||
|
||||
if (this.apiType?.includes("azure")) {
|
||||
// Default is `azure-openai`, but previously was `azure`
|
||||
const isAzureOpenAI =
|
||||
this.apiType === "azure-openai" || this.apiType === "azure";
|
||||
|
||||
const path = isAzureOpenAI
|
||||
? `openai/deployments/${this.deployment}/${endpoint}`
|
||||
: endpoint;
|
||||
|
||||
const version = this.apiVersion ? `?api-version=${this.apiVersion}` : "";
|
||||
return new URL(`${path}${version}`, this.apiBase);
|
||||
}
|
||||
|
||||
return new URL(endpoint, this.apiBase);
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -445,7 +445,7 @@ class VertexAI extends BaseLLM {
|
|||
}
|
||||
|
||||
const resp = await this.fetch(
|
||||
new URL(this.apiBase + `/publishers/google/models/${this.model}:predict`),
|
||||
new URL(`publishers/google/models/${this.model}:predict`, this.apiBase),
|
||||
{
|
||||
method: "POST",
|
||||
body: JSON.stringify({
|
||||
|
|
|
|||
|
|
@ -57,30 +57,34 @@ export function toChatMessage(
|
|||
}
|
||||
return msg;
|
||||
} else {
|
||||
if (typeof message.content === "string") {
|
||||
return {
|
||||
role: "user",
|
||||
content: message.content ?? " ", // LM Studio (and other providers) don't accept empty content
|
||||
};
|
||||
}
|
||||
|
||||
// If no multi-media is in the message, just send as text
|
||||
// for compatibility with OpenAI-"compatible" servers
|
||||
// that don't support multi-media format
|
||||
return {
|
||||
role: "user",
|
||||
content:
|
||||
typeof message.content === "string"
|
||||
? message.content || " " // LM Studio (and other providers) don't accept empty content
|
||||
: // If no multi-media is in the message, just send as text
|
||||
// for compatibility with OpenAI-"compatible" servers
|
||||
// that don't support multi-media format
|
||||
message.content.some((item) => item.type !== "text")
|
||||
? message.content
|
||||
.map((item) => (item as TextMessagePart).text)
|
||||
.join("") || " "
|
||||
: message.content.map((part) => {
|
||||
if (part.type === "imageUrl") {
|
||||
return {
|
||||
type: "image_url" as const,
|
||||
image_url: {
|
||||
url: part.imageUrl.url,
|
||||
detail: "auto" as const,
|
||||
},
|
||||
};
|
||||
}
|
||||
return part;
|
||||
}),
|
||||
content: !message.content.some((item) => item.type !== "text")
|
||||
? message.content
|
||||
.map((item) => (item as TextMessagePart).text)
|
||||
.join("") || " "
|
||||
: message.content.map((part) => {
|
||||
if (part.type === "imageUrl") {
|
||||
return {
|
||||
type: "image_url" as const,
|
||||
image_url: {
|
||||
url: part.imageUrl.url,
|
||||
detail: "auto" as const,
|
||||
},
|
||||
};
|
||||
}
|
||||
return part;
|
||||
}),
|
||||
};
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -175,7 +175,7 @@ describe.skip("Chat Templates", () => {
|
|||
];
|
||||
const prompt = deepseekTemplateMessages(messages);
|
||||
const expectedPrompt =
|
||||
"You are an AI programming assistant, utilizing the DeepSeek Coder model, developed by DeepSeek Company, and you only answer questions related to computer science. For politically sensitive questions, security and privacy issues, and other non-computer science questions, you will refuse to answer.\n### Instruction:\nWhat is polymorphism in OOP?\n### Response:\nExplanation of polymorphism.<|EOT|>\n";
|
||||
"You are an AI programming assistant, utilizing the DeepSeek Coder model, developed by DeepSeek Company, and your role is to assist with questions related to computer science. For politically sensitive questions, security and privacy issues, and other non-computer science questions, you will not answer.\n### Instruction:\nWhat is polymorphism in OOP?\n### Response:\nExplanation of polymorphism.<|EOT|>\n";
|
||||
expect(prompt).toBe(expectedPrompt);
|
||||
});
|
||||
});
|
||||
|
|
|
|||
|
|
@ -156,7 +156,7 @@ function deepseekTemplateMessages(msgs: ChatMessage[]): string {
|
|||
let prompt = "";
|
||||
let system: string | null = null;
|
||||
prompt +=
|
||||
"You are an AI programming assistant, utilizing the DeepSeek Coder model, developed by DeepSeek Company, and you only answer questions related to computer science. For politically sensitive questions, security and privacy issues, and other non-computer science questions, you will refuse to answer.\n";
|
||||
"You are an AI programming assistant, utilizing the DeepSeek Coder model, developed by DeepSeek Company, and your role is to assist with questions related to computer science. For politically sensitive questions, security and privacy issues, and other non-computer science questions, you will not answer.\n";
|
||||
if (msgs[0].role === "system") {
|
||||
system = renderChatMessage(msgs.shift()!);
|
||||
}
|
||||
|
|
|
|||
|
|
@ -129,7 +129,7 @@ Sure! Here's the code you requested:
|
|||
`;
|
||||
|
||||
const deepseekEditPrompt = `### System Prompt
|
||||
You are an AI programming assistant, utilizing the DeepSeek Coder model, developed by DeepSeek Company, and you only answer questions related to computer science. For politically sensitive questions, security and privacy issues, and other non-computer science questions, you will refuse to answer.
|
||||
You are an AI programming assistant, utilizing the DeepSeek Coder model, developed by DeepSeek Company, and your role is to assist with questions related to computer science. For politically sensitive questions, security and privacy issues, and other non-computer science questions, you will not answer.
|
||||
### Instruction:
|
||||
Rewrite the code to satisfy this request: "{{{userInput}}}"
|
||||
|
||||
|
|
|
|||
|
|
@ -2,6 +2,11 @@ export const PROVIDER_TOOL_SUPPORT: Record<
|
|||
string,
|
||||
(model: string) => boolean | undefined
|
||||
> = {
|
||||
"continue-proxy": (model) => {
|
||||
return ["claude-3-5", "claude-3.5", "gpt-4", "o3", "gemini"].some((part) =>
|
||||
model.toLowerCase().startsWith(part),
|
||||
);
|
||||
},
|
||||
anthropic: (model) => {
|
||||
if (
|
||||
["claude-3-5", "claude-3.5"].some((part) =>
|
||||
|
|
@ -13,7 +18,10 @@ export const PROVIDER_TOOL_SUPPORT: Record<
|
|||
},
|
||||
openai: (model) => {
|
||||
// https://platform.openai.com/docs/guides/function-calling#models-supporting-function-calling
|
||||
if (model.toLowerCase().startsWith("gpt-4") || model.toLowerCase().startsWith("o3")) {
|
||||
if (
|
||||
model.toLowerCase().startsWith("gpt-4") ||
|
||||
model.toLowerCase().startsWith("o3")
|
||||
) {
|
||||
return true;
|
||||
}
|
||||
},
|
||||
|
|
|
|||
16
core/package-lock.json
generated
16
core/package-lock.json
generated
|
|
@ -13,11 +13,11 @@
|
|||
"@aws-sdk/client-sagemaker-runtime": "^3.621.0",
|
||||
"@aws-sdk/credential-providers": "^3.620.1",
|
||||
"@continuedev/config-types": "^1.0.13",
|
||||
"@continuedev/config-yaml": "^1.0.26",
|
||||
"@continuedev/config-yaml": "^1.0.31",
|
||||
"@continuedev/fetch": "^1.0.4",
|
||||
"@continuedev/llm-info": "^1.0.2",
|
||||
"@continuedev/openai-adapters": "^1.0.10",
|
||||
"@modelcontextprotocol/sdk": "^1.4.1",
|
||||
"@modelcontextprotocol/sdk": "^1.5.0",
|
||||
"@mozilla/readability": "^0.5.0",
|
||||
"@octokit/rest": "^20.0.2",
|
||||
"@typescript-eslint/eslint-plugin": "^7.8.0",
|
||||
|
|
@ -3038,9 +3038,9 @@
|
|||
}
|
||||
},
|
||||
"node_modules/@continuedev/config-yaml": {
|
||||
"version": "1.0.26",
|
||||
"resolved": "https://registry.npmjs.org/@continuedev/config-yaml/-/config-yaml-1.0.26.tgz",
|
||||
"integrity": "sha512-Fxu59+AR4S6WaoyyGysiQWVwMvQQt+pR68P1mVQGstDw4YpIghFioK0m6jXrN9vw1fJTIr6tFtcA9N41xI5mDQ==",
|
||||
"version": "1.0.31",
|
||||
"resolved": "https://registry.npmjs.org/@continuedev/config-yaml/-/config-yaml-1.0.31.tgz",
|
||||
"integrity": "sha512-HNj+z7UTTARgsJTI0A1buM09fS4HoWVnn6Hbl6kJ2tZmOOm1OgogbcKP68AzHb4fy5H18MWnKS7XuseZpHFzHQ==",
|
||||
"dependencies": {
|
||||
"@continuedev/config-types": "^1.0.14",
|
||||
"yaml": "^2.6.1",
|
||||
|
|
@ -4218,9 +4218,9 @@
|
|||
]
|
||||
},
|
||||
"node_modules/@modelcontextprotocol/sdk": {
|
||||
"version": "1.4.1",
|
||||
"resolved": "https://registry.npmjs.org/@modelcontextprotocol/sdk/-/sdk-1.4.1.tgz",
|
||||
"integrity": "sha512-wS6YC4lkUZ9QpP+/7NBTlVNiEvsnyl0xF7rRusLF+RsG0xDPc/zWR7fEEyhKnnNutGsDAZh59l/AeoWGwIb1+g==",
|
||||
"version": "1.5.0",
|
||||
"resolved": "https://registry.npmjs.org/@modelcontextprotocol/sdk/-/sdk-1.5.0.tgz",
|
||||
"integrity": "sha512-IJ+5iVVs8FCumIHxWqpwgkwOzyhtHVKy45s6Ug7Dv0MfRpaYisH8QQ87rIWeWdOzlk8sfhitZ7HCyQZk7d6b8w==",
|
||||
"dependencies": {
|
||||
"content-type": "^1.0.5",
|
||||
"eventsource": "^3.0.2",
|
||||
|
|
|
|||
|
|
@ -46,11 +46,11 @@
|
|||
"@aws-sdk/client-sagemaker-runtime": "^3.621.0",
|
||||
"@aws-sdk/credential-providers": "^3.620.1",
|
||||
"@continuedev/config-types": "^1.0.13",
|
||||
"@continuedev/config-yaml": "^1.0.26",
|
||||
"@continuedev/config-yaml": "^1.0.31",
|
||||
"@continuedev/fetch": "^1.0.4",
|
||||
"@continuedev/llm-info": "^1.0.2",
|
||||
"@continuedev/openai-adapters": "^1.0.10",
|
||||
"@modelcontextprotocol/sdk": "^1.4.1",
|
||||
"@modelcontextprotocol/sdk": "^1.5.0",
|
||||
"@mozilla/readability": "^0.5.0",
|
||||
"@octokit/rest": "^20.0.2",
|
||||
"@typescript-eslint/eslint-plugin": "^7.8.0",
|
||||
|
|
|
|||
|
|
@ -14,11 +14,11 @@ import type {
|
|||
ContextSubmenuItem,
|
||||
DiffLine,
|
||||
DocsIndexingDetails,
|
||||
ExperimentalModelRoles,
|
||||
FileSymbolMap,
|
||||
IdeSettings,
|
||||
LLMFullCompletionOptions,
|
||||
ModelDescription,
|
||||
ModelRoles,
|
||||
PromptLog,
|
||||
RangeInFile,
|
||||
SerializedContinueConfig,
|
||||
|
|
@ -52,7 +52,7 @@ export type ToCoreFromIdeOrWebviewProtocol = {
|
|||
"config/addModel": [
|
||||
{
|
||||
model: SerializedContinueConfig["models"][number];
|
||||
role?: keyof ModelRoles;
|
||||
role?: keyof ExperimentalModelRoles;
|
||||
},
|
||||
void,
|
||||
];
|
||||
|
|
@ -62,13 +62,13 @@ export type ToCoreFromIdeOrWebviewProtocol = {
|
|||
undefined,
|
||||
{
|
||||
result: ConfigResult<BrowserSerializedContinueConfig>;
|
||||
profileId: string;
|
||||
profileId: string | null;
|
||||
},
|
||||
];
|
||||
"config/deleteModel": [{ title: string }, void];
|
||||
"config/addContextProvider": [ContextProviderWithParams, void];
|
||||
"config/reload": [undefined, ConfigResult<BrowserSerializedContinueConfig>];
|
||||
"config/listProfiles": [undefined, ProfileDescription[]];
|
||||
"config/listProfiles": [undefined, ProfileDescription[] | null];
|
||||
"config/openProfile": [{ profileId: string | undefined }, void];
|
||||
"config/updateSharedConfig": [SharedConfigSchema, void];
|
||||
"context/getContextItems": [
|
||||
|
|
@ -184,9 +184,7 @@ export type ToCoreFromIdeOrWebviewProtocol = {
|
|||
"docs/getDetails": [{ startUrl: string }, DocsIndexingDetails];
|
||||
addAutocompleteModel: [{ model: ModelDescription }, void];
|
||||
|
||||
"profiles/switch": [{ id: string }, undefined];
|
||||
|
||||
"auth/getAuthUrl": [undefined, { url: string }];
|
||||
"auth/getAuthUrl": [{ useOnboarding: boolean }, { url: string }];
|
||||
"tools/call": [
|
||||
{ toolCall: ToolCall; selectedModelTitle: string },
|
||||
{ contextItems: ContextItem[] },
|
||||
|
|
|
|||
|
|
@ -4,9 +4,12 @@ import { ToCoreFromIdeOrWebviewProtocol } from "./core.js";
|
|||
import { ToWebviewFromIdeOrCoreProtocol } from "./webview.js";
|
||||
|
||||
export type ToCoreFromWebviewProtocol = ToCoreFromIdeOrWebviewProtocol & {
|
||||
didChangeSelectedProfile: [{ id: string }, void];
|
||||
didChangeSelectedProfile: [{ id: string | null }, void];
|
||||
didChangeSelectedOrg: [{ id: string | null }, void];
|
||||
};
|
||||
export type ToWebviewFromCoreProtocol = ToWebviewFromIdeOrCoreProtocol & {
|
||||
didChangeAvailableProfiles: [{ profiles: ProfileDescription[] }, void];
|
||||
didChangeAvailableProfiles: [
|
||||
{ profiles: ProfileDescription[]; selectedProfileId: string | null },
|
||||
void,
|
||||
];
|
||||
};
|
||||
|
|
|
|||
|
|
@ -57,7 +57,6 @@ export const WEBVIEW_TO_CORE_PASS_THROUGH: (keyof ToCoreFromWebviewProtocol)[] =
|
|||
//
|
||||
"completeOnboarding",
|
||||
"addAutocompleteModel",
|
||||
"profiles/switch",
|
||||
"didChangeSelectedProfile",
|
||||
"didChangeSelectedOrg",
|
||||
"tools/call",
|
||||
|
|
@ -82,7 +81,5 @@ export const CORE_TO_WEBVIEW_PASS_THROUGH: (keyof ToWebviewFromCoreProtocol)[] =
|
|||
"setTTSActive",
|
||||
"getWebviewHistoryLength",
|
||||
"getCurrentSessionId",
|
||||
"signInToControlPlane",
|
||||
"openDialogMessage",
|
||||
"docs/suggestions",
|
||||
];
|
||||
|
|
|
|||
|
|
@ -12,7 +12,7 @@ export type ToWebviewFromIdeOrCoreProtocol = {
|
|||
configUpdate: [
|
||||
{
|
||||
result: ConfigResult<BrowserSerializedContinueConfig>;
|
||||
profileId: string;
|
||||
profileId: string | null;
|
||||
},
|
||||
void,
|
||||
];
|
||||
|
|
@ -37,7 +37,6 @@ export type ToWebviewFromIdeOrCoreProtocol = {
|
|||
setTTSActive: [boolean, void];
|
||||
getWebviewHistoryLength: [undefined, number];
|
||||
getCurrentSessionId: [undefined, string];
|
||||
signInToControlPlane: [undefined, void];
|
||||
openDialogMessage: ["account", void];
|
||||
"docs/suggestions": [PackageDocsResult[], void];
|
||||
"jetbrains/setColors": [Record<string, string>, void];
|
||||
};
|
||||
|
|
|
|||
|
|
@ -18,7 +18,7 @@ export const testConfigHandler = new ConfigHandler(
|
|||
testIde,
|
||||
ideSettingsPromise,
|
||||
async (text) => {},
|
||||
testControlPlaneClient,
|
||||
Promise.resolve(undefined),
|
||||
);
|
||||
|
||||
export const testLLM = new Mock({
|
||||
|
|
|
|||
|
|
@ -12,7 +12,9 @@ import { SiteIndexingConfig } from "..";
|
|||
export type GlobalContextType = {
|
||||
indexingPaused: boolean;
|
||||
selectedTabAutocompleteModel: string;
|
||||
lastSelectedProfileForWorkspace: { [workspaceIdentifier: string]: string };
|
||||
lastSelectedProfileForWorkspace: {
|
||||
[workspaceIdentifier: string]: string | null;
|
||||
};
|
||||
lastSelectedOrgIdForWorkspace: {
|
||||
[workspaceIdentifier: string]: string | null;
|
||||
};
|
||||
|
|
|
|||
|
|
@ -18,6 +18,10 @@ export const DEFAULT_AUTOCOMPLETE_OPTS: TabAutocompleteOptions = {
|
|||
useImports: true,
|
||||
transform: true,
|
||||
showWhateverWeHaveAtXMs: 300,
|
||||
experimental_includeClipboard: true,
|
||||
experimental_includeRecentlyVisitedRanges: true,
|
||||
experimental_includeRecentlyEditedRanges: true,
|
||||
experimental_includeDiff: true,
|
||||
};
|
||||
|
||||
export const COUNT_COMPLETION_REJECTED_AFTER = 10_000;
|
||||
|
|
|
|||
|
|
@ -377,6 +377,10 @@ export function getEsbuildBinaryPath(): string {
|
|||
return path.join(getContinueUtilsPath(), "esbuild");
|
||||
}
|
||||
|
||||
export function getStagingEnvironmentDotFilePath(): string {
|
||||
return path.join(getContinueGlobalPath(), ".staging");
|
||||
}
|
||||
|
||||
export function setupInitialDotContinueDirectory() {
|
||||
const devDataTypes = [
|
||||
"chat",
|
||||
|
|
|
|||
|
|
@ -93,6 +93,7 @@ export const supportedLanguages: { [key: string]: LanguageName } = {
|
|||
htm: LanguageName.HTML,
|
||||
java: LanguageName.JAVA,
|
||||
lua: LanguageName.LUA,
|
||||
luau: LanguageName.LUA,
|
||||
ocaml: LanguageName.OCAML,
|
||||
ml: LanguageName.OCAML,
|
||||
mli: LanguageName.OCAML,
|
||||
|
|
|
|||
|
|
@ -7,7 +7,7 @@ sidebar_position: 3
|
|||
|
||||
## Slash commands
|
||||
|
||||
Slash commands can be combined with additional instructions, including [context providers](chat/context-selection.md) or [highlighted code](chat/context-selection.md).
|
||||
Slash commands can be combined with additional instructions, including [context providers](../customize/context-providers.mdx) or [highlighted code](../edit/context-selection#highlighted-code).
|
||||
|
||||
For example, with the “/edit” slash command you should describe the edit that you want the LLM to perform.
|
||||
|
||||
|
|
|
|||
|
|
@ -7,6 +7,6 @@ sidebar_position: 4
|
|||
|
||||
While many Actions are based on templated prompts and can be customized with .prompt files, there are a number that execute more complex code under the hood.
|
||||
|
||||
Actions that generate inline diffs, like “/edit”, “/comment”, or right click actions, use the same prompt and response processing logic as [Edit](edit/how-it-works.md).
|
||||
Actions that generate inline diffs, like “/edit”, “/comment”, or right click actions, use the same prompt and response processing logic as [Edit](../edit/how-it-works.md).
|
||||
|
||||
To learn how other slash commands work, see the full reference [here](../customize/slash-commands.md).
|
||||
To learn how other slash commands work, see the full reference [here](../customize/slash-commands.mdx).
|
||||
|
|
@ -7,7 +7,7 @@ sidebar_position: 5
|
|||
|
||||
## Built-in slash commands
|
||||
|
||||
Continue has a large library of built-in slash commands, but when you first install we only display the most commonly used ones, like “/edit”, “/comment”, and “/share”. To add more actions, you can open [config.json](../reference.md) and add them to the `slashCommands` array.
|
||||
Continue has a large library of built-in slash commands, but when you first install we only display the most commonly used ones, like “/edit”, “/comment”, and “/share”. To add more actions, you can open [config.json](../json-reference.md) and add them to the `slashCommands` array.
|
||||
|
||||
## Custom slash commands
|
||||
|
||||
|
|
@ -18,11 +18,6 @@ There are two ways to add custom slash commands:
|
|||
|
||||
### Custom Slash Commands with `config.ts`
|
||||
|
||||
<!-- TODO: We need a config.ts reference -->
|
||||
<!-- :::tip[config.ts]
|
||||
Before adding a custom slash command, we recommend reading the [introduction to `config.ts`](../customize/deep-dives/ways-to-configure.md).
|
||||
::: -->
|
||||
|
||||
If you want to go a step further than writing custom commands with natural language, you can write a custom function that returns the response. This requires using `config.ts` instead of `config.json`.
|
||||
|
||||
To do this, push a new `SlashCommand` object to the `slashCommands` list. This object contains "name", the name that you will type to invoke the slash command, "description", the description seen in the dropdown menu, and "run". The `run` function is any async generator that should yield strings as you want them to be streamed to the UI. As an argument to the function, you have access to a `ContinueSDK` object with utilities such as access to certain information/actions within the IDE, the current language model, and a few other utilities. For example, here is a slash command that generates a commit message:
|
||||
|
|
@ -51,9 +46,6 @@ export function modifyConfig(config: Config): Config {
|
|||
}
|
||||
```
|
||||
|
||||
<!-- TODO: We need a config.ts reference -->
|
||||
<!-- For full `config.ts` reference, see [here](reference/config-ts.md). -->
|
||||
|
||||
## Other custom actions
|
||||
|
||||
Currently the other action triggers are not open for configuration, but we plan to allow this via .prompt files in the future.
|
||||
|
|
|
|||
|
|
@ -18,7 +18,7 @@ The most common way to invoke an action is with a slash command. These are short
|
|||
|
||||

|
||||
|
||||
A few of the most useful slash commands are available by default, like “/edit”, “/comment”, and “/share”, but Continue has a large built-in library of other options. To enable these, learn more [here](../customize/slash-commands.md).
|
||||
A few of the most useful slash commands are available by default, like “/edit”, “/comment”, and “/share”, but Continue has a large built-in library of other options. To enable these, learn more [here](../customize/slash-commands.mdx).
|
||||
|
||||
### Prompt files
|
||||
|
||||
|
|
@ -36,7 +36,7 @@ Below is a quick example of setting up a prompt file to write unit tests using J
|
|||
2. Add a file called `test.prompt` to this folder. The name of this file will be the name of the slash command you will use to generate your prompt.
|
||||
3. Write the following contents to `test.prompt` and save.
|
||||
|
||||
```
|
||||
```.prompt
|
||||
{{{ input }}}
|
||||
|
||||
Write unit tests for the above selected code, following each of these instructions:
|
||||
|
|
|
|||
|
|
@ -16,7 +16,7 @@ In order to display suggestions quickly, without sending too many requests, we d
|
|||
|
||||
## Context
|
||||
|
||||
As explained on the [context selection](context-selection.md) page, Continue uses a number of retrieval methods to find relevant snippets from your codebase to include in the prompt.
|
||||
As explained on the [context selection](./context-selection.md) page, Continue uses a number of retrieval methods to find relevant snippets from your codebase to include in the prompt.
|
||||
|
||||
## Filtering
|
||||
|
||||
|
|
@ -28,4 +28,4 @@ Language models aren't perfect, but can be made much closer by adjusting their o
|
|||
|
||||
We will also occasionally entirely filter out responses if they are bad. This is often due to extreme repetition.
|
||||
|
||||
You can learn more about how it works in the [Autocomplete deep dive](../customize/deep-dives/autocomplete.md).
|
||||
You can learn more about how it works in the [Autocomplete deep dive](../customize/deep-dives/autocomplete.mdx).
|
||||
|
|
|
|||
|
|
@ -5,18 +5,20 @@ keywords: [customize]
|
|||
sidebar_position: 5
|
||||
---
|
||||
|
||||
Continue offers a handful of parameters in [`config.json`](../reference.md) that can be tuned to find the perfect balance between suggestion quality and system performance for your specific needs and hardware capabilities:
|
||||
Continue offers a handful of parameters in [`config.json`](../json-reference.md) that can be tuned to find the perfect balance between suggestion quality and system performance for your specific needs and hardware capabilities:
|
||||
|
||||
```json title="config.json"
|
||||
"tabAutocompleteOptions": {
|
||||
"maxPromptTokens": 400,
|
||||
"prefixPercentage": 0.5,
|
||||
"multilineCompletions": "always"
|
||||
}
|
||||
{
|
||||
"tabAutocompleteOptions": {
|
||||
"maxPromptTokens": 400,
|
||||
"prefixPercentage": 0.5,
|
||||
"multilineCompletions": "always"
|
||||
}
|
||||
}
|
||||
```
|
||||
|
||||
- `maxPromptTokens`: Sets the maximum number of tokens for the prompt, balancing context and speed.
|
||||
- `prefixPercentage`: Defines the proportion of the prompt dedicated to the code before the cursor.
|
||||
- `multilineCompletions`: Controls whether suggestions can span multiple lines ("always", "never", or "auto").
|
||||
|
||||
For a comprehensive guide on all configuration options and their impacts, see the [Autocomplete deep dive](../customize/deep-dives/autocomplete.md).
|
||||
For a comprehensive guide on all configuration options and their impacts, see the [Autocomplete deep dive](../customize/deep-dives/autocomplete.mdx).
|
||||
|
|
|
|||
|
|
@ -1,68 +0,0 @@
|
|||
---
|
||||
title: Model setup
|
||||
description: Autocomplete \-model setup
|
||||
keywords: [model, autocomplete]
|
||||
sidebar_position: 2
|
||||
---
|
||||
|
||||
:::info
|
||||
This page recommends models and providers for Autocomplete. Read more about how to set up your `config.json` [here](../reference.md).
|
||||
:::
|
||||
|
||||
## Best overall experience
|
||||
|
||||
For the best Autocomplete experience, we recommend using Codestral through the [Mistral API](https://console.mistral.ai/). This model offers high-quality completions with an excellent understanding of code context:
|
||||
|
||||
```json title="config.json""
|
||||
{
|
||||
"tabAutocompleteModel": {
|
||||
"title": "Codestral",
|
||||
"provider": "mistral",
|
||||
"model": "codestral-latest",
|
||||
"apiKey": "YOUR_API_KEY"
|
||||
}
|
||||
}
|
||||
```
|
||||
|
||||
:::tip[Codestral API Key]
|
||||
The API keys for Codestral and the general Mistral APIs are different. If you are using Codestral, you probably want a Codestral API key, but if you are sharing the key as a team or otherwise want to use `api.mistral.ai`, then make sure to set `"apiBase": "https://api.mistral.ai/v1"` in your `tabAutocompleteModel`.
|
||||
:::
|
||||
|
||||
## Local, offline / self-hosted experience
|
||||
|
||||
For those preferring local execution or self-hosting,`Qwen2.5-Coder 1.5B` offers a good balance of performance and quality for most users (e.g. using [Ollama](../customize/model-providers/top-level/ollama.md) or [LM Studio](../customize/model-providers/more/lmstudio.md)).
|
||||
|
||||
```json title="config.json""
|
||||
{
|
||||
"tabAutocompleteModel": {
|
||||
"title": "Qwen2.5-Coder 1.5B",
|
||||
"model": "qwen2.5-coder:1.5b-base",
|
||||
"provider": "ollama"
|
||||
}
|
||||
}
|
||||
```
|
||||
|
||||
Have more compute? Use `qwen2.5-coder:7b-base` for potentially higher-quality suggestions.
|
||||
|
||||
:::note
|
||||
|
||||
For LM Studio users, navigate to the "My Models" section, find your desired model, and copy the path (e.g., `Qwen/Qwen2.5-Coder-1.5B-Instruct-GGUF/qwen2.5-coder-1.5b-instruct-q4_k_m.gguf`). Use this path as the `model` value in your configuration.
|
||||
|
||||
:::
|
||||
### Using a remote instance
|
||||
|
||||
When using a remote instance you need to set the `"apiBase"` value in the configuration:
|
||||
|
||||
```json title="config.json""
|
||||
{
|
||||
"tabAutocompleteModel": {
|
||||
"title": "Qwen2.5-Coder 1.5B",
|
||||
"model": "qwen2.5-coder:1.5b-base",
|
||||
"provider": "ollama"
|
||||
"apiBase": "http://<my endpoint>:11434"
|
||||
}
|
||||
}
|
||||
```
|
||||
## Other experiences
|
||||
|
||||
There are many more models and providers you can use with Autocomplete. Check them out [here](../customize/model-types/autocomplete.md). You can also see more examples of Autocomplete configuration [here](../customize/deep-dives/autocomplete.md)
|
||||
115
docs/docs/autocomplete/model-setup.mdx
Normal file
115
docs/docs/autocomplete/model-setup.mdx
Normal file
|
|
@ -0,0 +1,115 @@
|
|||
---
|
||||
title: Model setup
|
||||
description: Autocomplete \-model setup
|
||||
keywords: [model, autocomplete]
|
||||
sidebar_position: 2
|
||||
---
|
||||
|
||||
import Tabs from "@theme/Tabs";
|
||||
import TabItem from "@theme/TabItem";
|
||||
|
||||
:::info
|
||||
This page recommends models and providers for Autocomplete. Read more about how to set up your `config.yaml` [here](../reference.md).
|
||||
:::
|
||||
|
||||
## Best overall experience
|
||||
|
||||
For the best Autocomplete experience, we recommend using Codestral through the [Mistral API](https://console.mistral.ai/). This model offers high-quality completions with an excellent understanding of code context:
|
||||
|
||||
<Tabs groupId="config-example">
|
||||
<TabItem value="yaml" label="YAML">
|
||||
```yaml title="config.yaml"
|
||||
models:
|
||||
- name: Codestral
|
||||
provider: mistral
|
||||
model: codestral-latest
|
||||
apiKey: <YOUR_CODESTRAL_API_KEY>
|
||||
roles:
|
||||
- autocomplete
|
||||
```
|
||||
</TabItem>
|
||||
<TabItem value="json" label="JSON">
|
||||
```json title="config.json"
|
||||
{
|
||||
"tabAutocompleteModel": {
|
||||
"title": "Codestral",
|
||||
"provider": "mistral",
|
||||
"model": "codestral-latest",
|
||||
"apiKey": "<YOUR_API_KEY>"
|
||||
}
|
||||
}
|
||||
```
|
||||
</TabItem>
|
||||
</Tabs>
|
||||
|
||||
:::tip[Codestral API Key]
|
||||
The API keys for Codestral and the general Mistral APIs are different. If you are using Codestral, you probably want a Codestral API key, but if you are sharing the key as a team or otherwise want to use `api.mistral.ai`, then make sure to set `"apiBase": "https://api.mistral.ai/v1"` in your `tabAutocompleteModel`.
|
||||
:::
|
||||
|
||||
## Local, offline / self-hosted experience
|
||||
|
||||
For those preferring local execution or self-hosting,`Qwen2.5-Coder 1.5B` offers a good balance of performance and quality for most users (e.g. using [Ollama](../customize/model-providers/top-level/ollama.mdx) or [LM Studio](../customize/model-providers/more/lmstudio.mdx)).
|
||||
|
||||
<Tabs groupId="config-example">
|
||||
<TabItem value="yaml" label="YAML">
|
||||
```yaml title="config.yaml"
|
||||
models:
|
||||
- name: Qwen2.5-Coder 1.5B
|
||||
model: qwen2.5-coder:1.5b-base
|
||||
provider: ollama
|
||||
roles:
|
||||
- autocomplete
|
||||
```
|
||||
</TabItem>
|
||||
<TabItem value="json" label="JSON">
|
||||
```json title="config.json"
|
||||
{
|
||||
"tabAutocompleteModel": {
|
||||
"title": "Qwen2.5-Coder 1.5B",
|
||||
"model": "qwen2.5-coder:1.5b-base",
|
||||
"provider": "ollama"
|
||||
}
|
||||
}
|
||||
```
|
||||
</TabItem>
|
||||
</Tabs>
|
||||
|
||||
Have more compute? Use `qwen2.5-coder:7b-base` for potentially higher-quality suggestions.
|
||||
|
||||
:::note
|
||||
For LM Studio users, navigate to the "My Models" section, find your desired model, and copy the path (e.g., `Qwen/Qwen2.5-Coder-1.5B-Instruct-GGUF/qwen2.5-coder-1.5b-instruct-q4_k_m.gguf`). Use this path as the `model` value in your configuration.
|
||||
:::
|
||||
|
||||
### Using a remote instance
|
||||
|
||||
When using a remote instance you need to set the `"apiBase"` value in the configuration:
|
||||
|
||||
<Tabs groupId="config-example">
|
||||
<TabItem value="yaml" label="YAML">
|
||||
```yaml title="config.yaml"
|
||||
models:
|
||||
- name: Qwen2.5-Coder 1.5B
|
||||
model: qwen2.5-coder:1.5b-base
|
||||
provider: ollama
|
||||
apiBase: http://<my endpoint>:11434
|
||||
roles:
|
||||
- autocomplete
|
||||
```
|
||||
</TabItem>
|
||||
<TabItem value="json" label="JSON">
|
||||
```json title="config.json"
|
||||
{
|
||||
"tabAutocompleteModel": {
|
||||
"title": "Qwen2.5-Coder 1.5B",
|
||||
"model": "qwen2.5-coder:1.5b-base",
|
||||
"provider": "ollama",
|
||||
"apiBase": "http://<my endpoint>:11434"
|
||||
}
|
||||
}
|
||||
```
|
||||
</TabItem>
|
||||
</Tabs>
|
||||
|
||||
## Other experiences
|
||||
|
||||
There are many more models and providers you can use with Autocomplete. Check them out [here](../customize/model-types/autocomplete.md). You can also see more examples of Autocomplete configuration [here](../customize/deep-dives/autocomplete.mdx)
|
||||
|
|
@ -19,28 +19,28 @@ You can include the currently open file as context by pressing <kbd>opt</kbd> +
|
|||
|
||||
## Specific file
|
||||
|
||||
You can include a specific file in your current workspace as context by typing [`@Files`](../customize/context-providers.md#file) and selecting the file.
|
||||
You can include a specific file in your current workspace as context by typing [`@Files`](../customize/context-providers.mdx#file) and selecting the file.
|
||||
|
||||
## Specific folder
|
||||
|
||||
You can include a folder in your current workspace as context by typing [`@Folder`](../customize/context-providers.md#folder) and selecting the directory. It [works like `@Codebase`](../customize/deep-dives/codebase.md) but only includes the files in the selected folder.
|
||||
You can include a folder in your current workspace as context by typing [`@Folder`](../customize/context-providers.mdx#folder) and selecting the directory. It [works like `@Codebase`](../customize/deep-dives/codebase.mdx) but only includes the files in the selected folder.
|
||||
|
||||
## Codebase search
|
||||
|
||||
You can automatically include relevant files from your codebase as context by typing [`@Codebase`](../customize/context-providers.md#codebase). You can learn about how @Codebase works [here](../customize/deep-dives/codebase.md).
|
||||
You can automatically include relevant files from your codebase as context by typing [`@Codebase`](../customize/context-providers.mdx#codebase). You can learn about how @Codebase works [here](../customize/deep-dives/codebase.mdx).
|
||||
|
||||
## Documentation site
|
||||
|
||||
You can include a documentation site as context by typing [`@Docs`](../customize/context-providers.md#docs) and selecting the documentation site. You can learn about how @Docs works [here](../customize/deep-dives/docs.md).
|
||||
You can include a documentation site as context by typing [`@Docs`](../customize/context-providers.mdx#docs) and selecting the documentation site. You can learn about how @Docs works [here](../customize/deep-dives/docs.mdx).
|
||||
|
||||
## Terminal contents
|
||||
|
||||
You can include the contents of the terminal in your IDE as context by typing [`@Terminal`](../customize/context-providers.md#terminal).
|
||||
You can include the contents of the terminal in your IDE as context by typing [`@Terminal`](../customize/context-providers.mdx#terminal).
|
||||
|
||||
## Git diff
|
||||
|
||||
You can include all of the changes you've made to your current branch by typing [`@Git Diff`](../customize/context-providers.md#git-diff).
|
||||
You can include all of the changes you've made to your current branch by typing [`@Git Diff`](../customize/context-providers.mdx#git-diff).
|
||||
|
||||
## Other context
|
||||
|
||||
You can see a full list of built-in context providers [here](../customize/context-providers.md) and how to create your own custom context provider [here](../customize/tutorials/build-your-own-context-provider.md).
|
||||
You can see a full list of built-in context providers [here](../customize/context-providers.mdx) and how to create your own custom context provider [here](../customize/tutorials/build-your-own-context-provider.md).
|
||||
|
|
|
|||
|
|
@ -9,6 +9,6 @@ Using any selected code sections, all context that you have selected with @, and
|
|||
|
||||
The model response is then streamed directly back to the sidebar. Each code section included in the response will be placed into its own code block, which gives you buttons to either “Apply to current file”, “Insert at cursor”, or “Copy” for each section. When you press <kbd>cmd/ctrl</kbd> + <kbd>L</kbd> (VS Code) or <kbd>cmd/ctrl</kbd> + <kbd>J</kbd> (JetBrains) at the end of a session, all context is cleared and a new session is started, so that you can begin a new task.
|
||||
|
||||
If you would like to view the exact prompt that is sent to the model during Chat, you can [view this in the prompt logs](troubleshooting.md#llm-prompt-logs).
|
||||
If you would like to view the exact prompt that is sent to the model during Chat, you can [view this in the prompt logs](troubleshooting.mdx#llm-prompt-logs).
|
||||
|
||||
You can learn more about how `@Codebase` works [here](../customize/deep-dives/codebase.md) and `@Docs` [here](../customize/deep-dives/docs.md).
|
||||
You can learn more about how `@Codebase` works [here](../customize/deep-dives/codebase.mdx) and `@Docs` [here](../customize/deep-dives/docs.mdx).
|
||||
|
|
|
|||
|
|
@ -8,8 +8,8 @@ sidebar_position: 5
|
|||
There are a number of different ways to customize Chat
|
||||
|
||||
- You can add a [`.continuerules`](../customize/deep-dives/rules.md) file to the root of your project to customize the system prompt
|
||||
- You can configure [`@Codebase`](../customize/deep-dives/codebase.md)
|
||||
- You can create your own [custom code RAG](../customize/tutorials/custom-code-rag.md)
|
||||
- You can configure [`@Docs`](../customize/deep-dives/docs.md)
|
||||
- You can configure [`@Codebase`](../customize/deep-dives/codebase.mdx)
|
||||
- You can create your own [custom code RAG](../customize/tutorials/custom-code-rag.mdx)
|
||||
- You can configure [`@Docs`](../customize/deep-dives/docs.mdx)
|
||||
- You can [build your own context provider](../customize/tutorials/build-your-own-context-provider.md)
|
||||
- You can configure and create custom [tools](../customize/tools.md)
|
||||
- You can configure and create custom [tools](../customize/tools.mdx)
|
||||
|
|
|
|||
|
|
@ -9,7 +9,7 @@ import Tabs from "@theme/Tabs";
|
|||
import TabItem from "@theme/TabItem";
|
||||
|
||||
:::info
|
||||
This page recommends models and providers for Chat. Read more about how to set up your `config.json` [here](../reference.md).
|
||||
This page recommends models and providers for Chat. Read more about how to set up your config [here](../reference.md).
|
||||
:::
|
||||
|
||||
## Best overall experience
|
||||
|
|
@ -18,116 +18,226 @@ For the best overall Chat experience, you will want to use a 400B+ parameter mod
|
|||
|
||||
### Claude Sonnet 3.5 from Anthropic
|
||||
|
||||
Our current top recommendation is Claude Sonnet 3.5 from [Anthropic](../customize/model-providers/top-level/anthropic.md).
|
||||
Our current top recommendation is Claude Sonnet 3.5 from [Anthropic](../customize/model-providers/top-level/anthropic.mdx).
|
||||
|
||||
```json title="config.json"
|
||||
"models": [
|
||||
{
|
||||
"title": "Claude 3.5 Sonnet",
|
||||
"provider": "anthropic",
|
||||
"model": "claude-3-5-sonnet-latest",
|
||||
"apiKey": "[ANTHROPIC_API_KEY]"
|
||||
}
|
||||
]
|
||||
```
|
||||
<Tabs groupId="config-example">
|
||||
<TabItem value="yaml" label="YAML">
|
||||
```yaml title="Package or config.yaml"
|
||||
models:
|
||||
- name: Claude 3.5 Sonnet
|
||||
provider: anthropic
|
||||
model: claude-3-5-sonnet-latest
|
||||
apiKey: <YOUR_ANTHROPIC_API_KEY>
|
||||
```
|
||||
</TabItem>
|
||||
<TabItem value="json" label="JSON">
|
||||
```json title="config.json"
|
||||
{
|
||||
"models": [
|
||||
{
|
||||
"title": "Claude 3.5 Sonnet",
|
||||
"provider": "anthropic",
|
||||
"model": "claude-3-5-sonnet-latest",
|
||||
"apiKey": "<YOUR_ANTHROPIC_API_KEY>"
|
||||
}
|
||||
]
|
||||
}
|
||||
```
|
||||
</TabItem>
|
||||
</Tabs>
|
||||
|
||||
### Llama 3.1 405B from Meta
|
||||
|
||||
If you prefer to use an open-weight model, then Llama 3.1 405B from Meta is your best option right now. You will need to decide if you use it through a SaaS model provider (e.g. [Together](../customize/model-providers/more/together.md) or [Groq](../customize/model-providers/more/groq.md)) or self-host it (e.g. using [vLLM](../customize/model-providers//more/vllm.md) or [Ollama](../customize/model-providers/top-level/ollama.md)).
|
||||
If you prefer to use an open-weight model, then Llama 3.1 405B from Meta is your best option right now. You will need to decide if you use it through a SaaS model provider (e.g. [Together](../customize/model-providers/more/together.mdx) or [Groq](../customize/model-providers/more/groq.mdx)) or self-host it (e.g. using [vLLM](../customize/model-providers//more/vllm.mdx) or [Ollama](../customize/model-providers/top-level/ollama.mdx)).
|
||||
|
||||
<Tabs groupId="providers">
|
||||
<TabItem value="Together">
|
||||
```json title="config.json"
|
||||
"models": [
|
||||
{
|
||||
"title": "Llama 3.1 405B",
|
||||
"provider": "together",
|
||||
"model": "llama3.1-405b",
|
||||
"apiKey": "[TOGETHER_API_KEY]"
|
||||
}
|
||||
]
|
||||
<Tabs groupId="config-example">
|
||||
<TabItem value="yaml" label="YAML">
|
||||
<Tabs groupId="providers">
|
||||
<TabItem value="Together">
|
||||
```yaml title="Package or config.yaml"
|
||||
models:
|
||||
- name: "Llama 3.1 405B"
|
||||
provider: "together"
|
||||
model: "llama3.1-405b"
|
||||
apiKey: <YOUR_TOGETHER_API_KEY>
|
||||
```
|
||||
</TabItem>
|
||||
<TabItem value="Groq">
|
||||
```json title="config.json"
|
||||
"models": [
|
||||
{
|
||||
"title": "Llama 3.1 405B",
|
||||
"provider": "groq",
|
||||
"model": "llama3.1-405b",
|
||||
"apiKey": "[GROQ_API_KEY]"
|
||||
}
|
||||
]
|
||||
</TabItem>
|
||||
<TabItem value="Groq">
|
||||
```yaml title="Package or config.yaml"
|
||||
models:
|
||||
- name: "Llama 3.1 405B"
|
||||
provider: "groq"
|
||||
model: "llama3.1-405b"
|
||||
apiKey: <YOUR_GROQ_API_KEY>
|
||||
```
|
||||
</TabItem>
|
||||
<TabItem value="vLLM">
|
||||
```json title="config.json"
|
||||
"models": [
|
||||
{
|
||||
"title": "Llama 3.1 405B",
|
||||
"provider": "vllm",
|
||||
"model": "llama3.1-405b"
|
||||
}
|
||||
]
|
||||
</TabItem>
|
||||
<TabItem value="vLLM">
|
||||
```yaml title="Package or config.yaml"
|
||||
models:
|
||||
- name: "Llama 3.1 405B"
|
||||
provider: "vllm"
|
||||
model: "llama3.1-405b"
|
||||
```
|
||||
</TabItem>
|
||||
<TabItem value="Ollama">
|
||||
```json title="config.json"
|
||||
"models": [
|
||||
{
|
||||
"title": "Llama 3.1 405B",
|
||||
"provider": "ollama",
|
||||
"model": "llama3.1:405b"
|
||||
}
|
||||
]
|
||||
</TabItem>
|
||||
<TabItem value="Ollama">
|
||||
```yaml title="Package or config.yaml"
|
||||
models:
|
||||
- name: "Llama 3.1 405B"
|
||||
provider: "ollama"
|
||||
model: "llama3.1:405b"
|
||||
```
|
||||
</TabItem>
|
||||
</TabItem>
|
||||
</Tabs>
|
||||
</TabItem>
|
||||
<TabItem value="json" label="JSON">
|
||||
<Tabs groupId="providers">
|
||||
<TabItem value="Together">
|
||||
```json title="config.json"
|
||||
{
|
||||
"models": [
|
||||
{
|
||||
"title": "Llama 3.1 405B",
|
||||
"provider": "together",
|
||||
"model": "llama3.1-405b",
|
||||
"apiKey": "<YOUR_TOGETHER_API_KEY>"
|
||||
}
|
||||
]
|
||||
}
|
||||
```
|
||||
</TabItem>
|
||||
<TabItem value="Groq">
|
||||
```json title="config.json"
|
||||
{
|
||||
"models": [
|
||||
{
|
||||
"title": "Llama 3.1 405B",
|
||||
"provider": "groq",
|
||||
"model": "llama3.1-405b",
|
||||
"apiKey": "<YOUR_GROQ_API_KEY>"
|
||||
}
|
||||
]
|
||||
}
|
||||
```
|
||||
</TabItem>
|
||||
<TabItem value="vLLM">
|
||||
```json title="config.json"
|
||||
{
|
||||
"models": [
|
||||
{
|
||||
"title": "Llama 3.1 405B",
|
||||
"provider": "vllm",
|
||||
"model": "llama3.1-405b"
|
||||
}
|
||||
]
|
||||
}
|
||||
```
|
||||
</TabItem>
|
||||
<TabItem value="Ollama">
|
||||
```json title="config.json"
|
||||
{
|
||||
"models": [
|
||||
{
|
||||
"title": "Llama 3.1 405B",
|
||||
"provider": "ollama",
|
||||
"model": "llama3.1:405b"
|
||||
}
|
||||
]
|
||||
}
|
||||
```
|
||||
</TabItem>
|
||||
</Tabs>
|
||||
</TabItem>
|
||||
</Tabs>
|
||||
|
||||
### GPT-4o from OpenAI
|
||||
|
||||
If you prefer to use a model from [OpenAI](../customize/model-providers/top-level/openai.md), then we recommend GPT-4o.
|
||||
If you prefer to use a model from [OpenAI](../customize/model-providers/top-level/openai.mdx), then we recommend GPT-4o.
|
||||
|
||||
```json title="config.json"
|
||||
"models": [
|
||||
{
|
||||
"title": "GPT-4o",
|
||||
"provider": "openai",
|
||||
"model": "",
|
||||
"apiKey": "[OPENAI_API_KEY]"
|
||||
}
|
||||
]
|
||||
```
|
||||
<Tabs groupId="config-example">
|
||||
<TabItem value="yaml" label="YAML">
|
||||
```yaml title="Package or config.yaml"
|
||||
models:
|
||||
- name: GPT-4o
|
||||
provider: openai
|
||||
model: ''
|
||||
apiKey: <YOUR_OPENAI_API_KEY>
|
||||
```
|
||||
</TabItem>
|
||||
<TabItem value="json" label="JSON">
|
||||
```json title="config.json"
|
||||
{
|
||||
"models": [
|
||||
{
|
||||
"title": "GPT-4o",
|
||||
"provider": "openai",
|
||||
"model": "",
|
||||
"apiKey": "<YOUR_OPENAI_API_KEY>"
|
||||
}
|
||||
]
|
||||
}
|
||||
```
|
||||
</TabItem>
|
||||
</Tabs>
|
||||
|
||||
### Grok-2 from xAI
|
||||
|
||||
If you prefer to use a model from [xAI](../customize/model-providers/top-level/xAI.md), then we recommend Grok-2.
|
||||
If you prefer to use a model from [xAI](../customize/model-providers/top-level/xAI.mdx), then we recommend Grok-2.
|
||||
|
||||
```json title="config.json"
|
||||
"models": [
|
||||
{
|
||||
"title": "Grok-2",
|
||||
"provider": "xAI",
|
||||
"model": "grok-2-latest",
|
||||
"apiKey": "[XAI_API_KEY]"
|
||||
}
|
||||
]
|
||||
```
|
||||
<Tabs groupId="config-example">
|
||||
<TabItem value="yaml" label="YAML">
|
||||
```yaml title="Package or config.yaml"
|
||||
models:
|
||||
- name: Grok-2
|
||||
provider: xAI
|
||||
model: grok-2-latest
|
||||
apiKey: <YOUR_XAI_API_KEY>
|
||||
```
|
||||
</TabItem>
|
||||
<TabItem value="json" label="JSON">
|
||||
```json title="config.json"
|
||||
{
|
||||
"models": [
|
||||
{
|
||||
"title": "Grok-2",
|
||||
"provider": "xAI",
|
||||
"model": "grok-2-latest",
|
||||
"apiKey": "<YOUR_XAI_API_KEY>"
|
||||
}
|
||||
]
|
||||
}
|
||||
```
|
||||
</TabItem>
|
||||
</Tabs>
|
||||
|
||||
### Gemini 1.5 Pro from Google
|
||||
|
||||
If you prefer to use a model from [Google](../customize/model-providers/top-level/gemini.md), then we recommend Gemini 1.5 Pro.
|
||||
If you prefer to use a model from [Google](../customize/model-providers/top-level/gemini.mdx), then we recommend Gemini 1.5 Pro.
|
||||
|
||||
```json title="config.json"
|
||||
"models": [
|
||||
{
|
||||
"title": "Gemini 1.5 Pro",
|
||||
"provider": "gemini",
|
||||
"model": "gemini-1.5-pro-latest",
|
||||
"apiKey": "[GEMINI_API_KEY]"
|
||||
}
|
||||
]
|
||||
```
|
||||
<Tabs groupId="config-example">
|
||||
<TabItem value="yaml" label="YAML">
|
||||
```yaml title="Package or config.yaml"
|
||||
models:
|
||||
- name: Gemini 1.5 Pro
|
||||
provider: gemini
|
||||
model: gemini-1.5-pro-latest
|
||||
apiKey: <YOUR_GEMINI_API_KEY>
|
||||
```
|
||||
</TabItem>
|
||||
<TabItem value="json" label="JSON">
|
||||
```json title="config.json"
|
||||
{
|
||||
"models": [
|
||||
{
|
||||
"title": "Gemini 1.5 Pro",
|
||||
"provider": "gemini",
|
||||
"model": "gemini-1.5-pro-latest",
|
||||
"apiKey": "<YOUR_GEMINI_API_KEY>"
|
||||
}
|
||||
]
|
||||
}
|
||||
```
|
||||
</TabItem>
|
||||
</Tabs>
|
||||
|
||||
## Local, offline experience
|
||||
|
||||
|
|
@ -135,65 +245,117 @@ For the best local, offline Chat experience, you will want to use a model that i
|
|||
|
||||
### Llama 3.1 8B
|
||||
|
||||
If your local machine can run an 8B parameter model, then we recommend running Llama 3.1 8B on your machine (e.g. using [Ollama](../customize/model-providers/top-level/ollama.md) or [LM Studio](../customize/model-providers/more/lmstudio.md)).
|
||||
If your local machine can run an 8B parameter model, then we recommend running Llama 3.1 8B on your machine (e.g. using [Ollama](../customize/model-providers/top-level/ollama.mdx) or [LM Studio](../customize/model-providers/more/lmstudio.mdx)).
|
||||
|
||||
<Tabs groupId="providers">
|
||||
<TabItem value="Ollama">
|
||||
```json title="config.json"
|
||||
"models": [
|
||||
{
|
||||
"title": "Llama 3.1 8B",
|
||||
"provider": "ollama",
|
||||
"model": "llama3.1:8b",
|
||||
"apiBase": "http://localhost:11434"
|
||||
}
|
||||
]
|
||||
```
|
||||
</TabItem>
|
||||
<TabItem value="LM Studio">
|
||||
```json title="config.json"
|
||||
"models": [
|
||||
{
|
||||
"title": "Llama 3.1 8B",
|
||||
"provider": "lmstudio",
|
||||
"model": "llama3.1-8b"
|
||||
}
|
||||
]
|
||||
```
|
||||
</TabItem>
|
||||
<Tabs groupId="config-example">
|
||||
<TabItem value="yaml" label="YAML">
|
||||
<Tabs groupId="providers">
|
||||
<TabItem value="Ollama">
|
||||
```yaml title="Package or config.yaml"
|
||||
models:
|
||||
- name: Llama 3.1 8B
|
||||
provider: ollama
|
||||
model: llama3.1:8b
|
||||
```
|
||||
</TabItem>
|
||||
<TabItem value="LM Studio">
|
||||
```yaml title="Package or config.yaml"
|
||||
models:
|
||||
- name: Llama 3.1 8B
|
||||
provider: lmstudio
|
||||
model: llama3.1:8b
|
||||
```
|
||||
</TabItem>
|
||||
</Tabs>
|
||||
</TabItem>
|
||||
<TabItem value="json" label="JSON">
|
||||
<Tabs groupId="providers">
|
||||
<TabItem value="Ollama">
|
||||
```json title="config.json"
|
||||
{
|
||||
"models": [
|
||||
{
|
||||
"title": "Llama 3.1 8B",
|
||||
"provider": "ollama",
|
||||
"model": "llama3.1:8b"
|
||||
}
|
||||
]
|
||||
}
|
||||
```
|
||||
</TabItem>
|
||||
<TabItem value="LM Studio">
|
||||
```json title="config.json"
|
||||
{
|
||||
"models": [
|
||||
{
|
||||
"title": "Llama 3.1 8B",
|
||||
"provider": "lmstudio",
|
||||
"model": "llama3.1-8b"
|
||||
}
|
||||
]
|
||||
}
|
||||
```
|
||||
</TabItem>
|
||||
</Tabs>
|
||||
</TabItem>
|
||||
</Tabs>
|
||||
|
||||
### DeepSeek Coder 2 16B
|
||||
|
||||
If your local machine can run a 16B parameter model, then we recommend running DeepSeek Coder 2 16B (e.g. using [Ollama](../customize/model-providers/top-level/ollama.md) or [LM Studio](../customize/model-providers/more/lmstudio.md)).
|
||||
If your local machine can run a 16B parameter model, then we recommend running DeepSeek Coder 2 16B (e.g. using [Ollama](../customize/model-providers/top-level/ollama.mdx) or [LM Studio](../customize/model-providers/more/lmstudio.mdx)).
|
||||
|
||||
<Tabs groupId="providers">
|
||||
<TabItem value="Ollama">
|
||||
```json title="config.json"
|
||||
"models": [
|
||||
{
|
||||
"title": "DeepSeek Coder 2 16B",
|
||||
"provider": "ollama",
|
||||
"model": "deepseek-coder-v2:16b",
|
||||
"apiBase": "http://localhost:11434"
|
||||
}
|
||||
]
|
||||
<Tabs groupId="config-example">
|
||||
<TabItem value="yaml" label="YAML">
|
||||
<Tabs groupId="providers">
|
||||
<TabItem value="Ollama">
|
||||
```yaml title="Package or config.yaml"
|
||||
models:
|
||||
- name: DeepSeek Coder 2 16B
|
||||
provider: ollama
|
||||
model: deepseek-coder-v2:16b
|
||||
```
|
||||
|
||||
</TabItem>
|
||||
<TabItem value="LM Studio">
|
||||
|
||||
```json title="config.json"
|
||||
"models": [
|
||||
{
|
||||
"title": "DeepSeek Coder 2 16B",
|
||||
"provider": "lmstudio",
|
||||
"model": "deepseek-coder-v2:16b"
|
||||
}
|
||||
]
|
||||
</TabItem>
|
||||
<TabItem value="LM Studio">
|
||||
```yaml title="Package or config.yaml"
|
||||
models:
|
||||
- name: DeepSeek Coder 2 16B
|
||||
provider: lmstudio
|
||||
model: deepseek-coder-v2:16b
|
||||
```
|
||||
</TabItem>
|
||||
|
||||
</TabItem>
|
||||
</Tabs>
|
||||
</TabItem>
|
||||
<TabItem value="json" label="JSON">
|
||||
<Tabs groupId="providers">
|
||||
<TabItem value="Ollama">
|
||||
```json title="config.json"
|
||||
{
|
||||
"models": [
|
||||
{
|
||||
"title": "DeepSeek Coder 2 16B",
|
||||
"provider": "ollama",
|
||||
"model": "deepseek-coder-v2:16b",
|
||||
"apiBase": "http://localhost:11434"
|
||||
}
|
||||
]
|
||||
}
|
||||
```
|
||||
</TabItem>
|
||||
<TabItem value="LM Studio">
|
||||
```json title="config.json"
|
||||
{
|
||||
"models": [
|
||||
{
|
||||
"title": "DeepSeek Coder 2 16B",
|
||||
"provider": "lmstudio",
|
||||
"model": "deepseek-coder-v2:16b"
|
||||
}
|
||||
]
|
||||
}
|
||||
```
|
||||
</TabItem>
|
||||
</Tabs>
|
||||
</TabItem>
|
||||
</Tabs>
|
||||
|
||||
## Other experiences
|
||||
|
|
|
|||
|
|
@ -1,676 +0,0 @@
|
|||
---
|
||||
title: Context providers
|
||||
description: Type '@' to select content to the LLM as context
|
||||
keywords: [context, "@", provider, LLM]
|
||||
---
|
||||
|
||||
Context Providers allow you to type '@' and see a dropdown of content that can all be fed to the LLM as context. Every context provider is a plugin, which means if you want to reference some source of information that you don't see here, you can request (or build!) a new context provider.
|
||||
|
||||
As an example, say you are working on solving a new GitHub Issue. You type '@Issue' and select the one you are working on. Continue can now see the issue title and contents. You also know that the issue is related to the files 'readme.md' and 'helloNested.py', so you type '@readme' and '@hello' to find and select them. Now these 3 "Context Items" are displayed inline with the rest of your input.
|
||||
|
||||

|
||||
|
||||
## Built-in Context Providers
|
||||
|
||||
To use any of the built-in context providers, open `config.json` and add it to the `contextProviders` list.
|
||||
|
||||
### `@File`
|
||||
|
||||
Reference any file in your current workspace.
|
||||
|
||||
```json title="config.json"
|
||||
{
|
||||
"contextProviders": [
|
||||
{
|
||||
"name": "file"
|
||||
}
|
||||
]
|
||||
}
|
||||
```
|
||||
|
||||
### `@Code`
|
||||
|
||||
Reference specific functions or classes from throughout your project.
|
||||
|
||||
```json title="config.json"
|
||||
{
|
||||
"contextProviders": [
|
||||
{
|
||||
"name": "code"
|
||||
}
|
||||
]
|
||||
}
|
||||
```
|
||||
|
||||
### `@Git Diff`
|
||||
|
||||
Reference all of the changes you've made to your current branch. This is useful if you want to summarize what you've done or ask for a general review of your work before committing.
|
||||
|
||||
```json title="config.json"
|
||||
{
|
||||
"contextProviders": [
|
||||
{
|
||||
"name": "diff"
|
||||
}
|
||||
]
|
||||
}
|
||||
```
|
||||
|
||||
### `@Current File`
|
||||
|
||||
Reference the currently open file.
|
||||
|
||||
```json title="config.json"
|
||||
{
|
||||
"contextProviders": [
|
||||
{
|
||||
"name": "currentFile"
|
||||
}
|
||||
]
|
||||
}
|
||||
```
|
||||
|
||||
### `@Terminal`
|
||||
|
||||
Reference the last command you ran in your IDE's terminal and its output.
|
||||
|
||||
```json title="config.json"
|
||||
{
|
||||
"contextProviders": [
|
||||
{
|
||||
"name": "terminal"
|
||||
}
|
||||
]
|
||||
}
|
||||
```
|
||||
|
||||
### `@Docs`
|
||||
|
||||
Reference the contents from any documentation site.
|
||||
|
||||
```json title="config.json"
|
||||
{
|
||||
"contextProviders": [
|
||||
{
|
||||
"name": "docs"
|
||||
}
|
||||
]
|
||||
}
|
||||
```
|
||||
|
||||
Note that this will only enable the `@Docs` context provider.
|
||||
|
||||
To use it, you need to add a documentation site to your `config.json`. See the [docs](../customize/deep-dives/docs.md) page for more information.
|
||||
|
||||
### `@Open`
|
||||
|
||||
Reference the contents of all of your open files. Set `onlyPinned` to `true` to only reference pinned files.
|
||||
|
||||
```json title="config.json"
|
||||
{
|
||||
"contextProviders": [
|
||||
{
|
||||
"name": "open",
|
||||
"params": {
|
||||
"onlyPinned": true
|
||||
}
|
||||
}
|
||||
]
|
||||
}
|
||||
```
|
||||
|
||||
### `@Web`
|
||||
|
||||
Reference relevant pages from across the web, automatically determined from your input.
|
||||
|
||||
Optionally, set "n" to limit the number of results returned (default 6).
|
||||
|
||||
```json title="config.json"
|
||||
{
|
||||
"contextProviders": [
|
||||
{
|
||||
"name": "web",
|
||||
"params": {
|
||||
"n": 5
|
||||
}
|
||||
}
|
||||
]
|
||||
}
|
||||
```
|
||||
|
||||
### `@Codebase`
|
||||
|
||||
Reference the most relevant snippets from your codebase.
|
||||
|
||||
```json title="config.json"
|
||||
{
|
||||
"contextProviders": [
|
||||
{
|
||||
"name": "codebase"
|
||||
}
|
||||
]
|
||||
}
|
||||
```
|
||||
|
||||
Read more about indexing and retrieval [here](../customize/deep-dives/codebase.md).
|
||||
|
||||
### `@Folder`
|
||||
|
||||
Uses the same retrieval mechanism as `@Codebase`, but only on a single folder.
|
||||
|
||||
```json title="config.json"
|
||||
{
|
||||
"contextProviders": [
|
||||
{
|
||||
"name": "folder"
|
||||
}
|
||||
]
|
||||
}
|
||||
```
|
||||
|
||||
### `@Search`
|
||||
|
||||
Reference the results of codebase search, just like the results you would get from VS Code search.
|
||||
|
||||
```json title="config.json"
|
||||
{
|
||||
"contextProviders": [
|
||||
{
|
||||
"name": "search"
|
||||
}
|
||||
]
|
||||
}
|
||||
```
|
||||
|
||||
This context provider is powered by [ripgrep](https://github.com/BurntSushi/ripgrep).
|
||||
|
||||
### `@Url`
|
||||
|
||||
Reference the markdown converted contents of a given URL.
|
||||
|
||||
```json title="config.json"
|
||||
{
|
||||
"contextProviders": [
|
||||
{
|
||||
"name": "url"
|
||||
}
|
||||
]
|
||||
}
|
||||
```
|
||||
|
||||
### `@Clipboard`
|
||||
|
||||
Reference recent clipboard items
|
||||
|
||||
```json title="config.json"
|
||||
{
|
||||
"contextProviders": [
|
||||
{
|
||||
"name": "clipboard"
|
||||
}
|
||||
]
|
||||
}
|
||||
```
|
||||
|
||||
### `@Tree`
|
||||
|
||||
Reference the structure of your current workspace.
|
||||
|
||||
```json title="config.json"
|
||||
{
|
||||
"contextProviders": [
|
||||
{
|
||||
"name": "tree"
|
||||
}
|
||||
]
|
||||
}
|
||||
```
|
||||
|
||||
### `@Problems`
|
||||
|
||||
Get Problems from the current file.
|
||||
|
||||
```json title="config.json"
|
||||
{
|
||||
"contextProviders": [
|
||||
{
|
||||
"name": "problems"
|
||||
}
|
||||
]
|
||||
}
|
||||
```
|
||||
|
||||
### `@Debugger`
|
||||
|
||||
Reference the contents of the local variables in the debugger. Currently only available in VS Code.
|
||||
|
||||
```json title="config.json"
|
||||
{
|
||||
"contextProviders": [
|
||||
{
|
||||
"name": "debugger",
|
||||
"params": {
|
||||
"stackDepth": 3
|
||||
}
|
||||
}
|
||||
]
|
||||
}
|
||||
```
|
||||
|
||||
Uses the top _n_ levels (defaulting to 3) of the call stack for that thread.
|
||||
|
||||
### `@Repository Map`
|
||||
|
||||
Reference the outline of your codebase. By default, signatures are included along with file in the repo map.
|
||||
|
||||
`includeSignatures` params can be set to false to exclude signatures. This could be necessary for large codebases and/or to reduce context size significantly. Signatures will not be included if indexing is disabled.
|
||||
|
||||
```json title="config.json"
|
||||
{
|
||||
"contextProviders": [
|
||||
{
|
||||
"name": "repo-map",
|
||||
"params": {
|
||||
"includeSignatures": false // default true
|
||||
}
|
||||
}
|
||||
]
|
||||
}
|
||||
```
|
||||
|
||||
Provides a list of files and the call signatures of top-level classes, functions, and methods in those files. This helps the model better understand how a particular piece of code relates to the rest of the codebase.
|
||||
|
||||
In the submenu that appears, you can select either `Entire codebase`, or specify a subfolder to generate the repostiory map from.
|
||||
|
||||
This context provider is inpsired by [Aider's repository map](https://aider.chat/2023/10/22/repomap.html).
|
||||
|
||||
### `@Operating System`
|
||||
|
||||
Reference the architecture and platform of your current operating system.
|
||||
|
||||
```json title="config.json"
|
||||
{
|
||||
"contextProviders": [
|
||||
{
|
||||
"name": "os"
|
||||
}
|
||||
]
|
||||
}
|
||||
```
|
||||
|
||||
### Model Context Protocol
|
||||
|
||||
The [Model Context Protocol](https://modelcontextprotocol.io/introduction) is a standard proposed by Anthropic to unify prompts, context, and tool use. Continue supports any MCP server with the MCP context provider. Read their [quickstart](https://modelcontextprotocol.io/quickstart) to learn how to set up a local server and then configure your `config.json` like this:
|
||||
|
||||
```json
|
||||
{
|
||||
"experimental": {
|
||||
"modelContextProtocolServers": [
|
||||
{
|
||||
"transport": {
|
||||
"type": "stdio",
|
||||
"command": "uvx",
|
||||
"args": ["mcp-server-sqlite", "--db-path", "/Users/NAME/test.db"]
|
||||
}
|
||||
}
|
||||
]
|
||||
}
|
||||
}
|
||||
```
|
||||
|
||||
You'll then be able to type "@" and see "MCP" in the context providers dropdown.
|
||||
|
||||
### Prompt Files
|
||||
|
||||
See [Prompt Files](/customize/deep-dives/prompt-files). Prompt files are not added directly to the config file; prompt files are parsed and injected into the config automatically, to be used like other context providers.
|
||||
|
||||
### `@Issue`
|
||||
|
||||
Reference the conversation in a GitHub issue.
|
||||
|
||||
```json title="config.json"
|
||||
{
|
||||
"contextProviders": [
|
||||
{
|
||||
"name": "issue",
|
||||
"params": {
|
||||
"repos": [
|
||||
{
|
||||
"owner": "continuedev",
|
||||
"repo": "continue"
|
||||
}
|
||||
],
|
||||
"githubToken": "ghp_xxx"
|
||||
}
|
||||
}
|
||||
]
|
||||
}
|
||||
```
|
||||
|
||||
Make sure to include your own [GitHub personal access token](https://docs.github.com/en/authentication/keeping-your-account-and-data-secure/managing-your-personal-access-tokens#creating-a-fine-grained-personal-access-token) to avoid being rate-limited.
|
||||
|
||||
### `@Database`
|
||||
|
||||
Reference table schemas from Sqlite, Postgres, MSSQL, and MySQL databases.
|
||||
|
||||
```json title="config.json"
|
||||
{
|
||||
"contextProviders": [
|
||||
{
|
||||
"name": "database",
|
||||
"params": {
|
||||
"connections": [
|
||||
{
|
||||
"name": "examplePostgres",
|
||||
"connection_type": "postgres",
|
||||
"connection": {
|
||||
"user": "username",
|
||||
"host": "localhost",
|
||||
"database": "exampleDB",
|
||||
"password": "yourPassword",
|
||||
"port": 5432
|
||||
}
|
||||
},
|
||||
{
|
||||
"name": "exampleMssql",
|
||||
"connection_type": "mssql",
|
||||
"connection": {
|
||||
"user": "username",
|
||||
"server": "localhost",
|
||||
"database": "exampleDB",
|
||||
"password": "yourPassword"
|
||||
}
|
||||
},
|
||||
{
|
||||
"name": "exampleSqlite",
|
||||
"connection_type": "sqlite",
|
||||
"connection": {
|
||||
"filename": "/path/to/your/sqlite/database.db"
|
||||
}
|
||||
}
|
||||
]
|
||||
}
|
||||
}
|
||||
]
|
||||
}
|
||||
```
|
||||
|
||||
Each connection should include a unique name, the `connection_type`, and the necessary connection parameters specific to each database type.
|
||||
|
||||
Available connection types:
|
||||
|
||||
- `postgres`
|
||||
- `mysql`
|
||||
- `sqlite`
|
||||
|
||||
### `@Postgres`
|
||||
|
||||
Reference the schema of a table, and some sample rows
|
||||
|
||||
```json title="config.json"
|
||||
{
|
||||
"contextProviders": [
|
||||
{
|
||||
"name": "postgres",
|
||||
"params": {
|
||||
"host": "localhost",
|
||||
"port": 5436,
|
||||
"user": "myuser",
|
||||
"password": "catsarecool",
|
||||
"database": "animals",
|
||||
"schema": "public",
|
||||
"sampleRows": 3
|
||||
}
|
||||
}
|
||||
]
|
||||
}
|
||||
```
|
||||
|
||||
The only required settings are those for creating the database connection: `host`, `port`, `user`, `password`, and `database`.
|
||||
|
||||
By default, the `schema` filter is set to `public`, and the `sampleRows` is set to 3. You may unset the schema if you want to include tables from all schemas.
|
||||
|
||||
[Here is a short demo.](https://github.com/continuedev/continue/pull/859)
|
||||
|
||||
### `@Google`
|
||||
|
||||
Reference the results of a Google search.
|
||||
|
||||
```json title="config.json"
|
||||
{
|
||||
"contextProviders": [
|
||||
{
|
||||
"name": "google",
|
||||
"params": {
|
||||
"serperApiKey": "<your serper.dev api key>"
|
||||
}
|
||||
}
|
||||
]
|
||||
}
|
||||
```
|
||||
|
||||
For example, type "@Google python tutorial" if you want to search and discuss ways of learning Python.
|
||||
|
||||
Note: You can get an API key for free at [serper.dev](https://serper.dev).
|
||||
|
||||
### `@Gitlab Merge Request`
|
||||
|
||||
Reference an open MR for this branch on GitLab.
|
||||
|
||||
```json title="config.json"
|
||||
{
|
||||
"contextProviders": [
|
||||
{
|
||||
"name": "gitlab-mr",
|
||||
"params": {
|
||||
"token": "..."
|
||||
}
|
||||
}
|
||||
]
|
||||
}
|
||||
```
|
||||
|
||||
You will need to create a [personal access token](https://docs.gitlab.com/ee/user/profile/personal_access_tokens.html) with the `read_api` scope.
|
||||
|
||||
#### Using Self-Hosted GitLab
|
||||
|
||||
You can specify the domain to communicate with by setting the `domain` parameter in your configurtion. By default this is set to `gitlab.com`.
|
||||
|
||||
```json title="config.json"
|
||||
{
|
||||
"contextProviders": [
|
||||
{
|
||||
"name": "gitlab-mr",
|
||||
"params": {
|
||||
"token": "...",
|
||||
"domain": "gitlab.example.com"
|
||||
}
|
||||
}
|
||||
]
|
||||
}
|
||||
```
|
||||
|
||||
#### Filtering Comments
|
||||
|
||||
If you select some code to be edited, you can have the context provider filter out comments for other files. To enable this feature, set `filterComments` to `true`.
|
||||
|
||||
### `@Jira`
|
||||
|
||||
Reference the conversation in a Jira issue.
|
||||
|
||||
```json title="config.json"
|
||||
{
|
||||
"contextProviders": [
|
||||
{
|
||||
"name": "jira",
|
||||
"params": {
|
||||
"domain": "company.atlassian.net",
|
||||
"token": "ATATT..."
|
||||
}
|
||||
}
|
||||
]
|
||||
}
|
||||
```
|
||||
|
||||
Make sure to include your own [Atlassian API Token](https://id.atlassian.com/manage-profile/security/api-tokens), or use your `email` and `token`, with token set to your password for basic authentication. If you use your own Atlassian API Token, don't configure your email.
|
||||
|
||||
#### Jira Datacenter Support
|
||||
|
||||
This context provider supports both Jira API version 2 and 3. It will use version 3 by default since
|
||||
that's what the cloud version uses, but if you have the datacenter version of Jira, you'll need
|
||||
to set the API Version to 2 using the `apiVersion` property.
|
||||
|
||||
```json title="config.json"
|
||||
{
|
||||
"contextProviders": [
|
||||
{
|
||||
"name": "jira",
|
||||
"params": {
|
||||
"apiVersion": "2"
|
||||
}
|
||||
}
|
||||
]
|
||||
}
|
||||
```
|
||||
|
||||
#### Issue Query
|
||||
|
||||
By default, the following query will be used to find issues:
|
||||
|
||||
```jql
|
||||
assignee = currentUser() AND resolution = Unresolved order by updated DESC
|
||||
```
|
||||
|
||||
You can override this query by setting the `issueQuery` parameter.
|
||||
|
||||
### `@Discord`
|
||||
|
||||
Reference the messages in a Discord channel.
|
||||
|
||||
```json title="config.json"
|
||||
{
|
||||
"contextProviders": [
|
||||
{
|
||||
"name": "discord",
|
||||
"params": {
|
||||
"discordKey": "bot token",
|
||||
"guildId": "1234567890",
|
||||
"channels": [
|
||||
{
|
||||
"id": "123456",
|
||||
"name": "example-channel"
|
||||
},
|
||||
{
|
||||
"id": "678901",
|
||||
"name": "example-channel-2"
|
||||
}
|
||||
]
|
||||
}
|
||||
}
|
||||
]
|
||||
}
|
||||
```
|
||||
|
||||
Make sure to include your own [Bot Token](https://discord.com/developers/applications), and join it to your related server . If you want more granular control over which channels are searched, you can specify a list of channel IDs to search in. If you don't want to specify any channels, just include the guild id(Server ID) and all channels will be included. The provider only reads text channels.
|
||||
|
||||
### `@HTTP`
|
||||
|
||||
The HttpContextProvider makes a POST request to the url passed in the configuration. The server must return 200 OK with a ContextItem object or an array of ContextItems.
|
||||
|
||||
```json title="config.json"
|
||||
{
|
||||
"contextProviders": [
|
||||
{
|
||||
"name": "http",
|
||||
"params": {
|
||||
"url": "https://api.example.com/v1/users"
|
||||
}
|
||||
}
|
||||
]
|
||||
}
|
||||
```
|
||||
|
||||
The receiving URL should expect to receive the following parameters:
|
||||
|
||||
```js title="POST parameters"
|
||||
{
|
||||
query: string,
|
||||
fullInput: string
|
||||
}
|
||||
```
|
||||
|
||||
The response 200 OK should be a JSON object with the following structure:
|
||||
|
||||
```json title="Response"
|
||||
[
|
||||
{
|
||||
"name": "",
|
||||
"description": "",
|
||||
"content": ""
|
||||
}
|
||||
]
|
||||
|
||||
// OR
|
||||
{
|
||||
"name": "",
|
||||
"description": "",
|
||||
"content": ""
|
||||
}
|
||||
```
|
||||
|
||||
### `@Commits`
|
||||
|
||||
Reference specific git commit metadata and diff or all of the recent commits.
|
||||
|
||||
```json title="config.json"
|
||||
{
|
||||
"contextProviders": [
|
||||
{
|
||||
"name": "commit",
|
||||
"params": {
|
||||
"Depth": 50,
|
||||
"LastXCommitsDepth": 10
|
||||
}
|
||||
}
|
||||
]
|
||||
}
|
||||
```
|
||||
|
||||
The depth is how many commits will be loaded into the submenu, defaults to 50.
|
||||
The LastXCommitsDepth is how many recent commits will be included, defaults to 10.
|
||||
|
||||
### `@Clipboard`
|
||||
|
||||
Reference recent clipboard items
|
||||
|
||||
```json title="config.json"
|
||||
{
|
||||
"contextProviders": [
|
||||
{
|
||||
"name": "clipboard"
|
||||
}
|
||||
]
|
||||
}
|
||||
```
|
||||
|
||||
### `@Greptile`
|
||||
|
||||
Query a [Greptile](https://www.greptile.com/) index of the current repo/branch.
|
||||
|
||||
```json title="config.json"
|
||||
{
|
||||
"contextProviders": [
|
||||
{
|
||||
"name": "greptile",
|
||||
"params": {
|
||||
"GreptileToken": "...",
|
||||
"GithubToken": "..."
|
||||
}
|
||||
}
|
||||
]
|
||||
}
|
||||
```
|
||||
|
||||
### Requesting Context Providers
|
||||
|
||||
Not seeing what you want? Create an issue [here](https://github.com/continuedev/continue/issues/new?assignees=TyDunn&labels=enhancement&projects=&template=feature-request-%F0%9F%92%AA.md&title=) to request a new Context Provider.
|
||||
1050
docs/docs/customize/context-providers.mdx
Normal file
1050
docs/docs/customize/context-providers.mdx
Normal file
File diff suppressed because it is too large
Load diff
|
|
@ -3,20 +3,38 @@ title: Autocomplete
|
|||
keywords: [autocomplete]
|
||||
---
|
||||
|
||||
import Tabs from "@theme/Tabs";
|
||||
import TabItem from "@theme/TabItem";
|
||||
|
||||
### Setting up with Codestral (recommended)
|
||||
|
||||
If you want to have the best autocomplete experience, we recommend using Codestral, which is available through the [Mistral API](https://console.mistral.ai/). To do this, obtain an API key and add it to your `config.json`:
|
||||
If you want to have the best autocomplete experience, we recommend using Codestral, which is available through the [Mistral API](https://console.mistral.ai/). To do this, obtain an API key and add it to your config:
|
||||
|
||||
```json
|
||||
{
|
||||
"tabAutocompleteModel": {
|
||||
"title": "Codestral",
|
||||
"provider": "mistral",
|
||||
"model": "codestral-latest",
|
||||
"apiKey": "YOUR_API_KEY"
|
||||
<Tabs groupId="config-example">
|
||||
<TabItem value="yaml" label="YAML">
|
||||
```yaml title="config.yaml"
|
||||
models:
|
||||
- name: Codestral
|
||||
provider: mistral
|
||||
model: codestral-latest
|
||||
apiKey: <YOUR_CODESTRAL_API_KEY>
|
||||
roles:
|
||||
- autocomplete
|
||||
```
|
||||
</TabItem>
|
||||
<TabItem value="json" label="JSON">
|
||||
```json title="config.json"
|
||||
{
|
||||
"tabAutocompleteModel": {
|
||||
"title": "Codestral",
|
||||
"provider": "mistral",
|
||||
"model": "codestral-latest",
|
||||
"apiKey": "<YOUR_CODESTRAL_API_KEY>"
|
||||
}
|
||||
}
|
||||
}
|
||||
```
|
||||
```
|
||||
</TabItem>
|
||||
</Tabs>
|
||||
|
||||
### Setting up with Ollama (default)
|
||||
|
||||
|
|
@ -32,17 +50,31 @@ Once it has been downloaded, you should begin to see completions in VS Code.
|
|||
|
||||
All of the configuration options available for chat models are available to use for tab-autocomplete. For example, if you wanted to use a remote Ollama instance you would edit your `config.json` like this (note that it is not inside the models array):
|
||||
|
||||
```json title="config.json"
|
||||
{
|
||||
<Tabs groupId="config-example">
|
||||
<TabItem value="yaml" label="YAML">
|
||||
```yaml title="config.yaml"
|
||||
models:
|
||||
- name: Tab Autocomplete Model
|
||||
provider: ollama
|
||||
model: qwen2.5-coder:1.5b-base
|
||||
apiBase: https://<my endpoint>
|
||||
roles:
|
||||
- autocomplete
|
||||
```
|
||||
</TabItem>
|
||||
<TabItem value="json" label="JSON">
|
||||
```json title="config.json"
|
||||
{
|
||||
"tabAutocompleteModel": {
|
||||
"title": "Tab Autocomplete Model",
|
||||
"provider": "ollama",
|
||||
"model": "qwen2.5-coder:1.5b-base",
|
||||
"apiBase": "https://<my endpoint>"
|
||||
},
|
||||
...
|
||||
}
|
||||
```
|
||||
"title": "Tab Autocomplete Model",
|
||||
"provider": "ollama",
|
||||
"model": "qwen2.5-coder:1.5b-base",
|
||||
"apiBase": "https://<my endpoint>"
|
||||
}
|
||||
}
|
||||
```
|
||||
</TabItem>
|
||||
</Tabs>
|
||||
|
||||
If you aren't yet familiar with the available options, you can find the full reference [here](./configuration.md).
|
||||
|
||||
|
|
@ -70,21 +102,36 @@ This object allows you to customize the behavior of tab-autocomplete. The availa
|
|||
|
||||
### Full example
|
||||
|
||||
```json title="config.json"
|
||||
{
|
||||
"tabAutocompleteModel": {
|
||||
"title": "Tab Autocomplete Model",
|
||||
"provider": "ollama",
|
||||
"model": "qwen2.5-coder:1.5b-base",
|
||||
"apiBase": "https://<my endpoint>"
|
||||
},
|
||||
"tabAutocompleteOptions": {
|
||||
"debounceDelay": 500,
|
||||
"maxPromptTokens": 1500,
|
||||
"disableInFiles": ["*.md"]
|
||||
<Tabs groupId="config-example">
|
||||
<TabItem value="yaml" label="YAML">
|
||||
```yaml title="config.yaml"
|
||||
models:
|
||||
- name: Tab Autocomplete Model
|
||||
provider: ollama
|
||||
model: qwen2.5-coder:1.5b-base
|
||||
apiBase: https://<my endpoint>
|
||||
roles:
|
||||
- autocomplete
|
||||
```
|
||||
</TabItem>
|
||||
<TabItem value="json" label="JSON">
|
||||
```json title="config.json"
|
||||
{
|
||||
"tabAutocompleteModel": {
|
||||
"title": "Tab Autocomplete Model",
|
||||
"provider": "ollama",
|
||||
"model": "qwen2.5-coder:1.5b-base",
|
||||
"apiBase": "https://<my endpoint>"
|
||||
},
|
||||
"tabAutocompleteOptions": {
|
||||
"debounceDelay": 500,
|
||||
"maxPromptTokens": 1500,
|
||||
"disableInFiles": ["*.md"]
|
||||
}
|
||||
}
|
||||
}
|
||||
```
|
||||
```
|
||||
</TabItem>
|
||||
</Tabs>
|
||||
|
||||
## FAQs
|
||||
|
||||
|
|
@ -3,12 +3,15 @@ description: Talk to your codebase
|
|||
keywords: [talk, embeddings, reranker, codebase, experimental]
|
||||
---
|
||||
|
||||
import Tabs from "@theme/Tabs";
|
||||
import TabItem from "@theme/TabItem";
|
||||
|
||||
# @Codebase
|
||||
|
||||
Continue indexes your codebase so that it can later automatically pull in the most relevant context from throughout your workspace. This is done via a combination of embeddings-based retrieval and keyword search. By default, all embeddings are calculated locally using `transformers.js` and stored locally in `~/.continue/index`.
|
||||
|
||||
:::info[`transformers.js cannot be used in JetBrains`]
|
||||
Currently, `transformers.js` cannot be used in JetBrains IDEs. However, you can select a differet embeddings model from [the list here](../model-types/embeddings.md).
|
||||
Currently, `transformers.js` cannot be used in JetBrains IDEs. However, you can select a differet embeddings model from [the list here](../model-types/embeddings.mdx).
|
||||
:::
|
||||
|
||||
Currently, the codebase retrieval feature is available as the "codebase" and "folder" context providers. You can use them by typing `@Codebase` or `@Folder` in the input box, and then asking a question. The contents of the input box will be compared with the embeddings from the rest of the codebase (or folder) to determine relevant files.
|
||||
|
|
@ -38,22 +41,36 @@ Here are use cases where it is not useful:
|
|||
|
||||
## Configuration
|
||||
|
||||
There are a few options that let you configure the behavior of the codebase context provider. These can be set in `config.json`, and are the same for the codebase, docs, and folder context providers:
|
||||
There are a few options that let you configure the behavior of the `@codebase` context provider, which are the same for the `@folder` context provider:
|
||||
|
||||
```json title="config.json"
|
||||
{
|
||||
"contextProviders": [
|
||||
{
|
||||
"name": "codebase",
|
||||
"params": {
|
||||
"nRetrieve": 25,
|
||||
"nFinal": 5,
|
||||
"useReranking": true
|
||||
<Tabs groupId="config-example">
|
||||
<TabItem value="yaml" label="YAML">
|
||||
```yaml title="Package or config.yaml"
|
||||
context:
|
||||
- provider: codebase
|
||||
params:
|
||||
nRetrieve: 25,
|
||||
nFinal: 5,
|
||||
useReranking: true
|
||||
```
|
||||
</TabItem>
|
||||
<TabItem value="json" label="JSON">
|
||||
```json title="config.json"
|
||||
{
|
||||
"contextProviders": [
|
||||
{
|
||||
"name": "codebase",
|
||||
"params": {
|
||||
"nRetrieve": 25,
|
||||
"nFinal": 5,
|
||||
"useReranking": true
|
||||
}
|
||||
}
|
||||
}
|
||||
]
|
||||
}
|
||||
```
|
||||
]
|
||||
}
|
||||
```
|
||||
</TabItem>
|
||||
</Tabs>
|
||||
|
||||
### `nRetrieve`
|
||||
|
||||
|
|
@ -79,4 +96,4 @@ If you need to force a refresh of the index, reload the VS Code window with <kbd
|
|||
|
||||
## Repository map
|
||||
|
||||
Models in the Claude 3, Llama 3.1/3.2, Gemini 1.5, and GPT-4o families will automatically use a [repository map](../context-providers.md#repository-map) during codebase retrieval, which allows the model to understand the structure of your codebase and use it to answer questions. Currently, the repository map only contains the filepaths in the codebase.
|
||||
Models in the Claude 3, Llama 3.1/3.2, Gemini 1.5, and GPT-4o families will automatically use a [repository map](../context-providers.mdx#repository-map) during codebase retrieval, which allows the model to understand the structure of your codebase and use it to answer questions. Currently, the repository map only contains the filepaths in the codebase.
|
||||
|
|
@ -5,27 +5,34 @@ keywords: [config, settings, customize]
|
|||
|
||||
# Configuration
|
||||
|
||||
Continue can be deeply customized. User-level configuration is stored and can be edited in your home directory in [`config.json`](#configjson):
|
||||
## YAML Config
|
||||
|
||||
- `~/.continue/config.json` (MacOS / Linux)
|
||||
- `%USERPROFILE%\.continue\config.json` (Windows)
|
||||
Continue can be deeply customized. Local user-level configuration is stored and can be edited in your home directory in `config.yaml`:
|
||||
|
||||
To open `config.json`, you can click the "gear" icon in the header of the Continue Chat sidebar to open the settings page, and then click `Open [your config location]` to open the file. When editing this file, you can see the available options suggested as you type, or check the reference below.
|
||||
To open `config.yaml`, you can click the "gear" icon in the header of the Continue Chat sidebar to open the settings page, and then click `Open Config File` to open the file. When editing this file, you can see the available options suggested as you type, or check the reference below.
|
||||
|
||||
When you save `config.json`, Continue will automatically refresh to take into account your changes. `config.json` is automatically created the first time you use Continue. `config.json` is automatically generated if it doesn't exist.
|
||||
- `~/.continue/config.yaml` (MacOS / Linux)
|
||||
- `%USERPROFILE%\.continue\config.yaml` (Windows)
|
||||
|
||||
In the vast majority of cases, you will only need to edit `config.json`. However, Continue offers two additional ways to customize configuration:
|
||||
To open your configuration file, you can click the "gear" icon in the bottom right corner of the Continue Chat sidebar. When editing this file, you can see the available options suggested as you type, or check the reference below.
|
||||
|
||||
- [`.continuerc.json`](#continuercjson) - Workspace-level configuration. If you'd like to scope certain settings to a particular workspace, you can add a `.continuerc.json` to the root of your project. This can be set to merge with _or_ override the user-level `config.json`
|
||||
When you save a config file from the IDE, Continue will automatically refresh to take into account your changes. A config file is automatically created the first time you use Continue, and always automatically generated with default values if it doesn't exist.
|
||||
|
||||
See the full reference for `config.yaml` [here](../../reference.md).
|
||||
|
||||
## Deprecated configuration methods
|
||||
|
||||
:::info
|
||||
View the `config.json` migration guide [here](../../yaml-migration.md)
|
||||
:::
|
||||
|
||||
- [`config.json`](../../json-reference.md) - The original configuration format which is stored in a file at the same location as `config.yaml`
|
||||
- [`.continuerc.json`](#continuercjson) - Workspace-level configuration
|
||||
- [`config.ts`](#configts) - Advanced configuration (probably unnecessary) - a TypeScript file in your home directory that can be used to programmatically modify (_merged_) the `config.json` schema:
|
||||
- `~/.continue/config.ts` (MacOS / Linux)
|
||||
- `%USERPROFILE%\.continue\config.ts` (Windows)
|
||||
|
||||
## `config.json`
|
||||
|
||||
See the full reference for `config.json` [here](../../reference.md).
|
||||
|
||||
## `.continuerc.json`
|
||||
### `.continuerc.json`
|
||||
|
||||
The format of `.continuerc.json` is the same as `config.json`, plus one _additional_ property `mergeBehavior`, which can be set to either "merge" or "overwrite". If set to "merge" (the default), `.continuerc.json` will be applied on top of `config.json` (arrays and objects are merged). If set to "overwrite", then every top-level property of `.continuerc.json` will overwrite that property from `config.json`.
|
||||
|
||||
|
|
@ -40,7 +47,7 @@ Example
|
|||
}
|
||||
```
|
||||
|
||||
## `config.ts`
|
||||
### `config.ts`
|
||||
|
||||
To programatically extend `config.json`, you can place a `config.ts` script in same directory as `config.json` and export a `modifyConfig` function, like:
|
||||
|
||||
|
|
|
|||
|
|
@ -14,23 +14,36 @@ keywords:
|
|||
toc_max_heading_level: 5
|
||||
---
|
||||
|
||||
import Tabs from "@theme/Tabs";
|
||||
import TabItem from "@theme/TabItem";
|
||||
|
||||
# @Docs
|
||||
|
||||
The [`@Docs` context provider](customize/context-providers.md#docs) allows you to efficiently reference locally-indexed documentation directly within Continue.
|
||||
The [`@Docs` context provider](customize/context-providers.mdx#docs) allows you to efficiently reference documentation directly within Continue.
|
||||
|
||||
## Enabling the `@Docs` context provider
|
||||
|
||||
To enable the `@Docs` context provider, add it to the list of context providers in your `config.json` file.
|
||||
|
||||
```json title="config.json"
|
||||
{
|
||||
"contextProviders": [
|
||||
{
|
||||
"name": "docs"
|
||||
}
|
||||
]
|
||||
}
|
||||
```
|
||||
<Tabs groupId="config-example">
|
||||
<TabItem value="yaml" label="YAML">
|
||||
```yaml title="config.yaml"
|
||||
context:
|
||||
- provider: docs
|
||||
```
|
||||
</TabItem>
|
||||
<TabItem value="json" label="JSON">
|
||||
```json title="config.json"
|
||||
{
|
||||
"contextProviders": [
|
||||
{
|
||||
"name": "docs"
|
||||
}
|
||||
]
|
||||
}
|
||||
```
|
||||
</TabItem>
|
||||
</Tabs>
|
||||
|
||||
## How It Works
|
||||
|
||||
|
|
@ -76,17 +89,29 @@ Documentation sources may be suggested based on package files in your repo. This
|
|||
|
||||
For bulk documentation site adds or edits, we recommend editing your global configuration file directly. Documentation sites are stored in an array within `docs` in your global configuration, as follows:
|
||||
|
||||
```json title="config.json"
|
||||
{
|
||||
"docs": [
|
||||
{
|
||||
"title": "Nest.js",
|
||||
"startUrl": "https://docs.nestjs.com/",
|
||||
"faviconUrl": "https://docs.nestjs.com/favicon.ico"
|
||||
}
|
||||
]
|
||||
}
|
||||
```
|
||||
<Tabs groupId="config-example">
|
||||
<TabItem value="yaml" label="YAML">
|
||||
```yaml title="config.yaml"
|
||||
docs:
|
||||
- title: Nest.js
|
||||
startUrl: https://docs.nestjs.com/
|
||||
faviconUrl: https://docs.nestjs.com/favicon.ico
|
||||
```
|
||||
</TabItem>
|
||||
<TabItem value="json" label="JSON">
|
||||
```json title="config.json"
|
||||
{
|
||||
"docs": [
|
||||
{
|
||||
"title": "Nest.js",
|
||||
"startUrl": "https://docs.nestjs.com/",
|
||||
"faviconUrl": "https://docs.nestjs.com/favicon.ico"
|
||||
}
|
||||
]
|
||||
}
|
||||
```
|
||||
</TabItem>
|
||||
</Tabs>
|
||||
|
||||
See [the config reference](../../reference) for all documentation site configuration options.
|
||||
|
||||
|
|
@ -96,43 +121,69 @@ Indexing will re-sync upon saving the configuration file.
|
|||
|
||||
### Using Your Embeddings Provider
|
||||
|
||||
If you have set up an [embeddings provider](../model-types/embeddings.md), @docs will use your embeddings provider. Switching embeddings providers will trigger a re-index of all documentation sites in your configuration.
|
||||
If you have set up an [embeddings provider](../model-types/embeddings.mdx), @docs will use your embeddings provider. Switching embeddings providers will trigger a re-index of all documentation sites in your configuration.
|
||||
|
||||
### Reranking
|
||||
|
||||
As with [@Codebase context provider configuration](./codebase#configuration), you can adjust the reranking behavior of the `@Docs` context provider with the `nRetrieve`, `nFinal`, and `useReranking`.
|
||||
|
||||
```json title="config.json"
|
||||
{
|
||||
"contextProviders": [
|
||||
{
|
||||
"name": "docs",
|
||||
"params": {
|
||||
"nRetrieve": 25, // The number of docs to retreive from the embeddings query
|
||||
"nFinal": 5, // The number of docs chunks to return IF reranking
|
||||
"useReranking": true // use reranking if a reranker is configured (defaults to true)
|
||||
<Tabs groupId="config-example">
|
||||
<TabItem value="yaml" label="YAML">
|
||||
```yaml title="config.yaml"
|
||||
context:
|
||||
- provider: docs
|
||||
params:
|
||||
nRetrieve: 25 # The number of docs to retreive from the embeddings query
|
||||
nFinal: 5 # The number of docs chunks to return IF reranking
|
||||
useReranking: true # use reranking if a reranker is configured (defaults to true)
|
||||
```
|
||||
</TabItem>
|
||||
<TabItem value="json" label="JSON">
|
||||
```json title="config.json"
|
||||
{
|
||||
"contextProviders": [
|
||||
{
|
||||
"name": "docs",
|
||||
"params": {
|
||||
"nRetrieve": 25, // The number of docs to retreive from the embeddings query
|
||||
"nFinal": 5, // The number of docs chunks to return IF reranking
|
||||
"useReranking": true // use reranking if a reranker is configured (defaults to true)
|
||||
}
|
||||
}
|
||||
}
|
||||
]
|
||||
}
|
||||
```
|
||||
]
|
||||
}
|
||||
```
|
||||
</TabItem>
|
||||
</Tabs>
|
||||
|
||||
### Github
|
||||
|
||||
The Github API rate limits public requests to 60 per hour. If you want to reliably index Github repos, you can add a github token to your config file:
|
||||
|
||||
```json title="config.json"
|
||||
{
|
||||
"contextProviders": [
|
||||
{
|
||||
"name": "docs",
|
||||
"params": {
|
||||
"githubToken": "github_..."
|
||||
<Tabs groupId="config-example">
|
||||
<TabItem value="yaml" label="YAML">
|
||||
```yaml title="config.yaml"
|
||||
context:
|
||||
- provider: docs
|
||||
params:
|
||||
githubToken: <GITHUB_TOKEN>
|
||||
```
|
||||
</TabItem>
|
||||
<TabItem value="json" label="JSON">
|
||||
```json title="config.json"
|
||||
{
|
||||
"contextProviders": [
|
||||
{
|
||||
"name": "docs",
|
||||
"params": {
|
||||
"githubToken": "github_..."
|
||||
}
|
||||
}
|
||||
}
|
||||
]
|
||||
}
|
||||
```
|
||||
]
|
||||
}
|
||||
```
|
||||
</TabItem>
|
||||
</Tabs>
|
||||
|
||||
### Local Crawling
|
||||
|
||||
|
|
@ -140,18 +191,31 @@ By default, Continue crawls documentation sites using a specialized crawling ser
|
|||
|
||||
If your documentation is private, you can skip the default crawler and use a local crawler instead by setting `useLocalCrawling` to `true`.
|
||||
|
||||
```json title="config.json"
|
||||
{
|
||||
"docs": [
|
||||
{
|
||||
"title": "My Private Docs",
|
||||
"startUrl": "http://10.2.1.2/docs",
|
||||
"faviconUrl": "http://10.2.1.2/docs/assets/favicon.ico",
|
||||
"useLocalCrawling": true
|
||||
}
|
||||
]
|
||||
}
|
||||
```
|
||||
<Tabs groupId="config-example">
|
||||
<TabItem value="yaml" label="YAML">
|
||||
```yaml title="config.yaml"
|
||||
docs:
|
||||
- title: My Private Docs
|
||||
startUrl: http://10.2.1.2/docs
|
||||
faviconUrl: http://10.2.1.2/docs/assets/favicon.ico,
|
||||
useLocalCrawling: true
|
||||
```
|
||||
</TabItem>
|
||||
<TabItem value="json" label="JSON">
|
||||
```json title="config.json"
|
||||
{
|
||||
"docs": [
|
||||
{
|
||||
"title": "My Private Docs",
|
||||
"startUrl": "http://10.2.1.2/docs",
|
||||
"faviconUrl": "http://10.2.1.2/docs/assets/favicon.ico",
|
||||
"useLocalCrawling": true
|
||||
}
|
||||
]
|
||||
}
|
||||
```
|
||||
</TabItem>
|
||||
</Tabs>
|
||||
|
||||
The default local crawler is a lightweight tool that cannot render sites that are dynamically generated using JavaScript. If your sites need to be rendered, you can enable the experimental `Use Chromium for Docs Crawling` feature from your [User Settings Page](../settings.md) This will download and install Chromium to `~/.continue/.utils`, and use it as the local crawler.
|
||||
|
||||
|
|
@ -182,41 +246,78 @@ You can also use the following IDE command to force a re-index of all docs: `Con
|
|||
|
||||
The following configuration example works out of the box for VS Code. This uses the built-in embeddings provider with no reranking. Pre-indexed docs will be accessible.
|
||||
|
||||
```json title="config.json"
|
||||
"contextProviders": [
|
||||
{
|
||||
"name": "docs",
|
||||
}
|
||||
],
|
||||
"docs": [
|
||||
{
|
||||
"title": "Nest.js",
|
||||
"startUrl": "https://docs.nestjs.com/",
|
||||
},
|
||||
],
|
||||
```
|
||||
<Tabs groupId="config-example">
|
||||
<TabItem value="yaml" label="YAML">
|
||||
```yaml title="config.yaml"
|
||||
context:
|
||||
- provider: docs
|
||||
|
||||
docs:
|
||||
- title: Nest.js
|
||||
startUrl: https://docs.nestjs.com/
|
||||
```
|
||||
</TabItem>
|
||||
<TabItem value="json" label="JSON">
|
||||
```json title="config.json"
|
||||
{
|
||||
"contextProviders": [
|
||||
{
|
||||
"name": "docs",
|
||||
}
|
||||
],
|
||||
"docs": [
|
||||
{
|
||||
"title": "Nest.js",
|
||||
"startUrl": "https://docs.nestjs.com/",
|
||||
},
|
||||
]
|
||||
}
|
||||
```
|
||||
</TabItem>
|
||||
</Tabs>
|
||||
|
||||
### Jetbrains minimal setup
|
||||
|
||||
Here is the equivalent minimal example for Jetbrains, which requires setting up an [embeddings provider](../model-types/embeddings.md). Pre-indexed docs will _not_ be accessible.
|
||||
Here is the equivalent minimal example for Jetbrains, which requires setting up an [embeddings provider](../model-types/embeddings.mdx). Pre-indexed docs will _not_ be accessible.
|
||||
|
||||
```json title="config.json"
|
||||
"contextProviders": [
|
||||
{
|
||||
"name": "docs",
|
||||
<Tabs groupId="config-example">
|
||||
<TabItem value="yaml" label="YAML">
|
||||
```yaml title="config.yaml"
|
||||
models:
|
||||
- name: LMStudio embedder
|
||||
provider: lmstudio
|
||||
model: nomic-ai/nomic-embed-text-v1.5-GGUF
|
||||
roles:
|
||||
- embed
|
||||
context:
|
||||
- provider: docs
|
||||
docs:
|
||||
- title: Nest.js
|
||||
startUrl: https://docs.nestjs.com/
|
||||
```
|
||||
</TabItem>
|
||||
<TabItem value="json" label="JSON">
|
||||
```json title="config.json"
|
||||
{
|
||||
"contextProviders": [
|
||||
{
|
||||
"name": "docs",
|
||||
}
|
||||
],
|
||||
"docs": [
|
||||
{
|
||||
"title": "Nest.js",
|
||||
"startUrl": "https://docs.nestjs.com/",
|
||||
},
|
||||
],
|
||||
"embeddingsProvider": {
|
||||
"provider": "lmstudio",
|
||||
"model": "nomic-ai/nomic-embed-text-v1.5-GGUF"
|
||||
}
|
||||
],
|
||||
"docs": [
|
||||
{
|
||||
"title": "Nest.js",
|
||||
"startUrl": "https://docs.nestjs.com/",
|
||||
},
|
||||
],
|
||||
"embeddingsProvider": {
|
||||
"provider": "lmstudio",
|
||||
"model": "nomic-ai/nomic-embed-text-v1.5-GGUF"
|
||||
},
|
||||
```
|
||||
}
|
||||
```
|
||||
</TabItem>
|
||||
</Tabs>
|
||||
|
||||
### Full-power setup (VS Code or Jetbrains)
|
||||
|
||||
|
|
@ -227,44 +328,79 @@ The following configuration example includes:
|
|||
- A reranker model available, with reranking parameters customized
|
||||
- A Github token to enable Github crawling
|
||||
|
||||
```json title="config.json"
|
||||
{
|
||||
"contextProviders": [
|
||||
{
|
||||
"name": "docs",
|
||||
"params": {
|
||||
"githubToken": "github_...",
|
||||
"nRetrieve": 25,
|
||||
"nFinal": 5,
|
||||
"useReranking": true
|
||||
<Tabs groupId="config-example">
|
||||
<TabItem value="yaml" label="YAML">
|
||||
```yaml title="config.yaml"
|
||||
models:
|
||||
- name: LMStudio Nomic Text
|
||||
provider: lmstudio
|
||||
model: nomic-ai/nomic-embed-text-v1.5-GGUF
|
||||
roles:
|
||||
- embed
|
||||
- name: Voyage Rerank-2
|
||||
provider: voyage
|
||||
apiKey: <VOYAGE_API_KEY>
|
||||
model: rerank-2
|
||||
roles:
|
||||
- rerank
|
||||
context:
|
||||
- provider: docs
|
||||
params:
|
||||
githubToken: <GITHUB_TOKEN>
|
||||
nRetrieve: 25
|
||||
nFinal: 5
|
||||
useReranking: true
|
||||
docs:
|
||||
- title: Nest.js
|
||||
startUrl: https://docs.nestjs.com/
|
||||
- title: My Private Docs
|
||||
startUrl: http://10.2.1.2/docs
|
||||
faviconUrl: http://10.2.1.2/docs/assets/favicon.ico
|
||||
maxDepth: 4
|
||||
useLocalCrawling: true
|
||||
```
|
||||
</TabItem>
|
||||
<TabItem value="json" label="JSON">
|
||||
```json title="config.json"
|
||||
{
|
||||
"contextProviders": [
|
||||
{
|
||||
"name": "docs",
|
||||
"params": {
|
||||
"githubToken": "github_...",
|
||||
"nRetrieve": 25,
|
||||
"nFinal": 5,
|
||||
"useReranking": true
|
||||
}
|
||||
}
|
||||
],
|
||||
"docs": [
|
||||
{
|
||||
"title": "Nest.js",
|
||||
"startUrl": "https://docs.nestjs.com/"
|
||||
},
|
||||
{
|
||||
"title": "My Private Docs",
|
||||
"startUrl": "http://10.2.1.2/docs",
|
||||
"faviconUrl": "http://10.2.1.2/docs/assets/favicon.ico",
|
||||
"maxDepth": 4,
|
||||
"useLocalCrawling": true
|
||||
}
|
||||
],
|
||||
"reranker": {
|
||||
"name": "voyage",
|
||||
"params": {
|
||||
"model": "rerank-2",
|
||||
"apiKey": "<YOUR_VOYAGE_API_KEY>"
|
||||
}
|
||||
}
|
||||
],
|
||||
"docs": [
|
||||
{
|
||||
"title": "Nest.js",
|
||||
"startUrl": "https://docs.nestjs.com/"
|
||||
},
|
||||
{
|
||||
"title": "My Private Docs",
|
||||
"startUrl": "http://10.2.1.2/docs",
|
||||
"faviconUrl": "http://10.2.1.2/docs/assets/favicon.ico",
|
||||
"maxDepth": 4,
|
||||
"useLocalCrawling": true
|
||||
"embeddingsProvider": {
|
||||
"provider": "lmstudio",
|
||||
"model": "nomic-ai/nomic-embed-text-v1.5-GGUF"
|
||||
}
|
||||
],
|
||||
"reranker": {
|
||||
"name": "voyage",
|
||||
"params": {
|
||||
"model": "rerank-2",
|
||||
"apiKey": "<VOYAGE_API_KEY>"
|
||||
}
|
||||
},
|
||||
"embeddingsProvider": {
|
||||
"provider": "lmstudio",
|
||||
"model": "nomic-ai/nomic-embed-text-v1.5-GGUF"
|
||||
}
|
||||
}
|
||||
```
|
||||
```
|
||||
</TabItem>
|
||||
</Tabs>
|
||||
|
||||
This could also involve enabling Chromium as a backup for local documentation the [User Settings Page](../settings.md).
|
||||
|
|
@ -16,7 +16,7 @@ Below is a quick example of setting up a prompt file to de
|
|||
2. Add a file called `rails.prompt` to this folder.
|
||||
3. Write the following contents to `rails.prompt` and save.
|
||||
|
||||
```
|
||||
```.prompt
|
||||
name: Rails Project
|
||||
description: Information about this project
|
||||
---
|
||||
|
|
@ -47,7 +47,7 @@ If you don't need any of these parameters, you can leave out the preamble and do
|
|||
|
||||
### Context
|
||||
|
||||
Many [context provider](../context-providers.md) can be referenced by typing "@" followed by the name of the context provider. The currently supported list is:
|
||||
Many [context provider](../context-providers.mdx) can be referenced by typing "@" followed by the name of the context provider. The currently supported list is:
|
||||
|
||||
- `@terminal` - The contents of the terminal
|
||||
- `@currentFile` - The currently active file
|
||||
|
|
|
|||
|
|
@ -1,60 +0,0 @@
|
|||
# Moonshot
|
||||
|
||||
[Moonshot AI](https://platform.moonshot.cn/) provides high-quality large language model services with competitive pricing and excellent performance.
|
||||
|
||||
## Configuration
|
||||
|
||||
To use Moonshot AI models, you need to:
|
||||
|
||||
1. Get an API key from [Moonshot AI Platform](https://platform.moonshot.cn/)
|
||||
2. Add the following configuration to your `config.json`:
|
||||
|
||||
```json
|
||||
{
|
||||
"models": [
|
||||
{
|
||||
"title": "Moonshot",
|
||||
"provider": "moonshot",
|
||||
"model": "moonshot-v1-8k",
|
||||
"apiKey": "YOUR_API_KEY"
|
||||
}
|
||||
]
|
||||
}
|
||||
```
|
||||
|
||||
## Available Models
|
||||
|
||||
Moonshot AI currently provides the following models:
|
||||
|
||||
- `moonshot-v1-8k`: Base model with 8K context window
|
||||
- `moonshot-v1-32k`: Base model with 32K context window
|
||||
- `moonshot-v1-128k`: Base model with 128K context window
|
||||
|
||||
## Configuration Options
|
||||
|
||||
| Option | Description | Default |
|
||||
|--------|-------------|---------|
|
||||
| `apiKey` | Moonshot API key | Required |
|
||||
| `apiBase` | API base URL | `https://api.moonshot.cn/v1/` |
|
||||
| `model` | Model name to use | `moonshot-v1-8k` |
|
||||
|
||||
## Example
|
||||
|
||||
Here's a complete configuration example:
|
||||
|
||||
```json
|
||||
{
|
||||
"models": [
|
||||
{
|
||||
"title": "Moonshot-8K",
|
||||
"provider": "moonshot",
|
||||
"model": "moonshot-v1-8k",
|
||||
"apiKey": "YOUR_API_KEY",
|
||||
"completionOptions": {
|
||||
"temperature": 0.7,
|
||||
"topP": 0.95,
|
||||
"maxTokens": 2048
|
||||
}
|
||||
}
|
||||
]
|
||||
}
|
||||
|
|
@ -1,18 +0,0 @@
|
|||
# SambaNova Cloud
|
||||
|
||||
The SambaNova Cloud is a cloud platform for running large AI models with the world record Llama 3.1 70B/405B performance. You can follow the instructions in [this blog post](https://sambanova.ai/blog/accelerating-coding-with-sambanova-cloud?ref=blog.continue.dev) to configure your setup.
|
||||
|
||||
```json title="config.json"
|
||||
{
|
||||
"models": [
|
||||
{
|
||||
"title": "SambaNova Llama 3.1 405B",
|
||||
"provider": "sambanova",
|
||||
"model": "llama3.1-405b",
|
||||
"apiKey": "YOUR_API_KEY"
|
||||
}
|
||||
]
|
||||
}
|
||||
```
|
||||
|
||||
[View the source](https://github.com/continuedev/continue/blob/main/core/llm/llms/SambaNova.ts)
|
||||
34
docs/docs/customize/model-providers/more/SambaNova.mdx
Normal file
34
docs/docs/customize/model-providers/more/SambaNova.mdx
Normal file
|
|
@ -0,0 +1,34 @@
|
|||
import Tabs from "@theme/Tabs";
|
||||
import TabItem from "@theme/TabItem";
|
||||
|
||||
# SambaNova Cloud
|
||||
|
||||
The SambaNova Cloud is a cloud platform for running large AI models with the world record Llama 3.1 70B/405B performance. You can follow the instructions in [this blog post](https://sambanova.ai/blog/accelerating-coding-with-sambanova-cloud?ref=blog.continue.dev) to configure your setup.
|
||||
|
||||
<Tabs groupId="config-example">
|
||||
<TabItem value="yaml" label="YAML">
|
||||
```yaml title="Package or config.yaml"
|
||||
models:
|
||||
- name: SambaNova Llama 3.1 405B
|
||||
provider: sambanova
|
||||
model: llama3.1-405b
|
||||
apiKey: <YOUR_SAMBANOVA_API_KEY>
|
||||
```
|
||||
</TabItem>
|
||||
<TabItem value="json" label="JSON">
|
||||
```json title="config.json"
|
||||
{
|
||||
"models": [
|
||||
{
|
||||
"title": "SambaNova Llama 3.1 405B",
|
||||
"provider": "sambanova",
|
||||
"model": "llama3.1-405b",
|
||||
"apiKey": "<YOUR_SAMBANOVA_API_KEY>"
|
||||
}
|
||||
]
|
||||
}
|
||||
```
|
||||
</TabItem>
|
||||
</Tabs>
|
||||
|
||||
[View the source](https://github.com/continuedev/continue/blob/main/core/llm/llms/SambaNova.ts)
|
||||
|
|
@ -1,75 +0,0 @@
|
|||
# Ask Sage
|
||||
|
||||
:::info
|
||||
|
||||
To get an Ask Sage API key login to the Ask Sage platform (If you don't have an account, you can create one [here](https://chat.asksage.ai/)) and follow the instructions in the Ask Sage Docs:[Ask Sage API Key](https://docs.asksage.ai/docs/api-documentation/api-documentation.html)
|
||||
|
||||
:::
|
||||
|
||||
## Configuration
|
||||
|
||||
To use the Ask Sage models, the following configuration is required to the `config.json` file:
|
||||
|
||||
```json
|
||||
{
|
||||
"models": [
|
||||
{
|
||||
"apiKey": "YOUR_API_KEY",
|
||||
"apiBase": "https://api.asksage.ai/server/", // apiBase will be the same for all models, but will vary based on tenant.
|
||||
"model": "gpt4-gov",
|
||||
"title": "GPT-4 gov",
|
||||
"provider": "askSage"
|
||||
}
|
||||
]
|
||||
}
|
||||
```
|
||||
|
||||
The `apiBase` will be listed on the Ask Sage platform when you generate an `API key`. You will see context as shown below:
|
||||
|
||||
> Server API for query/training etc.:
|
||||
> - Documentation: https://app.swaggerhub.com/apis-docs/NICOLASCHAILLAN_1/server_ask-sage_api/1.0
|
||||
> - URL for this API is: https://api.asksage.ai/server/
|
||||
|
||||
## Usage
|
||||
|
||||
Currently, the setup for the models provided by Ask Sage is to support the following two functionalities provided by Continue.Dev:
|
||||
|
||||
- `Chat` to understand and iterate on code in the sidebar
|
||||
- `Edit` to modify code without leaving your current file
|
||||
|
||||
More models, functionalities and documentation will be added in the future for Ask Sage Integration.
|
||||
|
||||
> We recommend to utilize the`OpenAI` or `Anthropic` models for the best performance and results for the `Chat` and `Edit` functionalities.
|
||||
|
||||
## Ask Sage Documentation
|
||||
Ask Sage documentation is not available with Continue.Dev, so if you have any questions or need help with Ask Sage type `@ask` and select the `Ask Sage` option in the chat. Then procced to ask your question about Ask Sage.
|
||||
|
||||
## Current Models From Ask Sage Supported
|
||||
|
||||
The current Models available provided by Ask Sage are:
|
||||
|
||||
| Index | Model | Added | Status |
|
||||
|-------|------------------------|-------|--------|
|
||||
| 1 | GPT-4 Gov | Yes | ✅ |
|
||||
| 2 | GPT-4o Gov | Yes | ✅ |
|
||||
| 3 | GPT-4o-mini Gov | Yes | ✅ |
|
||||
| 4 | GPT-3.5-Turbo Gov | Yes | ✅ |
|
||||
| 5 | GPT-4o | Yes | ✅ |
|
||||
| 6 | GPT-4o-mini | Yes | ✅ |
|
||||
| 7 | GPT-4 | Yes | ✅ |
|
||||
| 8 | GPT-4-32K | Yes | ✅ |
|
||||
| 9 | GPT-o1 | Yes | ✅ |
|
||||
| 10 | GPT-o1-mini | Yes | ✅ |
|
||||
| 10 | GPT-o3-mini | Yes | ✅ |
|
||||
| 11 | GPT-3.5-turbo | Yes | ✅ |
|
||||
| 12 | Calude 3.5 Sonnet Gov | Yes | ✅ |
|
||||
| 13 | Calude 3 Opus | Yes | ✅ |
|
||||
| 14 | Calude 3 Sonet | Yes | ✅ |
|
||||
| 15 | Calude 3.5 Sonnet | Yes | ✅ |
|
||||
| 16 | Grok (xAI) | Yes | ✅ |
|
||||
| 17 | Groq Llama 3.3 | Yes | ✅ |
|
||||
| 18 | Groq 70B | Yes | ✅ |
|
||||
| 19 | Gemini Pro | Yes | ✅ |
|
||||
| 20 | llama 3 | Yes | ✅ |
|
||||
| 21 | Mistral Large | Yes | ✅ |
|
||||
|
||||
91
docs/docs/customize/model-providers/more/asksage.mdx
Normal file
91
docs/docs/customize/model-providers/more/asksage.mdx
Normal file
|
|
@ -0,0 +1,91 @@
|
|||
# Ask Sage
|
||||
|
||||
import Tabs from "@theme/Tabs";
|
||||
import TabItem from "@theme/TabItem";
|
||||
|
||||
:::info
|
||||
To get an Ask Sage API key login to the Ask Sage platform (If you don't have an account, you can create one [here](https://chat.asksage.ai/)) and follow the instructions in the Ask Sage Docs:[Ask Sage API Key](https://docs.asksage.ai/docs/api-documentation/api-documentation.html)
|
||||
:::
|
||||
|
||||
## Configuration
|
||||
|
||||
To use the Ask Sage models, you can use the following
|
||||
|
||||
<Tabs groupId="config-example">
|
||||
<TabItem value="yaml" label="YAML">
|
||||
```yaml title="Package or config.yaml"
|
||||
models:
|
||||
- name: GPT-4 gov
|
||||
provider: askSage
|
||||
model: gpt4-gov
|
||||
apiBase: https://api.asksage.ai/server/
|
||||
apiKey: <YOUR_ASK_SAGE_API_KEY>
|
||||
```
|
||||
</TabItem>
|
||||
<TabItem value="json" label="JSON">
|
||||
```json title="config.json"
|
||||
{
|
||||
"models": [
|
||||
{
|
||||
"title": "GPT-4 gov",
|
||||
"provider": "askSage",
|
||||
"model": "gpt4-gov",
|
||||
"apiBase": "https://api.asksage.ai/server/",
|
||||
"apiKey": "<YOUR_ASK_SAGE_API_KEY>"
|
||||
}
|
||||
]
|
||||
}
|
||||
```
|
||||
</TabItem>
|
||||
</Tabs>
|
||||
|
||||
The `apiBase` will be listed on the Ask Sage platform when you generate an `API key`. You will see context as shown below:
|
||||
|
||||
> Server API for query/training etc.:
|
||||
>
|
||||
> - Documentation: https://app.swaggerhub.com/apis-docs/NICOLASCHAILLAN_1/server_ask-sage_api/1.0
|
||||
> - URL for this API is: https://api.asksage.ai/server/
|
||||
|
||||
## Usage
|
||||
|
||||
Currently, the setup for the models provided by Ask Sage is to support the following two functionalities provided by Continue.Dev:
|
||||
|
||||
- `Chat` to understand and iterate on code in the sidebar
|
||||
- `Edit` to modify code without leaving your current file
|
||||
|
||||
More models, functionalities and documentation will be added in the future for Ask Sage Integration.
|
||||
|
||||
> We recommend to utilize the`OpenAI` or `Anthropic` models for the best performance and results for the `Chat` and `Edit` functionalities.
|
||||
|
||||
## Ask Sage Documentation
|
||||
|
||||
Ask Sage documentation is not available with Continue.Dev, so if you have any questions or need help with Ask Sage type `@ask` and select the `Ask Sage` option in the chat. Then procced to ask your question about Ask Sage.
|
||||
|
||||
## Current Models From Ask Sage Supported
|
||||
|
||||
The current Models available provided by Ask Sage are:
|
||||
|
||||
| Index | Model | Added |
|
||||
| ----- | --------------------- | ----- |
|
||||
| 1 | GPT-4 Gov | ✅ |
|
||||
| 2 | GPT-4o Gov | ✅ |
|
||||
| 3 | GPT-4o-mini Gov | ✅ |
|
||||
| 4 | GPT-3.5-Turbo Gov | ✅ |
|
||||
| 5 | GPT-4o | ✅ |
|
||||
| 6 | GPT-4o-mini | ✅ |
|
||||
| 7 | GPT-4 | ✅ |
|
||||
| 8 | GPT-4-32K | ✅ |
|
||||
| 9 | GPT-o1 | ✅ |
|
||||
| 10 | GPT-o1-mini | ✅ |
|
||||
| 10 | GPT-o3-mini | ✅ |
|
||||
| 11 | GPT-3.5-turbo | ✅ |
|
||||
| 12 | Claude 3.5 Sonnet Gov | ✅ |
|
||||
| 13 | Claude 3 Opus | ✅ |
|
||||
| 14 | Claude 3 Sonet | ✅ |
|
||||
| 15 | Claude 3.5 Sonnet | ✅ |
|
||||
| 16 | Grok (xAI) | ✅ |
|
||||
| 17 | Groq Llama 3.3 | ✅ |
|
||||
| 18 | Groq 70B | ✅ |
|
||||
| 19 | Gemini Pro | ✅ |
|
||||
| 20 | llama 3 | ✅ |
|
||||
| 21 | Mistral Large | ✅ |
|
||||
|
|
@ -1,20 +0,0 @@
|
|||
# Cerebras Inference
|
||||
|
||||
Cerebras Inference uses specialized silicon to provides fast inference.
|
||||
|
||||
1. Create an account in the portal [here](https://cloud.cerebras.ai/).
|
||||
2. Create and copy the API key for use in Continue.
|
||||
3. Update your Continue config file:
|
||||
|
||||
```json title="config.json"
|
||||
{
|
||||
"models": [
|
||||
{
|
||||
"title": "Cerebras Llama 3.1 70B",
|
||||
"provider": "cerebras",
|
||||
"model": "llama3.1-70b",
|
||||
"apiKey": "YOUR_API_KEY"
|
||||
}
|
||||
]
|
||||
}
|
||||
```
|
||||
36
docs/docs/customize/model-providers/more/cerebras.mdx
Normal file
36
docs/docs/customize/model-providers/more/cerebras.mdx
Normal file
|
|
@ -0,0 +1,36 @@
|
|||
# Cerebras Inference
|
||||
|
||||
import Tabs from "@theme/Tabs";
|
||||
import TabItem from "@theme/TabItem";
|
||||
|
||||
Cerebras Inference uses specialized silicon to provides fast inference.
|
||||
|
||||
1. Create an account in the portal [here](https://cloud.cerebras.ai/).
|
||||
2. Create and copy the API key for use in Continue.
|
||||
3. Update your Continue config file:
|
||||
|
||||
<Tabs groupId="config-example">
|
||||
<TabItem value="yaml" label="YAML">
|
||||
```yaml title="Package or config.yaml"
|
||||
models:
|
||||
- name: Cerebras Llama 3.1 70B
|
||||
provider: cerebras
|
||||
model: llama3.1-70b
|
||||
apiKey: <YOUR_CEREBRAS_API_KEY>
|
||||
```
|
||||
</TabItem>
|
||||
<TabItem value="json" label="JSON">
|
||||
```json title="config.json"
|
||||
{
|
||||
"models": [
|
||||
{
|
||||
"title": "Cerebras Llama 3.1 70B",
|
||||
"provider": "cerebras",
|
||||
"model": "llama3.1-70b",
|
||||
"apiKey": "<YOUR_CEREBRAS_API_KEY>"
|
||||
}
|
||||
]
|
||||
}
|
||||
```
|
||||
</TabItem>
|
||||
</Tabs>
|
||||
|
|
@ -1,46 +0,0 @@
|
|||
# Cloudflare Workers AI
|
||||
|
||||
Cloudflare Workers AI can be used for both chat and tab autocompletion in Continue. To setup Cloudflare Workers AI, add the following to your `config.json` file:
|
||||
|
||||
```json title="config.json"
|
||||
{
|
||||
"models": [
|
||||
{
|
||||
"accountId": "YOUR CLOUDFLARE ACCOUNT ID",
|
||||
"apiKey": "YOUR CLOUDFLARE API KEY",
|
||||
"contextLength": 2400,
|
||||
"completionOptions": {
|
||||
"maxTokens": 500
|
||||
},
|
||||
"model": "@cf/meta/llama-3-8b-instruct", // This can be the name of any model supported by Workers AI
|
||||
"provider": "cloudflare",
|
||||
"title": "Llama 3 8B"
|
||||
},
|
||||
{
|
||||
"accountId": "YOUR CLOUDFLARE ACCOUNT ID",
|
||||
"apiKey": "YOUR CLOUDFLARE API KEY",
|
||||
"contextLength": 2400,
|
||||
"completionOptions": {
|
||||
"maxTokens": 500
|
||||
},
|
||||
"model": "@hf/thebloke/deepseek-coder-6.7b-instruct-awq",
|
||||
"provider": "cloudflare",
|
||||
"title": "DeepSeek Coder 6.7b Instruct"
|
||||
}
|
||||
...
|
||||
"tabAutocompleteModel": {
|
||||
"accountId": "YOUR CLOUDFLARE ACCOUNT ID",
|
||||
"apiKey": "YOUR CLOUDFLARE API KEY",
|
||||
"model": "@hf/thebloke/deepseek-coder-6.7b-base-awq",
|
||||
"provider": "cloudflare",
|
||||
"title": "DeepSeek 7b"
|
||||
},
|
||||
]
|
||||
}
|
||||
```
|
||||
|
||||
Visit the [Cloudflare dashboard](https://dash.cloudflare.com/) to [create an API key](https://developers.cloudflare.com/fundamentals/api/get-started/create-token/).
|
||||
|
||||
Review [available models](https://developers.cloudflare.com/workers-ai/models/) on Workers AI
|
||||
|
||||
[View the source](https://github.com/continuedev/continue/blob/main/core/llm/llms/Cloudflare.ts)
|
||||
84
docs/docs/customize/model-providers/more/cloudflare.mdx
Normal file
84
docs/docs/customize/model-providers/more/cloudflare.mdx
Normal file
|
|
@ -0,0 +1,84 @@
|
|||
import Tabs from "@theme/Tabs";
|
||||
import TabItem from "@theme/TabItem";
|
||||
|
||||
# Cloudflare Workers AI
|
||||
|
||||
Cloudflare Workers AI can be used for both chat and tab autocompletion in Continue. Here is an example of Cloudflare Workers AI configuration:
|
||||
|
||||
<Tabs groupId="config-example">
|
||||
<TabItem value="yaml" label="YAML">
|
||||
```yaml title="config.yaml"
|
||||
models:
|
||||
- name: Llama 3 8B
|
||||
provider: cloudflare
|
||||
accountId: YOUR CLOUDFLARE ACCOUNT ID
|
||||
apiKey: <YOUR_CLOUDFARE_API_KEY>
|
||||
model: "@cf/meta/llama-3-8b-instruct"
|
||||
contextLength: 2400
|
||||
defaultCompletionOptions:
|
||||
maxTokens: 500
|
||||
roles:
|
||||
- chat
|
||||
- name: DeepSeek Coder 6.7b Instruct
|
||||
provider: cloudflare
|
||||
accountId: YOUR CLOUDFLARE ACCOUNT ID
|
||||
apiKey: <YOUR_CLOUDFARE_API_KEY>
|
||||
model: "@hf/thebloke/deepseek-coder-6.7b-instruct-awq"
|
||||
contextLength: 2400
|
||||
defaultCompletionOptions:
|
||||
maxTokens: 500
|
||||
roles:
|
||||
- chat
|
||||
- name: DeepSeek 7b
|
||||
provider: cloudflare
|
||||
accountId: YOUR CLOUDFLARE ACCOUNT ID
|
||||
apiKey: <YOUR_CLOUDFARE_API_KEY>
|
||||
model: "@hf/thebloke/deepseek-coder-6.7b-base-awq"
|
||||
roles:
|
||||
- autocomplete
|
||||
```
|
||||
</TabItem>
|
||||
<TabItem value="json" label="JSON">
|
||||
```json title="config.json"
|
||||
{
|
||||
"models": [
|
||||
{
|
||||
"title": "Llama 3 8B",
|
||||
"provider": "cloudflare",
|
||||
"accountId": "YOUR CLOUDFLARE ACCOUNT ID",
|
||||
"apiKey": "YOUR CLOUDFLARE API KEY",
|
||||
"contextLength": 2400,
|
||||
"completionOptions": {
|
||||
"maxTokens": 500
|
||||
},
|
||||
"model": "@cf/meta/llama-3-8b-instruct"
|
||||
},
|
||||
{
|
||||
"title": "DeepSeek Coder 6.7b Instruct",
|
||||
"provider": "cloudflare",
|
||||
"accountId": "YOUR CLOUDFLARE ACCOUNT ID",
|
||||
"apiKey": "YOUR CLOUDFLARE API KEY",
|
||||
"contextLength": 2400,
|
||||
"completionOptions": {
|
||||
"maxTokens": 500
|
||||
},
|
||||
"model": "@hf/thebloke/deepseek-coder-6.7b-instruct-awq"
|
||||
}
|
||||
],
|
||||
"tabAutocompleteModel": {
|
||||
"title": "DeepSeek 7b",
|
||||
"provider": "cloudflare",
|
||||
"accountId": "YOUR CLOUDFLARE ACCOUNT ID",
|
||||
"apiKey": "YOUR CLOUDFLARE API KEY",
|
||||
"model": "@hf/thebloke/deepseek-coder-6.7b-base-awq"
|
||||
}
|
||||
}
|
||||
```
|
||||
</TabItem>
|
||||
</Tabs>
|
||||
|
||||
Visit the [Cloudflare dashboard](https://dash.cloudflare.com/) to [create an API key](https://developers.cloudflare.com/fundamentals/api/get-started/create-token/).
|
||||
|
||||
Review [available models](https://developers.cloudflare.com/workers-ai/models/) on Workers AI
|
||||
|
||||
[View the source](https://github.com/continuedev/continue/blob/main/core/llm/llms/Cloudflare.ts)
|
||||
|
|
@ -1,56 +0,0 @@
|
|||
# Cohere
|
||||
|
||||
Before using Cohere, visit the [Cohere dashboard](https://dashboard.cohere.com/api-keys) to create an API key.
|
||||
|
||||
## Chat model
|
||||
|
||||
We recommend configuring **Command-R Plus** as your chat model.
|
||||
|
||||
```json title="config.json"
|
||||
{
|
||||
"models": [
|
||||
{
|
||||
"title": "Cohere",
|
||||
"provider": "cohere",
|
||||
"model": "command-r-plus",
|
||||
"apiKey": "YOUR_API_KEY"
|
||||
}
|
||||
]
|
||||
}
|
||||
```
|
||||
|
||||
## Autocomplete model
|
||||
|
||||
Cohere currently does not offer any autocomplete models.
|
||||
|
||||
[Click here](../../model-types/autocomplete.md) to see a list of autocomplete model providers.
|
||||
|
||||
## Embeddings model
|
||||
|
||||
We recommend configuring **embed-english-v3.0** as your embeddings model.
|
||||
|
||||
```json title="config.json"
|
||||
{
|
||||
"embeddingsProvider": {
|
||||
"provider": "cohere",
|
||||
"model": "embed-english-v3.0",
|
||||
"apiKey": "<COHERE_API_KEY>"
|
||||
}
|
||||
}
|
||||
```
|
||||
|
||||
## Reranking model
|
||||
|
||||
We recommend configuring **rerank-english-v3.0** as your reranking model.
|
||||
|
||||
```json title="config.json"
|
||||
{
|
||||
"reranker": {
|
||||
"name": "cohere",
|
||||
"params": {
|
||||
"model": "rerank-english-v3.0",
|
||||
"apiKey": "<COHERE_API_KEY>"
|
||||
}
|
||||
}
|
||||
}
|
||||
```
|
||||
102
docs/docs/customize/model-providers/more/cohere.mdx
Normal file
102
docs/docs/customize/model-providers/more/cohere.mdx
Normal file
|
|
@ -0,0 +1,102 @@
|
|||
import Tabs from "@theme/Tabs";
|
||||
import TabItem from "@theme/TabItem";
|
||||
|
||||
# Cohere
|
||||
|
||||
Before using Cohere, visit the [Cohere dashboard](https://dashboard.cohere.com/api-keys) to create an API key.
|
||||
|
||||
## Chat model
|
||||
|
||||
We recommend configuring **Command-R Plus** as your chat model.
|
||||
|
||||
<Tabs groupId="config-example">
|
||||
<TabItem value="yaml" label="YAML">
|
||||
```yaml title="Package or config.yaml"
|
||||
models:
|
||||
- name: Cohere
|
||||
provider: cohere
|
||||
model: command-r-plus
|
||||
apiKey: <YOUR_COHERE_API_KEY>
|
||||
```
|
||||
</TabItem>
|
||||
<TabItem value="json" label="JSON">
|
||||
```json title="config.json"
|
||||
{
|
||||
"models": [
|
||||
{
|
||||
"title": "Cohere",
|
||||
"provider": "cohere",
|
||||
"model": "command-r-plus",
|
||||
"apiKey": "<YOUR_COHERE_API_KEY>"
|
||||
}
|
||||
]
|
||||
}
|
||||
```
|
||||
</TabItem>
|
||||
</Tabs>
|
||||
|
||||
## Autocomplete model
|
||||
|
||||
Cohere currently does not offer any autocomplete models.
|
||||
|
||||
[Click here](../../model-types/autocomplete.md) to see a list of autocomplete model providers.
|
||||
|
||||
## Embeddings model
|
||||
|
||||
We recommend configuring **embed-english-v3.0** as your embeddings model.
|
||||
|
||||
<Tabs groupId="config-example">
|
||||
<TabItem value="yaml" label="YAML">
|
||||
```yaml title="config.yaml"
|
||||
models:
|
||||
- name: Cohere Embed
|
||||
provider: cohere
|
||||
model: embed-english-v3.0
|
||||
apiKey: <YOUR_COHERE_API_KEY>
|
||||
roles:
|
||||
- embed
|
||||
```
|
||||
</TabItem>
|
||||
<TabItem value="json" label="JSON">
|
||||
```json title="config.json"
|
||||
{
|
||||
"embeddingsProvider": {
|
||||
"provider": "cohere",
|
||||
"model": "embed-english-v3.0",
|
||||
"apiKey": "<YOUR_COHERE_API_KEY>"
|
||||
}
|
||||
}
|
||||
```
|
||||
</TabItem>
|
||||
</Tabs>
|
||||
|
||||
## Reranking model
|
||||
|
||||
We recommend configuring **rerank-english-v3.0** as your reranking model.
|
||||
|
||||
<Tabs groupId="config-example">
|
||||
<TabItem value="yaml" label="YAML">
|
||||
```yaml title="config.yaml"
|
||||
models:
|
||||
- name: Cohere Reranker
|
||||
provider: cohere
|
||||
model: rerank-english-v3.0
|
||||
apiKey: <YOUR_COHERE_API_KEY>
|
||||
roles:
|
||||
- rerank
|
||||
```
|
||||
</TabItem>
|
||||
<TabItem value="json" label="JSON">
|
||||
```json title="config.json"
|
||||
{
|
||||
"reranker": {
|
||||
"name": "cohere",
|
||||
"params": {
|
||||
"model": "rerank-english-v3.0",
|
||||
"apiKey": "<YOUR_COHERE_API_KEY>"
|
||||
}
|
||||
}
|
||||
}
|
||||
```
|
||||
</TabItem>
|
||||
</Tabs>
|
||||
|
|
@ -1,18 +0,0 @@
|
|||
# DeepInfra
|
||||
|
||||
[DeepInfra](https://deepinfra.com) provides inference for open-source models at very low cost. To get started with DeepInfra, obtain your API key [here](https://deepinfra.com/dash). Then, find the model you want to use [here](https://deepinfra.com/models?type=text-generation) and copy the name of the model. Continue can then be configured to use the `DeepInfra` LLM class, like the example here:
|
||||
|
||||
```json title="config.json"
|
||||
{
|
||||
"models": [
|
||||
{
|
||||
"provider": "deepinfra",
|
||||
"title": "DeepInfra",
|
||||
"model": "mistralai/Mixtral-8x7B-Instruct-v0.1",
|
||||
"apiKey": "<API_KEY>"
|
||||
}
|
||||
]
|
||||
}
|
||||
```
|
||||
|
||||
[View the source](https://github.com/continuedev/continue/blob/main/core/llm/llms/DeepInfra.ts)
|
||||
34
docs/docs/customize/model-providers/more/deepinfra.mdx
Normal file
34
docs/docs/customize/model-providers/more/deepinfra.mdx
Normal file
|
|
@ -0,0 +1,34 @@
|
|||
import Tabs from "@theme/Tabs";
|
||||
import TabItem from "@theme/TabItem";
|
||||
|
||||
# DeepInfra
|
||||
|
||||
[DeepInfra](https://deepinfra.com) provides inference for open-source models at very low cost. To get started with DeepInfra, obtain your API key [here](https://deepinfra.com/dash). Then, find the model you want to use [here](https://deepinfra.com/models?type=text-generation) and copy the name of the model. Continue can then be configured to use the `DeepInfra` LLM class, like the example here:
|
||||
|
||||
<Tabs groupId="config-example">
|
||||
<TabItem value="yaml" label="YAML">
|
||||
```yaml title="config.yaml"
|
||||
models:
|
||||
- name: DeepInfra
|
||||
provider: deepinfra
|
||||
model: mistralai/Mixtral-8x7B-Instruct-v0.1
|
||||
apiKey: <YOUR_DEEP_INFRA_API_KEY>
|
||||
```
|
||||
</TabItem>
|
||||
<TabItem value="json" label="JSON">
|
||||
```json title="config.json"
|
||||
{
|
||||
"models": [
|
||||
{
|
||||
"provider": "deepinfra",
|
||||
"title": "DeepInfra",
|
||||
"model": "mistralai/Mixtral-8x7B-Instruct-v0.1",
|
||||
"apiKey": "<YOUR_DEEP_INFRA_API_KEY>"
|
||||
}
|
||||
]
|
||||
}
|
||||
```
|
||||
</TabItem>
|
||||
</Tabs>
|
||||
|
||||
[View the source](https://github.com/continuedev/continue/blob/main/core/llm/llms/DeepInfra.ts)
|
||||
|
|
@ -1,18 +0,0 @@
|
|||
# Flowise
|
||||
|
||||
[Flowise](https://flowiseai.com/) is a low-code/no-code drag & drop tool with the aim to make it easy for people to visualize and build LLM apps. Continue can then be configured to use the `Flowise` LLM class, like the example here:
|
||||
|
||||
```json title="config.json"
|
||||
{
|
||||
"models": [
|
||||
{
|
||||
"provider": "flowise",
|
||||
"title": "Flowise",
|
||||
"model": "<MODEL>",
|
||||
"apiBase": "<API_BASE>"
|
||||
}
|
||||
]
|
||||
}
|
||||
```
|
||||
|
||||
[View the source](https://github.com/continuedev/continue/blob/main/core/llm/llms/Flowise.ts)
|
||||
34
docs/docs/customize/model-providers/more/flowise.mdx
Normal file
34
docs/docs/customize/model-providers/more/flowise.mdx
Normal file
|
|
@ -0,0 +1,34 @@
|
|||
import Tabs from "@theme/Tabs";
|
||||
import TabItem from "@theme/TabItem";
|
||||
|
||||
# Flowise
|
||||
|
||||
[Flowise](https://flowiseai.com/) is a low-code/no-code drag & drop tool with the aim to make it easy for people to visualize and build LLM apps. Continue can then be configured to use the `Flowise` LLM class, like the example here:
|
||||
|
||||
<Tabs groupId="config-example">
|
||||
<TabItem value="yaml" label="YAML">
|
||||
```yaml title="Package or config.yaml"
|
||||
models:
|
||||
- name: Flowise
|
||||
provider: flowise
|
||||
model: <MODEL>
|
||||
apiBase: <API_BASE>
|
||||
```
|
||||
</TabItem>
|
||||
<TabItem value="json" label="JSON">
|
||||
```json title="config.json"
|
||||
{
|
||||
"models": [
|
||||
{
|
||||
"provider": "flowise",
|
||||
"title": "Flowise",
|
||||
"model": "<MODEL>",
|
||||
"apiBase": "<API_BASE>"
|
||||
}
|
||||
]
|
||||
}
|
||||
```
|
||||
</TabItem>
|
||||
</Tabs>
|
||||
|
||||
[View the source](https://github.com/continuedev/continue/blob/main/core/llm/llms/Flowise.ts)
|
||||
|
|
@ -3,12 +3,15 @@ title: Free Trial
|
|||
slug: ../free-trial
|
||||
---
|
||||
|
||||
import Tabs from "@theme/Tabs";
|
||||
import TabItem from "@theme/TabItem";
|
||||
|
||||
The `"free-trial"` provider lets new users quickly try out the best experience in Continue using our API keys through a secure proxy server. To prevent abuse, we will ask you to sign in with GitHub, which you can read more about below.
|
||||
|
||||
While the Continue extension is always free to use, we cannot support infinite free LLM usage for all of our users. You will eventually need to either:
|
||||
|
||||
1. Select an open-source model to use for free [locally](../top-level/ollama.md), or
|
||||
2. Add your own API key for [Anthropic](../top-level/anthropic.md) or [another LLM provider](/customize/model-providers)
|
||||
1. Select an open-source model to use for free [locally](../top-level/ollama.mdx), or
|
||||
2. Add your own API key for [Anthropic](../top-level/anthropic.mdx) or [another LLM provider](/customize/model-providers)
|
||||
|
||||
## FAQ about the trial
|
||||
|
||||
|
|
@ -1,67 +0,0 @@
|
|||
---
|
||||
title: Function Network
|
||||
slug: ../function-network
|
||||
---
|
||||
# Function Network
|
||||
|
||||
> Private, Affordable User-Owned AI
|
||||
|
||||
:::info
|
||||
|
||||
To get an API key, login to the Function Network Developer Platform. If you don't have an account, you can create one [here](https://www.function.network/join-waitlist).
|
||||
|
||||
:::
|
||||
|
||||
## Chat model
|
||||
|
||||
Function Network supports a number of models for chat. We recommend using LLama 3.1 70b or Qwen2.5-Coder-32B-Instruct.
|
||||
|
||||
```json title="config.json"
|
||||
{
|
||||
"models": [
|
||||
{
|
||||
"title": "Llama 3.1 70b",
|
||||
"provider": "function-network",
|
||||
"model": "meta/llama-3.1-70b-instruct",
|
||||
"apiKey": "YOUR_API_KEY"
|
||||
}
|
||||
]
|
||||
}
|
||||
```
|
||||
|
||||
[Click here](https://docs.function.network/models-supported/chat-and-code-completion) to see a list of chat model providers.
|
||||
|
||||
## Autocomplete model
|
||||
|
||||
Function Network supports a number of models for autocomplete. We recommend using Llama 3.1 8b or Qwen2.5-Coder-1.5B.
|
||||
|
||||
```json title="config.json"
|
||||
{
|
||||
"tabAutocompleteModel": {
|
||||
"title": "Deepseek Coder 6.7b",
|
||||
"provider": "function-network",
|
||||
"model": "thebloke/deepseek-coder-6.7b-base-awq",
|
||||
"apiKey": "YOUR_API_KEY"
|
||||
}
|
||||
}
|
||||
```
|
||||
|
||||
## Embeddings model
|
||||
|
||||
Function Network supports a number of models for embeddings. We recommend using baai/bge-base-en-v1.5.
|
||||
|
||||
```json title="config.json"
|
||||
{
|
||||
"embeddingsProvider": {
|
||||
"provider": "function-network",
|
||||
"model": "baai/bge-base-en-v1.5",
|
||||
"apiKey": "YOUR_API_KEY"
|
||||
}
|
||||
}
|
||||
```
|
||||
|
||||
[Click here](https://docs.function.network/models-supported/embeddings) to see a list of embeddings model providers.
|
||||
|
||||
## Reranking model
|
||||
|
||||
Function Network currently does not offer any reranking models.
|
||||
116
docs/docs/customize/model-providers/more/function-network.mdx
Normal file
116
docs/docs/customize/model-providers/more/function-network.mdx
Normal file
|
|
@ -0,0 +1,116 @@
|
|||
---
|
||||
title: Function Network
|
||||
slug: ../function-network
|
||||
---
|
||||
|
||||
import Tabs from "@theme/Tabs";
|
||||
import TabItem from "@theme/TabItem";
|
||||
|
||||
# Function Network
|
||||
|
||||
> Private, Affordable User-Owned AI
|
||||
|
||||
:::info
|
||||
|
||||
To get an API key, login to the Function Network Developer Platform. If you don't have an account, you can create one [here](https://www.function.network/join-waitlist).
|
||||
|
||||
:::
|
||||
|
||||
## Chat model
|
||||
|
||||
Function Network supports a number of models for chat. We recommend using LLama 3.1 70b or Qwen2.5-Coder-32B-Instruct.
|
||||
|
||||
<Tabs groupId="config-example">
|
||||
<TabItem value="yaml" label="YAML">
|
||||
```yaml title="Package or config.yaml"
|
||||
models:
|
||||
- name: Llama 3.1 70b
|
||||
provider: function-network
|
||||
model: meta/llama-3.1-70b-instruct
|
||||
apiKey: <YOUR_FUNCTION_NETWORK_API_KEY>
|
||||
roles:
|
||||
- chat
|
||||
```
|
||||
</TabItem>
|
||||
<TabItem value="json" label="JSON">
|
||||
```json title="config.json"
|
||||
{
|
||||
"models": [
|
||||
{
|
||||
"title": "Llama 3.1 70b",
|
||||
"provider": "function-network",
|
||||
"model": "meta/llama-3.1-70b-instruct",
|
||||
"apiKey": "<YOUR_FUNCTION_NETWORK_API_KEY>"
|
||||
}
|
||||
]
|
||||
}
|
||||
```
|
||||
</TabItem>
|
||||
</Tabs>
|
||||
|
||||
[Click here](https://docs.function.network/models-supported/chat-and-code-completion) to see a list of chat model providers.
|
||||
|
||||
## Autocomplete model
|
||||
|
||||
Function Network supports a number of models for autocomplete. We recommend using Llama 3.1 8b or Qwen2.5-Coder-1.5B.
|
||||
|
||||
<Tabs groupId="config-example">
|
||||
<TabItem value="yaml" label="YAML">
|
||||
```yaml title="Package or config.yaml"
|
||||
models:
|
||||
- name: Deepseek Coder 6.7b
|
||||
provider: function-network
|
||||
model: thebloke/deepseek-coder-6.7b-base-awq
|
||||
apiKey: <YOUR_FUNCTION_NETWORK_API_KEY>
|
||||
roles:
|
||||
- autocomplete
|
||||
```
|
||||
</TabItem>
|
||||
<TabItem value="json" label="JSON">
|
||||
```json title="config.json"
|
||||
{
|
||||
"tabAutocompleteModel": {
|
||||
"title": "Deepseek Coder 6.7b",
|
||||
"provider": "function-network",
|
||||
"model": "thebloke/deepseek-coder-6.7b-base-awq",
|
||||
"apiKey": "<YOUR_FUNCTION_NETWORK_API_KEY>"
|
||||
}
|
||||
}
|
||||
```
|
||||
</TabItem>
|
||||
</Tabs>
|
||||
|
||||
## Embeddings model
|
||||
|
||||
Function Network supports a number of models for embeddings. We recommend using baai/bge-base-en-v1.5.
|
||||
|
||||
<Tabs groupId="config-example">
|
||||
<TabItem value="yaml" label="YAML">
|
||||
```yaml title="config.yaml"
|
||||
models:
|
||||
- name: BGE Base En
|
||||
provider: function-network
|
||||
model: baai/bge-base-en-v1.5
|
||||
apiKey: <YOUR_FUNCTION_NETWORK_API_KEY>
|
||||
roles:
|
||||
- embed
|
||||
```
|
||||
</TabItem>
|
||||
<TabItem value="json" label="JSON">
|
||||
```json title="config.json"
|
||||
{
|
||||
"embeddingsProvider": {
|
||||
"provider": "function-network",
|
||||
"model": "baai/bge-base-en-v1.5",
|
||||
"apiKey": "<YOUR_FUNCTION_NETWORK_API_KEY>"
|
||||
}
|
||||
}
|
||||
```
|
||||
</TabItem>
|
||||
</Tabs>
|
||||
|
||||
[Click here](https://docs.function.network/models-supported/embeddings) to see a list of embeddings model providers.
|
||||
|
||||
## Reranking model
|
||||
|
||||
Function Network currently does not offer any reranking models.
|
||||
|
|
@ -1,25 +0,0 @@
|
|||
# Groq
|
||||
|
||||
:::info
|
||||
|
||||
Check if your chosen model is still supported by referring to the [model documentation](https://console.groq.com/docs/models). If a model has been deprecated, you may encounter a 404 error when attempting to use it.
|
||||
|
||||
:::
|
||||
|
||||
Groq provides the fastest available inference for open-source language models, including the entire Llama 3.1 family.
|
||||
|
||||
1. Obtain an API key [here](https://console.groq.com/keys)
|
||||
2. Update your Continue config file like this:
|
||||
|
||||
```json title="config.json"
|
||||
{
|
||||
"models": [
|
||||
{
|
||||
"title": "Llama 3.3 70b Versatile",
|
||||
"provider": "groq",
|
||||
"model": "llama-3.3-70b-versatile",
|
||||
"apiKey": "<API_KEY>"
|
||||
}
|
||||
]
|
||||
}
|
||||
```
|
||||
Some files were not shown because too many files have changed in this diff Show more
Loading…
Add table
Reference in a new issue