diff --git a/.changes/extensions/intellij/0.0.92.md b/.changes/extensions/intellij/0.0.92.md new file mode 100644 index 000000000..2d3774eec --- /dev/null +++ b/.changes/extensions/intellij/0.0.92.md @@ -0,0 +1,5 @@ +## 0.0.92 - 2025-02-26 +### Fixed +* Off-screen rendering to solve white flash on load and lack of changing cursor type +* OSR-related fixes for non-Mac users +* Fixes for inline edit in JetBrains diff --git a/.changes/extensions/intellij/1.0.0.md b/.changes/extensions/intellij/1.0.0.md new file mode 100644 index 000000000..43ea4a0ed --- /dev/null +++ b/.changes/extensions/intellij/1.0.0.md @@ -0,0 +1,7 @@ +## 1.0.0 - 2025-02-26 +### Added +* Introduces hub.continue.dev +* Improved theme matching +### Fixed +* Fixes interference between SonarQube and Continue autocomplete +* Numerous reliability improvements diff --git a/.changes/extensions/vscode/1.0.0.md b/.changes/extensions/vscode/1.0.0.md new file mode 100644 index 000000000..cea7899ff --- /dev/null +++ b/.changes/extensions/vscode/1.0.0.md @@ -0,0 +1,6 @@ +## 1.0.0 - 2025-02-26 +### Added +* Introduces hub.continue.dev +* Improved apply quality +### Fixed +* Numerous reliability improvements diff --git a/.changes/unreleased/Fixed-20241007-183820.yaml b/.changes/unreleased/Fixed-20241007-183820.yaml deleted file mode 100644 index f756e6f90..000000000 --- a/.changes/unreleased/Fixed-20241007-183820.yaml +++ /dev/null @@ -1,5 +0,0 @@ -project: extensions/intellij -kind: Fixed -body: Off-screen rendering to solve white flash on load and lack of changing cursor - type -time: 2024-10-07T18:38:20.733658-07:00 diff --git a/.changes/unreleased/Fixed-20241108-114322.yaml b/.changes/unreleased/Fixed-20241108-114322.yaml deleted file mode 100644 index e896eac4d..000000000 --- a/.changes/unreleased/Fixed-20241108-114322.yaml +++ /dev/null @@ -1,4 +0,0 @@ -project: extensions/intellij -kind: Fixed -body: OSR-related fixes for non-Mac users -time: 2024-11-08T11:43:22.623155-08:00 diff --git a/.changes/unreleased/Fixed-20241108-114707.yaml b/.changes/unreleased/Fixed-20241108-114707.yaml deleted file mode 100644 index 95c70c844..000000000 --- a/.changes/unreleased/Fixed-20241108-114707.yaml +++ /dev/null @@ -1,4 +0,0 @@ -project: extensions/intellij -kind: Fixed -body: Fixes for inline edit in JetBrains -time: 2024-11-08T11:47:07.953304-08:00 diff --git a/.continue/prompts/core-unit-test.prompt b/.continue/prompts/core-unit-test.prompt index 42ecef7bb..1a08945b4 100644 --- a/.continue/prompts/core-unit-test.prompt +++ b/.continue/prompts/core-unit-test.prompt @@ -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 diff --git a/.github/ISSUE_TEMPLATE/bug_report.yml b/.github/ISSUE_TEMPLATE/bug_report.yml index 93c04fe38..4a0595a38 100644 --- a/.github/ISSUE_TEMPLATE/bug_report.yml +++ b/.github/ISSUE_TEMPLATE/bug_report.yml @@ -27,16 +27,17 @@ body: - **Continue version**: v0.9.4 - **IDE version**: VSCode 1.85.1 - Model: Claude Sonnet 3.5 - - config.json: `{ "models": ... }` + - Assistant configuration value: | - OS: - Continue version: - IDE version: - Model: - - config.json: - ```json + - config: + ```yaml ``` + OR link to assistant in Continue hub: render: Markdown validations: required: false diff --git a/.github/workflows/jetbrains-release.yaml b/.github/workflows/jetbrains-release.yaml index 9b79be9c1..bf2fa74a6 100644 --- a/.github/workflows/jetbrains-release.yaml +++ b/.github/workflows/jetbrains-release.yaml @@ -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 @@ -31,7 +31,7 @@ jobs: - id: check working-directory: . run: | - if [[ "${{ github.event.release.tag_name }}" == v0.0.*-jetbrains ]]; then + if [[ "${{ github.event.release.tag_name }}" == v1.0.*-jetbrains ]]; then echo "should_run=true" >> $GITHUB_OUTPUT else echo "should_run=false" >> $GITHUB_OUTPUT @@ -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 diff --git a/.github/workflows/main.yaml b/.github/workflows/main.yaml index d10d58ef1..29965a305 100644 --- a/.github/workflows/main.yaml +++ b/.github/workflows/main.yaml @@ -20,7 +20,7 @@ jobs: - id: check working-directory: . run: | - if [[ "${{ github.event.release.tag_name }}" == v0.8.*-vscode ]]; then + if [[ "${{ github.event.release.tag_name }}" == v1.0.*-vscode ]]; then echo "should_run=true" >> $GITHUB_OUTPUT else echo "should_run=false" >> $GITHUB_OUTPUT @@ -208,7 +208,7 @@ jobs: runs-on: ubuntu-latest needs: - build - if: github.event.inputs.publish_build == 'true' + if: github.event_name != 'workflow_dispatch' || github.event.inputs.publish_build == 'true' permissions: contents: write steps: diff --git a/.github/workflows/pr_checks.yaml b/.github/workflows/pr_checks.yaml index 455a58428..258ec33e2 100644 --- a/.github/workflows/pr_checks.yaml +++ b/.github/workflows/pr_checks.yaml @@ -4,23 +4,12 @@ on: pull_request: branches: - main - paths: - - "extensions/intellij/**" - - "extensions/vscode/**" - - "core/**" - - "gui/**" - - ".github/workflows/**" - - "docs/**" + - staging push: branches: - main - paths: - - "extensions/intellij/**" - - "extensions/vscode/**" - - "core/**" - - "gui/**" - - ".github/workflows/**" + - staging jobs: install-root: @@ -291,6 +280,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 diff --git a/.github/workflows/preview.yaml b/.github/workflows/preview.yaml index 945f8d84b..7408cf76f 100644 --- a/.github/workflows/preview.yaml +++ b/.github/workflows/preview.yaml @@ -20,7 +20,7 @@ jobs: - id: check working-directory: . run: | - if [[ "${{ github.event.release.tag_name }}" == v0.9.*-vscode ]]; then + if [[ "${{ github.event.release.tag_name }}" == v1.1.*-vscode ]]; then echo "should_run=true" >> $GITHUB_OUTPUT else echo "should_run=false" >> $GITHUB_OUTPUT @@ -204,7 +204,7 @@ jobs: runs-on: ubuntu-latest needs: - build - if: github.event.inputs.publish_build == 'true' + if: github.event_name != 'workflow_dispatch' || github.event.inputs.publish_build == 'true' permissions: contents: write steps: @@ -217,8 +217,8 @@ jobs: git config --local user.email "action@github.com" git config --local user.name "GitHub Action" - - name: Pull latest changes - run: git pull origin main + - name: Pull latest changes from release + run: git fetch origin ${{ github.ref }} && git checkout ${{ github.ref }} # 1. Download the artifacts - uses: actions/download-artifact@v4 diff --git a/.vscode/launch.json b/.vscode/launch.json index 7a5161729..294429bcb 100644 --- a/.vscode/launch.json +++ b/.vscode/launch.json @@ -138,6 +138,25 @@ "env": { "NODE_OPTIONS": "--experimental-vm-modules" } + }, + { + "name": "[config-yaml] Jest Test Debugger, Current Open File", + "type": "node", + "request": "launch", + "runtimeArgs": [ + "--inspect-brk", + "${workspaceRoot}/packages/config-yaml/node_modules/jest/bin/jest.js", + "--runInBand", + "--config", + "${workspaceRoot}/packages/config-yaml/jest.config.mjs", + "${relativeFile}" + ], + "cwd": "${workspaceRoot}/packages/config-yaml", + "console": "integratedTerminal", + "internalConsoleOptions": "neverOpen", + "env": { + "NODE_OPTIONS": "--experimental-vm-modules" + } } ] } diff --git a/.vscode/settings.json b/.vscode/settings.json index dd446726a..397937afb 100644 --- a/.vscode/settings.json +++ b/.vscode/settings.json @@ -13,6 +13,9 @@ "args": ["-l"] } }, + "editor.codeActionsOnSave": { + "source.organizeImports": "explicit" + }, "editor.defaultFormatter": "esbenp.prettier-vscode", "search.exclude": { "**/package-lock.json": true, diff --git a/.vscode/tasks.json b/.vscode/tasks.json index e3250d80a..e40d9d054 100644 --- a/.vscode/tasks.json +++ b/.vscode/tasks.json @@ -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": [] } ] } diff --git a/CONTRIBUTING.md b/CONTRIBUTING.md index b69b1fd44..4f7e1634f 100644 --- a/CONTRIBUTING.md +++ b/CONTRIBUTING.md @@ -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 diff --git a/README.md b/README.md index 9751d618d..bdfa8533c 100644 --- a/README.md +++ b/README.md @@ -8,7 +8,7 @@
-**[Continue](https://docs.continue.dev) is the leading open-source AI code assistant. You can connect any models and any context to build custom autocomplete and chat experiences inside [VS Code](https://marketplace.visualstudio.com/items?itemName=Continue.continue) and [JetBrains](https://plugins.jetbrains.com/plugin/22707-continue-extension)** +**[Continue](https://docs.continue.dev) enables to developers to create, share, and use custom AI code assistants with our open-source [VS Code](https://marketplace.visualstudio.com/items?itemName=Continue.continue) and [JetBrains](https://plugins.jetbrains.com/plugin/22707-continue-extension) extensions and [hub of models, rules, prompts, docs, and other building blocks](https://hub.continue.dev)**
@@ -46,7 +46,7 @@ ## Actions -[Actions](https://continue.dev/docs/actions/how-to-use-it) are shortcuts for common use cases. +[Actions](https://continue.dev/docs/actions/how-to-use-it) are shortcuts for common use cases ![actions](docs/static/img/actions.gif) diff --git a/binary/build.js b/binary/build.js index 11aaf5c59..adc461396 100644 --- a/binary/build.js +++ b/binary/build.js @@ -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`); @@ -279,7 +285,7 @@ async function installNodeModuleInTempDirAndCopyToCurrent(packageName, toCopy) { // Informs the `continue-binary` of where to look for node_sqlite3.node // https://www.npmjs.com/package/bindings#:~:text=The%20searching%20for,file%20is%20found - // fs.writeFileSync(`${targetDir}/package.json`, ""); + fs.writeFileSync(`${targetDir}/package.json`, ""); } // Cleanup - this is needed when running locally diff --git a/binary/package-lock.json b/binary/package-lock.json index 72c044f14..ca7d26b85 100644 --- a/binary/package-lock.json +++ b/binary/package-lock.json @@ -48,13 +48,13 @@ "@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.24", + "@continuedev/config-yaml": "^1.0.52", "@continuedev/fetch": "^1.0.4", "@continuedev/llm-info": "^1.0.2", "@continuedev/openai-adapters": "^1.0.10", - "@modelcontextprotocol/sdk": "^1.0.0", + "@modelcontextprotocol/sdk": "^1.5.0", "@mozilla/readability": "^0.5.0", - "@octokit/rest": "^20.0.2", + "@octokit/rest": "^20.1.1", "@typescript-eslint/eslint-plugin": "^7.8.0", "@xenova/transformers": "2.14.0", "adf-to-md": "^1.1.0", @@ -107,7 +107,7 @@ "wink-nlp-utils": "^2.1.0", "workerpool": "^9.1.3", "yaml": "^2.4.2", - "zod": "^3.23.8" + "zod": "^3.24.2" }, "devDependencies": { "@babel/preset-env": "^7.24.7", @@ -2556,9 +2556,10 @@ } }, "node_modules/axios": { - "version": "1.6.8", - "resolved": "https://registry.npmjs.org/axios/-/axios-1.6.8.tgz", - "integrity": "sha512-v/ZHtJDU39mDpyBoFVkETcd/uNdxrWRrg3bKpOKzXFA6Bvqopts6ALSMU3y6ijYxbw2B+wPrIv46egTzJXCLGQ==", + "version": "1.7.9", + "resolved": "https://registry.npmjs.org/axios/-/axios-1.7.9.tgz", + "integrity": "sha512-LhLcE7Hbiryz8oMDdDptSrWowmB4Bl6RCt6sIJKpRB4XtVf0iEgewX3au/pJqm+Py1kCASkb/FFKjxQaLtxJvw==", + "license": "MIT", "dependencies": { "follow-redirects": "^1.15.6", "form-data": "^4.0.0", @@ -3166,10 +3167,11 @@ } }, "node_modules/cross-spawn": { - "version": "7.0.3", - "resolved": "https://registry.npmjs.org/cross-spawn/-/cross-spawn-7.0.3.tgz", - "integrity": "sha512-iRDPJKUPVEND7dHPO8rkbOnPpyDygcDFtWjpeWNCgy8WP2rXcxXL8TskReQl6OrB2G7+UJrags1q15Fudc7G6w==", + "version": "7.0.6", + "resolved": "https://registry.npmjs.org/cross-spawn/-/cross-spawn-7.0.6.tgz", + "integrity": "sha512-uV2QOWP2nWzsy2aMp8aRibhi9dlzF5Hgh5SHaB9OiTGEyDTiJJyx0uy51QXdyWbtAHNua4XJzUKca3OzKUd3vA==", "dev": true, + "license": "MIT", "dependencies": { "path-key": "^3.1.0", "shebang-command": "^2.0.0", @@ -5135,12 +5137,13 @@ } }, "node_modules/micromatch": { - "version": "4.0.5", - "resolved": "https://registry.npmjs.org/micromatch/-/micromatch-4.0.5.tgz", - "integrity": "sha512-DMy+ERcEW2q8Z2Po+WNXuw3c5YaUSFjAO5GsJqfEl7UjvtIuFKO6ZrKvcItdy98dwFI2N1tg3zNIdKaQT+aNdA==", + "version": "4.0.8", + "resolved": "https://registry.npmjs.org/micromatch/-/micromatch-4.0.8.tgz", + "integrity": "sha512-PXwfBhYu0hBCPw8Dn0E+WDYb7af3dSLVWKi3HGv84IdF4TyFoC0ysxFd0Goxw7nSv4T/PzEJQxsYsEiFCKo2BA==", "dev": true, + "license": "MIT", "dependencies": { - "braces": "^3.0.2", + "braces": "^3.0.3", "picomatch": "^2.3.1" }, "engines": { diff --git a/core/autocomplete/constants/AutocompleteLanguageInfo.ts b/core/autocomplete/constants/AutocompleteLanguageInfo.ts index d51fe1f1f..82b169677 100644 --- a/core/autocomplete/constants/AutocompleteLanguageInfo.ts +++ b/core/autocomplete/constants/AutocompleteLanguageInfo.ts @@ -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 { diff --git a/core/autocomplete/snippets/getAllSnippets.ts b/core/autocomplete/snippets/getAllSnippets.ts index fc6538b41..dce9c9ff4 100644 --- a/core/autocomplete/snippets/getAllSnippets.ts +++ b/core/autocomplete/snippets/getAllSnippets.ts @@ -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(promise: Promise): Promise { return Promise.race([promise, timeoutPromise]); } +class DiffSnippetsCache { + private cache: Map = new Map(); + private lastTimestamp: number = 0; + + public set(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 => { + 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)), ]); diff --git a/core/autocomplete/templating/AutocompleteTemplate.ts b/core/autocomplete/templating/AutocompleteTemplate.ts index 8f7bbd66d..2c8b12a31 100644 --- a/core/autocomplete/templating/AutocompleteTemplate.ts +++ b/core/autocomplete/templating/AutocompleteTemplate.ts @@ -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; } diff --git a/core/autocomplete/templating/filtering.ts b/core/autocomplete/templating/filtering.ts index c741dedc8..02dbade36 100644 --- a/core/autocomplete/templating/filtering.ts +++ b/core/autocomplete/templating/filtering.ts @@ -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; } diff --git a/core/autocomplete/util/AutocompleteLoggingService.ts b/core/autocomplete/util/AutocompleteLoggingService.ts index 7fd49cfaf..2e4d19844 100644 --- a/core/autocomplete/util/AutocompleteLoggingService.ts +++ b/core/autocomplete/util/AutocompleteLoggingService.ts @@ -1,4 +1,4 @@ -import { logDevData } from "../../util/devdata"; +import { DataLogger } from "../../data/log"; import { COUNT_COMPLETION_REJECTED_AFTER } from "../../util/parameters"; import { Telemetry } from "../../util/posthog"; import { getUriFileExtension } from "../../util/uri"; @@ -96,7 +96,14 @@ export class AutocompleteLoggingService { } private logAutocompleteOutcome(outcome: AutocompleteOutcome) { - logDevData("autocomplete", outcome); + void DataLogger.getInstance().logDevData({ + name: "autocomplete", + data: { + ...outcome, + useFileSuffix: true, // from outdated schema + }, + }); + const { prompt, completion, prefix, suffix, ...restOfOutcome } = outcome; void Telemetry.capture( "autocomplete", @@ -113,6 +120,7 @@ export class AutocompleteLoggingService { multilineCompletions: restOfOutcome.multilineCompletions, time: restOfOutcome.time, useRecentlyEdited: restOfOutcome.useRecentlyEdited, + numLines: restOfOutcome.numLines, }, true, ); diff --git a/core/commands/index.ts b/core/commands/index.ts index f4a0084da..72719d832 100644 --- a/core/commands/index.ts +++ b/core/commands/index.ts @@ -10,7 +10,7 @@ export function slashFromCustomCommand( return { name: customCommand.name, description: customCommand.description ?? "", - run: async function* ({ input, llm, history, ide }) { + run: async function* ({ input, llm, history, ide, completionOptions }) { // Remove slash command prefix from input let userInput = input; if (userInput.startsWith(`/${customCommand.name}`)) { @@ -20,11 +20,16 @@ export function slashFromCustomCommand( } // Render prompt template - const promptUserInput = await renderTemplatedString( - customCommand.prompt, - ide.readFile.bind(ide), - { input: userInput }, - ); + let promptUserInput: string; + if (customCommand.prompt.includes("{{{ input }}}")) { + promptUserInput = await renderTemplatedString( + customCommand.prompt, + ide.readFile.bind(ide), + { input: userInput }, + ); + } else { + promptUserInput = customCommand.prompt + "\n\n" + userInput; + } const messages = [...history]; // Find the last chat message with this slash command and replace it with the user input @@ -67,6 +72,7 @@ export function slashFromCustomCommand( for await (const chunk of llm.streamChat( messages, new AbortController().signal, + completionOptions, )) { yield renderChatMessage(chunk); } diff --git a/core/config/ConfigHandler.test.ts b/core/config/ConfigHandler.test.ts index deb1deded..eadaa137f 100644 --- a/core/config/ConfigHandler.test.ts +++ b/core/config/ConfigHandler.test.ts @@ -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 () => { diff --git a/core/config/ConfigHandler.ts b/core/config/ConfigHandler.ts index 4638613b9..b9a0f0896 100644 --- a/core/config/ConfigHandler.ts +++ b/core/config/ConfigHandler.ts @@ -1,11 +1,6 @@ import * as fs from "node:fs"; -import { - AssistantUnrolled, - ConfigResult, - FullSlug, -} from "@continuedev/config-yaml"; -import * as YAML from "yaml"; +import { ConfigResult, FullSlug } from "@continuedev/config-yaml"; import { ControlPlaneClient, @@ -27,7 +22,7 @@ import { localPathToUri } from "../util/pathToUri.js"; import { LOCAL_ONBOARDING_CHAT_MODEL, - ONBOARDING_LOCAL_MODEL_TITLE, + LOCAL_ONBOARDING_PROVIDER_TITLE, } from "./onboarding.js"; import ControlPlaneProfileLoader from "./profile/ControlPlaneProfileLoader.js"; import LocalProfileLoader from "./profile/LocalProfileLoader.js"; @@ -36,7 +31,6 @@ import { ProfileDescription, ProfileLifecycleManager, } from "./ProfileLifecycleManager.js"; -import { clientRenderHelper } from "./yaml/clientRender.js"; export type { ProfileDescription }; @@ -47,71 +41,94 @@ type ConfigUpdateFunction = (payload: ConfigResult) => 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; + controlPlaneClient: ControlPlaneClient; + + initializedPromise: Promise; constructor( private readonly ide: IDE, private ideSettingsPromise: Promise, private readonly writeLog: (text: string) => Promise, - private controlPlaneClient: ControlPlaneClient, + sessionInfoPromise: Promise, ) { 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 in init: ", 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 +149,80 @@ 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, - this.ide, - this.ideSettingsPromise, - this.writeLog, - this.reloadConfig.bind(this), - ); + let profiles: ProfileLifecycleManager[] | null = null; + if (!userId) { + // Not logged in + profiles = [this.localProfileManager]; + } else { + // Logged in + const assistants = + await this.controlPlaneClient.listAssistants(selectedOrgId); - return new ProfileLifecycleManager(profileLoader, this.ide); - }), + const hubProfiles = assistants.map((assistant) => { + const profileLoader = new PlatformProfileLoader( + { + ...assistant.configResult, + config: assistant.configResult.config, + }, + assistant.ownerSlug, + assistant.packageSlug, + assistant.iconUrl, + assistant.configResult.config?.version ?? "latest", + this.controlPlaneClient, + this.ide, + this.ideSettingsPromise, + this.writeLog, + this.reloadConfig.bind(this), ); - 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, - ); - } - }) - .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(); + + // Check if the previously selected profile exists in the current profiles + const profileExists = profiles.some( + (profile) => + profile.profileDescription.id === previouslySelectedProfileId, + ); + + const selectedProfileId = profileExists + ? 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 +247,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 { + const workspaceId = await this.getWorkspaceId(); + const lastSelectedIds = + this.globalContext.get("lastSelectedProfileForWorkspace") ?? {}; + return lastSelectedIds[workspaceId] ?? null; + } + + async getSelectedOrgId(): Promise { + 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); @@ -334,21 +353,32 @@ export class ConfigHandler { Promise.resolve(sessionInfo), this.ideSettingsPromise, ); - this.fetchControlPlaneProfiles().catch((e) => { + this.fetchControlPlaneProfiles().catch(async (e) => { console.error("Failed to fetch control plane profiles: ", e); + await this.updateAvailableProfiles([this.localProfileManager]); + await this.reloadConfig(); }); } - 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 +395,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 +413,36 @@ export class ConfigHandler { } this.notifyConfigListeners({ config, errors, configLoadInterrupted }); - return { config, errors }; + return { config, errors, configLoadInterrupted }; } - getSerializedConfig(): Promise< + async getSerializedConfig(): Promise< ConfigResult > { - 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> { + if (!this.currentProfile) { + return { + config: undefined, + errors: [], + configLoadInterrupted: true, + }; + } return await this.currentProfile.loadConfig( this.additionalContextProviders, ); @@ -401,7 +452,7 @@ export class ConfigHandler { const { config } = await this.loadConfig(); const model = config?.models.find((m) => m.title === title); if (!model) { - if (title === ONBOARDING_LOCAL_MODEL_TITLE) { + if (title === LOCAL_ONBOARDING_PROVIDER_TITLE) { // Special case, make calls to Ollama before we have it in the config const ollama = new Ollama({ model: LOCAL_ONBOARDING_CHAT_MODEL, diff --git a/core/config/ProfileLifecycleManager.ts b/core/config/ProfileLifecycleManager.ts index 9fc3dc960..deaf5f40e 100644 --- a/core/config/ProfileLifecycleManager.ts +++ b/core/config/ProfileLifecycleManager.ts @@ -27,6 +27,7 @@ export interface OrganizationDescription { id: string; iconUrl: string; name: string; + slug: string | undefined; // TODO: This doesn't need to be undefined, just doing while transitioning the backend } export class ProfileLifecycleManager { diff --git a/core/config/default.ts b/core/config/default.ts index 23e709603..8c349a13b 100644 --- a/core/config/default.ts +++ b/core/config/default.ts @@ -82,10 +82,12 @@ export const defaultConfig: SerializedContinueConfig = { models: [], contextProviders: defaultContextProvidersVsCode, slashCommands: defaultSlashCommandsVscode, + data: [], }; export const defaultConfigJetBrains: SerializedContinueConfig = { models: [], contextProviders: defaultContextProvidersJetBrains, slashCommands: defaultSlashCommandsJetBrains, + data: [], }; diff --git a/core/config/load.ts b/core/config/load.ts index da95ec5a8..1d29124d6 100644 --- a/core/config/load.ts +++ b/core/config/load.ts @@ -18,6 +18,7 @@ import { EmbeddingsProviderDescription, IContextProvider, IDE, + IdeInfo, IdeSettings, IdeType, ILLM, @@ -62,7 +63,13 @@ import { getEsbuildBinaryPath, } from "../util/paths"; -import { ConfigResult, ConfigValidationError } from "@continuedev/config-yaml"; +import { + ConfigResult, + ConfigValidationError, + ModelRole, +} from "@continuedev/config-yaml"; +import { useHub } from "../control-plane/env"; +import { localPathToUri } from "../util/pathToUri"; import { defaultContextProvidersJetBrains, defaultContextProvidersVsCode, @@ -70,9 +77,8 @@ import { defaultSlashCommandsVscode, } from "./default"; import { getSystemPromptDotFile } from "./getSystemPromptDotFile"; -import { useHub } from "../control-plane/env"; -import { localPathToUri } from "../util/pathToUri"; -import { modifyContinueConfigWithSharedConfig } from "./sharedConfig"; +import { modifyAnyConfigWithSharedConfig } from "./sharedConfig"; +import { getModelByRole } from "./util"; import { validateConfig } from "./validation.js"; export function resolveSerializedConfig( @@ -238,6 +244,7 @@ async function intermediateToFinalConfig( config: Config, ide: IDE, ideSettings: IdeSettings, + ideInfo: IdeInfo, uniqueId: string, writeLog: (log: string) => Promise, workOsAccessToken: string | undefined, @@ -326,6 +333,7 @@ async function intermediateToFinalConfig( ...model.requestOptions, ...config.requestOptions, }; + model.roles = model.roles ?? ["chat", "apply", "edit", "summarize"]; // Default to chat role if not specified } if (allowFreeTrial) { @@ -435,23 +443,28 @@ async function intermediateToFinalConfig( } // Embeddings Provider - const embeddingsProviderDescription = config.embeddingsProvider as - | EmbeddingsProviderDescription - | undefined; - if (embeddingsProviderDescription?.provider) { - const { provider, ...options } = embeddingsProviderDescription; + function getEmbeddingsILLM( + embedConfig: EmbeddingsProviderDescription | ILLM | undefined, + ): ILLM | null { + if (!embedConfig) { + return null; + } + if ("providerName" in embedConfig) { + return embedConfig; + } + const { provider, ...options } = embedConfig; const embeddingsProviderClass = allEmbeddingsProviders[provider]; if (embeddingsProviderClass) { if ( embeddingsProviderClass.name === "_TransformersJsEmbeddingsProvider" ) { - config.embeddingsProvider = new embeddingsProviderClass(); + return new embeddingsProviderClass(); } else { const llmOptions: LLMOptions = { model: options.model ?? "UNSPECIFIED", ...options, }; - config.embeddingsProvider = new embeddingsProviderClass( + return new embeddingsProviderClass( llmOptions, (url: string | URL, init: any) => fetchwithRequestOptions(url, init, { @@ -460,42 +473,74 @@ async function intermediateToFinalConfig( }), ); } + } else { + errors.push({ + fatal: false, + message: `Embeddings provider ${provider} not found. Using default`, + }); } + return null; } - - if (!config.embeddingsProvider) { - config.embeddingsProvider = new TransformersJsEmbeddingsProvider(); - } + const newEmbedder = getEmbeddingsILLM(config.embeddingsProvider); // Reranker - if (config.reranker && !(config.reranker as ILLM | undefined)?.rerank) { + function getRerankingILLM( + rerankingConfig: ILLM | RerankerDescription | undefined, + ): ILLM | null { + if (!rerankingConfig) { + return null; + } + if ("providerName" in rerankingConfig) { + return rerankingConfig; + } const { name, params } = config.reranker as RerankerDescription; const rerankerClass = AllRerankers[name]; if (name === "llm") { const llm = models.find((model) => model.title === params?.modelTitle); if (!llm) { - console.warn(`Unknown model ${params?.modelTitle}`); + errors.push({ + fatal: false, + message: `Unknown reranking model ${params?.modelTitle}`, + }); + return null; } else { - config.reranker = new LLMReranker(llm); + return new LLMReranker(llm); } } else if (rerankerClass) { const llmOptions: LLMOptions = { model: "rerank-2", ...params, }; - config.reranker = new rerankerClass(llmOptions); + return new rerankerClass(llmOptions); } + return null; } + const newReranker = getRerankingILLM(config.reranker); - let continueConfig: ContinueConfig = { + const continueConfig: ContinueConfig = { ...config, contextProviders, models, - embeddingsProvider: config.embeddingsProvider as any, - tabAutocompleteModels, - reranker: config.reranker as any, tools: allTools, + modelsByRole: { + chat: models, + edit: models, + apply: models, + summarize: models, + autocomplete: [...tabAutocompleteModels], + embed: newEmbedder ? [newEmbedder] : [], + rerank: newReranker ? [newReranker] : [], + }, + selectedModelByRole: { + chat: null, // Not implemented (uses GUI defaultModel) + edit: null, + apply: null, + embed: newEmbedder ?? null, + autocomplete: null, + rerank: newReranker ?? null, + summarize: null, // Not implemented + }, }; // Apply MCP if specified @@ -517,6 +562,8 @@ async function intermediateToFinalConfig( continueConfig, mcpId, abortController.signal, + "MCP Server", + server.faviconUrl, ); if (mcpError) { errors.push(mcpError); @@ -535,47 +582,112 @@ async function intermediateToFinalConfig( ); } + // Handle experimental modelRole config values for apply and edit + const inlineEditModel = getModelByRole(continueConfig, "inlineEdit")?.title; + if (inlineEditModel) { + const match = continueConfig.models.find( + (m) => m.title === inlineEditModel, + ); + if (match) { + continueConfig.selectedModelByRole.edit = match; + continueConfig.modelsByRole.edit = [match]; // The only option if inlineEdit role is set + } else { + errors.push({ + fatal: false, + message: `experimental.modelRoles.inlineEdit model title ${inlineEditModel} not found in models array`, + }); + } + } + + const applyBlockModel = getModelByRole( + continueConfig, + "applyCodeBlock", + )?.title; + if (applyBlockModel) { + const match = continueConfig.models.find( + (m) => m.title === applyBlockModel, + ); + if (match) { + continueConfig.selectedModelByRole.apply = match; + continueConfig.modelsByRole.apply = [match]; // The only option if applyCodeBlock role is set + } else { + errors.push({ + fatal: false, + message: `experimental.modelRoles.applyCodeBlock model title ${inlineEditModel} not found in models array`, + }); + } + } + + // Add transformers JS to the embed models list if not already added + if ( + ideInfo.ideType === "vscode" && + !continueConfig.modelsByRole.embed.find( + (m) => m.providerName === "transformers.js", + ) + ) { + continueConfig.modelsByRole.embed.push( + new TransformersJsEmbeddingsProvider(), + ); + } + return { config: continueConfig, errors }; } +function llmToSerializedModelDescription(llm: ILLM): ModelDescription { + return { + provider: llm.providerName, + model: llm.model, + title: llm.title ?? llm.model, + apiKey: llm.apiKey, + apiBase: llm.apiBase, + contextLength: llm.contextLength, + template: llm.template, + completionOptions: llm.completionOptions, + systemMessage: llm.systemMessage, + requestOptions: llm.requestOptions, + promptTemplates: llm.promptTemplates as any, + capabilities: llm.capabilities, + roles: llm.roles, + }; +} + async function finalToBrowserConfig( final: ContinueConfig, ide: IDE, ): Promise { return { allowAnonymousTelemetry: final.allowAnonymousTelemetry, - models: final.models.map((m) => ({ - provider: m.providerName, - model: m.model, - title: m.title ?? m.model, - apiKey: m.apiKey, - apiBase: m.apiBase, - contextLength: m.contextLength, - template: m.template, - completionOptions: m.completionOptions, - systemMessage: m.systemMessage, - requestOptions: m.requestOptions, - promptTemplates: m.promptTemplates as any, - capabilities: m.capabilities, - })), + models: final.models.map(llmToSerializedModelDescription), systemMessage: final.systemMessage, completionOptions: final.completionOptions, slashCommands: final.slashCommands?.map((s) => ({ name: s.name, description: s.description, - params: s.params, //PZTODO: is this why params aren't referenced properly by slash commands? + params: s.params, // TODO: is this why params aren't referenced properly by slash commands? })), contextProviders: final.contextProviders?.map((c) => c.description), disableIndexing: final.disableIndexing, disableSessionTitles: final.disableSessionTitles, userToken: final.userToken, - embeddingsProvider: final.embeddingsProvider?.embeddingId, ui: final.ui, experimental: final.experimental, docs: final.docs, tools: final.tools, tabAutocompleteOptions: final.tabAutocompleteOptions, usePlatform: await useHub(ide.getIdeSettings()), + modelsByRole: Object.fromEntries( + Object.entries(final.modelsByRole).map(([k, v]) => [ + k, + v.map(llmToSerializedModelDescription), + ]), + ) as Record, // TODO better types here + selectedModelByRole: Object.fromEntries( + Object.entries(final.selectedModelByRole).map(([k, v]) => [ + k, + v ? llmToSerializedModelDescription(v) : null, + ]), + ) as Record, // TODO better types here + // data not included here because client doesn't need }; } @@ -763,7 +875,7 @@ async function loadContinueConfigFromJson( ide: IDE, workspaceConfigs: ContinueRcJson[], ideSettings: IdeSettings, - ideType: IdeType, + ideInfo: IdeInfo, uniqueId: string, writeLog: (log: string) => Promise, workOsAccessToken: string | undefined, @@ -777,7 +889,7 @@ async function loadContinueConfigFromJson( } = loadSerializedConfig( workspaceConfigs, ideSettings, - ideType, + ideInfo.ideType, overrideConfigJson, ide, ); @@ -794,16 +906,16 @@ async function loadContinueConfigFromJson( // Apply shared config // TODO: override several of these values with user/org shared config const sharedConfig = new GlobalContext().getSharedConfig(); - const withShared = modifyContinueConfigWithSharedConfig( - serialized, - sharedConfig, - ); + const withShared = modifyAnyConfigWithSharedConfig(serialized, sharedConfig); // Convert serialized to intermediate config let intermediate = await serializedToIntermediateConfig(withShared, ide); // Apply config.ts to modify intermediate config - const configJsContents = await buildConfigTsandReadConfigJs(ide, ideType); + const configJsContents = await buildConfigTsandReadConfigJs( + ide, + ideInfo.ideType, + ); if (configJsContents) { try { // Try config.ts first @@ -863,6 +975,7 @@ async function loadContinueConfigFromJson( intermediate, ide, ideSettings, + ideInfo, uniqueId, writeLog, workOsAccessToken, diff --git a/core/config/migrateSharedConfig.ts b/core/config/migrateSharedConfig.ts index b68e3adec..189bb21ed 100644 --- a/core/config/migrateSharedConfig.ts +++ b/core/config/migrateSharedConfig.ts @@ -1,13 +1,9 @@ -import * as fs from "fs"; - -import * as JSONC from "comment-json"; - -import { IDE, SerializedContinueConfig } from ".."; -import { SharedConfigSchema } from "./sharedConfig"; +import { IDE } from ".."; +import { deduplicateArray } from "../util"; import { GlobalContext } from "../util/GlobalContext"; import { editConfigJson } from "../util/paths"; import { resolveSerializedConfig } from "./load"; -import { deduplicateArray } from "../util"; +import { SharedConfigSchema } from "./sharedConfig"; /* This migration function eliminates deprecated values from the json file @@ -201,10 +197,10 @@ export function migrateJsonSharedConfig(filepath: string, ide: IDE): void { if (effected) { new GlobalContext().updateSharedConfig(shareConfigUpdates); editConfigJson(() => config); - void ide.showToast( - "warning", - "Migrated deprecated Continue JSON settings. Edit in the Settings Page", - ); + // void ide.showToast( + // "warning", + // "Migrated deprecated Continue JSON settings. Edit in the Settings Page", + // ); } } catch (e) { throw new Error(`Migration: Failed to parse config.json: ${e}`); diff --git a/core/config/onboarding.ts b/core/config/onboarding.ts index 426a7a4ba..8babfffde 100644 --- a/core/config/onboarding.ts +++ b/core/config/onboarding.ts @@ -3,10 +3,12 @@ import { SerializedContinueConfig } from "../"; import { FREE_TRIAL_MODELS } from "./default"; export const TRIAL_FIM_MODEL = "codestral-latest"; -export const ONBOARDING_LOCAL_MODEL_TITLE = "Ollama"; +export const LOCAL_ONBOARDING_PROVIDER_TITLE = "Ollama"; export const LOCAL_ONBOARDING_FIM_MODEL = "qwen2.5-coder:1.5b-base"; +export const LOCAL_ONBOARDING_FIM_TITLE = "Qwen2.5-Coder 1.5B"; export const LOCAL_ONBOARDING_CHAT_MODEL = "llama3.1:8b"; export const LOCAL_ONBOARDING_CHAT_TITLE = "Llama 3.1 8B"; +export const LOCAL_ONBOARDING_EMBEDDINGS_MODEL = "nomic-embed-text:latest"; /** * We set the "best" chat + autocopmlete models by default @@ -35,13 +37,13 @@ export function setupLocalConfig( ...config.models.filter((model) => model.provider !== "free-trial"), ], tabAutocompleteModel: { - title: "Qwen2.5-Coder 1.5B", + title: LOCAL_ONBOARDING_FIM_TITLE, provider: "ollama", model: LOCAL_ONBOARDING_FIM_MODEL, }, embeddingsProvider: { provider: "ollama", - model: "nomic-embed-text", + model: LOCAL_ONBOARDING_EMBEDDINGS_MODEL, }, }; } @@ -68,24 +70,3 @@ export function setupQuickstartConfig( }, }; } - -export function setupLocalConfigAfterFreeTrial( - config: SerializedContinueConfig, -): SerializedContinueConfig { - return { - ...config, - models: [ - { - title: LOCAL_ONBOARDING_CHAT_TITLE, - provider: "ollama", - model: LOCAL_ONBOARDING_CHAT_MODEL, - }, - { - title: ONBOARDING_LOCAL_MODEL_TITLE, - provider: "ollama", - model: "AUTODETECT", - }, - ...config.models.filter((model) => model.provider !== "free-trial"), - ], - }; -} diff --git a/core/config/profile/LocalProfileLoader.ts b/core/config/profile/LocalProfileLoader.ts index 3196faff4..9ccf5c812 100644 --- a/core/config/profile/LocalProfileLoader.ts +++ b/core/config/profile/LocalProfileLoader.ts @@ -38,6 +38,7 @@ export default class LocalProfileLoader implements IProfileLoader { undefined, undefined, undefined, + this.description.id, ); this.description.errors = result.errors; diff --git a/core/config/profile/PlatformProfileLoader.ts b/core/config/profile/PlatformProfileLoader.ts index 7650cb0e3..c0fa4c5cc 100644 --- a/core/config/profile/PlatformProfileLoader.ts +++ b/core/config/profile/PlatformProfileLoader.ts @@ -1,8 +1,8 @@ -import { ConfigResult } from "@continuedev/config-yaml"; -import { AssistantUnrolled } from "@continuedev/config-yaml/dist/schemas/index.js"; +import { AssistantUnrolled, ConfigResult } from "@continuedev/config-yaml"; import { ControlPlaneClient } from "../../control-plane/client.js"; import { ContinueConfig, IDE, IdeSettings } from "../../index.js"; + import { ProfileDescription } from "../ProfileLifecycleManager.js"; import doLoadConfig from "./doLoadConfig.js"; @@ -43,7 +43,7 @@ export default class PlatformProfileLoader implements IProfileLoader { packageSlug, versionSlug, }, - title: `${ownerSlug}/${packageSlug}@${versionSlug}`, + title: configResult.config?.name ?? `${ownerSlug}/${packageSlug}`, errors: configResult.errors, iconUrl: this.iconUrl, }; @@ -69,6 +69,7 @@ export default class PlatformProfileLoader implements IProfileLoader { ownerSlug: this.ownerSlug, packageSlug: this.packageSlug, }, + this.description.id, ); return { diff --git a/core/config/profile/doLoadConfig.ts b/core/config/profile/doLoadConfig.ts index af8c59c97..0ec9b4137 100644 --- a/core/config/profile/doLoadConfig.ts +++ b/core/config/profile/doLoadConfig.ts @@ -4,6 +4,7 @@ import { AssistantUnrolled, ConfigResult, ConfigValidationError, + ModelRole, } from "@continuedev/config-yaml"; import { ContinueConfig, @@ -24,6 +25,7 @@ import { loadContinueConfigFromJson } from "../load"; import { migrateJsonSharedConfig } from "../migrateSharedConfig"; import { loadContinueConfigFromYaml } from "../yaml/loadYaml"; import { PlatformConfigMetadata } from "./PlatformProfileLoader"; +import { rectifySelectedModelsFromGlobalContext } from "../selectedModels"; export default async function doLoadConfig( ide: IDE, @@ -33,7 +35,7 @@ export default async function doLoadConfig( overrideConfigJson: SerializedContinueConfig | undefined, overrideConfigYaml: AssistantUnrolled | undefined, platformConfigMetadata: PlatformConfigMetadata | undefined, - workspaceId?: string, + profileId: string, ): Promise> { const workspaceConfigs = await getWorkspaceConfigs(ide); const ideInfo = await ide.getIdeInfo(); @@ -59,7 +61,7 @@ export default async function doLoadConfig( ide, workspaceConfigs.map((c) => JSON.stringify(c)), ideSettings, - ideInfo.ideType, + ideInfo, uniqueId, writeLog, workOsAccessToken, @@ -75,7 +77,7 @@ export default async function doLoadConfig( ide, workspaceConfigs, ideSettings, - ideInfo.ideType, + ideInfo, uniqueId, writeLog, workOsAccessToken, @@ -86,6 +88,11 @@ export default async function doLoadConfig( configLoadInterrupted = result.configLoadInterrupted; } + // Rectify model selections for each role + if (newConfig) { + newConfig = rectifySelectedModelsFromGlobalContext(newConfig, profileId); + } + if (configLoadInterrupted || !newConfig) { return { errors, config: newConfig, configLoadInterrupted: true }; } @@ -117,7 +124,7 @@ export default async function doLoadConfig( controlPlaneProxyUrl += "/"; } const controlPlaneProxyInfo = { - workspaceId, + profileId, controlPlaneProxyUrl, workOsAccessToken, }; @@ -147,21 +154,26 @@ async function injectControlPlaneProxyInfo( config: ContinueConfig, info: ControlPlaneProxyInfo, ): Promise { - [...config.models, ...(config.tabAutocompleteModels ?? [])].forEach( - async (model) => { + Object.keys(config.modelsByRole).forEach((key) => { + config.modelsByRole[key as ModelRole].forEach((model) => { if (model.providerName === "continue-proxy") { (model as ContinueProxy).controlPlaneProxyInfo = info; } - }, - ); + }); + }); - if (config.embeddingsProvider?.providerName === "continue-proxy") { - (config.embeddingsProvider as ContinueProxy).controlPlaneProxyInfo = info; - } + Object.keys(config.selectedModelByRole).forEach((key) => { + const model = config.selectedModelByRole[key as ModelRole]; + if (model?.providerName === "continue-proxy") { + (model as ContinueProxy).controlPlaneProxyInfo = info; + } + }); - if (config.reranker?.providerName === "continue-proxy") { - (config.reranker as ContinueProxy).controlPlaneProxyInfo = info; - } + config.models.forEach((model) => { + if (model.providerName === "continue-proxy") { + (model as ContinueProxy).controlPlaneProxyInfo = info; + } + }); return config; } diff --git a/core/config/selectedModels.ts b/core/config/selectedModels.ts new file mode 100644 index 000000000..dd537665d --- /dev/null +++ b/core/config/selectedModels.ts @@ -0,0 +1,67 @@ +import { ModelRole } from "@continuedev/config-yaml"; + +import { ContinueConfig, ILLM } from ".."; +import { + GlobalContext, + GlobalContextModelSelections, +} from "../util/GlobalContext"; + +export function rectifySelectedModelsFromGlobalContext( + continueConfig: ContinueConfig, + profileId: string, +): ContinueConfig { + const configCopy = { ...continueConfig }; + + const globalContext = new GlobalContext(); + const currentSelectedModels = globalContext.get("selectedModelsByProfileId"); + const currentForProfile: GlobalContextModelSelections = + currentSelectedModels?.[profileId] ?? {}; + + let fellBack = false; + + // chat and summarize not implemented yet + // default chat model is stored in GUI still + + const roles: ModelRole[] = [ + "autocomplete", + "apply", + "edit", + "embed", + "rerank", + ]; + for (const role of roles) { + let newModel: ILLM | null = null; + const currentSelection = currentForProfile[role] ?? null; + if (currentSelection) { + const match = continueConfig.modelsByRole[role].find( + (m) => m.title === currentSelection, + ); + if (match) { + newModel = match; + } + } + if (!newModel && continueConfig.modelsByRole[role].length > 0) { + newModel = continueConfig.modelsByRole[role][0]; + } + if (!(currentSelection === (newModel?.title ?? null))) { + fellBack = true; + } + configCopy.selectedModelByRole[role] = newModel; + } + + // In the case shared config wasn't respected, + // Rewrite the shared config + if (fellBack) { + globalContext.update("selectedModelsByProfileId", { + ...currentSelectedModels, + [profileId]: Object.fromEntries( + Object.entries(configCopy.selectedModelByRole).map(([key, value]) => [ + key, + value?.title ?? null, + ]), + ), + }); + } + + return configCopy; +} diff --git a/core/config/sharedConfig.ts b/core/config/sharedConfig.ts index 9f2335243..ce16ea24f 100644 --- a/core/config/sharedConfig.ts +++ b/core/config/sharedConfig.ts @@ -1,13 +1,15 @@ import z from "zod"; + import { BrowserSerializedContinueConfig, - ContinueConfig, Config, + ContinueConfig, SerializedContinueConfig, } from ".."; export const sharedConfigSchema = z .object({ + // boolean fields in config.json allowAnonymousTelemetry: z.boolean(), disableIndexing: z.boolean(), disableSessionTitles: z.boolean(), @@ -18,6 +20,7 @@ export const sharedConfigSchema = z promptPath: z.string(), // `ui` in `ContinueConfig` + showSessionTabs: z.boolean(), codeBlockToolbarPosition: z.enum(["top", "bottom"]), fontSize: z.number(), codeWrap: z.boolean(), @@ -65,7 +68,19 @@ export function salvageSharedConfig(sharedConfig: object): SharedConfigSchema { return salvagedConfig; } -export function modifyContinueConfigWithSharedConfig< +// Apply shared config to all forms of config +// - SerializedContinueConfig (config.json) +// - Config ("intermediate") - passed to config.ts +// - ContinueConfig +// - BrowserSerializedContinueConfig (final converted to be passed to GUI) + +// This modify function is split into two steps +// - rectifySharedModelsFromSharedConfig - includes boolean flags like allowAnonymousTelemetry which +// must be added BEFORE config.ts and remote server config apply for JSON +// for security reasons +// - setSharedModelsFromSharedConfig - exists because of selectedModelsByRole +// Which don't exist on SerializedContinueConfig/Config types, so must be added after the fact +export function modifyAnyConfigWithSharedConfig< T extends | ContinueConfig | BrowserSerializedContinueConfig @@ -92,6 +107,7 @@ export function modifyContinueConfigWithSharedConfig< configCopy.ui = { ...configCopy.ui, }; + if (sharedConfig.codeBlockToolbarPosition !== undefined) { configCopy.ui.codeBlockToolbarPosition = sharedConfig.codeBlockToolbarPosition; @@ -119,6 +135,10 @@ export function modifyContinueConfigWithSharedConfig< configCopy.disableSessionTitles = sharedConfig.disableSessionTitles; } + if (sharedConfig.showSessionTabs !== undefined) { + configCopy.ui.showSessionTabs = sharedConfig.showSessionTabs; + } + configCopy.experimental = { ...configCopy.experimental, }; @@ -135,28 +155,3 @@ export function modifyContinueConfigWithSharedConfig< return configCopy; } - -// continueConfig.tabAutocompleteOptions = { -// ...continueConfig.tabAutocompleteOptions, -// useCache: sharedConfig.useAutocompleteCache, -// disableInFiles: sharedConfig.disableAutocompleteInFiles, -// multilineCompletions: sharedConfig.useAutocompleteMultilineCompletions, -// }; -// continueConfig.ui = { -// ...continueConfig.ui, -// codeBlockToolbarPosition: sharedConfig.codeBlockToolbarPosition, -// fontSize: sharedConfig.fontSize, -// codeWrap: sharedConfig.codeWrap, -// displayRawMarkdown: sharedConfig.displayRawMarkdown, -// showChatScrollbar: sharedConfig.showChatScrollbar, -// }; -// continueConfig.allowAnonymousTelemetry = sharedConfig.allowAnonymousTelemetry; -// continueConfig.disableIndexing = sharedConfig.disableIndexing; -// continueConfig.disableIndexing = sharedConfig.disableIndexing; -// continueConfig.disableSessionTitles = sharedConfig.disableSessionTitles; -// continueConfig.experimental = { -// ...continueConfig.experimental, -// useChromiumForDocsCrawling: sharedConfig.useChromiumForDocsCrawling, -// readResponseTTS: sharedConfig.readResponseTTS, -// promptPath: sharedConfig.promptPath, -// }; diff --git a/core/config/types.ts b/core/config/types.ts index 384da0c8f..2a68c4c35 100644 --- a/core/config/types.ts +++ b/core/config/types.ts @@ -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; diff --git a/core/config/util.ts b/core/config/util.ts index 6d28dcbcb..f55848586 100644 --- a/core/config/util.ts +++ b/core/config/util.ts @@ -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( +export function getModelByRole( config: ContinueConfig, role: T, ): ILLM | undefined { diff --git a/core/config/yaml/clientRender.ts b/core/config/yaml/clientRender.ts deleted file mode 100644 index 8cb727456..000000000 --- a/core/config/yaml/clientRender.ts +++ /dev/null @@ -1,40 +0,0 @@ -import { - clientRender, - PlatformClient, - SecretStore, -} from "@continuedev/config-yaml"; - -import { IDE } from "../.."; -import { ControlPlaneClient } from "../../control-plane/client"; - -export async function clientRenderHelper( - unrolledAssistant: string, - ide: IDE, - controlPlaneClient: ControlPlaneClient, -) { - const ideSecretStore: SecretStore = { - get: async function (secretName: string): Promise { - const results = await ide.readSecrets([secretName]); - return results[secretName]; - }, - set: async function ( - secretName: string, - secretValue: string, - ): Promise { - return await ide.writeSecrets({ - [secretName]: secretValue, - }); - }, - }; - - const platformClient: PlatformClient = { - resolveFQSNs: controlPlaneClient.resolveFQSNs.bind(controlPlaneClient), - }; - - const userId = await controlPlaneClient.userId; - return await clientRender( - unrolledAssistant, - ideSecretStore, - userId ? platformClient : undefined, - ); -} diff --git a/core/config/yaml/convertFromJson.ts b/core/config/yaml/convertFromJson.ts index 576e196c8..fdf73606f 100644 --- a/core/config/yaml/convertFromJson.ts +++ b/core/config/yaml/convertFromJson.ts @@ -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 "../.."; @@ -16,10 +15,11 @@ export function convertConfigJsonToConfigYaml( name: model.title, // defaultCompletionOptions: model.completionOptions, provider: model.provider, - roles: ["chat"], + roles: ["chat", "edit", "apply", "summarize"], }), ), - // ... tabAutocompleteModels + // TODO + // tabAutocompleteModels // embeddingsModels // rerankModels ], diff --git a/core/config/yaml/default.ts b/core/config/yaml/default.ts index 0bc872f88..c9ca4dc8e 100644 --- a/core/config/yaml/default.ts +++ b/core/config/yaml/default.ts @@ -1,4 +1,4 @@ -import { AssistantUnrolled } from "@continuedev/config-yaml/dist/schemas"; +import { AssistantUnrolled } from "@continuedev/config-yaml"; // TODO export const defaultConfigYaml: AssistantUnrolled = { diff --git a/core/config/yaml/loadYaml.ts b/core/config/yaml/loadYaml.ts index 666317447..bf0515253 100644 --- a/core/config/yaml/loadYaml.ts +++ b/core/config/yaml/loadYaml.ts @@ -3,23 +3,26 @@ import fs from "node:fs"; import { AssistantUnrolled, ConfigResult, + ConfigValidationError, + ModelRole, parseAssistantUnrolled, validateConfigYaml, } from "@continuedev/config-yaml"; import { fetchwithRequestOptions } from "@continuedev/fetch"; import { - BrowserSerializedContinueConfig, ContinueConfig, IContextProvider, IDE, + IdeInfo, IdeSettings, - 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"; @@ -29,15 +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 { modifyAnyConfigWithSharedConfig } from "../sharedConfig"; -import { slashFromCustomCommand } from "../../commands"; -import { allTools } from "../../tools"; -import { GlobalContext } from "../../util/GlobalContext"; -import { modifyContinueConfigWithSharedConfig } from "../sharedConfig"; -import { clientRenderHelper } from "./clientRender"; import { llmsFromModelConfig } from "./models"; async function loadConfigYaml( @@ -47,12 +48,14 @@ async function loadConfigYaml( ide: IDE, controlPlaneClient: ControlPlaneClient, ): Promise> { - const ideSettings = await ide.getIdeSettings(); + // 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)) { @@ -95,22 +98,22 @@ async function configYamlToContinueConfig( config: AssistantUnrolled, ide: IDE, ideSettings: IdeSettings, + ideInfo: IdeInfo, uniqueId: string, writeLog: (log: string) => Promise, workOsAccessToken: string | undefined, platformConfigMetadata: PlatformConfigMetadata | undefined, allowFreeTrial: boolean = true, -): Promise { +): Promise<{ config: ContinueConfig; errors: ConfigValidationError[] }> { + const errors: ConfigValidationError[] = []; const continueConfig: ContinueConfig = { slashCommands: [ ...(await slashCommandsFromV1PromptFiles(ide)), ...(config.prompts?.map(slashFromCustomCommand) ?? []), ], models: [], - tabAutocompleteModels: [], tools: allTools, systemMessage: config.rules?.join("\n"), - embeddingsProvider: new TransformersJsEmbeddingsProvider(), experimental: { modelContextProtocolServers: config.mcpServers?.map((mcpServer) => ({ transport: { @@ -128,41 +131,123 @@ async function configYamlToContinueConfig( faviconUrl: doc.faviconUrl, })), contextProviders: [], + modelsByRole: { + chat: [], + edit: [], + apply: [], + embed: [], + autocomplete: [], + rerank: [], + summarize: [], + }, + selectedModelByRole: { + chat: null, // not currently used - defaultModel on GUI is used + edit: null, // not currently used + apply: null, + embed: null, + autocomplete: null, + rerank: null, + summarize: null, + }, + data: config.data, }; // 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), - ) - ) { - // Main model array - const llms = await llmsFromModelConfig( - model, - ide, - uniqueId, - ideSettings, - writeLog, - platformConfigMetadata, - continueConfig.systemMessage, - ); + model.roles = model.roles ?? modelsArrayRoles; // Default to all 4 chat-esque roles if not specified + const llms = await llmsFromModelConfig( + model, + ide, + uniqueId, + ideSettings, + writeLog, + platformConfigMetadata, + continueConfig.systemMessage, + ); + + // + if (modelsArrayRoles.some((role) => model.roles?.includes(role))) { continueConfig.models.push(...llms); } - if (model.roles?.includes("autocomplete")) { - // Autocomplete models array - const llms = await llmsFromModelConfig( - model, - ide, - uniqueId, - ideSettings, - writeLog, - platformConfigMetadata, - continueConfig.systemMessage, - ); - continueConfig.tabAutocompleteModels?.push(...llms); + if (model.roles?.includes("chat")) { + continueConfig.modelsByRole.chat.push(...llms); } + + if (model.roles?.includes("summarize")) { + continueConfig.modelsByRole.summarize.push(...llms); + } + + if (model.roles?.includes("apply")) { + continueConfig.modelsByRole.apply.push(...llms); + } + + if (model.roles?.includes("edit")) { + continueConfig.modelsByRole.edit.push(...llms); + } + + if (model.roles?.includes("autocomplete")) { + continueConfig.modelsByRole.autocomplete.push(...llms); + } + + if (model.roles?.includes("embed")) { + const { provider, ...options } = model; + const embeddingsProviderClass = allEmbeddingsProviders[provider]; + if (embeddingsProviderClass) { + if ( + embeddingsProviderClass.name === "_TransformersJsEmbeddingsProvider" + ) { + continueConfig.modelsByRole.embed.push(new embeddingsProviderClass()); + } else { + continueConfig.modelsByRole.embed.push( + new embeddingsProviderClass( + options, + (url: string | URL, init: any) => + fetchwithRequestOptions(url, init, { + ...options.requestOptions, + }), + ), + ); + } + } else { + errors.push({ + fatal: false, + message: `Unsupported embeddings model provider found: ${provider}`, + }); + } + } + + if (model.roles?.includes("rerank")) { + const { provider, ...options } = model; + const rerankerClass = AllRerankers[provider]; + if (rerankerClass) { + continueConfig.modelsByRole.rerank.push( + new rerankerClass(options, (url: string | URL, init: any) => + fetchwithRequestOptions(url, init, { + ...options.requestOptions, + }), + ), + ); + } else { + errors.push({ + fatal: false, + message: `Unsupported reranking model provider found: ${provider}`, + }); + } + } + } + + // Add transformers js to the embed models in vs code if not already added + if ( + ideInfo.ideType === "vscode" && + !continueConfig.modelsByRole.embed.find( + (m) => m.providerName === "transformers.js", + ) + ) { + continueConfig.modelsByRole.embed.push( + new TransformersJsEmbeddingsProvider(), + ); } if (allowFreeTrial) { @@ -183,8 +268,6 @@ async function configYamlToContinueConfig( ); } - // TODO: Split into model roles. - // Context providers const codebaseContextParams: IContextProvider[] = (config.context || []).find((cp) => cp.provider === "codebase")?.params || @@ -214,92 +297,69 @@ async function configYamlToContinueConfig( .filter((p) => !!p) ?? []) as IContextProvider[]; continueConfig.contextProviders.push(...DEFAULT_CONTEXT_PROVIDERS); - // Embeddings Provider - const embedConfig = config.models?.find((model) => - model.roles?.includes("embed"), - ); - if (embedConfig) { - const { provider, ...options } = embedConfig; - const embeddingsProviderClass = allEmbeddingsProviders[provider]; - if (embeddingsProviderClass) { - if ( - embeddingsProviderClass.name === "_TransformersJsEmbeddingsProvider" - ) { - continueConfig.embeddingsProvider = new embeddingsProviderClass(); - } else { - continueConfig.embeddingsProvider = new embeddingsProviderClass( - options, - (url: string | URL, init: any) => - fetchwithRequestOptions(url, init, { - ...options.requestOptions, - }), - ); - } - } - } - - // Reranker - const rerankConfig = config.models?.find((model) => - model.roles?.includes("rerank"), - ); - if (rerankConfig) { - const { provider, ...options } = rerankConfig; - const rerankerClass = AllRerankers[provider]; - - if (rerankerClass) { - continueConfig.reranker = new rerankerClass( - options, - (url: string | URL, init: any) => - fetchwithRequestOptions(url, init, { - ...options.requestOptions, - }), - ); - } + if ( + continueConfig.docs?.length && + !continueConfig.contextProviders?.some( + (cp) => cp.description.title === "docs", + ) + ) { + continueConfig.contextProviders.push(new DocsContextProvider({})); } // Apply MCP if specified const mcpManager = MCPManagerSingleton.getInstance(); - config.mcpServers?.forEach(async (server) => { - const mcpId = server.name; - const mcpConnection = mcpManager.createConnection(mcpId, { - transport: { - type: "stdio", - args: [], - ...server, - }, - }); - if (!mcpConnection) { - return; - } - - const abortController = new AbortController(); - const mcpConnectionTimeout = setTimeout( - () => abortController.abort(), - 2000, - ); - - try { - await mcpConnection.modifyConfig( - continueConfig, - mcpId, - abortController.signal, - ); - } catch (e: any) { - if (e.name !== "AbortError") { - throw e; + await Promise.all( + config.mcpServers?.map(async (server) => { + const mcpId = server.name; + const mcpConnection = mcpManager.createConnection(mcpId, { + transport: { + type: "stdio", + args: [], + ...server, + }, + }); + if (!mcpConnection) { + return; } - } - clearTimeout(mcpConnectionTimeout); - }); - return continueConfig; + const abortController = new AbortController(); + const mcpConnectionTimeout = setTimeout( + () => abortController.abort(), + 5000, + ); + + try { + const mcpError = await mcpConnection.modifyConfig( + continueConfig, + mcpId, + abortController.signal, + server.name, + server.faviconUrl, + ); + if (mcpError) { + errors.push(mcpError); + } + } catch (e: any) { + errors.push({ + fatal: false, + message: `Failed to load MCP server: ${e.message}`, + }); + if (e.name !== "AbortError") { + throw e; + } + } + clearTimeout(mcpConnectionTimeout); + }) ?? [], + ); + + return { config: continueConfig, errors }; } export async function loadContinueConfigFromYaml( ide: IDE, workspaceConfigs: string[], ideSettings: IdeSettings, - ideType: IdeType, + ideInfo: IdeInfo, uniqueId: string, writeLog: (log: string) => Promise, workOsAccessToken: string | undefined, @@ -309,7 +369,7 @@ export async function loadContinueConfigFromYaml( ): Promise> { const rawYaml = overrideConfigYaml === undefined - ? fs.readFileSync(getConfigYamlPath(ideType), "utf-8") + ? fs.readFileSync(getConfigYamlPath(ideInfo.ideType), "utf-8") : ""; const configYamlResult = await loadConfigYaml( @@ -328,10 +388,11 @@ export async function loadContinueConfigFromYaml( }; } - const continueConfig = await configYamlToContinueConfig( + const { config: continueConfig, errors } = await configYamlToContinueConfig( configYamlResult.config, ide, ideSettings, + ideInfo, uniqueId, writeLog, workOsAccessToken, @@ -350,16 +411,14 @@ export async function loadContinueConfigFromYaml( // Apply shared config // TODO: override several of these values with user/org shared config const sharedConfig = new GlobalContext().getSharedConfig(); - const withShared = modifyContinueConfigWithSharedConfig( + const withShared = modifyAnyConfigWithSharedConfig( continueConfig, sharedConfig, ); return { config: withShared, - errors: configYamlResult.errors, + errors: [...(configYamlResult.errors ?? []), ...errors], configLoadInterrupted: false, }; } - -export { type BrowserSerializedContinueConfig }; diff --git a/core/config/yaml/models.ts b/core/config/yaml/models.ts index 8fe34677f..c6916b010 100644 --- a/core/config/yaml/models.ts +++ b/core/config/yaml/models.ts @@ -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,10 +47,59 @@ async function modelConfigToBaseLLM( writeLog, uniqueId, title: model.name, - model: modelName, systemMessage, + promptTemplates: model.promptTemplates, }; + if (model.embedOptions?.maxBatchSize) { + options.maxEmbeddingBatchSize = model.embedOptions.maxBatchSize; + } + if (model.embedOptions?.maxChunkSize) { + options.maxEmbeddingChunkSize = model.embedOptions.maxChunkSize; + } + + // These are params that are at model config level in JSON + // But we decided to move to nested `env` in YAML + // Since types vary and we don't want to blindly spread env for now, + // Each one is handled individually here + const env = model.env ?? {}; + if ( + "useLegacyCompletionsEndpoint" in env && + typeof env.useLegacyCompletionsEndpoint === "boolean" + ) { + options.useLegacyCompletionsEndpoint = env.useLegacyCompletionsEndpoint; + } + if ("apiType" in env && typeof env.apiType === "string") { + options.apiType = env.apiType; + } + if ("apiVersion" in env && typeof env.apiVersion === "string") { + options.apiVersion = env.apiVersion; + } + if ("deployment" in env && typeof env.deployment === "string") { + options.deployment = env.deployment; + } + if ("deploymentId" in env && typeof env.deploymentId === "string") { + options.deploymentId = env.deploymentId; + } + if ("projectId" in env && typeof env.projectId === "string") { + options.projectId = env.projectId; + } + if ("region" in env && typeof env.region === "string") { + options.region = env.region; + } + if ("profile" in env && typeof env.profile === "string") { + options.profile = env.profile; + } + if ("modelArn" in env && typeof env.modelArn === "string") { + options.modelArn = env.modelArn; + } + if ("aiGatewaySlug" in env && typeof env.aiGatewaySlug === "string") { + options.aiGatewaySlug = env.aiGatewaySlug; + } + if ("accountId" in env && typeof env.accountId === "string") { + options.accountId = env.accountId; + } + const llm = new cls(options); return llm; } diff --git a/core/context/mcp/index.ts b/core/context/mcp/index.ts index b1a960910..19de5434a 100644 --- a/core/context/mcp/index.ts +++ b/core/context/mcp/index.ts @@ -121,6 +121,8 @@ class MCPConnection { config: ContinueConfig, mcpId: string, signal: AbortSignal, + name: string, + faviconUrl: string | undefined, ): Promise { try { await Promise.race([ @@ -152,6 +154,7 @@ class MCPConnection { title: resource.name, description: resource.description, id: resource.uri, + icon: faviconUrl, })); if (!config.contextProviders) { @@ -161,6 +164,7 @@ class MCPConnection { config.contextProviders.push( new MCPContextProvider({ submenuItems, + mcpId, }), ); } @@ -169,19 +173,20 @@ class MCPConnection { if (capabilities?.tools) { const { tools } = await this.client.listTools({}, { signal }); const continueTools: Tool[] = tools.map((tool: any) => ({ - displayTitle: tool.name, + displayTitle: name + " " + tool.name, function: { description: tool.description, name: tool.name, parameters: tool.inputSchema, }, + faviconUrl, readonly: false, type: "function", - wouldLikeTo: `use the ${tool.name} tool`, + wouldLikeTo: `use the ${name} ${tool.name} tool`, uri: encodeMCPToolUri(mcpId, tool.name), })); - config.tools = [...config.tools, ...continueTools]; + config.tools = [...continueTools, ...config.tools]; } // Prompts <—> Slash commands diff --git a/core/context/providers/DocsContextProvider.ts b/core/context/providers/DocsContextProvider.ts index cb8e926d5..f4b816f33 100644 --- a/core/context/providers/DocsContextProvider.ts +++ b/core/context/providers/DocsContextProvider.ts @@ -23,7 +23,7 @@ class DocsContextProvider extends BaseContextProvider { // Todo: consider a different renderInline so that when multiple docs are referenced in one message, // Or the doc has an odd name unrelated to the content // The name of the doc itself doesn't skew the embedding results - // renderInlineAs: "", + renderInlineAs: "", }; constructor(options: any) { diff --git a/core/context/providers/MCPContextProvider.ts b/core/context/providers/MCPContextProvider.ts index f239e3ee1..0cb8e2c66 100644 --- a/core/context/providers/MCPContextProvider.ts +++ b/core/context/providers/MCPContextProvider.ts @@ -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 { 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, }), }), diff --git a/core/context/providers/_context-providers.test.ts b/core/context/providers/_context-providers.test.ts index 22f1dffbc..345d21e37 100644 --- a/core/context/providers/_context-providers.test.ts +++ b/core/context/providers/_context-providers.test.ts @@ -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"); @@ -42,10 +42,10 @@ async function getContextProviderExtras( fullInput, ide, config, - embeddingsProvider: config.embeddingsProvider, + embeddingsProvider: config.selectedModelByRole.embed, fetch: fetch, llm: config.models[0], - reranker: config.reranker, + reranker: config.selectedModelByRole.rerank, selectedCode: [], }; } diff --git a/core/context/retrieval/pipelines/BaseRetrievalPipeline.ts b/core/context/retrieval/pipelines/BaseRetrievalPipeline.ts index 0ba94964c..e341c681c 100644 --- a/core/context/retrieval/pipelines/BaseRetrievalPipeline.ts +++ b/core/context/retrieval/pipelines/BaseRetrievalPipeline.ts @@ -7,6 +7,8 @@ import { FullTextSearchCodebaseIndex } from "../../../indexing/FullTextSearchCod import { LanceDbIndex } from "../../../indexing/LanceDbIndex"; import { recentlyEditedFilesCache } from "../recentlyEditedFilesCache"; +const DEFAULT_CHUNK_SIZE = 384; + export interface RetrievalPipelineOptions { llm: ILLM; config: ContinueConfig; @@ -16,13 +18,13 @@ export interface RetrievalPipelineOptions { nFinal: number; tags: BranchAndDir[]; filterDirectory?: string; - includeEmbeddings?: boolean; // Used to handle JB w/o an embeddings model } export interface RetrievalPipelineRunArguments { query: string; tags: BranchAndDir[]; filterDirectory?: string; + includeEmbeddings: boolean; } export interface IRetrievalPipeline { @@ -35,7 +37,7 @@ export default class BaseRetrievalPipeline implements IRetrievalPipeline { constructor(protected readonly options: RetrievalPipelineOptions) { this.lanceDbIndex = new LanceDbIndex( - options.config.embeddingsProvider, + options.config.selectedModelByRole.embed, (uri) => options.ide.readFile(uri), ); } @@ -109,7 +111,7 @@ export default class BaseRetrievalPipeline implements IRetrievalPipeline { filepath, contents, maxChunkSize: - this.options.config.embeddingsProvider.maxEmbeddingChunkSize, + this.options.config.selectedModelByRole.embed?.maxEmbeddingChunkSize ?? DEFAULT_CHUNK_SIZE, digest: filepath, }); diff --git a/core/context/retrieval/pipelines/NoRerankerRetrievalPipeline.ts b/core/context/retrieval/pipelines/NoRerankerRetrievalPipeline.ts index af72c0639..889005414 100644 --- a/core/context/retrieval/pipelines/NoRerankerRetrievalPipeline.ts +++ b/core/context/retrieval/pipelines/NoRerankerRetrievalPipeline.ts @@ -9,7 +9,7 @@ import BaseRetrievalPipeline, { export default class NoRerankerRetrievalPipeline extends BaseRetrievalPipeline { async run(args: RetrievalPipelineRunArguments): Promise { - const { input, nFinal, filterDirectory, includeEmbeddings } = this.options; + const { input, nFinal, filterDirectory, config } = this.options; // We give 1/4 weight to recently edited files, 1/4 to full text search, // and the remaining 1/2 to embeddings @@ -21,7 +21,7 @@ export default class NoRerankerRetrievalPipeline extends BaseRetrievalPipeline { const ftsChunks = await this.retrieveFts(args, ftsNFinal); - const embeddingsChunks = includeEmbeddings + const embeddingsChunks = !!config.selectedModelByRole.embed ? await this.retrieveEmbeddings(input, embeddingsNFinal) : []; diff --git a/core/context/retrieval/pipelines/RerankerRetrievalPipeline.ts b/core/context/retrieval/pipelines/RerankerRetrievalPipeline.ts index 7c7e69860..67f4bcd45 100644 --- a/core/context/retrieval/pipelines/RerankerRetrievalPipeline.ts +++ b/core/context/retrieval/pipelines/RerankerRetrievalPipeline.ts @@ -12,13 +12,12 @@ export default class RerankerRetrievalPipeline extends BaseRetrievalPipeline { private async _retrieveInitial( args: RetrievalPipelineRunArguments, ): Promise { - const { input, nRetrieve, filterDirectory, includeEmbeddings } = - this.options; + const { input, nRetrieve, filterDirectory, config } = this.options; let retrievalResults: Chunk[] = []; const ftsChunks = await this.retrieveFts(args, nRetrieve); - const embeddingsChunks = includeEmbeddings + const embeddingsChunks = !!config.selectedModelByRole.embed ? await this.retrieveEmbeddings(input, nRetrieve) : []; const recentlyEditedFilesChunks = @@ -53,17 +52,18 @@ export default class RerankerRetrievalPipeline extends BaseRetrievalPipeline { } private async _rerank(input: string, chunks: Chunk[]): Promise { - if (!this.options.config.reranker) { - throw new Error("No reranker provided"); + if (!this.options.config.selectedModelByRole.rerank) { + throw new Error("No reranker set up"); } // remove empty chunks -- some APIs fail on that chunks = chunks.filter((chunk) => chunk.content); - let scores: number[] = await this.options.config.reranker.rerank( - input, - chunks, - ); + let scores: number[] = + await this.options.config.selectedModelByRole.rerank.rerank( + input, + chunks, + ); // Filter out low-scoring results let results = chunks; diff --git a/core/context/retrieval/repoMapRequest.ts b/core/context/retrieval/repoMapRequest.ts index 39223321b..5637019ad 100644 --- a/core/context/retrieval/repoMapRequest.ts +++ b/core/context/retrieval/repoMapRequest.ts @@ -2,7 +2,6 @@ import { Chunk, ContinueConfig, IDE, ILLM } from "../.."; import { getModelByRole } from "../../config/util"; import generateRepoMap from "../../util/generateRepoMap"; import { renderChatMessage } from "../../util/messageContent"; -import { getUriPathBasename } from "../../util/uri"; const SUPPORTED_MODEL_TITLE_FAMILIES = [ "claude-3", @@ -16,7 +15,7 @@ function isSupportedModel( config: ContinueConfig, modelTitle?: string, ): boolean { - if (config.experimental?.modelRoles?.applyCodeBlock) { + if (config.experimental?.modelRoles?.repoMapFileSelection) { return true; } diff --git a/core/context/retrieval/retrieval.ts b/core/context/retrieval/retrieval.ts index d2e73e060..3b8e98427 100644 --- a/core/context/retrieval/retrieval.ts +++ b/core/context/retrieval/retrieval.ts @@ -1,5 +1,4 @@ import { BranchAndDir, ContextItem, ContextProviderExtras } from "../../"; -import TransformersJsEmbeddingsProvider from "../../llm/llms/TransformersJsEmbeddingsProvider"; import { getUriDescription } from "../../util/uri"; import { INSTRUCTIONS_BASE_ITEM } from "../providers/utils"; @@ -14,26 +13,16 @@ export async function retrieveContextItemsFromEmbeddings( options: any | undefined, filterDirectory: string | undefined, ): Promise { - if (!extras.embeddingsProvider) { - return []; - } - - // transformers.js not supported in JetBrains IDEs right now - - const isJetBrainsAndTransformersJs = - extras.embeddingsProvider.providerName === - TransformersJsEmbeddingsProvider.providerName && - (await extras.ide.getIdeInfo()).ideType === "jetbrains"; - - if (isJetBrainsAndTransformersJs) { - void extras.ide.showToast( - "warning", - "Codebase retrieval is limited when `embeddingsProvider` is empty or set to `transformers.js` in JetBrains. " + - "You can use Ollama to set up local embeddings, use our 'free-trial', " + - "or configure your own. See here to learn more: " + - "https://docs.continue.dev/customize/model-types/embeddings", - ); - } + // Currently you can use codebase without an embeddings provider and it will just skip the embeddings inputs + // if (!extras.embeddingsProvider) { + // void extras.ide.showToast( + // "warning", + // "Set up an embeddings model to use this feature. Visit the docs to learn more: " + + // "https://docs.continue.dev/customize/model-roles/embeddings", + // ); + // return []; + // } + const includeEmbeddings = !!extras.config.selectedModelByRole.embed; // Get tags to retrieve for const workspaceDirs = await extras.ide.getWorkspaceDirs(); @@ -78,7 +67,6 @@ export async function retrieveContextItemsFromEmbeddings( input: extras.fullInput, llm: extras.llm, config: extras.config, - includeEmbeddings: !isJetBrainsAndTransformersJs, }; const pipeline = new pipelineType(pipelineOptions); @@ -86,16 +74,17 @@ export async function retrieveContextItemsFromEmbeddings( tags, filterDirectory, query: extras.fullInput, + includeEmbeddings, }); if (results.length === 0) { if (extras.config.disableIndexing) { - void extras.ide.showToast("warning", "No embeddings results found."); + void extras.ide.showToast("warning", "No results found."); return []; } else { void extras.ide.showToast( "warning", - "No embeddings results found. If you think this is an error, re-index your codebase.", + "No results found. If you think this is an error, re-index your codebase.", ); // TODO - add "re-index" option to warning message which clears and reindexes codebase } @@ -119,7 +108,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: { diff --git a/core/control-plane/auth/index.ts b/core/control-plane/auth/index.ts index 8965f4fdb..a3441ab65 100644 --- a/core/control-plane/auth/index.ts +++ b/core/control-plane/auth/index.ts @@ -4,13 +4,14 @@ import { getControlPlaneEnv } from "../env"; export async function getAuthUrlForTokenPage( ideSettingsPromise: Promise, + useOnboarding: boolean, ): Promise { 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", diff --git a/core/control-plane/client.ts b/core/control-plane/client.ts index 7d0e03cc8..9dcf40b6d 100644 --- a/core/control-plane/client.ts +++ b/core/control-plane/client.ts @@ -40,7 +40,10 @@ export class ControlPlaneClient { private readonly ideSettingsPromise: Promise, ) {} - async resolveFQSNs(fqsns: FQSN[]): Promise<(SecretResult | undefined)[]> { + async resolveFQSNs( + fqsns: FQSN[], + orgScopeId: string | null, + ): Promise<(SecretResult | undefined)[]> { const userId = await this.userId; if (!userId) { throw new Error("No user id"); @@ -48,7 +51,7 @@ export class ControlPlaneClient { const resp = await this.request("ide/sync-secrets", { method: "POST", - body: JSON.stringify({ fqsns }), + body: JSON.stringify({ fqsns, orgScopeId }), }); return (await resp.json()) as any; } @@ -183,21 +186,4 @@ export class ControlPlaneClient { }); return ((await resp.json()) as any).settings; } - - async syncSecrets(secretNames: string[]): Promise> { - const userId = await this.userId; - if (!userId) { - throw new Error("No user id"); - } - - try { - const resp = await this.request("ide/sync-secrets", { - method: "POST", - body: JSON.stringify({ secretNames }), - }); - return (await resp.json()) as any; - } catch (e) { - return {}; - } - } } diff --git a/core/control-plane/env.ts b/core/control-plane/env.ts index 8f5bb40a4..288901cab 100644 --- a/core/control-plane/env.ts +++ b/core/control-plane/env.ts @@ -1,4 +1,6 @@ +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 +37,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,21 +60,37 @@ const LOCAL_ENV: ControlPlaneEnv = { APP_URL: "http://localhost:3000/", }; +export async function enableHubContinueDev() { + return true; +} + export async function getControlPlaneEnv( ideSettingsPromise: Promise, ): Promise { const ideSettings = await ideSettingsPromise; - return getControlPlaneEnvSync(ideSettings.continueTestEnvironment); + return getControlPlaneEnvSync( + ideSettings.continueTestEnvironment, + ideSettings.enableControlServerBeta, + ); } export function getControlPlaneEnvSync( ideTestEnvironment: IdeSettings["continueTestEnvironment"], + enableControlServerBeta: IdeSettings["enableControlServerBeta"], ): ControlPlaneEnv { + if (fs.existsSync(getStagingEnvironmentDotFilePath())) { + return STAGING_ENV; + } + + if (enableControlServerBeta === true) { + return PRODUCTION_ENV; + } + const env = ideTestEnvironment === "production" ? "hub" - : ideTestEnvironment === "test" - ? "test" + : ideTestEnvironment === "staging" + ? "staging" : ideTestEnvironment === "local" ? "local" : process.env.CONTROL_PLANE_ENV; @@ -94,5 +110,8 @@ export async function useHub( ideSettingsPromise: Promise, ): Promise { const ideSettings = await ideSettingsPromise; + if (ideSettings.enableControlServerBeta) { + return false; + } return ideSettings.continueTestEnvironment !== "none"; } diff --git a/core/core.ts b/core/core.ts index edfbc6c95..6d78ca855 100644 --- a/core/core.ts +++ b/core/core.ts @@ -11,15 +11,17 @@ import { SYSTEM_PROMPT_DOT_FILE } from "./config/getSystemPromptDotFile"; import { setupBestConfig, setupLocalConfig, - setupLocalConfigAfterFreeTrial, setupQuickstartConfig, } from "./config/onboarding"; import { addContextProvider, addModel, deleteModel } from "./config/util"; +import CodebaseContextProvider from "./context/providers/CodebaseContextProvider"; +import CurrentFileContextProvider from "./context/providers/CurrentFileContextProvider"; 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 { DevDataSqliteDb } from "./data/devdataSqlite"; +import { DataLogger } from "./data/log"; import { streamDiffLines } from "./edit/streamDiffLines"; import { CodebaseIndexer, PauseToken } from "./indexing/CodebaseIndexer"; import DocsService from "./indexing/docs/DocsService"; @@ -30,14 +32,12 @@ import { createNewPromptFileV2 } from "./promptFiles/v2/createNewPromptFile"; import { callTool } from "./tools/callTool"; import { ChatDescriber } from "./util/chatDescriber"; import { clipboardCache } from "./util/clipboardCache"; -import { logDevData } from "./util/devdata"; -import { DevDataSqliteDb } from "./util/devdataSqlite"; import { GlobalContext } from "./util/GlobalContext"; import historyManager from "./util/history"; import { editConfigJson, getConfigJsonPath, - setupInitialDotContinueDirectory, + migrateV1DevDataFiles, } from "./util/paths"; import { localPathToUri } from "./util/pathToUri"; import { Telemetry } from "./util/posthog"; @@ -62,7 +62,6 @@ export class Core { completionProvider: CompletionProvider; continueServerClientPromise: Promise; codebaseIndexingState: IndexingProgressUpdate; - controlPlaneClient: ControlPlaneClient; private docsService: DocsService; private globalContext = new GlobalContext(); @@ -72,10 +71,6 @@ export class Core { private abortedMessageIds: Set = new Set(); - private async config() { - return (await this.configHandler.loadConfig()).config; - } - invoke( messageType: T, data: ToCoreProtocol[T][0], @@ -99,7 +94,7 @@ export class Core { private readonly onWrite: (text: string) => Promise = async () => {}, ) { // Ensure .continue directory is created - setupInitialDotContinueDirectory(); + migrateV1DevDataFiles(); this.codebaseIndexingState = { status: "loading", @@ -107,22 +102,18 @@ export class Core { progress: 0, }; + const ideInfoPromise = messenger.request("getIdeInfo", undefined); const ideSettingsPromise = messenger.request("getIdeSettings", undefined); const sessionInfoPromise = messenger.request("getControlPlaneSessionInfo", { silent: true, useOnboarding: false, }); - this.controlPlaneClient = new ControlPlaneClient( - sessionInfoPromise, - ideSettingsPromise, - ); - this.configHandler = new ConfigHandler( this.ide, ideSettingsPromise, this.onWrite, - this.controlPlaneClient, + sessionInfoPromise, ); this.docsService = DocsService.createSingleton( @@ -135,14 +126,34 @@ 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, + }), ); + // Dev Data Logger + const dataLogger = DataLogger.getInstance(); + dataLogger.core = this; + dataLogger.ideInfoPromise = ideInfoPromise; + dataLogger.ideSettingsPromise = ideSettingsPromise; + // Codebase Indexer and ContinueServerClient depend on IdeSettings let codebaseIndexerResolve: (_: any) => void | undefined; this.codebaseIndexerPromise = new Promise( @@ -189,12 +200,10 @@ export class Core { const getLlm = async () => { const { config } = await this.configHandler.loadConfig(); - const selected = this.globalContext.get("selectedTabAutocompleteModel"); - return ( - config?.tabAutocompleteModels?.find( - (model) => model.title === selected, - ) ?? config?.tabAutocompleteModels?.[0] - ); + if (!config) { + return undefined; + } + return config.selectedModelByRole.autocomplete ?? undefined; }; this.completionProvider = new CompletionProvider( this.configHandler, @@ -228,11 +237,6 @@ export class Core { } }); - on("update/selectTabAutocompleteModel", async (msg) => { - this.globalContext.update("selectedTabAutocompleteModel", msg.data); - void this.configHandler.reloadConfig(); - }); - // Special on("abort", (msg) => { this.abortedMessageIds.add(msg.messageId); @@ -263,8 +267,8 @@ export class Core { }); // Dev data - on("devdata/log", (msg) => { - logDevData(msg.data.tableName, msg.data.data); + on("devdata/log", async (msg) => { + void DataLogger.getInstance().logDevData(msg.data); }); // Edit config @@ -280,10 +284,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(); }); @@ -304,22 +306,41 @@ export class Core { return this.configHandler.listProfiles(); }); + on("config/refreshProfiles", async (msg) => { + await this.configHandler.loadAssistantsForSelectedOrg(); + }); + on("config/addContextProvider", async (msg) => { - addContextProvider(msg.data); + addContextProvider(msg.data, this.configHandler); }); on("config/updateSharedConfig", async (msg) => { - this.globalContext.updateSharedConfig(msg.data); + const newSharedConfig = this.globalContext.updateSharedConfig(msg.data); await this.configHandler.reloadConfig(); + return newSharedConfig; + }); + + on("config/updateSelectedModel", async (msg) => { + const newSelectedModels = this.globalContext.updateSelectedModel( + msg.data.profileId, + msg.data.role, + msg.data.title, + ); + await this.configHandler.reloadConfig(); + return newSelectedModels; }); on("controlPlane/openUrl", async (msg) => { const env = await getControlPlaneEnv(this.ide.getIdeSettings()); - await this.messenger.request("openUrl", `${env.APP_URL}${msg.data.path}`); + let url = `${env.APP_URL}${msg.data.path}`; + if (msg.data.orgSlug) { + url += `?org=${msg.data.orgSlug}`; + } + await this.messenger.request("openUrl", url); }); on("controlPlane/listOrganizations", async (msg) => { - return await this.controlPlaneClient.listOrganizations(); + return await this.configHandler.listOrganizations(); }); // Context providers @@ -336,7 +357,7 @@ export class Core { }); on("context/loadSubmenuItems", async (msg) => { - const config = await this.config(); + const { config } = await this.configHandler.loadConfig(); if (!config) { return []; } @@ -353,17 +374,26 @@ 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( - (provider) => provider.description.title === name, - ); + const provider = + config.contextProviders?.find( + (provider) => provider.description.title === name, + ) ?? + [ + // user doesn't need these in their config.json for the shortcuts to work + // option+enter + new CurrentFileContextProvider({}), + // cmd+enter + new CodebaseContextProvider({}), + ].find((provider) => provider.description.title === name); if (!provider) { return []; } @@ -377,11 +407,11 @@ export class Core { const items = await provider.getContextItems(query, { config, llm, - embeddingsProvider: config.embeddingsProvider, + embeddingsProvider: config.selectedModelByRole.embed, fullInput, ide, selectedCode, - reranker: config.reranker, + reranker: config.selectedModelByRole.rerank, fetch: (url, init) => fetchwithRequestOptions(url, init, config.requestOptions), }); @@ -399,10 +429,35 @@ 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) { + // After removing transformers JS embeddings provider from jetbrains + // Should no longer see this error + // if (e.message.toLowerCase().includes("embeddings provider")) { + // 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-roles/embeddings", + // ); + // } + // }); + // } + } + if (!knownError) { + void this.ide.showToast( + "error", + `Error getting context items from ${name}: ${e}`, + ); + } return []; } }); @@ -415,7 +470,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, }; }); @@ -600,6 +656,7 @@ export class Core { params, historyIndex, selectedCode, + completionOptions, } = msg.data; const { config } = await configHandler.loadConfig(); @@ -648,6 +705,7 @@ export class Core { config, fetch: (url, init) => fetchwithRequestOptions(url, init, config.requestOptions), + completionOptions, })) { if (abortedMessageIds.has(msg.messageId)) { abortedMessageIds.delete(msg.messageId); @@ -703,6 +761,8 @@ export class Core { llm, data.input, data.language, + false, + undefined, )) { if (abortedMessageIds.has(msg.messageId)) { abortedMessageIds.delete(msg.messageId); @@ -734,10 +794,6 @@ export class Core { editConfigJsonCallback = setupQuickstartConfig; break; - case "LocalAfterFreeTrial": - editConfigJsonCallback = setupLocalConfigAfterFreeTrial; - break; - case "Best": editConfigJsonCallback = setupBestConfig; break; @@ -841,12 +897,18 @@ export class Core { on("files/created", async ({ data }) => { if (data?.uris?.length) { + this.messenger.send("refreshSubmenuItems", { + providers: ["file"], + }); await this.refreshCodebaseIndexFiles(data.uris); } }); on("files/deleted", async ({ data }) => { if (data?.uris?.length) { + this.messenger.send("refreshSubmenuItems", { + providers: ["file"], + }); await this.refreshCodebaseIndexFiles(data.uris); } }); @@ -896,13 +958,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 }; }); @@ -940,16 +1008,23 @@ export class Core { const llm = await this.configHandler.llmFromTitle(selectedModelTitle); const contextItems = await callTool( - tool.uri ?? tool.function.name, + tool, JSON.parse(toolCall.function.arguments || "{}"), { ide: this.ide, llm, fetch: (url, init) => fetchwithRequestOptions(url, init, config.requestOptions), + tool, }, ); + if (tool.faviconUrl) { + contextItems.forEach((item) => { + item.icon = tool.faviconUrl; + }); + } + return { contextItems }; }); } diff --git a/core/util/devdataSqlite.ts b/core/data/devdataSqlite.ts similarity index 95% rename from core/util/devdataSqlite.ts rename to core/data/devdataSqlite.ts index bd9e45dca..bf713ca6c 100644 --- a/core/util/devdataSqlite.ts +++ b/core/data/devdataSqlite.ts @@ -5,8 +5,9 @@ import sqlite3 from "sqlite3"; import { DatabaseConnection } from "../indexing/refreshIndex.js"; -import { getDevDataSqlitePath } from "./paths.js"; +import { getDevDataSqlitePath } from "../util/paths.js"; +/* The Dev Data SQLITE table is only used for local tokens generated */ export class DevDataSqliteDb { static db: DatabaseConnection | null = null; diff --git a/core/data/log.ts b/core/data/log.ts new file mode 100644 index 000000000..1b810d851 --- /dev/null +++ b/core/data/log.ts @@ -0,0 +1,226 @@ +import fs from "fs"; +import path from "path"; + +import { + allDevEventNames, + DataLogLevel, + DevDataLogEvent, + devDataVersionedSchemas, +} from "@continuedev/config-yaml"; +import { fetchwithRequestOptions } from "@continuedev/fetch"; +import * as URI from "uri-js"; +import { fileURLToPath } from "url"; +import { AnyZodObject } from "zod"; +import { Core } from "../core.js"; +import { IdeInfo, IdeSettings } from "../index.js"; +import { getDevDataFilePath } from "../util/paths.js"; +import { joinPathsToUri } from "../util/uri.js"; + +const DEFAULT_DEV_DATA_LEVEL: DataLogLevel = "all"; +export const LOCAL_DEV_DATA_VERSION = "0.2.0"; +export class DataLogger { + private static instance: DataLogger | null = null; + core?: Core; + ideSettingsPromise?: Promise; + ideInfoPromise?: Promise; + + private constructor() {} + + public static getInstance(): DataLogger { + if (DataLogger.instance === null) { + DataLogger.instance = new DataLogger(); + } + return DataLogger.instance; + } + + async addBaseValues( + body: Record, + eventName: string, + schema: string, + zodSchema: AnyZodObject, + ): Promise> { + const newBody = { ...body }; + const ideSettings = await this.ideSettingsPromise; + const ideInfo = await this.ideInfoPromise; + + if ("eventName" in zodSchema.shape) { + newBody.eventName = eventName; + } + if ("timestamp" in zodSchema.shape) { + newBody.timestamp = new Date().toISOString(); + } + if ("schema" in zodSchema.shape) { + newBody.schema = schema; + } + if ("userAgent" in zodSchema.shape) { + newBody.userAgent = ideInfo + ? `${ideInfo.name}/${ideInfo.version} (Continue/${ideInfo.extensionVersion})` + : "Unknown/Unknown (Continue/Unknown)"; + } + if ("selectedProfileId" in zodSchema.shape) { + newBody.selectedProfileId = + this.core?.configHandler.currentProfile?.profileDescription.id ?? ""; + } + if ("userId" in zodSchema.shape) { + newBody.userId = ideSettings?.userToken ?? ""; + } + + return newBody; + } + + async logDevData(event: DevDataLogEvent) { + // Local logs (always on for all levels) + try { + const filepath: string = getDevDataFilePath( + event.name, + LOCAL_DEV_DATA_VERSION, + ); + const localSchema = + devDataVersionedSchemas[LOCAL_DEV_DATA_VERSION]["all"][event.name]; + + if (!localSchema) { + throw new Error( + `Schema ${LOCAL_DEV_DATA_VERSION} doesn't exist at level "all"`, + ); + } + + const eventDataWithBaseValues = await this.addBaseValues( + event.data, + event.name, + LOCAL_DEV_DATA_VERSION, + localSchema, + ); + + const parsed = localSchema?.safeParse(eventDataWithBaseValues); + if (parsed?.success) { + fs.writeFileSync(filepath, `${JSON.stringify(parsed.data)}\n`, { + flag: "a", + }); + } + } catch (error) { + console.error("Error logging local dev data:", error); + } + + // Remote logs + const config = (await this.core?.configHandler.loadConfig())?.config; + if (config?.data?.length) { + await Promise.allSettled( + config.data.map(async (dataConfig) => { + try { + // First extract the data schema based on the version and level + const { schema } = dataConfig; + + const level = dataConfig.level ?? DEFAULT_DEV_DATA_LEVEL; + + // Skip event if `events` is specified and does not include the event + const events = dataConfig.events ?? allDevEventNames; + if (!events.includes(event.name)) { + return; + } + + const versionSchemas = devDataVersionedSchemas[schema]; + if (!versionSchemas) { + throw new Error( + `Attempting to log dev data to non-existent version ${schema}`, + ); + } + + const levelSchemas = versionSchemas[level]; + if (!levelSchemas) { + throw new Error( + `Attempting to log dev data at level ${level} for version ${schema} which does not exist`, + ); + } + + const zodSchema = levelSchemas[event.name]; + if (!zodSchema) { + throw new Error( + `Attempting to log dev data for event ${event.name} at level ${level} for version ${schema}: no schema found`, + ); + } + + const eventDataWithBaseValues = await this.addBaseValues( + event.data, + event.name, + schema, + zodSchema, + ); + + const parsed = zodSchema.safeParse(eventDataWithBaseValues); + if (!parsed.success) { + throw new Error( + `Failed to parse event data for event ${event.name} and schema ${schema}\n:${parsed.error.toString()}`, + ); + } + + const uriComponents = URI.parse(dataConfig.destination); + + // Send to remote server + if ( + uriComponents.scheme === "https" || + uriComponents.scheme === "http" + ) { + const headers: Record = { + "Content-Type": "application/json", + }; + if (dataConfig.apiKey) { + headers["Authorization"] = `Bearer ${dataConfig.apiKey}`; + } + + // For events going to Continue, overwrite the access token + if ( + uriComponents.host?.endsWith(".continue.dev") || + uriComponents.host === "continue.dev" + ) { + // + const accessToken = + await this.core?.configHandler.controlPlaneClient.getAccessToken(); + headers["Authorization"] = `Bearer ${accessToken}`; + } + const profileId = + this.core?.configHandler.currentProfile?.profileDescription + .id ?? ""; + const response = await fetchwithRequestOptions( + dataConfig.destination, + { + method: "POST", + headers, + body: JSON.stringify({ + name: event.name, + data: parsed.data, + schema, + level, + profileId, + }), + }, + dataConfig.requestOptions, + ); + if (!response.ok) { + throw new Error( + `Post request failed. ${response.status}: ${response.statusText}`, + ); + } + } else if (uriComponents.scheme === "file") { + // Write to jsonc file for local file URIs + const dirUri = joinPathsToUri(dataConfig.destination, schema); + const dirPath = fileURLToPath(dirUri); + + if (!fs.existsSync(dirPath)) { + fs.mkdirSync(dirPath, { recursive: true }); + } + const filepath = path.join(dirPath, `${event.name}.jsonl`); + const jsonLine = JSON.stringify(event.data); + fs.writeFileSync(filepath, `${jsonLine}\n`, { flag: "a" }); + } else { + throw new Error(`Unsupported URI scheme ${uriComponents.scheme}`); + } + } catch (error) { + console.error( + `Error logging data to ${dataConfig.destination}: ${error instanceof Error ? error.message : error}`, + ); + } + }), + ); + } + } +} diff --git a/core/edit/lazy/applyCodeBlock.ts b/core/edit/lazy/applyCodeBlock.ts index 924d1c282..424d4e831 100644 --- a/core/edit/lazy/applyCodeBlock.ts +++ b/core/edit/lazy/applyCodeBlock.ts @@ -18,7 +18,8 @@ export async function applyCodeBlock( llm: ILLM, fastLlm: ILLM, ): Promise<[boolean, AsyncGenerator]> { - if (canUseInstantApply(filename)) { + // This was buggy, removed for now, maybe forever + if (false && canUseInstantApply(filename)) { const diffLines = await deterministicApplyLazyEdit( oldFile, newFile, diff --git a/core/edit/streamDiffLines.ts b/core/edit/streamDiffLines.ts index 1d1202b91..f7b54dff6 100644 --- a/core/edit/streamDiffLines.ts +++ b/core/edit/streamDiffLines.ts @@ -54,7 +54,8 @@ export async function* streamDiffLines( llm: ILLM, input: string, language: string | undefined, - onlyOneInsertion?: boolean, + onlyOneInsertion: boolean, + overridePrompt: ChatMessage[] | undefined, ): AsyncGenerator { 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 = { diff --git a/core/index.d.ts b/core/index.d.ts index 1184b412b..7cbf0e25b 100644 --- a/core/index.d.ts +++ b/core/index.d.ts @@ -1,6 +1,6 @@ +import { DataDestination, ModelRole } from "@continuedev/config-yaml"; import Parser from "web-tree-sitter"; import { GetGhTokenArgs } from "./protocol/ide"; - declare global { interface Window { ide?: "vscode"; @@ -60,7 +60,7 @@ export interface IndexingStatus { progress: number; description: string; status: "indexing" | "complete" | "paused" | "failed" | "aborted" | "pending"; - embeddingsProviderId: string; + embeddingsProviderId?: string; isReindexing?: boolean; debugInfo?: string; title: string; @@ -94,6 +94,8 @@ export interface ILLM extends LLMOptions { apiKey?: string; apiBase?: string; cacheBehavior?: CacheBehavior; + capabilities?: ModelCapability; + roles?: ModelRole[]; deployment?: string; apiVersion?: string; @@ -177,8 +179,8 @@ export type FetchFunction = (url: string | URL, init?: any) => Promise; export interface ContextProviderExtras { config: ContinueConfig; fullInput: string; - embeddingsProvider: ILLM; - reranker: ILLM | undefined; + embeddingsProvider: ILLM | null; + reranker: ILLM | null; llm: ILLM; ide: IDE; selectedCode: RangeInFile[]; @@ -476,10 +478,18 @@ export interface LLMOptions { writeLog?: (str: string) => Promise; llmRequestHook?: (model: string, prompt: string) => any; apiKey?: string; + + // continueProperties apiKeyLocation?: string; - aiGatewaySlug?: string; apiBase?: string; + orgScopeId?: string | null; + + onPremProxyUrl?: string | null; + + aiGatewaySlug?: string; cacheBehavior?: CacheBehavior; + capabilities?: ModelCapability; + roles?: ModelRole[]; useLegacyCompletionsEndpoint?: boolean; @@ -500,17 +510,16 @@ export interface LLMOptions { profile?: string; modelArn?: string; - // AWS and GCP Options + // AWS and VertexAI Options region?: string; - // GCP Options - capabilities?: ModelCapability; - - // GCP and Watsonx Options + // VertexAI and Watsonx Options projectId?: string; // IBM watsonx Options deploymentId?: string; + + env?: Record; } type RequireAtLeastOne = Pick< @@ -599,7 +608,7 @@ export interface IdeSettings { remoteConfigSyncPeriod: number; userToken: string; enableControlServerBeta: boolean; - continueTestEnvironment: "none" | "production" | "test" | "local"; + continueTestEnvironment: "none" | "production" | "staging" | "local"; pauseCodebaseIndexOnStart: boolean; } @@ -672,6 +681,10 @@ export interface IDE { } >; + getLastFileSaveTimestamp?(): number; + + updateLastFileSaveTimestamp?(): void; + getPinnedFiles(): Promise; getSearchResults(query: string): Promise; @@ -725,6 +738,7 @@ export interface ContinueSDK { selectedCode: RangeInFile[]; config: ContinueConfig; fetch: FetchFunction; + completionOptions?: LLMFullCompletionOptions; } export interface SlashCommand { @@ -859,6 +873,7 @@ export interface ToolExtras { ide: IDE; llm: ILLM; fetch: FetchFunction; + tool: Tool; } export interface Tool { @@ -874,6 +889,7 @@ export interface Tool { wouldLikeTo: string; readonly: boolean; uri?: string; + faviconUrl?: string; } interface ToolChoice { @@ -905,6 +921,7 @@ export interface BaseCompletionOptions { export interface ModelCapability { uploadImage?: boolean; + tools?: boolean; } export interface ModelDescription { @@ -912,8 +929,14 @@ export interface ModelDescription { provider: string; model: string; apiKey?: string; + + // continueProperties apiKeyLocation?: string; apiBase?: string; + orgScopeId?: string | null; + + onPremProxyUrl?: string | null; + contextLength?: number; maxStopWords?: number; template?: TemplateType; @@ -921,8 +944,9 @@ export interface ModelDescription { systemMessage?: string; requestOptions?: RequestOptions; promptTemplates?: { [key: string]: string }; - capabilities?: ModelCapability; cacheBehavior?: CacheBehavior; + capabilities?: ModelCapability; + roles?: ModelRole[]; } export interface EmbedOptions { @@ -933,15 +957,16 @@ export interface EmbedOptions { apiType?: string; apiVersion?: string; requestOptions?: RequestOptions; - maxChunkSize?: number; - maxBatchSize?: number; + maxEmbeddingChunkSize?: number; + maxEmbeddingBatchSize?: number; + // AWS options profile?: string; - // AWS and GCP Options + // AWS and VertexAI Options region?: string; - // GCP and Watsonx Options + // VertexAI and Watsonx Options projectId?: string; } @@ -971,6 +996,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 { @@ -994,6 +1024,7 @@ export type TransportOptions = StdioOptions | WebSocketOptions | SSEOptions; export interface MCPOptions { transport: TransportOptions; + faviconUrl?: string; } export interface ContinueUIConfig { @@ -1002,6 +1033,7 @@ export interface ContinueUIConfig { displayRawMarkdown?: boolean; showChatScrollbar?: boolean; codeWrap?: boolean; + showSessionTabs?: boolean; } export interface ContextMenuConfig { @@ -1012,10 +1044,10 @@ export interface ContextMenuConfig { fixGrammar?: string; } -export interface ModelRoles { +export interface ExperimentalModelRoles { + repoMapFileSelection?: string; inlineEdit?: string; applyCodeBlock?: string; - repoMapFileSelection?: string; } export type EditStatus = @@ -1080,7 +1112,7 @@ export type DefaultContextProvider = ContextProviderWithParams & { export interface ExperimentalConfig { contextMenuPrompts?: ContextMenuConfig; - modelRoles?: ModelRoles; + modelRoles?: ExperimentalModelRoles; defaultContext?: DefaultContextProvider[]; promptPath?: string; @@ -1132,6 +1164,7 @@ export interface SerializedContinueConfig { experimental?: ExperimentalConfig; analytics?: AnalyticsConfig; docs?: SiteIndexingConfig[]; + data?: DataDestination[]; } export type ConfigMergeType = "merge" | "overwrite"; @@ -1184,6 +1217,7 @@ export interface Config { experimental?: ExperimentalConfig; /** Analytics configuration */ analytics?: AnalyticsConfig; + data?: DataDestination[]; } // in the actual Continue source code @@ -1198,15 +1232,15 @@ export interface ContinueConfig { disableSessionTitles?: boolean; disableIndexing?: boolean; userToken?: string; - embeddingsProvider: ILLM; - tabAutocompleteModels?: ILLM[]; tabAutocompleteOptions?: Partial; ui?: ContinueUIConfig; - reranker?: ILLM; experimental?: ExperimentalConfig; analytics?: AnalyticsConfig; docs?: SiteIndexingConfig[]; tools: Tool[]; + modelsByRole: Record; + selectedModelByRole: Record; + data?: DataDestination[]; } export interface BrowserSerializedContinueConfig { @@ -1220,15 +1254,15 @@ export interface BrowserSerializedContinueConfig { disableIndexing?: boolean; disableSessionTitles?: boolean; userToken?: string; - embeddingsProvider?: string; ui?: ContinueUIConfig; - reranker?: RerankerDescription; experimental?: ExperimentalConfig; analytics?: AnalyticsConfig; docs?: SiteIndexingConfig[]; tools: Tool[]; usePlatform: boolean; tabAutocompleteOptions?: Partial; + modelsByRole: Record; + selectedModelByRole: Record; } // DOCS SUGGESTIONS AND PACKAGE INFO diff --git a/core/indexing/CodebaseIndexer.ts b/core/indexing/CodebaseIndexer.ts index 677cc4305..6f5a5e946 100644 --- a/core/indexing/CodebaseIndexer.ts +++ b/core/indexing/CodebaseIndexer.ts @@ -5,8 +5,8 @@ import { IContinueServerClient } from "../continueServer/interface.js"; import { IDE, IndexingProgressUpdate, IndexTag } from "../index.js"; import { extractMinimalStackTraceInfo } from "../util/extractMinimalStackTraceInfo.js"; import { getIndexSqlitePath, getLanceDbPath } from "../util/paths.js"; - import { findUriInDirs, getUriPathBasename } from "../util/uri.js"; + import { ChunkCodebaseIndex } from "./chunk/ChunkCodebaseIndex.js"; import { CodeSnippetsCodebaseIndex } from "./CodeSnippetsIndex.js"; import { FullTextSearchCodebaseIndex } from "./FullTextSearchCodebaseIndex.js"; @@ -80,14 +80,19 @@ export class CodebaseIndexer { return []; } + const embeddingsModel = config.selectedModelByRole.embed; + if (!embeddingsModel) { + return []; + } + const indexes = [ new ChunkCodebaseIndex( this.ide.readFile.bind(this.ide), this.continueServerClient, - config.embeddingsProvider.maxEmbeddingChunkSize, + embeddingsModel.maxEmbeddingChunkSize, ), // Chunking must come first new LanceDbIndex( - config.embeddingsProvider, + embeddingsModel, this.ide.readFile.bind(this.ide), this.continueServerClient, ), diff --git a/core/indexing/LanceDbIndex.test.ts b/core/indexing/LanceDbIndex.test.ts index 08c8f9982..d8a7c9852 100644 --- a/core/indexing/LanceDbIndex.test.ts +++ b/core/indexing/LanceDbIndex.test.ts @@ -3,15 +3,15 @@ import lance from "vectordb"; import { testConfigHandler, testIde } from "../test/fixtures"; import { getLanceDbPath } from "../util/paths"; + +import { LanceDbIndex } from "./LanceDbIndex"; +import { DatabaseConnection, SqliteDb } from "./refreshIndex"; import { mockPathAndCacheKey, mockTag, testContinueServerClient, updateIndexAndAwaitGenerator, } from "./test/indexing"; - -import { LanceDbIndex } from "./LanceDbIndex"; -import { DatabaseConnection, SqliteDb } from "./refreshIndex"; import { IndexResultType } from "./types"; jest.useFakeTimers(); @@ -30,9 +30,12 @@ describe.skip("ChunkCodebaseIndex", () => { if (!mockConfig) { throw new Error("Failed to load config"); } + if (!mockConfig.selectedModelByRole.embed) { + throw new Error("No embeddings model selected"); + } index = new LanceDbIndex( - mockConfig.embeddingsProvider, + mockConfig.selectedModelByRole.embed, testIde.readFile.bind(testIde), testContinueServerClient, ); diff --git a/core/indexing/LanceDbIndex.ts b/core/indexing/LanceDbIndex.ts index d11feb1d1..077b2ace0 100644 --- a/core/indexing/LanceDbIndex.ts +++ b/core/indexing/LanceDbIndex.ts @@ -40,11 +40,11 @@ type ChunkMap = Map; export class LanceDbIndex implements CodebaseIndex { relativeExpectedTime: number = 13; get artifactId(): string { - return `vectordb::${this.embeddingsProvider.embeddingId}`; + return `vectordb::${this.embeddingsProvider?.embeddingId}`; } constructor( - private readonly embeddingsProvider: ILLM, + private readonly embeddingsProvider: ILLM | null, private readonly readFile: (filepath: string) => Promise, private readonly continueServerClient?: IContinueServerClient, ) {} @@ -142,6 +142,9 @@ export class LanceDbIndex implements CodebaseIndex { item: PathAndCacheKey, content: string, ): Promise { + if (!this.embeddingsProvider) { + return []; + } const chunks: Chunk[] = []; const chunkParams = { @@ -163,6 +166,9 @@ export class LanceDbIndex implements CodebaseIndex { } private async getEmbeddings(chunks: Chunk[]): Promise { + if (!this.embeddingsProvider) { + return []; + } try { return await this.embeddingsProvider.embed(chunks.map((c) => c.content)); } catch (err) { @@ -436,6 +442,9 @@ export class LanceDbIndex implements CodebaseIndex { tags: BranchAndDir[], filterDirectory: string | undefined, ): Promise { + if (!this.embeddingsProvider) { + return []; + } const [vector] = await this.embeddingsProvider.embed([query]); const db = await lance.connect(getLanceDbPath()); diff --git a/core/indexing/allEmbeddingsProviders.ts b/core/indexing/allEmbeddingsProviders.ts index 9efa37f2d..3986fa2c0 100644 --- a/core/indexing/allEmbeddingsProviders.ts +++ b/core/indexing/allEmbeddingsProviders.ts @@ -8,6 +8,7 @@ import Gemini from "../llm/llms/Gemini.js"; import HuggingFaceTEIEmbeddingsProvider from "../llm/llms/HuggingFaceTEI.js"; import LMStudio from "../llm/llms/LMStudio.js"; import Mistral from "../llm/llms/Mistral.js"; +import NCompass from "../llm/llms/NCompass.js"; import Nebius from "../llm/llms/Nebius.js"; import Nvidia from "../llm/llms/Nvidia.js"; import Ollama from "../llm/llms/Ollama.js"; @@ -39,6 +40,7 @@ export const allEmbeddingsProviders: Record< gemini: Gemini, "continue-proxy": ContinueProxy, deepinfra: DeepInfra, + ncompass: NCompass, nvidia: Nvidia, voyage: Voyage, mistral: Mistral, diff --git a/core/indexing/docs/DocsService.skip.ts b/core/indexing/docs/DocsService.skip.ts index 0064f064c..682b76a23 100644 --- a/core/indexing/docs/DocsService.skip.ts +++ b/core/indexing/docs/DocsService.skip.ts @@ -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); diff --git a/core/indexing/docs/DocsService.ts b/core/indexing/docs/DocsService.ts index f0d1e2f3c..307e3c117 100644 --- a/core/indexing/docs/DocsService.ts +++ b/core/indexing/docs/DocsService.ts @@ -1,3 +1,4 @@ +import { ConfigResult } from "@continuedev/config-yaml"; import { open, type Database } from "sqlite"; import sqlite3 from "sqlite3"; import lancedb, { Connection } from "vectordb"; @@ -19,6 +20,7 @@ import TransformersJsEmbeddingsProvider from "../../llm/llms/TransformersJsEmbed import { FromCoreProtocol, ToCoreProtocol } from "../../protocol"; import { IMessenger } from "../../protocol/messenger"; import { fetchFavicon, getFaviconBase64 } from "../../util/fetchFavicon"; +import { GlobalContext } from "../../util/GlobalContext"; import { editConfigJson, getDocsSqlitePath, @@ -40,7 +42,6 @@ import { SiteIndexingResults, } from "./preIndexed"; import preIndexedDocs from "./preIndexedDocs"; -import { ConfigResult } from "@continuedev/config-yaml"; // Purposefully lowercase because lancedb converts export interface LanceDbDocsRow { @@ -156,19 +157,26 @@ export default class DocsService { const currentStatus = this.statuses.get(doc.startUrl); if (currentStatus) { - return currentStatus; + this.handleStatusUpdate(currentStatus); + return; } - const sharedStatus = { - type: "docs" as IndexingStatus["type"], + const sharedStatus: Omit< + IndexingStatus, + "progress" | "description" | "status" + > = { + type: "docs", id: doc.startUrl, - embeddingsProviderId: this.config.embeddingsProvider.embeddingId, isReindexing: false, title: doc.title, debugInfo: `max depth: ${doc.maxDepth}`, icon: doc.faviconUrl, url: doc.startUrl, }; + if (this.config.selectedModelByRole.embed) { + sharedStatus.embeddingsProviderId = + this.config.selectedModelByRole.embed.embeddingId; + } const indexedStatus: IndexingStatus = metadata.find( (meta) => meta.startUrl === doc.startUrl, ) @@ -210,13 +218,11 @@ 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) { + if ( + this.config.selectedModelByRole.embed?.embeddingId !== startedWithEmbedder + ) { this.abort(startUrl); return true; } @@ -236,14 +242,6 @@ export default class DocsService { return true; } - async isUsingUnsupportedPreIndexedEmbeddingsProvider() { - const isPreIndexedDocsProvider = - this.config.embeddingsProvider.embeddingId === - DocsService.preIndexedDocsEmbeddingsProvider.embeddingId; - const canUsePreindexedDocs = await this.canUsePreindexedDocs(); - return isPreIndexedDocsProvider && !canUsePreindexedDocs; - } - // Determines if using preIndexed and returns proper embeddings provider async getEmbeddingsProvider(startUrl: string) { // Conditions for using a pre-indexed doc @@ -264,7 +262,7 @@ export default class DocsService { } } return { - provider: this.config.embeddingsProvider, + provider: this.config.selectedModelByRole.embed, isPreindexed: false, }; } @@ -276,10 +274,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) { @@ -288,9 +282,7 @@ export default class DocsService { // Skip docs indexing if not supported // No warning message here because would show on ANY config update - const unsupported = - await this.isUsingUnsupportedPreIndexedEmbeddingsProvider(); - if (unsupported) { + if (!this.config.selectedModelByRole.embed) { return; } @@ -329,18 +321,21 @@ export default class DocsService { // Returns true if startUrl has been indexed with current embeddingsProvider async hasMetadata(startUrl: string): Promise { + if (!this.config.selectedModelByRole.embed) { + return false; + } const db = await this.getOrCreateSqliteDb(); const title = await db.get( `SELECT title FROM ${DocsService.sqlitebTableName} WHERE startUrl = ? AND embeddingsProviderId = ?`, startUrl, - this.config.embeddingsProvider.embeddingId, + this.config.selectedModelByRole.embed.embeddingId, ); return !!title; } async listMetadata() { - const embeddingsProvider = this.config.embeddingsProvider; + const embeddingsProvider = this.config.selectedModelByRole.embed; if (!embeddingsProvider) { return []; } @@ -365,13 +360,16 @@ export default class DocsService { async indexAndAdd( siteIndexingConfig: SiteIndexingConfig, - reIndex: boolean = false, + forceReindex: boolean = false, ): Promise { - if (this.config.disableIndexing) { - console.warn("Attempting to add/index docs when indexing is disabled"); + 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 { startUrl, useLocalCrawling, maxDepth } = siteIndexingConfig; const { isPreindexed, provider } = await this.getEmbeddingsProvider(startUrl); @@ -379,13 +377,15 @@ export default class DocsService { 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)) { + if (!provider) { + console.warn("@docs indexAndAdd: no embeddings provider found"); 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 @@ -396,32 +396,82 @@ export default class DocsService { type: "docs", id: siteIndexingConfig.startUrl, embeddingsProviderId: provider.embeddingId, - isReindexing: reIndex && indexExists, + isReindexing: forceReindex && indexExists, title: siteIndexingConfig.title, debugInfo: `max depth: ${siteIndexingConfig.maxDepth}`, icon: siteIndexingConfig.faviconUrl, url: siteIndexingConfig.startUrl, }; - // Clear current indexes if reIndexing - if (indexExists) { - if (reIndex) { - await this.deleteIndexes(startUrl); - } else { + // If not force-reindexing and has failed with same config, don't reattempt + if (!forceReindex) { + const globalContext = new GlobalContext(); + const failedDocs = globalContext.get("failedDocs") ?? []; + const hasFailed = failedDocs.find((d) => + this.siteIndexingConfigsAreEqual(siteIndexingConfig, d), + ); + if (hasFailed) { + console.log( + `Not reattempting to index ${siteIndexingConfig.startUrl}, has already failed with same config`, + ); this.handleStatusUpdate({ ...fixedStatus, + description: "Failed", + status: "failed", progress: 1, - description: "Complete", - status: "complete", - debugInfo: "Already indexed", }); return; } } + 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") ?? []; + const newFailedDocs = failedDocs.filter( + (d) => !this.siteIndexingConfigsAreEqual(siteIndexingConfig, d), + ); + newFailedDocs.push(siteIndexingConfig); + globalContext.update("failedDocs", newFailedDocs); + }; + + const removeFromFailedGlobalContext = () => { + const globalContext = new GlobalContext(); + const failedDocs = globalContext.get("failedDocs") ?? []; + const newFailedDocs = failedDocs.filter( + (d) => !this.siteIndexingConfigsAreEqual(siteIndexingConfig, d), + ); + globalContext.update("failedDocs", newFailedDocs); + }; + try { this.docsIndexingQueue.add(startUrl); + // Clear current indexes if reIndexing + if (indexExists && forceReindex) { + await this.deleteIndexes(startUrl); + } + this.addToConfig(siteIndexingConfig); this.handleStatusUpdate({ @@ -523,9 +573,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; @@ -551,7 +602,7 @@ export default class DocsService { }); void this.ide.showToast("info", `Failed to index ${startUrl}`); - this.docsIndexingQueue.delete(startUrl); + markFailedInGlobalContext(); return; } @@ -569,7 +620,7 @@ export default class DocsService { }); // Delete indexed docs if re-indexing - if (reIndex && indexExists) { + if (forceReindex && indexExists) { console.log("Deleting old embeddings"); await this.deleteIndexes(startUrl); } @@ -593,11 +644,6 @@ export default class DocsService { favicon, }); - this.docsIndexingQueue.delete(startUrl); - - if (this.shouldCancel(startUrl, startedWithEmbedder)) { - return; - } this.handleStatusUpdate({ ...fixedStatus, description: "Complete", @@ -610,23 +656,29 @@ export default class DocsService { this.messenger?.send("refreshSubmenuItems", { providers: ["docs"], }); + + 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") && e.message.includes("rate limit") ) { - description = "Github rate limit exceeded"; + description = "Github rate limit exceeded"; // This text is used verbatim elsewhere } } - console.error("Error indexing docs", e); this.handleStatusUpdate({ ...fixedStatus, description, status: "failed", progress: 1, }); + markFailedInGlobalContext(); } finally { this.docsIndexingQueue.delete(startUrl); } @@ -670,21 +722,18 @@ export default class DocsService { startUrl: string, nRetrieve: number, ) { - if (await this.isUsingUnsupportedPreIndexedEmbeddingsProvider()) { - await this.ide.showToast( - "error", - `${DocsService.preIndexedDocsEmbeddingsProvider.embeddingId} is configured as ` + - "the embeddings provider, but it cannot be used with JetBrains. " + // TODO "with this IDE" - "Please select a different embeddings provider to use the '@docs' " + - "context provider.", - ); - - return []; - } - const { isPreindexed, provider } = await this.getEmbeddingsProvider(startUrl); + if (!provider) { + void this.ide.showToast( + "error", + "Set up an embeddings model to use the @docs context provider. See: " + + "https://docs.continue.dev/customize/model-roles/embeddings", + ); + return []; + } + if (isPreindexed) { void Telemetry.capture("docs_pre_indexed_doc_used", { doc: preIndexedDocs[startUrl]!["title"], @@ -715,8 +764,10 @@ export default class DocsService { try { const { isPreindexed, provider } = await this.getEmbeddingsProvider(startUrl); - const preIndexedDoc = preIndexedDocs[startUrl]; - const isPreIndexedDoc = !!preIndexedDoc; + + if (!provider) { + throw new Error("No embeddings model set"); + } const result = await db.get( `SELECT startUrl, title, favicon FROM ${DocsService.sqlitebTableName} WHERE startUrl = ? AND embeddingsProviderId = ?`, @@ -747,7 +798,7 @@ export default class DocsService { config: siteIndexingConfig, indexingStatus: this.statuses.get(startUrl), chunks: rows.map(this.lanceDBRowToChunk), - isPreIndexedDoc, + isPreIndexedDoc: isPreindexed, }; } catch (e) { console.warn("Error getting details", e); @@ -821,7 +872,7 @@ export default class DocsService { } async getFavicon(startUrl: string) { - if (!this.config.embeddingsProvider) { + if (!this.config.selectedModelByRole.embed) { console.warn( "Attempting to get favicon without embeddings provider specified", ); @@ -831,7 +882,7 @@ export default class DocsService { const result = await db.get( `SELECT favicon FROM ${DocsService.sqlitebTableName} WHERE startUrl = ? AND embeddingsProviderId = ?`, startUrl, - this.config.embeddingsProvider.embeddingId, + this.config.selectedModelByRole.embed.embeddingId, ); if (!result) { @@ -871,7 +922,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); @@ -895,7 +946,7 @@ export default class DocsService { type: "docs", id: doc.startUrl, embeddingsProviderId: - this.config.embeddingsProvider.embeddingId, + this.config.selectedModelByRole.embed?.embeddingId, isReindexing: false, title: doc.title, debugInfo: "Config sync: not changed", @@ -908,22 +959,16 @@ export default class DocsService { } } } else { - const currentStatus = this.statuses.get(doc.startUrl); - if (currentStatus?.status !== "failed") { - 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 newDocs) { - void Telemetry.capture("add_docs_config", { url: doc.startUrl }); - } - for (const doc of deletedDocs) { await this.deleteIndexes(doc.startUrl); } @@ -993,6 +1038,13 @@ export default class DocsService { const conn = await lancedb.connect(getLanceDbPath()); const tableNames = await conn.tableNames(); const { provider } = await this.getEmbeddingsProvider(startUrl); + + if (!provider) { + throw new Error( + "Could not retrieve @docs Lance Table: no embeddings provider specified", + ); + } + const tableNameFromEmbeddingsProvider = await this.getLanceTableName(provider); @@ -1049,13 +1101,19 @@ export default class DocsService { siteIndexingConfig: { title, startUrl }, favicon, }: AddParams) { + if (!this.config.selectedModelByRole.embed) { + console.warn( + `Attempting to add metadata for ${startUrl} without embeddings provider specified`, + ); + return; + } const db = await this.getOrCreateSqliteDb(); await db.run( `INSERT INTO ${DocsService.sqlitebTableName} (title, startUrl, favicon, embeddingsProviderId) VALUES (?, ?, ?, ?)`, title, startUrl, favicon, - this.config.embeddingsProvider.embeddingId, + this.config.selectedModelByRole.embed.embeddingId, ); } @@ -1107,7 +1165,7 @@ export default class DocsService { } private async deleteMetadataFromSqlite(startUrl: string) { - if (!this.config.embeddingsProvider) { + if (!this.config.selectedModelByRole.embed) { console.warn( `Attempting to delete metadata for ${startUrl} without embeddings provider specified`, ); @@ -1118,7 +1176,7 @@ export default class DocsService { await db.run( `DELETE FROM ${DocsService.sqlitebTableName} WHERE startUrl = ? AND embeddingsProviderId = ?`, startUrl, - this.config.embeddingsProvider.embeddingId, + this.config.selectedModelByRole.embed.embeddingId, ); } diff --git a/core/indexing/docs/article.ts b/core/indexing/docs/article.ts index 428bae967..aba1da6b0 100644 --- a/core/indexing/docs/article.ts +++ b/core/indexing/docs/article.ts @@ -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 { diff --git a/core/indexing/docs/preIndexedDocs.ts b/core/indexing/docs/preIndexedDocs.ts index 1e2a8dbc0..5342396fd 100644 --- a/core/indexing/docs/preIndexedDocs.ts +++ b/core/indexing/docs/preIndexedDocs.ts @@ -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; diff --git a/core/llm/autodetect.ts b/core/llm/autodetect.ts index ed1901641..6b9884c21 100644 --- a/core/llm/autodetect.ts +++ b/core/llm/autodetect.ts @@ -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( diff --git a/core/llm/constructMessages.ts b/core/llm/constructMessages.ts index 4d948e7d0..0e4533ceb 100644 --- a/core/llm/constructMessages.ts +++ b/core/llm/constructMessages.ts @@ -1,87 +1,26 @@ -import { ChatHistoryItem, ChatMessage, MessagePart } from "../"; +import { + ChatHistoryItem, + ChatMessage, + MessagePart, + ModelDescription, +} from "../"; import { normalizeToMessageParts } from "../util/messageContent"; import { modelSupportsTools } from "./autodetect"; -const CUSTOM_SYS_MSG_MODEL_FAMILIES = ["sonnet"]; - -const SYSTEM_MESSAGE = `When generating new code: - -1. Always produce a single code block. -2. Never separate the code into multiple code blocks. -3. Only include the code that is being added. -4. Replace existing code with a "lazy" comment like this: "// ... existing code ..." -5. The "lazy" comment must always be a valid comment in the current context (e.g. "" for HTML, "// ... existing code ..." for JavaScript, "{/* ... existing code */}" for TSX, etc.) -6. You must always provide 1-2 lines of context above and below a "lazy" comment -7. If the user submits a code block that contains a filename in the language specifier, always include the filename in any code block you generate based on that file. The filename should be on the same line as the language specifier in your code block. - -Example 1: -Input: -\`\`\`test.js -import addition from "addition" - -class Calculator { - constructor() { - this.result = 0; - } - - add(number) { - this.result += number; - return this; - } -} -\`\`\` -User request: Add a subtract method - -Output: -\`\`\`javascript test.js -// ... existing code ... -import subtraction from "subtraction" - -class Calculator { - // ... existing code ... - - subtract(number) { - this.result -= number; - return this; - } -} -\`\`\` - -Example 2: -Input: -\`\`\`javascript test.js (6-9) -function helloWorld() {} -\`\`\` - -Output: -\`\`\`javascript test.js -function helloWorld() { - // New code here -} -\`\`\` - -Always follow these guidelines when generating code responses.`; - 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))) { - systemMessage = SYSTEM_MESSAGE; + let systemMessage = + "Always include the language and file name in the info string when you write code blocks, for example '```python file.py'."; + if (useTools && modelSupportsTools(modelDescription)) { + systemMessage += "\n\n" + TOOL_USE_RULES; } - if (useTools && modelSupportsTools(model, provider)) { - if (systemMessage) { - systemMessage += "\n\n"; - } - systemMessage += TOOL_USE_RULES; - } - return systemMessage || null; + return systemMessage; } const CANCELED_TOOL_CALL_MESSAGE = @@ -89,8 +28,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 +36,7 @@ export function constructMessages( ); const msgs: ChatMessage[] = []; - const systemMessage = constructSystemPrompt(model, provider, useTools); + const systemMessage = constructSystemPrompt(modelDescription, useTools); if (systemMessage) { msgs.push({ role: "system", diff --git a/core/llm/index.ts b/core/llm/index.ts index 4989f14fa..ccbad6699 100644 --- a/core/llm/index.ts +++ b/core/llm/index.ts @@ -1,3 +1,4 @@ +import { ModelRole } from "@continuedev/config-yaml"; import { fetchwithRequestOptions } from "@continuedev/fetch"; import { findLlmInfo } from "@continuedev/llm-info"; import { @@ -7,6 +8,8 @@ import { } from "@continuedev/openai-adapters"; import Handlebars from "handlebars"; +import { DevDataSqliteDb } from "../data/devdataSqlite.js"; +import { DataLogger } from "../data/log.js"; import { CacheBehavior, ChatMessage, @@ -21,8 +24,6 @@ import { RequestOptions, TemplateType, } from "../index.js"; -import { logDevData } from "../util/devdata.js"; -import { DevDataSqliteDb } from "../util/devdataSqlite.js"; import mergeJson from "../util/merge.js"; import { renderChatMessage } from "../util/messageContent.js"; import { isOllamaInstalled } from "../util/ollamaHelper.js"; @@ -117,10 +118,17 @@ export abstract class BaseLLM implements ILLM { writeLog?: (str: string) => Promise; llmRequestHook?: (model: string, prompt: string) => any; apiKey?: string; + + // continueProperties apiKeyLocation?: string; apiBase?: string; + orgScopeId?: string | null; + + onPremProxyUrl?: string | null; + cacheBehavior?: CacheBehavior; capabilities?: ModelCapability; + roles?: ModelRole[]; deployment?: string; apiVersion?: string; @@ -196,9 +204,15 @@ export abstract class BaseLLM implements ILLM { this.writeLog = options.writeLog; this.llmRequestHook = options.llmRequestHook; this.apiKey = options.apiKey; + + // continueProperties this.apiKeyLocation = options.apiKeyLocation; - this.aiGatewaySlug = options.aiGatewaySlug; + this.orgScopeId = options.orgScopeId; this.apiBase = options.apiBase; + + this.onPremProxyUrl = options.onPremProxyUrl; + + this.aiGatewaySlug = options.aiGatewaySlug; this.cacheBehavior = options.cacheBehavior; // watsonx deploymentId @@ -209,6 +223,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; @@ -285,7 +300,7 @@ export abstract class BaseLLM implements ILLM { return this.templateMessages(msgs); } - private _compileLogMessage( + private _compilePromptForLog( prompt: string, completionOptions: CompletionOptions, ): string { @@ -340,11 +355,14 @@ export abstract class BaseLLM implements ILLM { generatedTokens, ); - logDevData("tokens_generated", { - model: model, - provider: this.providerName, - promptTokens: promptTokens, - generatedTokens: generatedTokens, + void DataLogger.getInstance().logDevData({ + name: "tokensGenerated", + data: { + model: model, + provider: this.providerName, + promptTokens: promptTokens, + generatedTokens: generatedTokens, + }, }); } @@ -444,7 +462,7 @@ export abstract class BaseLLM implements ILLM { options, ); - return { completionOptions, log, raw }; + return { completionOptions, logEnabled: log, raw }; } private _formatChatMessages(messages: ChatMessage[]): string { @@ -497,12 +515,15 @@ export abstract class BaseLLM implements ILLM { signal: AbortSignal, options: LLMFullCompletionOptions = {}, ): AsyncGenerator { - const { completionOptions, log } = this._parseCompletionOptions(options); + const { completionOptions, logEnabled } = + this._parseCompletionOptions(options); const fimLog = `Prefix: ${prefix}\nSuffix: ${suffix}`; - if (log) { + if (logEnabled) { if (this.writeLog) { - await this.writeLog(this._compileLogMessage(fimLog, completionOptions)); + await this.writeLog( + this._compilePromptForLog(fimLog, completionOptions), + ); } if (this.llmRequestHook) { this.llmRequestHook(completionOptions.model, fimLog); @@ -538,7 +559,7 @@ export abstract class BaseLLM implements ILLM { this._logTokensGenerated(completionOptions.model, fimLog, completion); - if (log && this.writeLog) { + if (logEnabled && this.writeLog) { await this.writeLog(`Completion:\n${completion}\n\n`); } @@ -554,7 +575,7 @@ export abstract class BaseLLM implements ILLM { signal: AbortSignal, options: LLMFullCompletionOptions = {}, ) { - const { completionOptions, log, raw } = + const { completionOptions, logEnabled, raw } = this._parseCompletionOptions(options); let prompt = pruneRawPromptFromTop( @@ -568,9 +589,11 @@ export abstract class BaseLLM implements ILLM { prompt = this._templatePromptLikeMessages(prompt); } - if (log) { + if (logEnabled) { if (this.writeLog) { - await this.writeLog(this._compileLogMessage(prompt, completionOptions)); + await this.writeLog( + this._compilePromptForLog(prompt, completionOptions), + ); } if (this.llmRequestHook) { this.llmRequestHook(completionOptions.model, prompt); @@ -615,7 +638,7 @@ export abstract class BaseLLM implements ILLM { } finally { this._logTokensGenerated(completionOptions.model, prompt, completion); - if (log && this.writeLog) { + if (logEnabled && this.writeLog) { await this.writeLog(`Completion:\n${completion}\n\n`); } } @@ -633,7 +656,7 @@ export abstract class BaseLLM implements ILLM { signal: AbortSignal, options: LLMFullCompletionOptions = {}, ) { - const { completionOptions, log, raw } = + const { completionOptions, logEnabled, raw } = this._parseCompletionOptions(options); let prompt = pruneRawPromptFromTop( @@ -647,9 +670,11 @@ export abstract class BaseLLM implements ILLM { prompt = this._templatePromptLikeMessages(prompt); } - if (log) { + if (logEnabled) { if (this.writeLog) { - await this.writeLog(this._compileLogMessage(prompt, completionOptions)); + await this.writeLog( + this._compilePromptForLog(prompt, completionOptions), + ); } if (this.llmRequestHook) { this.llmRequestHook(completionOptions.model, prompt); @@ -672,7 +697,7 @@ export abstract class BaseLLM implements ILLM { this._logTokensGenerated(completionOptions.model, prompt, completion); - if (log && this.writeLog) { + if (logEnabled && this.writeLog) { await this.writeLog(`Completion:\n${completion}\n\n`); } @@ -716,7 +741,8 @@ export abstract class BaseLLM implements ILLM { signal: AbortSignal, options: LLMFullCompletionOptions = {}, ): AsyncGenerator { - let { completionOptions, log } = this._parseCompletionOptions(options); + let { completionOptions, logEnabled } = + this._parseCompletionOptions(options); completionOptions = this._modifyCompletionOptions(completionOptions); @@ -725,9 +751,11 @@ export abstract class BaseLLM implements ILLM { const prompt = this.templateMessages ? this.templateMessages(messages) : this._formatChatMessages(messages); - if (log) { + if (logEnabled) { if (this.writeLog) { - await this.writeLog(this._compileLogMessage(prompt, completionOptions)); + await this.writeLog( + this._compilePromptForLog(prompt, completionOptions), + ); } if (this.llmRequestHook) { this.llmRequestHook(completionOptions.model, prompt); @@ -794,7 +822,7 @@ export abstract class BaseLLM implements ILLM { this._logTokensGenerated(completionOptions.model, prompt, completion); - if (log && this.writeLog) { + if (logEnabled && this.writeLog) { await this.writeLog(`Completion:\n${completion}\n\n`); } diff --git a/core/llm/llm.test.ts b/core/llm/llm.test.ts index 53729022a..9912b862e 100644 --- a/core/llm/llm.test.ts +++ b/core/llm/llm.test.ts @@ -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 = { @@ -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 }, + ); }); diff --git a/core/llm/llms/Anthropic.ts b/core/llm/llms/Anthropic.ts index df527d579..dcd13d38e 100644 --- a/core/llm/llms/Anthropic.ts +++ b/core/llm/llms/Anthropic.ts @@ -145,6 +145,12 @@ class Anthropic extends BaseLLM { signal: AbortSignal, options: CompletionOptions, ): AsyncGenerator { + if (!this.apiKey || this.apiKey === "") { + throw new Error( + "Request not sent. You have an Anthropic model configured in your config.json, but the API key is not set.", + ); + } + const shouldCacheSystemMessage = !!this.systemMessage && this.cacheBehavior?.cacheSystemMessage; const systemMessage: string = stripImages( diff --git a/core/llm/llms/Azure.ts b/core/llm/llms/Azure.ts index b2beae921..bd27daeb1 100644 --- a/core/llm/llms/Azure.ts +++ b/core/llm/llms/Azure.ts @@ -14,7 +14,7 @@ class Azure extends OpenAI { static defaultOptions: Partial = { apiVersion: "2024-02-15-preview", - apiType: "azure", + apiType: "azure-openai", }; constructor(options: LLMOptions) { diff --git a/core/llm/llms/FreeTrial.ts b/core/llm/llms/FreeTrial.ts index c092a1ecb..ab69aff70 100644 --- a/core/llm/llms/FreeTrial.ts +++ b/core/llm/llms/FreeTrial.ts @@ -215,7 +215,7 @@ class FreeTrial extends BaseLLM { "llama3.1-70b", "gpt-4o", "gpt-3.5-turbo", - "claude-3-haiku-20240307", + "claude-3-5-haiku-latest", "gemini-1.5-pro-latest", ]; } diff --git a/core/llm/llms/Gemini.ts b/core/llm/llms/Gemini.ts index 4c0fb189b..ee24cc3e9 100644 --- a/core/llm/llms/Gemini.ts +++ b/core/llm/llms/Gemini.ts @@ -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; } } diff --git a/core/llm/llms/NCompass.ts b/core/llm/llms/NCompass.ts new file mode 100644 index 000000000..744366b41 --- /dev/null +++ b/core/llm/llms/NCompass.ts @@ -0,0 +1,60 @@ +import { ChatCompletionCreateParams } from "openai/resources/index"; +import { ChatMessage, CompletionOptions, LLMOptions } from "../../index.js"; + +import OpenAI from "./OpenAI.js"; + +class NCompass extends OpenAI { + static providerName = "ncompass"; + static defaultOptions: Partial = { + apiBase: "https://api.ncompass.tech/v1" + }; + static embeddingsApiEndpoint: "https://api.gcp.ncompass.tech/v1/embeddings" + + private static modelConversion: { [key: string]: string } = { + "qwen2.5-coder-7b": "Qwen/Qwen2.5-Coder-7B-Instruct", + "qwen2.5-coder-32b": "Qwen/Qwen2.5-Coder-32B-Instruct", + }; + protected _convertModelName(model: string): string { + return NCompass.modelConversion[model] ?? model; + } + + protected _convertArgs( + options: CompletionOptions, + messages: ChatMessage[], + ): ChatCompletionCreateParams { + const finalOptions = super._convertArgs(options, messages); + finalOptions.model = this._convertModelName(options.model); + return finalOptions; + } + + protected _getHeaders() { + const headers = super._getHeaders() as { "Content-Type": string; Authorization: string; "api-key": string; Accept?: string }; + headers["Accept"] = "text/event-stream"; + return headers; + } + + protected async _embed(chunks: string[]): Promise { + const resp = await this.fetch(NCompass.embeddingsApiEndpoint, { + method: "POST", + body: JSON.stringify({ + input: chunks, + model: this.model, + ...this.extraBodyProperties(), + }), + headers: { + Authorization: `Bearer ${this.apiKey}`, + "Content-Type": "application/json", + }, + }); + + if (!resp.ok) { + throw new Error(await resp.text()); + } + + const data = (await resp.json()) as any; + return data.data.map((result: { embedding: number[] }) => result.embedding); + } + +} + +export default NCompass; diff --git a/core/llm/llms/Nebius.ts b/core/llm/llms/Nebius.ts index dc97f94d0..e346e4ca8 100644 --- a/core/llm/llms/Nebius.ts +++ b/core/llm/llms/Nebius.ts @@ -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", diff --git a/core/llm/llms/Ollama.ts b/core/llm/llms/Ollama.ts index b9734acb9..ee822eb27 100644 --- a/core/llm/llms/Ollama.ts +++ b/core/llm/llms/Ollama.ts @@ -139,12 +139,17 @@ class Ollama extends BaseLLM { if (options.model === "AUTODETECT") { return; } + const headers: Record = { + "Content-Type": "application/json", + }; + + if (this.apiKey) { + headers.Authorization = `Bearer ${this.apiKey}`; + } + this.fetch(this.getEndpoint("api/show"), { method: "POST", - headers: { - Authorization: `Bearer ${this.apiKey}`, - "Content-Type": "application/json", - }, + headers: headers, body: JSON.stringify({ name: this._getModel() }), }) .then(async (response) => { @@ -323,12 +328,16 @@ class Ollama extends BaseLLM { signal: AbortSignal, options: CompletionOptions, ): AsyncGenerator { + const headers: Record = { + "Content-Type": "application/json", + }; + + if (this.apiKey) { + headers.Authorization = `Bearer ${this.apiKey}`; + } const response = await this.fetch(this.getEndpoint("api/generate"), { method: "POST", - headers: { - "Content-Type": "application/json", - Authorization: `Bearer ${this.apiKey}`, - }, + headers: headers, body: JSON.stringify(this._getGenerateOptions(options, prompt)), signal, }); @@ -384,13 +393,16 @@ class Ollama extends BaseLLM { })); chatOptions.stream = false; // Cannot set stream = true for tools calls } - + const headers: Record = { + "Content-Type": "application/json", + }; + + if (this.apiKey) { + headers.Authorization = `Bearer ${this.apiKey}`; + } const response = await this.fetch(this.getEndpoint("api/chat"), { method: "POST", - headers: { - "Content-Type": "application/json", - Authorization: `Bearer ${this.apiKey}`, - }, + headers: headers, body: JSON.stringify(chatOptions), signal, }); @@ -467,12 +479,16 @@ class Ollama extends BaseLLM { signal: AbortSignal, options: CompletionOptions, ): AsyncGenerator { + const headers: Record = { + "Content-Type": "application/json", + }; + + if (this.apiKey) { + headers.Authorization = `Bearer ${this.apiKey}`; + } const response = await this.fetch(this.getEndpoint("api/generate"), { method: "POST", - headers: { - "Content-Type": "application/json", - Authorization: `Bearer ${this.apiKey}`, - }, + headers: headers, body: JSON.stringify(this._getGenerateOptions(options, prefix, suffix)), signal, }); @@ -504,11 +520,19 @@ class Ollama extends BaseLLM { } async listModels(): Promise { + const headers: Record = { + "Content-Type": "application/json", + }; + + if (this.apiKey) { + headers.Authorization = `Bearer ${this.apiKey}`; + } const response = await this.fetch( // localhost was causing fetch failed in pkg binary only for this Ollama endpoint this.getEndpoint("api/tags"), { method: "GET", + headers: headers, }, ); const data = await response.json(); @@ -522,16 +546,20 @@ class Ollama extends BaseLLM { } protected async _embed(chunks: string[]): Promise { + const headers: Record = { + "Content-Type": "application/json", + }; + + if (this.apiKey) { + headers.Authorization = `Bearer ${this.apiKey}`; + } const resp = await this.fetch(new URL("api/embed", this.apiBase), { method: "POST", body: JSON.stringify({ model: this.model, input: chunks, }), - headers: { - "Content-Type": "application/json", - Authorization: `Bearer ${this.apiKey}`, - }, + headers: headers }); if (!resp.ok) { diff --git a/core/llm/llms/OpenAI.ts b/core/llm/llms/OpenAI.ts index e0acc961e..92f0aca08 100644 --- a/core/llm/llms/OpenAI.ts +++ b/core/llm/llms/OpenAI.ts @@ -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); } @@ -267,7 +274,7 @@ class OpenAI extends BaseLLM { body.max_completion_tokens = undefined; } - if (body.tools?.length) { + if (body.tools?.length && !body.model?.startsWith("o3")) { // To ensure schema adherence: https://platform.openai.com/docs/guides/function-calling#parallel-function-calling-and-structured-outputs // In practice, setting this to true and asking for multiple tool calls // leads to "arguments" being something like '{"file": "test.ts"}{"file": "test.js"}' diff --git a/core/llm/llms/TransformersJsEmbeddingsProvider.ts b/core/llm/llms/TransformersJsEmbeddingsProvider.ts index 206d534d3..d17c9e0f1 100644 --- a/core/llm/llms/TransformersJsEmbeddingsProvider.ts +++ b/core/llm/llms/TransformersJsEmbeddingsProvider.ts @@ -43,6 +43,7 @@ export class TransformersJsEmbeddingsProvider extends BaseLLM { static maxGroupSize: number = 1; static model: string = "all-MiniLM-L6-v2"; static mockVector: number[] = Array.from({ length: 384 }).fill(2) as number[]; + static title: string = "Transformers.js (Built-In)"; static defaultOptions: Partial | undefined = { model: TransformersJsEmbeddingsProvider.model, diff --git a/core/llm/llms/VertexAI.ts b/core/llm/llms/VertexAI.ts index 8d20c3212..4d52e5c43 100644 --- a/core/llm/llms/VertexAI.ts +++ b/core/llm/llms/VertexAI.ts @@ -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({ diff --git a/core/llm/llms/index.ts b/core/llm/llms/index.ts index 20bc8b710..32cda4aec 100644 --- a/core/llm/llms/index.ts +++ b/core/llm/llms/index.ts @@ -19,6 +19,7 @@ import Cohere from "./Cohere"; import DeepInfra from "./DeepInfra"; import Deepseek from "./Deepseek"; import Fireworks from "./Fireworks"; +import NCompass from "./NCompass"; import Flowise from "./Flowise"; import FreeTrial from "./FreeTrial"; import FunctionNetwork from "./FunctionNetwork"; @@ -81,6 +82,7 @@ export const LLMClasses = [ Flowise, Groq, Fireworks, + NCompass, ContinueProxy, Cloudflare, Deepseek, diff --git a/core/llm/llms/stubs/ContinueProxy.ts b/core/llm/llms/stubs/ContinueProxy.ts index 848b3fff7..00ec93dbc 100644 --- a/core/llm/llms/stubs/ContinueProxy.ts +++ b/core/llm/llms/stubs/ContinueProxy.ts @@ -1,3 +1,5 @@ +import { ContinueProperties } from "@continuedev/config-yaml"; + import { ControlPlaneProxyInfo } from "../../../control-plane/analytics/IAnalyticsProvider.js"; import { Telemetry } from "../../../util/posthog.js"; import OpenAI from "../OpenAI.js"; @@ -7,7 +9,12 @@ import type { Chunk, LLMOptions } from "../../../index.js"; class ContinueProxy extends OpenAI { set controlPlaneProxyInfo(value: ControlPlaneProxyInfo) { this.apiKey = value.workOsAccessToken; - this.apiBase = new URL("openai/v1/", value.controlPlaneProxyUrl).toString(); + if (!this.onPremProxyUrl) { + this.apiBase = new URL( + "openai/v1/", + value.controlPlaneProxyUrl, + ).toString(); + } } // The apiKey and apiBase are set to the values for the proxy, @@ -19,6 +26,11 @@ class ContinueProxy extends OpenAI { super(options); this.actualApiBase = options.apiBase; this.apiKeyLocation = options.apiKeyLocation; + this.orgScopeId = options.orgScopeId; + this.onPremProxyUrl = options.onPremProxyUrl; + if (this.onPremProxyUrl) { + this.apiBase = new URL("openai/v1/", this.onPremProxyUrl).toString(); + } } static providerName = "continue-proxy"; @@ -27,11 +39,13 @@ class ContinueProxy extends OpenAI { }; protected extraBodyProperties(): Record { + const continueProperties: ContinueProperties = { + apiKeyLocation: this.apiKeyLocation, + apiBase: this.actualApiBase, + orgScopeId: this.orgScopeId ?? null, + }; return { - continueProperties: { - apiKeyLocation: this.apiKeyLocation, - apiBase: this.actualApiBase, - }, + continueProperties, }; } diff --git a/core/llm/openaiTypeConverters.ts b/core/llm/openaiTypeConverters.ts index 4ed8be1c4..8e0acef56 100644 --- a/core/llm/openaiTypeConverters.ts +++ b/core/llm/openaiTypeConverters.ts @@ -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; + }), }; } } diff --git a/core/llm/templates/chat.test.ts b/core/llm/templates/chat.test.ts index fbe84c40f..0bbe087ad 100644 --- a/core/llm/templates/chat.test.ts +++ b/core/llm/templates/chat.test.ts @@ -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); }); }); diff --git a/core/llm/templates/chat.ts b/core/llm/templates/chat.ts index a4b999b05..b205f3d3c 100644 --- a/core/llm/templates/chat.ts +++ b/core/llm/templates/chat.ts @@ -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()!); } diff --git a/core/llm/templates/edit.ts b/core/llm/templates/edit.ts index e6ad4d6b6..aa8433fc4 100644 --- a/core/llm/templates/edit.ts +++ b/core/llm/templates/edit.ts @@ -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}}}" diff --git a/core/llm/toolSupport.ts b/core/llm/toolSupport.ts index dd8f72fb0..ea7f2adf3 100644 --- a/core/llm/toolSupport.ts +++ b/core/llm/toolSupport.ts @@ -2,9 +2,14 @@ export const PROVIDER_TOOL_SUPPORT: Record< string, (model: string) => boolean | undefined > = { + "continue-proxy": (model) => { + return ["claude-3-5", "claude-3.5", "claude-3-7", "claude-3.7", "gpt-4", "o3", "gemini"].some((part) => + model.toLowerCase().startsWith(part), + ); + }, anthropic: (model) => { if ( - ["claude-3-5", "claude-3.5"].some((part) => + ["claude-3-5", "claude-3.5", "claude-3-7", "claude-3.7"].some((part) => model.toLowerCase().startsWith(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")) { + if ( + model.toLowerCase().startsWith("gpt-4") || + model.toLowerCase().startsWith("o3") + ) { return true; } }, diff --git a/core/package-lock.json b/core/package-lock.json index 9c6ab8b38..abe4271f8 100644 --- a/core/package-lock.json +++ b/core/package-lock.json @@ -13,13 +13,13 @@ "@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.24", + "@continuedev/config-yaml": "^1.0.52", "@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", + "@octokit/rest": "^20.1.1", "@typescript-eslint/eslint-plugin": "^7.8.0", "@xenova/transformers": "2.14.0", "adf-to-md": "^1.1.0", @@ -72,7 +72,7 @@ "wink-nlp-utils": "^2.1.0", "workerpool": "^9.1.3", "yaml": "^2.4.2", - "zod": "^3.23.8" + "zod": "^3.24.2" }, "devDependencies": { "@babel/preset-env": "^7.24.7", @@ -3038,13 +3038,13 @@ } }, "node_modules/@continuedev/config-yaml": { - "version": "1.0.24", - "resolved": "https://registry.npmjs.org/@continuedev/config-yaml/-/config-yaml-1.0.24.tgz", - "integrity": "sha512-xA4tRUh9r9p3aHIXr9zl5GQd5VygEusIc7Zw7AAFCbbl6ahMB4CDcweT8+iz0UvxJ11PLYizFSygpvxu/Yl19Q==", + "version": "1.0.52", + "resolved": "https://registry.npmjs.org/@continuedev/config-yaml/-/config-yaml-1.0.52.tgz", + "integrity": "sha512-x0m4bcQpjHrrv95cq5tsen4Hb6yKCVGn+NeojyzNQYnRD0If/On+ATgX78uXtQtZxsdO4ip73HHCyQlA0O3ZyQ==", "dependencies": { "@continuedev/config-types": "^1.0.14", "yaml": "^2.6.1", - "zod": "^3.23.8" + "zod": "^3.24.2" } }, "node_modules/@continuedev/fetch": { @@ -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", @@ -4232,14 +4232,6 @@ "node": ">=18" } }, - "node_modules/@modelcontextprotocol/sdk/node_modules/zod": { - "version": "3.24.1", - "resolved": "https://registry.npmjs.org/zod/-/zod-3.24.1.tgz", - "integrity": "sha512-muH7gBL9sI1nciMZV67X5fTKKBLtwpZ5VBp1vsOQzj1MhrBZ4wlVCm3gedKZWLp0Oyel8sIGfeiz54Su+OVT+A==", - "funding": { - "url": "https://github.com/sponsors/colinhacks" - } - }, "node_modules/@modelcontextprotocol/sdk/node_modules/zod-to-json-schema": { "version": "3.24.1", "resolved": "https://registry.npmjs.org/zod-to-json-schema/-/zod-to-json-schema-3.24.1.tgz", @@ -6829,6 +6821,14 @@ "devtools-protocol": "*" } }, + "node_modules/chromium-bidi/node_modules/zod": { + "version": "3.23.8", + "resolved": "https://registry.npmjs.org/zod/-/zod-3.23.8.tgz", + "integrity": "sha512-XBx9AXhXktjUqnepgTiE5flcKIYWi/rme0Eaj+5Y0lftuGBq+jyRu/md4WnuxqgP1ubdpNCsYEYPxrzVHD8d6g==", + "funding": { + "url": "https://github.com/sponsors/colinhacks" + } + }, "node_modules/ci-info": { "version": "3.9.0", "resolved": "https://registry.npmjs.org/ci-info/-/ci-info-3.9.0.tgz", @@ -13691,6 +13691,14 @@ "node": ">=10" } }, + "node_modules/puppeteer-chromium-resolver/node_modules/zod": { + "version": "3.23.8", + "resolved": "https://registry.npmjs.org/zod/-/zod-3.23.8.tgz", + "integrity": "sha512-XBx9AXhXktjUqnepgTiE5flcKIYWi/rme0Eaj+5Y0lftuGBq+jyRu/md4WnuxqgP1ubdpNCsYEYPxrzVHD8d6g==", + "funding": { + "url": "https://github.com/sponsors/colinhacks" + } + }, "node_modules/puppeteer-core": { "version": "22.15.0", "resolved": "https://registry.npmjs.org/puppeteer-core/-/puppeteer-core-22.15.0.tgz", @@ -15560,9 +15568,10 @@ } }, "node_modules/undici": { - "version": "6.21.0", - "resolved": "https://registry.npmjs.org/undici/-/undici-6.21.0.tgz", - "integrity": "sha512-BUgJXc752Kou3oOIuU1i+yZZypyZRqNPW0vqoMPl8VaoalSfeR0D8/t4iAS3yirs79SSMTxTag+ZC86uswv+Cw==", + "version": "6.21.1", + "resolved": "https://registry.npmjs.org/undici/-/undici-6.21.1.tgz", + "integrity": "sha512-q/1rj5D0/zayJB2FraXdaWxbhWiNKDvu8naDT2dl1yTlvJp4BLtOcp2a5BvgGNQpYYJzau7tf1WgKv3b+7mqpQ==", + "license": "MIT", "engines": { "node": ">=18.17" } @@ -16267,9 +16276,9 @@ } }, "node_modules/zod": { - "version": "3.23.8", - "resolved": "https://registry.npmjs.org/zod/-/zod-3.23.8.tgz", - "integrity": "sha512-XBx9AXhXktjUqnepgTiE5flcKIYWi/rme0Eaj+5Y0lftuGBq+jyRu/md4WnuxqgP1ubdpNCsYEYPxrzVHD8d6g==", + "version": "3.24.2", + "resolved": "https://registry.npmjs.org/zod/-/zod-3.24.2.tgz", + "integrity": "sha512-lY7CDW43ECgW9u1TcT3IoXHflywfVqDYze4waEz812jR/bZ8FHDsl7pFQoSZTz5N+2NqRXs8GBwnAwo3ZNxqhQ==", "funding": { "url": "https://github.com/sponsors/colinhacks" } diff --git a/core/package.json b/core/package.json index c0f7f736d..a88bf0cf1 100644 --- a/core/package.json +++ b/core/package.json @@ -46,13 +46,13 @@ "@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.24", + "@continuedev/config-yaml": "^1.0.52", "@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", + "@octokit/rest": "^20.1.1", "@typescript-eslint/eslint-plugin": "^7.8.0", "@xenova/transformers": "2.14.0", "adf-to-md": "^1.1.0", @@ -105,7 +105,7 @@ "wink-nlp-utils": "^2.1.0", "workerpool": "^9.1.3", "yaml": "^2.4.2", - "zod": "^3.23.8" + "zod": "^3.24.2" }, "engine-strict": true, "engines": { diff --git a/core/promptFiles/v1/getContextProviderHelpers.ts b/core/promptFiles/v1/getContextProviderHelpers.ts index e027ffbc5..30b51bf8b 100644 --- a/core/promptFiles/v1/getContextProviderHelpers.ts +++ b/core/promptFiles/v1/getContextProviderHelpers.ts @@ -19,12 +19,12 @@ export function getContextProviderHelpers( async (helperContext: any) => { const items = await provider.getContextItems(helperContext, { config: context.config, - embeddingsProvider: context.config.embeddingsProvider, + embeddingsProvider: context.config.selectedModelByRole.embed, fetch: context.fetch, fullInput: context.input, ide: context.ide, llm: context.llm, - reranker: context.config.reranker, + reranker: context.config.selectedModelByRole.rerank, selectedCode: context.selectedCode, }); diff --git a/core/protocol/core.ts b/core/protocol/core.ts index 64bc5f5d4..ac991622a 100644 --- a/core/protocol/core.ts +++ b/core/protocol/core.ts @@ -1,10 +1,11 @@ -import { ConfigResult } from "@continuedev/config-yaml"; +import { ConfigResult, ModelRole } from "@continuedev/config-yaml"; import { AutocompleteInput } from "../autocomplete/util/types"; import { ProfileDescription } from "../config/ConfigHandler"; import { OrganizationDescription } from "../config/ProfileLifecycleManager"; import { SharedConfigSchema } from "../config/sharedConfig"; +import { DevDataLogEvent } from "@continuedev/config-yaml"; import type { BrowserSerializedContinueConfig, ChatMessage, @@ -14,11 +15,11 @@ import type { ContextSubmenuItem, DiffLine, DocsIndexingDetails, + ExperimentalModelRoles, FileSymbolMap, IdeSettings, LLMFullCompletionOptions, ModelDescription, - ModelRoles, PromptLog, RangeInFile, SerializedContinueConfig, @@ -27,13 +28,9 @@ import type { SiteIndexingConfig, ToolCall, } from "../"; +import { GlobalContextModelSelections } from "../util/GlobalContext"; -export type OnboardingModes = - | "Local" - | "Best" - | "Custom" - | "Quickstart" - | "LocalAfterFreeTrial"; +export type OnboardingModes = "Local" | "Best" | "Custom" | "Quickstart"; export interface ListHistoryOptions { offset?: number; @@ -41,8 +38,6 @@ export interface ListHistoryOptions { } export type ToCoreFromIdeOrWebviewProtocol = { - "update/selectTabAutocompleteModel": [string, void]; - // Special ping: [string, string]; abort: [undefined, void]; @@ -52,12 +47,12 @@ export type ToCoreFromIdeOrWebviewProtocol = { "history/delete": [{ id: string }, void]; "history/load": [{ id: string }, Session]; "history/save": [Session, void]; - "devdata/log": [{ tableName: string; data: any }, void]; + "devdata/log": [DevDataLogEvent, void]; "config/addOpenAiKey": [string, void]; "config/addModel": [ { model: SerializedContinueConfig["models"][number]; - role?: keyof ModelRoles; + role?: keyof ExperimentalModelRoles; }, void, ]; @@ -67,15 +62,24 @@ export type ToCoreFromIdeOrWebviewProtocol = { undefined, { result: ConfigResult; - profileId: string; + profileId: string | null; }, ]; "config/deleteModel": [{ title: string }, void]; "config/addContextProvider": [ContextProviderWithParams, void]; "config/reload": [undefined, ConfigResult]; - "config/listProfiles": [undefined, ProfileDescription[]]; + "config/listProfiles": [undefined, ProfileDescription[] | null]; + "config/refreshProfiles": [undefined, void]; "config/openProfile": [{ profileId: string | undefined }, void]; - "config/updateSharedConfig": [SharedConfigSchema, void]; + "config/updateSharedConfig": [SharedConfigSchema, SharedConfigSchema]; + "config/updateSelectedModel": [ + { + profileId: string; + role: ModelRole; + title: string | null; + }, + GlobalContextModelSelections, + ]; "context/getContextItems": [ { name: string; @@ -104,6 +108,7 @@ export type ToCoreFromIdeOrWebviewProtocol = { params: any; historyIndex: number; selectedCode: RangeInFile[]; + completionOptions?: LLMFullCompletionOptions; }, AsyncGenerator, ]; @@ -189,14 +194,12 @@ 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[] }, ]; "clipboardCache/add": [{ content: string }, void]; - "controlPlane/openUrl": [{ path: string }, void]; + "controlPlane/openUrl": [{ path: string; orgSlug: string | undefined }, void]; "controlPlane/listOrganizations": [undefined, OrganizationDescription[]]; }; diff --git a/core/protocol/coreWebview.ts b/core/protocol/coreWebview.ts index e8ef70ab9..67b5919a4 100644 --- a/core/protocol/coreWebview.ts +++ b/core/protocol/coreWebview.ts @@ -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, + ]; }; diff --git a/core/protocol/ideWebview.ts b/core/protocol/ideWebview.ts index 9cc19504d..a7cd16e5b 100644 --- a/core/protocol/ideWebview.ts +++ b/core/protocol/ideWebview.ts @@ -49,11 +49,11 @@ export type ToIdeFromWebviewProtocol = ToIdeFromWebviewOrCoreProtocol & { acceptDiff: [{ filepath: string; streamId?: string }, void]; rejectDiff: [{ filepath: string; streamId?: string }, void]; "edit/sendPrompt": [ - { prompt: MessageContent; range: RangeInFileWithContents }, - void, - ]; - "edit/acceptReject": [ - { accept: boolean; onlyFirst: boolean; filepath: string }, + { + prompt: MessageContent; + range: RangeInFileWithContents; + selectedModelTitle: string; + }, void, ]; "edit/exit": [{ shouldFocusEditor: boolean }, void]; @@ -79,10 +79,6 @@ export type ToWebviewFromIdeProtocol = ToWebviewFromIdeOrCoreProtocol & { navigateTo: [{ path: string; toggle?: boolean }, void]; addModel: [undefined, void]; - /** - * @deprecated Use navigateTo with a path instead. - */ - viewHistory: [undefined, void]; focusContinueSessionId: [{ sessionId: string | undefined }, void]; newSession: [undefined, void]; setTheme: [{ theme: any }, void]; diff --git a/core/protocol/passThrough.ts b/core/protocol/passThrough.ts index 8ee0c5ae8..ef71c66a1 100644 --- a/core/protocol/passThrough.ts +++ b/core/protocol/passThrough.ts @@ -22,8 +22,10 @@ export const WEBVIEW_TO_CORE_PASS_THROUGH: (keyof ToCoreFromWebviewProtocol)[] = "config/getSerializedProfileInfo", "config/deleteModel", "config/listProfiles", + "config/refreshProfiles", "config/openProfile", "config/updateSharedConfig", + "config/updateSelectedModel", "context/getContextItems", "context/getSymbolsForFiles", "context/loadSubmenuItems", @@ -57,7 +59,6 @@ export const WEBVIEW_TO_CORE_PASS_THROUGH: (keyof ToCoreFromWebviewProtocol)[] = // "completeOnboarding", "addAutocompleteModel", - "profiles/switch", "didChangeSelectedProfile", "didChangeSelectedOrg", "tools/call", @@ -82,7 +83,5 @@ export const CORE_TO_WEBVIEW_PASS_THROUGH: (keyof ToWebviewFromCoreProtocol)[] = "setTTSActive", "getWebviewHistoryLength", "getCurrentSessionId", - "signInToControlPlane", - "openDialogMessage", "docs/suggestions", ]; diff --git a/core/protocol/webview.ts b/core/protocol/webview.ts index 822d9b532..90df4bd0f 100644 --- a/core/protocol/webview.ts +++ b/core/protocol/webview.ts @@ -12,7 +12,7 @@ export type ToWebviewFromIdeOrCoreProtocol = { configUpdate: [ { result: ConfigResult; - 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, void]; }; diff --git a/core/test/fixtures.ts b/core/test/fixtures.ts index 4f8601303..ae54b03db 100644 --- a/core/test/fixtures.ts +++ b/core/test/fixtures.ts @@ -18,7 +18,7 @@ export const testConfigHandler = new ConfigHandler( testIde, ideSettingsPromise, async (text) => {}, - testControlPlaneClient, + Promise.resolve(undefined), ); export const testLLM = new Mock({ diff --git a/core/tools/callTool.ts b/core/tools/callTool.ts index 706fa57d9..959752af1 100644 --- a/core/tools/callTool.ts +++ b/core/tools/callTool.ts @@ -1,5 +1,6 @@ -import { ContextItem, ToolExtras } from ".."; +import { ContextItem, Tool, ToolExtras } from ".."; import { MCPManagerSingleton } from "../context/mcp"; +import { canParseUrl } from "../util/url"; import { BuiltInToolNames } from "./builtIn"; import { createNewFileImpl } from "./implementations/createNewFile"; @@ -55,9 +56,8 @@ async function callToolFromUri( args: any, extras: ToolExtras, ): Promise { - // @ts-ignore - const canParse = URL.canParse(uri); - if (!canParse) { + const parseable = canParseUrl(uri); + if (!parseable) { throw new Error(`Invalid URI: ${uri}`); } const parsedUri = new URL(uri); @@ -86,13 +86,18 @@ async function callToolFromUri( throw new Error(`Failed to call tool: ${toolName}`); } - return (response.content as any).map((item: any) => { + return (response.content as any).map((item: any): ContextItem => { if (item.type !== "text") { throw new Error( `Continue received item of type "${item.type}" from MCP tool, but currently only supports "text".`, ); } - return { name: toolName, description: toolName, content: item.text }; + return { + name: extras.tool.displayTitle, + description: "Tool output", + content: item.text, + icon: extras.tool.faviconUrl, + }; }); default: @@ -101,10 +106,12 @@ async function callToolFromUri( } export async function callTool( - uri: string, + tool: Tool, args: any, extras: ToolExtras, ): Promise { + const uri = tool.uri ?? tool.function.name; + switch (uri) { case BuiltInToolNames.ReadFile: return await readFileImpl(args, extras); diff --git a/core/util/GlobalContext.test.ts b/core/util/GlobalContext.test.ts index 0d6b9d799..b13f3b87b 100644 --- a/core/util/GlobalContext.test.ts +++ b/core/util/GlobalContext.test.ts @@ -29,12 +29,6 @@ describe("GlobalContext", () => { expect(value).toBe(true); }); - it("should update and get a string value correctly", () => { - globalContext.update("selectedTabAutocompleteModel", "test-model"); - const value = globalContext.get("selectedTabAutocompleteModel"); - expect(value).toBe("test-model"); - }); - it("should update and get an object value correctly", () => { const workspaceIdentifier = "workspace-1"; globalContext.update("lastSelectedProfileForWorkspace", { @@ -108,13 +102,9 @@ describe("GlobalContext", () => { it("should update and retrieve multiple values correctly", () => { globalContext.update("indexingPaused", true); - globalContext.update("selectedTabAutocompleteModel", "test-model"); globalContext.update("hasDismissedConfigTsNoticeJetBrains", false); expect(globalContext.get("indexingPaused")).toBe(true); - expect(globalContext.get("selectedTabAutocompleteModel")).toBe( - "test-model", - ); expect(globalContext.get("hasDismissedConfigTsNoticeJetBrains")).toBe( false, ); diff --git a/core/util/GlobalContext.ts b/core/util/GlobalContext.ts index aa1b66fcf..06cede64c 100644 --- a/core/util/GlobalContext.ts +++ b/core/util/GlobalContext.ts @@ -1,5 +1,8 @@ import fs from "node:fs"; +import { ModelRole } from "@continuedev/config-yaml"; + +import { SiteIndexingConfig } from ".."; import { salvageSharedConfig, sharedConfigSchema, @@ -8,13 +11,21 @@ import { import { getGlobalContextFilePath } from "./paths"; +export type GlobalContextModelSelections = Partial< + Record +>; + export type GlobalContextType = { indexingPaused: boolean; - selectedTabAutocompleteModel: string; - lastSelectedProfileForWorkspace: { [workspaceIdentifier: string]: string }; + lastSelectedProfileForWorkspace: { + [workspaceIdentifier: string]: string | null; + }; lastSelectedOrgIdForWorkspace: { [workspaceIdentifier: string]: string | null; }; + selectedModelsByProfileId: { + [profileId: string]: GlobalContextModelSelections; + }; /** * This is needed to handle the case where a JetBrains user has created @@ -27,6 +38,7 @@ export type GlobalContextType = { showConfigUpdateToast: boolean; isSupportedLanceDbCpuTarget: boolean; sharedConfig: SharedConfigSchema; + failedDocs: SiteIndexingConfig[]; }; /** @@ -109,4 +121,23 @@ export class GlobalContext { this.update("sharedConfig", updatedSharedConfig); return updatedSharedConfig; } + + updateSelectedModel( + profileId: string, + role: ModelRole, + title: string | null, + ): GlobalContextModelSelections { + const currentSelections = this.get("selectedModelsByProfileId") ?? {}; + const forProfile = currentSelections[profileId] ?? {}; + const newSelections = { + ...forProfile, + [role]: title, + }; + + this.update("selectedModelsByProfileId", { + ...currentSelections, + [profileId]: newSelections, + }); + return newSelections; + } } diff --git a/core/util/devdata.ts b/core/util/devdata.ts deleted file mode 100644 index 3f786fa84..000000000 --- a/core/util/devdata.ts +++ /dev/null @@ -1,9 +0,0 @@ -import fs from "fs"; - -import { getDevDataFilePath } from "./paths.js"; - -export function logDevData(tableName: string, data: any) { - const filepath: string = getDevDataFilePath(tableName); - const jsonLine = JSON.stringify(data); - fs.writeFileSync(filepath, `${jsonLine}\n`, { flag: "a" }); -} diff --git a/core/util/ideUtils.ts b/core/util/ideUtils.ts index 9ed4a47fc..352aad6ca 100644 --- a/core/util/ideUtils.ts +++ b/core/util/ideUtils.ts @@ -34,10 +34,11 @@ export async function resolveRelativePathInDir( If no meaninful path match just concatenates to first dir's uri */ export async function inferResolvedUriFromRelativePath( - relativePath: string, + _relativePath: string, ide: IDE, dirCandidates?: string[], ): Promise { + const relativePath = _relativePath.trim().replaceAll("\\", "/"); const dirs = dirCandidates ?? (await ide.getWorkspaceDirs()); if (dirs.length === 0) { @@ -51,7 +52,7 @@ export async function inferResolvedUriFromRelativePath( suffixes.push(segments.slice(i).join("/")); } - // For each suffix, try to find a unique matching directory + // For each suffix, try to find a unique matching dir/file for (const suffix of suffixes) { const uris = dirs.map((dir) => ({ dir, @@ -78,6 +79,13 @@ export async function inferResolvedUriFromRelativePath( } } + // Sometimes the model will decide to only output the base name or small number of path parts + // in which case we shouldn't create a new file if it matches the current file + const activeFile = await ide.getCurrentFile(); + if (activeFile && activeFile.path.endsWith(relativePath)) { + return activeFile.path; + } + // If no unique match found, use the first directory return joinPathsToUri(dirs[0], relativePath); } diff --git a/core/util/parameters.ts b/core/util/parameters.ts index 648253712..05ab61e06 100644 --- a/core/util/parameters.ts +++ b/core/util/parameters.ts @@ -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; diff --git a/core/util/paths.ts b/core/util/paths.ts index 1198dec49..9a4c77bb2 100644 --- a/core/util/paths.ts +++ b/core/util/paths.ts @@ -8,6 +8,7 @@ import dotenv from "dotenv"; import { IdeType, SerializedContinueConfig } from "../"; import { defaultConfig, defaultConfigJetBrains } from "../config/default"; import Types from "../config/types"; +import { DevEventName } from "@continuedev/config-yaml"; dotenv.config(); @@ -202,7 +203,7 @@ export function getContinueRcPath(): string { return continuercPath; } -export function devDataPath(): string { +function getDevDataPath(): string { const sPath = path.join(getContinueGlobalPath(), "dev_data"); if (!fs.existsSync(sPath)) { fs.mkdirSync(sPath); @@ -211,11 +212,18 @@ export function devDataPath(): string { } export function getDevDataSqlitePath(): string { - return path.join(devDataPath(), "devdata.sqlite"); + return path.join(getDevDataPath(), "devdata.sqlite"); } -export function getDevDataFilePath(fileName: string): string { - return path.join(devDataPath(), `${fileName}.jsonl`); +export function getDevDataFilePath( + eventName: DevEventName, + schema: string, +): string { + const versionPath = path.join(getDevDataPath(), schema); + if (!fs.existsSync(versionPath)) { + fs.mkdirSync(versionPath); + } + return path.join(versionPath, `${String(eventName)}.jsonl`); } export function editConfigJson( @@ -377,19 +385,33 @@ export function getEsbuildBinaryPath(): string { return path.join(getContinueUtilsPath(), "esbuild"); } -export function setupInitialDotContinueDirectory() { - const devDataTypes = [ - "chat", - "autocomplete", - "quickEdit", - "tokens_generated", - ]; - devDataTypes.forEach((p) => { - const devDataPath = getDevDataFilePath(p); - if (!fs.existsSync(devDataPath)) { - fs.writeFileSync(devDataPath, ""); +export function migrateV1DevDataFiles() { + const devDataPath = getDevDataPath(); + function moveToV1FolderIfExists( + oldFileName: string, + newFileName: DevEventName, + ) { + const oldFilePath = path.join(devDataPath, `${oldFileName}.jsonl`); + if (fs.existsSync(oldFilePath)) { + const newFilePath = getDevDataFilePath(newFileName, "0.1.0"); + if (!fs.existsSync(newFilePath)) { + fs.copyFileSync(oldFilePath, newFilePath); + fs.unlinkSync(oldFilePath); + } else { + console.warn( + `V1 Dev data migration: ${newFilePath} already exists, skipping ${oldFileName}`, + ); + } } - }); + } + moveToV1FolderIfExists("tokens_generated", "tokensGenerated"); + moveToV1FolderIfExists("chat", "chatFeedback"); + moveToV1FolderIfExists("quickEdit", "quickEdit"); + moveToV1FolderIfExists("autocomplete", "autocomplete"); +} + +export function getStagingEnvironmentDotFilePath(): string { + return path.join(getContinueGlobalPath(), ".staging"); } export function getDiffsDirectoryPath(): string { diff --git a/core/util/treeSitter.ts b/core/util/treeSitter.ts index 067445994..df1296e0c 100644 --- a/core/util/treeSitter.ts +++ b/core/util/treeSitter.ts @@ -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, diff --git a/core/util/url.ts b/core/util/url.ts new file mode 100644 index 000000000..83e0edcba --- /dev/null +++ b/core/util/url.ts @@ -0,0 +1,11 @@ +export function canParseUrl(url: string): boolean { + if ((URL as any)?.canParse) { + return (URL as any).canParse(url); + } + try { + new URL(url); + return true; + } catch (e) { + return false; + } +} diff --git a/docs/docs/actions/context-selection.md b/docs/docs/actions/context-selection.md index a63eeda38..90bc7c0d2 100644 --- a/docs/docs/actions/context-selection.md +++ b/docs/docs/actions/context-selection.md @@ -7,11 +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). - -For example, with the “/edit” slash command you should describe the edit that you want the LLM to perform. - -Some slash commands will not acknowledge your input; for example, the “/share” slash command just creates a markdown copy of the current conversation, regardless of what else you may request it to do. +Slash commands can be combined with additional instructions, including [context providers](../customize/context-providers.mdx) or [highlighted code](../edit/context-selection#highlighted-code). ## Quick actions diff --git a/docs/docs/actions/how-it-works.md b/docs/docs/actions/how-it-works.mdx similarity index 63% rename from docs/docs/actions/how-it-works.md rename to docs/docs/actions/how-it-works.mdx index 57afa90ea..afacc3dbe 100644 --- a/docs/docs/actions/how-it-works.md +++ b/docs/docs/actions/how-it-works.mdx @@ -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). +Right click actions that generate inline diffs, 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). diff --git a/docs/docs/actions/how-to-customize.md b/docs/docs/actions/how-to-customize.md index 0541bf464..2f13e4f1a 100644 --- a/docs/docs/actions/how-to-customize.md +++ b/docs/docs/actions/how-to-customize.md @@ -5,57 +5,6 @@ keywords: [customize, actions] sidebar_position: 5 --- -## Built-in slash commands +The easiest way to add actions is by adding [`prompt` blocks](../hub/blocks/block-types.md#prompts) to your assistant, which show up as slash commands in [Chat](../chat/how-it-works.md). -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. - -## Custom slash commands - -There are two ways to add custom slash commands: - -1. With `.prompt` files - this is recommended in most cases. See the full reference [here](../customize/deep-dives/prompt-files.md). -2. With `config.ts` - this gives you full programmatic access to the LLM, IDE, and other important entities by writing a JavaScript/TypeScript function - -### Custom Slash Commands with `config.ts` - - - - -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: - -```typescript title="config.ts" -export function modifyConfig(config: Config): Config { - config.slashCommands?.push({ - name: "commit", - description: "Write a commit message", - run: async function* (sdk) { - // The getDiff function takes a boolean parameter that indicates whether - // to include unstaged changes in the diff or not. - const diff = await sdk.ide.getDiff(false); // Pass false to exclude unstaged changes - for await (const message of sdk.llm.streamComplete( - `${diff}\n\nWrite a commit message for the above changes. Use no more than 20 tokens to give a brief description in the imperative mood (e.g. 'Add feature' not 'Added feature'):`, - new AbortController().signal, - { - maxTokens: 20, - }, - )) { - yield message; - } - }, - }); - return config; -} -``` - - - - -## 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. - - +Check out the [slash commands deep dive](../customize/slash-commands.mdx) for more information on extending actions. diff --git a/docs/docs/actions/how-to-use-it.md b/docs/docs/actions/how-to-use-it.md index 5be83b2e7..d69ec3851 100644 --- a/docs/docs/actions/how-to-use-it.md +++ b/docs/docs/actions/how-to-use-it.md @@ -14,43 +14,23 @@ Actions are shortcuts for common use cases. For example, you might want to revie ### Slash commands -The most common way to invoke an action is with a slash command. These are shortcuts that can be activated by typing '/' in a chat session (press cmd/ctrl + L (VS Code) or cmd/ctrl + J (JetBrains)), and selecting from the dropdown. For example, the built-in '/edit' slash command lets you stream edits directly into your editor. +The most common way to invoke an action is with a slash command. These are shortcuts that can be activated by typing '/' in a chat session (press cmd/ctrl + L (VS Code) or cmd/ctrl + J (JetBrains)), and selecting from the dropdown. ![slash-commands](/img/slash-commands.png) -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). +In YAML assistants, slash commands are generated from [`prompts` blocks](../hub/blocks/block-types.md#prompts). + +Learn more about slash commands [here](../customize/slash-commands.mdx). + +:::info +Important: For assistants, slash commands only come from `prompts` blocks. When using older `config.json` configuration, other slash commands like `/share` and `/cmd` are included by default. +::: ### Prompt files It is also possible to write your own slash command by defining a “.prompt file.” Prompt files can be as simple as a text file, but also include templating so that you can refer to files, URLs, highlighted code, and more. -The full .prompt file reference can be found [here](../customize/deep-dives/prompt-files.md). - -:::tip[Prompt library] -To assist you in getting started, [we've curated a small library of `.prompt` files](https://github.com/continuedev/prompt-file-examples). We encourage community contributions to this repository, so please consider opening up a pull request with your own prompts! -::: - -Below is a quick example of setting up a prompt file to write unit tests using Jest. - -1. Create a folder called `.prompts/` at the top level of your workspace. -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. - -``` -{{{ input }}} - -Write unit tests for the above selected code, following each of these instructions: -- Use `jest` -- Properly set up and tear down -- Include important edge cases -- The tests should be complete and sophisticated -- Give the tests just as chat output, don't edit any file -- Don't explain how to set up `jest` -``` - -Now to use this prompt, you can highlight code and use cmd/ctrl + L to select it in the Continue sidebar. - -Then, type "/" to see the list of slash commands and choose the one called "test". Press enter and the LLM will respond given the instructions from your prompt file. +Learn more about prompt files [here](../customize/deep-dives/prompt-files.md) ### Other triggers for Actions (VS Code) diff --git a/docs/docs/actions/model-setup.md b/docs/docs/actions/model-setup.md index 7dd9a0213..91912dcbf 100644 --- a/docs/docs/actions/model-setup.md +++ b/docs/docs/actions/model-setup.md @@ -5,4 +5,6 @@ keywords: [model] sidebar_position: 2 --- -By default, Actions uses the same model as [Chat](chat/model-setup.mdx) since we recommend a similar, 400B+ parameter model or one of the frontier models for the complex instructions that will be carried out. +By default, Actions uses the same model as [Chat](chat/model-setup.mdx), since we recommend a similar, 400B+ parameter model or one of the frontier models for the complex instructions that will be carried out. + +You can also set specific models to be used for Edit and Apply actions. See the [Model roles](../customize/model-roles/intro.mdx) page for more details. diff --git a/docs/docs/autocomplete/how-it-works.md b/docs/docs/autocomplete/how-it-works.md index 9d87819b3..c97b71c03 100644 --- a/docs/docs/autocomplete/how-it-works.md +++ b/docs/docs/autocomplete/how-it-works.md @@ -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). diff --git a/docs/docs/autocomplete/how-to-customize.md b/docs/docs/autocomplete/how-to-customize.md index ccd1dca9d..db77a43f0 100644 --- a/docs/docs/autocomplete/how-to-customize.md +++ b/docs/docs/autocomplete/how-to-customize.md @@ -5,18 +5,6 @@ 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 settings to customize autocomplete behavior. For the most part, these options can be found in the [User Settings Page](../customize/settings.md). -```json title="config.json" - "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). diff --git a/docs/docs/autocomplete/how-to-use-it.md b/docs/docs/autocomplete/how-to-use-it.md index 5fd127ce5..b9b3c19d2 100644 --- a/docs/docs/autocomplete/how-to-use-it.md +++ b/docs/docs/autocomplete/how-to-use-it.md @@ -2,7 +2,7 @@ title: Autocomplete description: Autocomplete \- how to use it sidebar_label: How to use it -keywords: [how] +keywords: [autocomplete] sidebar_position: 1 --- diff --git a/docs/docs/autocomplete/model-setup.md b/docs/docs/autocomplete/model-setup.md deleted file mode 100644 index 7d8c98944..000000000 --- a/docs/docs/autocomplete/model-setup.md +++ /dev/null @@ -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://: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) diff --git a/docs/docs/autocomplete/model-setup.mdx b/docs/docs/autocomplete/model-setup.mdx new file mode 100644 index 000000000..aa05e3c31 --- /dev/null +++ b/docs/docs/autocomplete/model-setup.mdx @@ -0,0 +1,17 @@ +--- +title: Model setup +description: Autocomplete \-model setup +keywords: [model, autocomplete] +sidebar_position: 2 +--- + +import TabItem from "@theme/TabItem"; +import Tabs from "@theme/Tabs"; + +For the best autocomplete experience we recommend Codestral from Mistral. + +Add Codestral to your assistant from the hub [here](https://hub.continue.dev/mistral/codestral). Visit the [Mistral Platform](https://console.mistral.ai/codestral) to get a Codestral API key. + +For a fully local autocomplete experience, we recommend [Qwen 2.5 Coder 1.5B on Ollama](https://hub.continue.dev/ollama/qwen2.5-coder-1.5b). + +For more details about setup and recommended models, visit the [autocomplete deep dive](../customize/deep-dives/autocomplete.mdx). diff --git a/docs/docs/chat/context-selection.md b/docs/docs/chat/context-selection.md index e4c35ddc5..ee427cf0a 100644 --- a/docs/docs/chat/context-selection.md +++ b/docs/docs/chat/context-selection.md @@ -19,28 +19,28 @@ You can include the currently open file as context by pressing opt + ## 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.mdx). diff --git a/docs/docs/chat/how-it-works.md b/docs/docs/chat/how-it-works.md index 84c81582e..92b6e75f9 100644 --- a/docs/docs/chat/how-it-works.md +++ b/docs/docs/chat/how-it-works.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 cmd/ctrl + L (VS Code) or cmd/ctrl + J (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). diff --git a/docs/docs/chat/how-to-customize.md b/docs/docs/chat/how-to-customize.md index ee26a6a84..acb357983 100644 --- a/docs/docs/chat/how-to-customize.md +++ b/docs/docs/chat/how-to-customize.md @@ -5,11 +5,11 @@ keywords: [customize, chat] sidebar_position: 5 --- -There are a number of different ways to customize Chat +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 [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 add a [`rules` block](../hub/blocks/block-types.md#rules) to your assistant to give the model persistent instructions through the system prompt. See the [rules deep dive](../customize/deep-dives/rules.md) for more information. +- You can configure [`@Codebase`](../customize/deep-dives/codebase.mdx) +- You can configure [`@Docs`](../customize/deep-dives/docs.mdx) +- You can configure and create custom [tools](../customize/tools.mdx) +- You can [build your own context provider](../customize/tutorials/build-your-own-context-provider.mdx) +- You can create your own [custom code RAG](../customize/tutorials/custom-code-rag.mdx) diff --git a/docs/docs/chat/model-setup.mdx b/docs/docs/chat/model-setup.mdx index 327f780d0..8608f5e1d 100644 --- a/docs/docs/chat/model-setup.mdx +++ b/docs/docs/chat/model-setup.mdx @@ -5,197 +5,20 @@ keywords: [model] sidebar_position: 2 --- -import Tabs from "@theme/Tabs"; import TabItem from "@theme/TabItem"; +import Tabs from "@theme/Tabs"; -:::info -This page recommends models and providers for Chat. Read more about how to set up your `config.json` [here](../reference.md). -::: +For the best chat experience we recommend Claude 3.7 Sonnet from Anthropic. -## Best overall experience +Add Claude 3.7 Sonnet to your assistant from the hub [here](https://hub.continue.dev/anthropic/claude-3-7-sonnet). You can get an API key from the [Anthropic console](https://console.anthropic.com/settings/keys). -For the best overall Chat experience, you will want to use a 400B+ parameter model or one of the frontier models. +Other recommended chat models include: -### Claude Sonnet 3.5 from Anthropic +- [GPT-4o from OpenAI](https://hub.continue.dev/openai/gpt-4o) +- [Grok-2 from xAI](https://hub.continue.dev/xai/grok-2) +- [Gemini 2.0 Flash from Google](https://hub.continue.dev/google/gemini-2.0-flash) +- [Llama 3.1 8b from Meta on Ollama](https://hub.continue.dev/ollama/llama3.1-8b) for a fully local experience + {/* HUB_TODO nonexistent blocks */} + {/* - Deepseek Coder 2 from deepseek on [Ollama](https://hub.continue.dev/explore/models) or [LM Studio](https://hub.continue.dev/explore/models) */} -Our current top recommendation is Claude Sonnet 3.5 from [Anthropic](../customize/model-providers/top-level/anthropic.md). - -```json title="config.json" - "models": [ - { - "title": "Claude 3.5 Sonnet", - "provider": "anthropic", - "model": "claude-3-5-sonnet-latest", - "apiKey": "[ANTHROPIC_API_KEY]" - } - ] -``` - -### 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)). - - - - ```json title="config.json" - "models": [ - { - "title": "Llama 3.1 405B", - "provider": "together", - "model": "llama3.1-405b", - "apiKey": "[TOGETHER_API_KEY]" - } - ] - ``` - - - ```json title="config.json" - "models": [ - { - "title": "Llama 3.1 405B", - "provider": "groq", - "model": "llama3.1-405b", - "apiKey": "[GROQ_API_KEY]" - } - ] - ``` - - - ```json title="config.json" - "models": [ - { - "title": "Llama 3.1 405B", - "provider": "vllm", - "model": "llama3.1-405b" - } - ] - ``` - - - ```json title="config.json" - "models": [ - { - "title": "Llama 3.1 405B", - "provider": "ollama", - "model": "llama3.1:405b" - } - ] - ``` - - - -### 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. - -```json title="config.json" - "models": [ - { - "title": "GPT-4o", - "provider": "openai", - "model": "", - "apiKey": "[OPENAI_API_KEY]" - } - ] -``` - -### 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. - -```json title="config.json" - "models": [ - { - "title": "Grok-2", - "provider": "xAI", - "model": "grok-2-latest", - "apiKey": "[XAI_API_KEY]" - } - ] -``` - -### 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. - -```json title="config.json" - "models": [ - { - "title": "Gemini 1.5 Pro", - "provider": "gemini", - "model": "gemini-1.5-pro-latest", - "apiKey": "[GEMINI_API_KEY]" - } - ] -``` - -## Local, offline experience - -For the best local, offline Chat experience, you will want to use a model that is large but fast enough on your machine. - -### 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)). - - - - ```json title="config.json" - "models": [ - { - "title": "Llama 3.1 8B", - "provider": "ollama", - "model": "llama3.1:8b", - "apiBase": "http://localhost:11434" - } - ] - ``` - - - ```json title="config.json" - "models": [ - { - "title": "Llama 3.1 8B", - "provider": "lmstudio", - "model": "llama3.1-8b" - } - ] - ``` - - - -### 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)). - - - - ```json title="config.json" - "models": [ - { - "title": "DeepSeek Coder 2 16B", - "provider": "ollama", - "model": "deepseek-coder-v2:16b", - "apiBase": "http://localhost:11434" - } - ] - ``` - - - - - ```json title="config.json" - "models": [ - { - "title": "DeepSeek Coder 2 16B", - "provider": "lmstudio", - "model": "deepseek-coder-v2:16b" - } - ] - ``` - - - - -## Other experiences - -There are many more models and providers you can use with Chat beyond those mentioned above. Read more [here](../customize/model-types/chat.md) +For more details about setup and recommended models, see [here](../customize/model-roles/chat.mdx). diff --git a/docs/docs/customize/context-providers.md b/docs/docs/customize/context-providers.md deleted file mode 100644 index d49b38c93..000000000 --- a/docs/docs/customize/context-providers.md +++ /dev/null @@ -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. - -![Context Items](/img/context-provider-example.png) - -## 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": "" - } - } - ] -} -``` - -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. diff --git a/docs/docs/customize/context-providers.mdx b/docs/docs/customize/context-providers.mdx new file mode 100644 index 000000000..41c6edc57 --- /dev/null +++ b/docs/docs/customize/context-providers.mdx @@ -0,0 +1,1054 @@ +--- +title: Context providers +description: Type '@' to select content to the LLM as context +keywords: [context, "@", provider, LLM] +--- + +import TabItem from "@theme/TabItem"; +import Tabs from "@theme/Tabs"; + +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. + +![Context Items](/img/context-provider-example.png) + +## Context blocks + +You can add context providers to assistants using [`context` blocks](../hub/blocks/block-types.md#context). Explore available context blocks in [the hub](https://hub.continue.dev/explore/context). + +## Built-in Context Providers + +You can add any built-in context-providers in your config file as shown below: + +### `@File` + +Reference any file in your current workspace. + + + + ```yaml title="config.yaml" + context: + - provider: file + ``` + + + ```json title="config.json" + { + "contextProviders": [ + { + "name": "file" + } + ] + } + ``` + + + +### `@Code` + +Reference specific functions or classes from throughout your project. + + + + ```yaml title="config.yaml" + context: + - provider: code + ``` + + + ```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. + + + + ```yaml title="config.yaml" + context: + - provider: diff + ``` + + + ```json title="config.json" + { + "contextProviders": [ + { + "name": "diff" + } + ] + } + ``` + + + +### `@Current File` + +Reference the currently open file. + + + + ```yaml title="config.yaml" + context: + - provider: currentFile + ``` + + + ```json title="config.json" + { + "contextProviders": [ + { + "name": "currentFile" + } + ] + } + ``` + + + +### `@Terminal` + +Reference the last command you ran in your IDE's terminal and its output. + + + + ```yaml title="config.yaml" + context: + - provider: terminal + ``` + + + ```json title="config.json" + { + "contextProviders": [ + { + "name": "terminal" + } + ] + } + ``` + + + +### `@Docs` + +Reference the contents from any documentation site. + + + + ```yaml title="config.yaml" + context: + - provider: docs + ``` + + + ```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 file. See the [docs](../customize/deep-dives/docs.mdx) page for more information. + +### `@Open` + +Reference the contents of all of your open files. Set `onlyPinned` to `true` to only reference pinned files. + + + + ```yaml title="config.yaml" + context: + - provider: open + params: + onlyPinned: true + ``` + + + ```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). + + + + ```yaml title="config.yaml" + context: + - provider: web + params: + n: 5 + ``` + + + ```json title="config.json" + { + "contextProviders": [ + { + "name": "web", + "params": { + "n": 5 + } + } + ] + } + ``` + + + +### `@Codebase` + +Reference the most relevant snippets from your codebase. + + + + ```yaml title="config.yaml" + context: + - provider: codebase + ``` + + + ```json title="config.json" + { + "contextProviders": [ + { + "name": "codebase" + } + ] + } + ``` + + + +Read more about indexing and retrieval [here](../customize/deep-dives/codebase.mdx). + +### `@Folder` + +Uses the same retrieval mechanism as `@Codebase`, but only on a single folder. + + + + ```yaml title="config.yaml" + context: + - provider: 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. + + + + ```yaml title="config.yaml" + context: + - provider: 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. + + + + ```yaml title="config.yaml" + context: + - provider: url + ``` + + + ```json title="config.json" + { + "contextProviders": [ + { + "name": "url" + } + ] + } + ``` + + + +### `@Clipboard` + +Reference recent clipboard items + + + + ```yaml title="config.yaml" + context: + - provider: clipboard + ``` + + + ```json title="config.json" + { + "contextProviders": [ + { + "name": "clipboard" + } + ] + } + ``` + + + +### `@Tree` + +Reference the structure of your current workspace. + + + + ```yaml title="config.yaml" + context: + - provider: tree + ``` + + + ```json title="config.json" + { + "contextProviders": [ + { + "name": "tree" + } + ] + } + ``` + + + +### `@Problems` + +Get Problems from the current file. + + + + ```yaml title="config.yaml" + context: + - provider: problems + ``` + + + ```json title="config.json" + { + "contextProviders": [ + { + "name": "problems" + } + ] + } + ``` + + + +### `@Debugger` + +Reference the contents of the local variables in the debugger. Currently only available in VS Code. + + + + ```yaml title="config.yaml" + context: + - provider: debugger + params: + stackDepth: 3 + ``` + + + ```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. + + + + ```yaml title="config.yaml" + context: + - provider: repo-map + params: + includeSignatures: false # default true + ``` + + + ```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. + + + + ```yaml title="config.yaml" + context: + - provider: os + ``` + + + ```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 set up your configuration like this: + + + + ```yaml title="config.yaml" + mcpServers: + - name: My MCP Server + command: uvx + args: + - mcp-server-sqlite + - --db-path + - /Users/NAME/test.db + ``` + + + ```json title="config.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](./deep-dives/prompt-files.md). 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. + + + + ```yaml title="config.yaml" + context: + - provider: issue + params: + repos: + - owner: continuedev + repo: continue + githubToken: ghp_xxx + ``` + + + ```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. + + + + ```yaml title="config.yaml" + context: + - provider: 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 + ``` + + + ```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 + + + + ```yaml title="config.yaml" + context: + - provider: postgres + params: + host: localhost + port: 5436 + user: myuser + password: catsarecool + database: animals + schema: public + sampleRows: 3 + ``` + + + ```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. + + + + ```yaml title="config.yaml" + context: + - provider: google + params: + serperApiKey: + ``` + + + ```json title="config.json" + { + "contextProviders": [ + { + "name": "google", + "params": { + "serperApiKey": "" + } + } + ] + } + ``` + + + +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. + + + + ```yaml title="config.yaml" + context: + - provider: gitlab-mr + params: + token: "..." + ``` + + + ```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`. + + + + ```yaml title="config.yaml" + context: + - provider: gitlab-mr + params: + token: "..." + domain: "gitlab.example.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. + + + + ```yaml title="config.yaml" + context: + - provider: jira + params: + domain: company.atlassian.net + token: ATATT... + ``` + + + ```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. + + + + ```yaml title="config.yaml" + context: + - provider: jira + params: + apiVersion: "2" + ``` + + + ```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. + + + + ```yaml title="config.yaml" + context: + - provider: discord + params: + discordKey: "bot token" + guildId: "1234567890" + channels: + - id: "123456" + name: "example-channel" + - id: "678901" + name: "example-channel-2" + ``` + + + ```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. + + + + ```yaml title="config.yaml" + context: + - provider: http + params: + url: "https://api.example.com/v1/users" + ``` + + + ```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. + + + + ```yaml title="config.yaml" + context: + - provider: commit + params: + Depth: 50 + LastXCommitsDepth: 10 + ``` + + + ```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. + +### `@Greptile` + +Query a [Greptile](https://www.greptile.com/) index of the current repo/branch. + + + + ```yaml title="config.yaml" + context: + - provider: greptile + params: + greptileToken: "..." + githubToken: "..." + ``` + + + ```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. diff --git a/docs/docs/customize/deep-dives/autocomplete.md b/docs/docs/customize/deep-dives/autocomplete.mdx similarity index 59% rename from docs/docs/customize/deep-dives/autocomplete.md rename to docs/docs/customize/deep-dives/autocomplete.mdx index 8d90f2145..c350b4d2c 100644 --- a/docs/docs/customize/deep-dives/autocomplete.md +++ b/docs/docs/customize/deep-dives/autocomplete.mdx @@ -3,88 +3,102 @@ title: Autocomplete keywords: [autocomplete] --- +import TabItem from "@theme/TabItem"; +import Tabs from "@theme/Tabs"; + ### 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" + + + [Mistral Codestral model block](https://hub.continue.dev/mistral/codestral) + + + ```yaml title="config.yaml" + models: + - name: Codestral + provider: mistral + model: codestral-latest + apiKey: + roles: + - autocomplete + ``` + + + ```json title="config.json" + { + "tabAutocompleteModel": { + "title": "Codestral", + "provider": "mistral", + "model": "codestral-latest", + "apiKey": "" + } } -} -``` + ``` + + + +:::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`. +::: ### Setting up with Ollama (default) If you'd like to run your autocomplete model locally, we recommend using Ollama. To do this, first download the latest version of Ollama from [here](https://ollama.ai). Then, run the following command to download our recommended model: ```bash -ollama run qwen2.5-coder:1.5b-base +ollama run qwen2.5-coder:1.5b ``` -Once it has been downloaded, you should begin to see completions in VS Code. +Then, add the model to your configuration: -### Setting up a custom model - -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" -{ + + + [Ollama Qwen 2.5 Coder 1.5B model block](https://hub.continue.dev/ollama/qwen2.5-coder-1.5b) + + + ```yaml title="config.yaml" + models: + - name: Qwen 1.5b Autocomplete Model + provider: ollama + model: qwen2.5-coder:1.5b + roles: + - autocomplete + ``` + + + ```json title="config.json" + { "tabAutocompleteModel": { - "title": "Tab Autocomplete Model", - "provider": "ollama", - "model": "qwen2.5-coder:1.5b-base", - "apiBase": "https://" - }, - ... -} -``` + "title": "Qwen 1.5b Autocomplete Model", + "provider": "ollama", + "model": "qwen2.5-coder:1.5b", + } + } + ``` + + -If you aren't yet familiar with the available options, you can find the full reference [here](./configuration.md). +Once the model has been downloaded, you should begin to see completions in VS Code. ## Configuration Options -The following can be configured in `config.json`: +### Hub Autocomplete models -### `tabAutocompleteModel` +Explore autocomplete model configurations on [the hub](https://hub.continue.dev/explore/models?roles=autocomplete) -This is just another object like the ones in the `"models"` array of `config.json`. You can choose and configure any model you would like, but we strongly suggest using a small model made for tab-autocomplete, such as `deepseek-1b`, `qwen2.5-coder:1.5b`, or `starcoder2-3b`. +### Autocomplete User Settings -### `tabAutocompleteOptions` +The following settings can be configured for autocompletion in the IDE extension [User Settings Page](../settings.md): -This object allows you to customize the behavior of tab-autocomplete. The available options are shown below, and you can find their default values [here](https://github.com/continuedev/continue/blob/fbeb2e4fe15d4b434a30a136f74b672485c852d9/core/util/parameters.ts). +- `Use autocomplete cache`: If on, caches completions +- `Multiline Autocompletions`: Controls multiline completions for autocomplete. Can be set to `always`, `never`, or `auto`. Defaults to `auto` +- `Disable autocomplete in files`: List of comma-separated glob pattern to disable autocomplete in matching files. E.g., "\_/.md, \*/.txt" -- `disable`: Disable autocomplete (can also be done from IDE settings) (default: `false`) -- `template`: An optional template string to be used for autocomplete. It will be rendered with the Mustache templating language, and is passed the 'prefix' and 'suffix' variables. (String) -- `maxPromptTokens`: The maximum number of prompt tokens to use. A smaller number will yield faster completions, but less context. (Number) (default: `1024`) -- `prefixPercentage`: The percentage of the input that should be dedicated to the prefix. (Number) (default: `0.3`) -- `maxSuffixPercentage`: The maximum percentage of the prompt that can be dedicated to the suffix. (Number) (default: `0.2`) -- `debounceDelay`: The delay in milliseconds before triggering autocomplete after a keystroke. (Number) (default: `350`) -- `multilineCompletions`: Whether to enable multiline completions ("always", "never", or "auto"). Defaults to "auto". (default: `auto`) -- `useCache`: Whether to cache and reuse completions when the prompt is the same as a previous one. May be useful to disable for testing purposes. (default: `true`) -- `disableInFiles`: A list of glob patterns for files in which you want to disable tab autocomplete. (default: `[]`) +### `config.json` Configuration -### Full example - -```json title="config.json" -{ - "tabAutocompleteModel": { - "title": "Tab Autocomplete Model", - "provider": "ollama", - "model": "qwen2.5-coder:1.5b-base", - "apiBase": "https://" - }, - "tabAutocompleteOptions": { - "debounceDelay": 500, - "maxPromptTokens": 1500, - "disableInFiles": ["*.md"] - } -} -``` +The `config.json` configuration format (deprecated) offers further configuration options through `tabAutocompleteOptions`. See the [JSON Reference](../../reference.md#tabautocompleteoptions) for more details. ## FAQs @@ -98,7 +112,7 @@ Follow these steps to ensure that everything is set up correctly: 1. Make sure you have the "Enable Tab Autocomplete" setting checked (in VS Code, you can toggle by clicking the "Continue" button in the status bar, and in JetBrains by going to Settings -> Tools -> Continue). 2. Make sure you have downloaded Ollama. -3. Run `ollama run qwen2.5-coder:1.5b-base` to verify that the model is downloaded. +3. Run `ollama run qwen2.5-coder:1.5b` to verify that the model is downloaded. 4. Make sure that any other completion providers are disabled (e.g. Copilot), as they may interfere. 5. Check the output of the logs to find any potential errors: cmd/ctrl + shift + P -> "Toggle Developer Tools" -> "Console" tab in VS Code, ~/.continue/logs/core.log in JetBrains. 6. Check VS Code settings to make sure that `"editor.inlineSuggest.enabled"` is set to `true` (use cmd/ctrl + , then search for this and check the box) diff --git a/docs/docs/customize/deep-dives/codebase.md b/docs/docs/customize/deep-dives/codebase.mdx similarity index 79% rename from docs/docs/customize/deep-dives/codebase.md rename to docs/docs/customize/deep-dives/codebase.mdx index 4da920943..24256672e 100644 --- a/docs/docs/customize/deep-dives/codebase.md +++ b/docs/docs/customize/deep-dives/codebase.mdx @@ -3,12 +3,15 @@ description: Talk to your codebase keywords: [talk, embeddings, reranker, codebase, experimental] --- +import TabItem from "@theme/TabItem"; +import Tabs from "@theme/Tabs"; + # @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-roles/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 + + + ```yaml title="config.yaml" + context: + - provider: codebase + params: + nRetrieve: 25, + nFinal: 5, + useReranking: true + ``` + + + ```json title="config.json" + { + "contextProviders": [ + { + "name": "codebase", + "params": { + "nRetrieve": 25, + "nFinal": 5, + "useReranking": true + } } - } - ] -} -``` + ] + } + ``` + + ### `nRetrieve` @@ -79,4 +96,4 @@ If you need to force a refresh of the index, reload the VS Code window with " - } - }, - "embeddingsProvider": { - "provider": "lmstudio", - "model": "nomic-ai/nomic-embed-text-v1.5-GGUF" - } -} -``` - -This could also involve enabling Chromium as a backup for local documentation the [User Settings Page](../settings.md). diff --git a/docs/docs/customize/deep-dives/docs.mdx b/docs/docs/customize/deep-dives/docs.mdx new file mode 100644 index 000000000..7a5be2263 --- /dev/null +++ b/docs/docs/customize/deep-dives/docs.mdx @@ -0,0 +1,410 @@ +--- +description: Learn how to access and search your project's documentation directly within Continue +keywords: + [ + documentation, + indexing, + context provider, + embeddings, + docs, + embedder, + embeddings provider, + documentation, + ] +toc_max_heading_level: 5 +--- + +import TabItem from "@theme/TabItem"; +import Tabs from "@theme/Tabs"; + +# @Docs + +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. + + + + ```yaml title="config.yaml" + context: + - provider: docs + ``` + + + ```json title="config.json" + { + "contextProviders": [ + { + "name": "docs" + } + ] + } + ``` + + + +## How It Works + +The `@Docs` context provider works by + +1. Crawling specified documentation sites +2. Generating embeddings for the chunked content +3. Storing the embeddings locally on your machine +4. Embedding chat input to include similar documentation chunks as context + +## Pre-indexed Documentation Sites + +In VS Code, Continue offers a selection of pre-indexed documentation sites for popular frameworks and libraries. You can view the list of [available pre-indexed sites and request additions here](https://github.com/continuedev/continue/blob/main/core/indexing/docs/preIndexedDocs.ts). + +Pre-indexed docs are only available in VS Code because the VS Code extension ships with the Transformers.js embedder built in, while Jetbrains currently does not. You can override a pre-indexed doc to index it with your own embeddings provider by adding it to your config (unique by `startUrl`). Otherwise, it will always use Transformers.js for queries. + +## Indexing Your Own Documentation + +### Hub `docs` Blocks + +@Docs uses [`docs` blocks](../../hub/blocks/block-types.md#docs) in Assistants from the hub. Visit the hub to [explore `docs` blocks](https://hub.continue.dev/explore/docs) or [create your own](https://hub.continue.dev/new?type=block&block=docs). + +### Through the `@Docs` Context Provider + +To add a single documentation site, we recommend using the **Add Documentation** Form within the GUI. This can be accessed + +- from the `@Docs` context provider - type `@Docs` in the chat, hit `Enter`, and search for `Add Docs` +- from the `More` page (three dots icon) in the `@docs indexes` section + the `@Docs` context provider. + +In the **Add Documentation** Form, enter a `Title` and `Start URL` for the site. + +- `Title`: The name of the documentation site, used for identification in the UI +- `Start URL`: The URL where the indexing process should begin. + +Indexing will begin upon submission. Progress can be viewed in the form or later in the `@docs indexes` section of the `More` page. + +Documentation sources may be suggested based on package files in your repo. This currently works for Python `requirements.txt` files and Node.js (Javascript/Typescript) `package.json` files. + +- Packages with a valid documentation URL (with a `+` icon) can be clicked to immediately kick off indexing +- Packages with partial information (with a pen icon) can be clicked to fill the form with the available information +- Note that you can hover over the information icon to see where the package suggestion was found. + +![Add documentation form](/img/docs-form.png) + +### In a configuration file + +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: + + + + ```yaml title="config.yaml" + docs: + - title: Nest.js + startUrl: https://docs.nestjs.com/ + faviconUrl: https://docs.nestjs.com/favicon.ico + ``` + + + ```json title="config.json" + { + "docs": [ + { + "title": "Nest.js", + "startUrl": "https://docs.nestjs.com/", + "faviconUrl": "https://docs.nestjs.com/favicon.ico" + } + ] + } + ``` + + + +See [the config reference](../../reference) for all documentation site configuration options. + +Indexing will re-sync upon saving the configuration file. + +## Configuration + +### Using Your Embeddings Provider + +If you have set up an [embeddings provider](../model-roles/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`. + + + + ```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) + ``` + + + ```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) + } + } + ] + } + ``` + + + +### 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: + + + + ```yaml title="config.yaml" + context: + - provider: docs + params: + githubToken: + ``` + + + ```json title="config.json" + { + "contextProviders": [ + { + "name": "docs", + "params": { + "githubToken": "github_..." + } + } + ] + } + ``` + + + +### Local Crawling + +By default, Continue crawls documentation sites using a specialized crawling service that provides the best experience for most users and documentation sites. + +If your documentation is private, you can skip the default crawler and use a local crawler instead by setting `useLocalCrawling` to `true`. + + + + ```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 + ``` + + + ```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 + } + ] + } + ``` + + + +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. + +Further notes: + +- If the site is only locally accessible, the default crawler will fail anyways and fall back to the local crawler. `useLocalCrawling` is especially useful if the URL itself is confidential. +- For Github Repos this has no effect because only the Github Crawler will be used, and if the repo is private it can only be accessed with a priveleged Github token anyways. + +## Managing your docs indexes + +You can view indexing statuses and manage your documentation sites from the `@docs indexes` section of the `More` page (three dots) + +- Continue does not automatically re-index your docs. Use `Click to re-index` to trigger a reindex for a specific source +- While a site is indexing, click `Cancel indexing` to cancel the process +- Failed indexing attempts will show an error status bar and icon +- Delete a documentation site from your configuration using the trash icon + +![More Page @docs indexes section](/img/docs-indexes.png) + +You can also view the overall status of currently indexing docs from a hideable progress bar at the bottom of the chat page +![Documentation indexing peek](/img/docs-indexing-peek.png) + +You can also use the following IDE command to force a re-index of all docs: `Continue: Docs Force Re-Index`. + +## Examples + +### VS Code minimal setup + +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. + + + + ```yaml title="config.yaml" + context: + - provider: docs + + docs: + - title: Nest.js + startUrl: https://docs.nestjs.com/ + ``` + + + ```json title="config.json" + { + "contextProviders": [ + { + "name": "docs", + } + ], + "docs": [ + { + "title": "Nest.js", + "startUrl": "https://docs.nestjs.com/", + }, + ] + } + ``` + + + +### Jetbrains minimal setup + +Here is the equivalent minimal example for Jetbrains, which requires setting up an [embeddings provider](../model-roles/embeddings.mdx). Pre-indexed docs will _not_ be accessible. + + + + ```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/ + ``` + + + ```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" + } + } + ``` + + + +### Full-power setup (VS Code or Jetbrains) + +The following configuration example includes: + +- Examples of both public and private documentation sources +- A custom embeddings provider +- A reranker model available, with reranking parameters customized +- A Github token to enable Github crawling + + + + ```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: + model: rerank-2 + roles: + - rerank + context: + - provider: docs + params: + githubToken: + 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 + ``` + + + ```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": "" + } + }, + "embeddingsProvider": { + "provider": "lmstudio", + "model": "nomic-ai/nomic-embed-text-v1.5-GGUF" + } + } + ``` + + + +This could also involve enabling Chromium as a backup for local documentation the [User Settings Page](../settings.md). diff --git a/docs/docs/customize/deep-dives/prompt-files.md b/docs/docs/customize/deep-dives/prompt-files.md index 7269a459a..1ab90e94a 100644 --- a/docs/docs/customize/deep-dives/prompt-files.md +++ b/docs/docs/customize/deep-dives/prompt-files.md @@ -4,19 +4,19 @@ title: Prompt files Prompt files provide a convenient way to standardize common patterns and share a collection of LLM prompts with your team. They make it easy to build and use these prompts. +On the [hub](../../hub/introduction.md), prompt files are stored within [prompt blocks](../../hub/blocks/block-types.md#prompts), which show up as [slash commands](../slash-commands.mdx) in Chat. Visit the hub to [explore prompts](https://hub.continue.dev/explore/prompts) or [create your own](https://hub.continue.dev/new?type=block&block=rules). + +Prompt files can also be stored within your project's root directory as `.prompt` files. See below. + ## Quick start - - -Below is a quick example of setting up a prompt file to de +Below is a quick example of setting up a prompt file: 1. Create a folder called `.continue/prompts` at the top level of your workspace (or you can use the button in the UI by typing @, selecting "Prompt Files", and selecting "New Prompt File"). 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 diff --git a/docs/docs/customize/deep-dives/rules.md b/docs/docs/customize/deep-dives/rules.md index ae8347f29..eac9137ce 100644 --- a/docs/docs/customize/deep-dives/rules.md +++ b/docs/docs/customize/deep-dives/rules.md @@ -3,11 +3,19 @@ description: Learn how to customize the system prompt with a `.continuerules` fi keywords: [rules, .continuerules, system, prompt, message] --- -# `.continuerules` +# Rules -You can create a project-specific system message by adding a `.continuerules` file to the root of your project. This file is raw text and its contents will be inserted into the system message for all chat requests. Rules are not used for autocomplete. +Rules are used to provide instructions to **chat** models. They are inserted into the system message for all chat requests. Rules are _only_ used during Chat, they are not used for autocomplete or other roles. -## Simple Examples +## Hub `rules` blocks + +Rules can be added to an Assistant on the Continue Hub. Explore available rules [here](https://hub.continue.dev/explore/rules), or [create your own](https://hub.continue.dev/new?type=block&block=rules) in the Hub. + +## `.continuerules` + +You can create a project-specific system message by adding a `.continuerules` file to the root of your project. This file is raw text and its full contents will be used as rules. + +### Simple Examples - If you want concise answers: diff --git a/docs/docs/customize/development-data.md b/docs/docs/customize/development-data.md deleted file mode 100644 index 5380eb7e7..000000000 --- a/docs/docs/customize/development-data.md +++ /dev/null @@ -1,9 +0,0 @@ ---- -title: Development data -description: Collecting data on how you build software -keywords: [development data, dev data, LLM-aided development] ---- - -When you use Continue, you automatically collect data on how you build software. By default, this development data is saved to `.continue/dev_data` on your local machine. When combined with the code that you ultimately commit, it can be used to improve the LLM that you or your team use (if you allow). - -You can read more about how development data is generated as a byproduct of LLM-aided development and why we believe that you should start collecting it now: [It’s time to collect data on how you build software](https://blog.continue.dev/its-time-to-collect-data-on-how-you-build-software) diff --git a/docs/docs/customize/model-providers/moonshot.md b/docs/docs/customize/model-providers/moonshot.md deleted file mode 100644 index 64017d1bd..000000000 --- a/docs/docs/customize/model-providers/moonshot.md +++ /dev/null @@ -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 - } - } - ] -} diff --git a/docs/docs/customize/model-providers/more/SambaNova.md b/docs/docs/customize/model-providers/more/SambaNova.md deleted file mode 100644 index f35c56dd5..000000000 --- a/docs/docs/customize/model-providers/more/SambaNova.md +++ /dev/null @@ -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) diff --git a/docs/docs/customize/model-providers/more/SambaNova.mdx b/docs/docs/customize/model-providers/more/SambaNova.mdx new file mode 100644 index 000000000..8fb2facfb --- /dev/null +++ b/docs/docs/customize/model-providers/more/SambaNova.mdx @@ -0,0 +1,34 @@ +import TabItem from "@theme/TabItem"; +import Tabs from "@theme/Tabs"; + +# 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. + + + + ```yaml title="config.yaml" + models: + - name: SambaNova Llama 3.1 405B + provider: sambanova + model: llama3.1-405b + apiKey: + ``` + + + ```json title="config.json" + { + "models": [ + { + "title": "SambaNova Llama 3.1 405B", + "provider": "sambanova", + "model": "llama3.1-405b", + "apiKey": "" + } + ] + } + ``` + + + +[View the source](https://github.com/continuedev/continue/blob/main/core/llm/llms/SambaNova.ts) diff --git a/docs/docs/customize/model-providers/more/asksage.md b/docs/docs/customize/model-providers/more/asksage.md deleted file mode 100644 index 204d29421..000000000 --- a/docs/docs/customize/model-providers/more/asksage.md +++ /dev/null @@ -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 | ✅ | - diff --git a/docs/docs/customize/model-providers/more/asksage.mdx b/docs/docs/customize/model-providers/more/asksage.mdx new file mode 100644 index 000000000..675cedc7f --- /dev/null +++ b/docs/docs/customize/model-providers/more/asksage.mdx @@ -0,0 +1,91 @@ +# Ask Sage + +import TabItem from "@theme/TabItem"; +import Tabs from "@theme/Tabs"; + +:::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 + + + + ```yaml title="config.yaml" + models: + - name: GPT-4 gov + provider: askSage + model: gpt4-gov + apiBase: https://api.asksage.ai/server/ + apiKey: + ``` + + + ```json title="config.json" + { + "models": [ + { + "title": "GPT-4 gov", + "provider": "askSage", + "model": "gpt4-gov", + "apiBase": "https://api.asksage.ai/server/", + "apiKey": "" + } + ] + } + ``` + + + +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 | ✅ | diff --git a/docs/docs/customize/model-providers/more/cerebras.md b/docs/docs/customize/model-providers/more/cerebras.md deleted file mode 100644 index d9cbd31dc..000000000 --- a/docs/docs/customize/model-providers/more/cerebras.md +++ /dev/null @@ -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" - } - ] -} -``` diff --git a/docs/docs/customize/model-providers/more/cerebras.mdx b/docs/docs/customize/model-providers/more/cerebras.mdx new file mode 100644 index 000000000..838b1d1b9 --- /dev/null +++ b/docs/docs/customize/model-providers/more/cerebras.mdx @@ -0,0 +1,36 @@ +# Cerebras Inference + +import TabItem from "@theme/TabItem"; +import Tabs from "@theme/Tabs"; + +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: + + + + ```yaml title="config.yaml" + models: + - name: Cerebras Llama 3.1 70B + provider: cerebras + model: llama3.1-70b + apiKey: + ``` + + + ```json title="config.json" + { + "models": [ + { + "title": "Cerebras Llama 3.1 70B", + "provider": "cerebras", + "model": "llama3.1-70b", + "apiKey": "" + } + ] + } + ``` + + diff --git a/docs/docs/customize/model-providers/more/cloudflare.md b/docs/docs/customize/model-providers/more/cloudflare.md deleted file mode 100644 index 5281cba79..000000000 --- a/docs/docs/customize/model-providers/more/cloudflare.md +++ /dev/null @@ -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) diff --git a/docs/docs/customize/model-providers/more/cloudflare.mdx b/docs/docs/customize/model-providers/more/cloudflare.mdx new file mode 100644 index 000000000..8463d2557 --- /dev/null +++ b/docs/docs/customize/model-providers/more/cloudflare.mdx @@ -0,0 +1,87 @@ +import TabItem from "@theme/TabItem"; +import Tabs from "@theme/Tabs"; + +# 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: + + + + ```yaml title="config.yaml" + models: + - name: Llama 3 8B + provider: cloudflare + apiKey: + model: "@cf/meta/llama-3-8b-instruct" + contextLength: 2400 + defaultCompletionOptions: + maxTokens: 500 + roles: + - chat + env: + accountId: YOUR CLOUDFLARE ACCOUNT ID + - name: DeepSeek Coder 6.7b Instruct + provider: cloudflare + apiKey: + model: "@hf/thebloke/deepseek-coder-6.7b-instruct-awq" + contextLength: 2400 + defaultCompletionOptions: + maxTokens: 500 + roles: + - chat + env: + accountId: YOUR CLOUDFLARE ACCOUNT ID + - name: DeepSeek 7b + provider: cloudflare + apiKey: + model: "@hf/thebloke/deepseek-coder-6.7b-base-awq" + roles: + - autocomplete + env: + accountId: YOUR CLOUDFLARE ACCOUNT ID + ``` + + + ```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" + } + } + ``` + + + +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) diff --git a/docs/docs/customize/model-providers/more/cohere.md b/docs/docs/customize/model-providers/more/cohere.md deleted file mode 100644 index 8a1f069a6..000000000 --- a/docs/docs/customize/model-providers/more/cohere.md +++ /dev/null @@ -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": "" - } -} -``` - -## 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": "" - } - } -} -``` diff --git a/docs/docs/customize/model-providers/more/cohere.mdx b/docs/docs/customize/model-providers/more/cohere.mdx new file mode 100644 index 000000000..352908e12 --- /dev/null +++ b/docs/docs/customize/model-providers/more/cohere.mdx @@ -0,0 +1,102 @@ +import TabItem from "@theme/TabItem"; +import Tabs from "@theme/Tabs"; + +# 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. + + + + ```yaml title="config.yaml" + models: + - name: Cohere + provider: cohere + model: command-r-plus + apiKey: + ``` + + + ```json title="config.json" + { + "models": [ + { + "title": "Cohere", + "provider": "cohere", + "model": "command-r-plus", + "apiKey": "" + } + ] + } + ``` + + + +## Autocomplete model + +Cohere currently does not offer any autocomplete models. + +[Click here](../../model-roles/autocomplete.md) to see a list of autocomplete model providers. + +## Embeddings model + +We recommend configuring **embed-english-v3.0** as your embeddings model. + + + + ```yaml title="config.yaml" + models: + - name: Cohere Embed + provider: cohere + model: embed-english-v3.0 + apiKey: + roles: + - embed + ``` + + + ```json title="config.json" + { + "embeddingsProvider": { + "provider": "cohere", + "model": "embed-english-v3.0", + "apiKey": "" + } + } + ``` + + + +## Reranking model + +We recommend configuring **rerank-english-v3.0** as your reranking model. + + + + ```yaml title="config.yaml" + models: + - name: Cohere Reranker + provider: cohere + model: rerank-english-v3.0 + apiKey: + roles: + - rerank + ``` + + + ```json title="config.json" + { + "reranker": { + "name": "cohere", + "params": { + "model": "rerank-english-v3.0", + "apiKey": "" + } + } + } + ``` + + diff --git a/docs/docs/customize/model-providers/more/deepinfra.md b/docs/docs/customize/model-providers/more/deepinfra.md deleted file mode 100644 index f79824cce..000000000 --- a/docs/docs/customize/model-providers/more/deepinfra.md +++ /dev/null @@ -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": "" - } - ] -} -``` - -[View the source](https://github.com/continuedev/continue/blob/main/core/llm/llms/DeepInfra.ts) diff --git a/docs/docs/customize/model-providers/more/deepinfra.mdx b/docs/docs/customize/model-providers/more/deepinfra.mdx new file mode 100644 index 000000000..de3e09e23 --- /dev/null +++ b/docs/docs/customize/model-providers/more/deepinfra.mdx @@ -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: + + + + ```yaml title="config.yaml" + models: + - name: DeepInfra + provider: deepinfra + model: mistralai/Mixtral-8x7B-Instruct-v0.1 + apiKey: + ``` + + + ```json title="config.json" + { + "models": [ + { + "provider": "deepinfra", + "title": "DeepInfra", + "model": "mistralai/Mixtral-8x7B-Instruct-v0.1", + "apiKey": "" + } + ] + } + ``` + + + +[View the source](https://github.com/continuedev/continue/blob/main/core/llm/llms/DeepInfra.ts) diff --git a/docs/docs/customize/model-providers/more/flowise.md b/docs/docs/customize/model-providers/more/flowise.md deleted file mode 100644 index f860d966b..000000000 --- a/docs/docs/customize/model-providers/more/flowise.md +++ /dev/null @@ -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": "", - "apiBase": "" - } - ] -} -``` - -[View the source](https://github.com/continuedev/continue/blob/main/core/llm/llms/Flowise.ts) diff --git a/docs/docs/customize/model-providers/more/flowise.mdx b/docs/docs/customize/model-providers/more/flowise.mdx new file mode 100644 index 000000000..c0257f851 --- /dev/null +++ b/docs/docs/customize/model-providers/more/flowise.mdx @@ -0,0 +1,34 @@ +import TabItem from "@theme/TabItem"; +import Tabs from "@theme/Tabs"; + +# 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: + + + + ```yaml title="config.yaml" + models: + - name: Flowise + provider: flowise + model: + apiBase: + ``` + + + ```json title="config.json" + { + "models": [ + { + "provider": "flowise", + "title": "Flowise", + "model": "", + "apiBase": "" + } + ] + } + ``` + + + +[View the source](https://github.com/continuedev/continue/blob/main/core/llm/llms/Flowise.ts) diff --git a/docs/docs/customize/model-providers/more/free-trial.md b/docs/docs/customize/model-providers/more/free-trial.md deleted file mode 100644 index a51d2e61c..000000000 --- a/docs/docs/customize/model-providers/more/free-trial.md +++ /dev/null @@ -1,31 +0,0 @@ ---- -title: Free Trial -slug: ../free-trial ---- - -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) - -## FAQ about the trial - -Continue asks free trial users to sign in so that we can prevent abuse of our API endpoints. If you are not using the free trial, we will not ask you to sign in. - -### How do I stop Continue from asking me to sign in? - -Remove all models from the "models" array or "tabAutocompleteModel" with `"provider": "free-trial"`, and we will never request sign in. - -### What information is collected? - -Continue uses your GitHub username and no other information, for the sole purpose of limiting requests. - -### What happens if I don't sign in? - -If you don't sign in, you can still use every feature of Continue, you will just need to provide your own LLM either with an API key or by running a local model. - -### How is telemetry related to sign in? - -It is not. We do not link your GitHub username to telemetry data. diff --git a/docs/docs/customize/model-providers/more/function-network.md b/docs/docs/customize/model-providers/more/function-network.md deleted file mode 100644 index c48e899d8..000000000 --- a/docs/docs/customize/model-providers/more/function-network.md +++ /dev/null @@ -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. diff --git a/docs/docs/customize/model-providers/more/function-network.mdx b/docs/docs/customize/model-providers/more/function-network.mdx new file mode 100644 index 000000000..e2089ac1a --- /dev/null +++ b/docs/docs/customize/model-providers/more/function-network.mdx @@ -0,0 +1,116 @@ +--- +title: Function Network +slug: ../function-network +--- + +import TabItem from "@theme/TabItem"; +import Tabs from "@theme/Tabs"; + +# 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. + + + + ```yaml title="config.yaml" + models: + - name: Llama 3.1 70b + provider: function-network + model: meta/llama-3.1-70b-instruct + apiKey: + roles: + - chat + ``` + + + ```json title="config.json" + { + "models": [ + { + "title": "Llama 3.1 70b", + "provider": "function-network", + "model": "meta/llama-3.1-70b-instruct", + "apiKey": "" + } + ] + } + ``` + + + +[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. + + + + ```yaml title="config.yaml" + models: + - name: Deepseek Coder 6.7b + provider: function-network + model: thebloke/deepseek-coder-6.7b-base-awq + apiKey: + roles: + - autocomplete + ``` + + + ```json title="config.json" + { + "tabAutocompleteModel": { + "title": "Deepseek Coder 6.7b", + "provider": "function-network", + "model": "thebloke/deepseek-coder-6.7b-base-awq", + "apiKey": "" + } + } + ``` + + + +## Embeddings model + +Function Network supports a number of models for embeddings. We recommend using baai/bge-base-en-v1.5. + + + + ```yaml title="config.yaml" + models: + - name: BGE Base En + provider: function-network + model: baai/bge-base-en-v1.5 + apiKey: + roles: + - embed + ``` + + + ```json title="config.json" + { + "embeddingsProvider": { + "provider": "function-network", + "model": "baai/bge-base-en-v1.5", + "apiKey": "" + } + } + ``` + + + +[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. diff --git a/docs/docs/customize/model-providers/more/groq.md b/docs/docs/customize/model-providers/more/groq.md deleted file mode 100644 index fa5bac12f..000000000 --- a/docs/docs/customize/model-providers/more/groq.md +++ /dev/null @@ -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": "" - } - ] -} -``` diff --git a/docs/docs/customize/model-providers/more/groq.mdx b/docs/docs/customize/model-providers/more/groq.mdx new file mode 100644 index 000000000..2c33e37f1 --- /dev/null +++ b/docs/docs/customize/model-providers/more/groq.mdx @@ -0,0 +1,41 @@ +import TabItem from "@theme/TabItem"; +import Tabs from "@theme/Tabs"; + +# 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: + + + + ```yaml title="config.yaml" + models: + - name: Llama 3.3 70b Versatile + provider: groq + model: llama-3.3-70b-versatile + apiKey: + roles: + - chat + ``` + + + ```json title="config.json" + { + "models": [ + { + "title": "Llama 3.3 70b Versatile", + "provider": "groq", + "model": "llama-3.3-70b-versatile", + "apiKey": "" + } + ] + } + ``` + + diff --git a/docs/docs/customize/model-providers/more/huggingfaceinferenceapi.md b/docs/docs/customize/model-providers/more/huggingfaceinferenceapi.md deleted file mode 100644 index a2122fc4d..000000000 --- a/docs/docs/customize/model-providers/more/huggingfaceinferenceapi.md +++ /dev/null @@ -1,19 +0,0 @@ -# HuggingFace Inference Endpoints - -Hugging Face Inference Endpoints are an easy way to setup instances of open-source language models on any cloud. Sign up for an account and add billing [here](https://huggingface.co/settings/billing), access the Inference Endpoints [here](https://ui.endpoints.huggingface.co), click on “New endpoint”, and fill out the form (e.g. select a model like [WizardCoder-Python-34B-V1.0](https://huggingface.co/WizardLM/WizardCoder-Python-34B-V1.0)), and then deploy your model by clicking “Create Endpoint”. Change `~/.continue/config.json` to look like this: - -```json title="config.json" -{ - "models": [ - { - "title": "Hugging Face Inference API", - "provider": "huggingface-inference-api", - "model": "MODEL_NAME", - "apiKey": "YOUR_HF_TOKEN", - "apiBase": "INFERENCE_API_ENDPOINT_URL" - } - ] -} -``` - -[View the source](https://github.com/continuedev/continue/blob/main/core/llm/llms/HuggingFaceInferenceAPI.ts) diff --git a/docs/docs/customize/model-providers/more/huggingfaceinferenceapi.mdx b/docs/docs/customize/model-providers/more/huggingfaceinferenceapi.mdx new file mode 100644 index 000000000..91f37051a --- /dev/null +++ b/docs/docs/customize/model-providers/more/huggingfaceinferenceapi.mdx @@ -0,0 +1,36 @@ +import Tabs from "@theme/Tabs"; +import TabItem from "@theme/TabItem"; + +# HuggingFace Inference Endpoints + +Hugging Face Inference Endpoints are an easy way to setup instances of open-source language models on any cloud. Sign up for an account and add billing [here](https://huggingface.co/settings/billing), access the Inference Endpoints [here](https://ui.endpoints.huggingface.co), click on “New endpoint”, and fill out the form (e.g. select a model like [WizardCoder-Python-34B-V1.0](https://huggingface.co/WizardLM/WizardCoder-Python-34B-V1.0)), and then deploy your model by clicking “Create Endpoint”. Change `~/.continue/config.json` to look like this: + + + + ```yaml title="config.yaml" + models: + - name: Hugging Face Inference API + provider: huggingface-inference-api + model: MODEL_NAME + apiKey: + apiBase: + ``` + + + ```json title="config.json" + { + "models": [ + { + "title": "Hugging Face Inference API", + "provider": "huggingface-inference-api", + "model": "MODEL_NAME", + "apiKey": "", + "apiBase": "" + } + ] + } + ``` + + + +[View the source](https://github.com/continuedev/continue/blob/main/core/llm/llms/HuggingFaceInferenceAPI.ts) diff --git a/docs/docs/customize/model-providers/more/ipex_llm.md b/docs/docs/customize/model-providers/more/ipex_llm.mdx similarity index 54% rename from docs/docs/customize/model-providers/more/ipex_llm.md rename to docs/docs/customize/model-providers/more/ipex_llm.mdx index 47bb18b2a..5af95a7cf 100644 --- a/docs/docs/customize/model-providers/more/ipex_llm.md +++ b/docs/docs/customize/model-providers/more/ipex_llm.mdx @@ -1,3 +1,6 @@ +import TabItem from "@theme/TabItem"; +import Tabs from "@theme/Tabs"; + # IPEX-LLM :::info @@ -6,35 +9,58 @@ IPEX-LLM supports accelerated Ollama backend to be hosted on Intel GPU. Refer to [this guide](https://ipex-llm.readthedocs.io/en/latest/doc/LLM/Quickstart/ollama_quickstart.html) from IPEX-LLM official documentation about how to install and run Ollama serve accelerated by IPEX-LLM on Intel GPU. You can then configure Continue to use the IPEX-LLM accelerated `"ollama"` provider as follows: -```json title="config.json" -{ - "models": [ - { - "title": "IPEX-LLM", - "provider": "ollama", - "model": "AUTODETECT" - } - ] -} -``` + + + ```yaml title="config.yaml" + models: + - name: IPEX-LLM + provider: ollama + model: AUTODETECT + ``` + + + ```json title="config.json" + { + "models": [ + { + "title": "IPEX-LLM", + "provider": "ollama", + "model": "AUTODETECT" + } + ] + } + ``` + + If you would like to reach the Ollama service from another machine, make sure you set or export the environment variable `OLLAMA_HOST=0.0.0.0` before executing the command `ollama serve`. Then, in the Continue configuration, set `'apiBase'` to correspond with the IP address / port of the remote machine. That is, Continue can be configured to be: -```json title="config.json" -{ - "models": [ - { - "title": "IPEX-LLM", - "provider": "ollama", - "model": "AUTODETECT", - "apiBase": "http://your-ollama-service-ip:11434" - } - ] -} -``` + + + ```yaml title="config.yaml" + models: + - name: IPEX-LLM + provider: ollama + model: AUTODETECT + apiBase: http://your-ollama-service-ip:11434 + ``` + + + ```json title="config.json" + { + "models": [ + { + "title": "IPEX-LLM", + "provider": "ollama", + "model": "AUTODETECT", + "apiBase": "http://your-ollama-service-ip:11434" + } + ] + } + ``` + + :::tip - If you would like to preload the model before your first conversation with that model in Continue, you could refer to [here](https://ipex-llm.readthedocs.io/en/latest/doc/LLM/Quickstart/continue_quickstart.html#pull-and-prepare-the-model) for more information. - ::: diff --git a/docs/docs/customize/model-providers/more/kindo.md b/docs/docs/customize/model-providers/more/kindo.md deleted file mode 100644 index 9e205c66e..000000000 --- a/docs/docs/customize/model-providers/more/kindo.md +++ /dev/null @@ -1,38 +0,0 @@ -# Kindo - -Kindo offers centralized control over your organization's AI operations, ensuring data protection and compliance with internal policies while supporting various commercial and open-source models. To get started, sign up [here](https://app.kindo.ai/), create an API key in [Settings > API > API Keys](https://app.kindo.ai/settings/api), and choose a model from the list of supported models in the "Available Models" tab or copy and paste the config in [Plugins > Your Configuration](https://app.kindo.ai/plugins). - -## Config Example - -```json title="config.json" -{ - "models": [ - { - "title": "Claude 3.5 Sonnet", - "provider": "kindo", - "model": "claude-3-5-sonnet", - "apiKey": "" - } - ] -} -``` - -## Tab Autocomplete Config Example - -```json title="config.json" -{ - "tabAutocompleteModel": [ - { - "title": "WhiteRabbitNeo", - "provider": "kindo", - "model": "/models/WhiteRabbitNeo-33B-DeepSeekCoder", - "apiKey": "", - "template": "none" - } - ] -} -``` - -## Security - -To update your organization's model access, adjust the controls in [security settings](https://app.kindo.ai/security-settings). diff --git a/docs/docs/customize/model-providers/more/kindo.mdx b/docs/docs/customize/model-providers/more/kindo.mdx new file mode 100644 index 000000000..2315fe7a1 --- /dev/null +++ b/docs/docs/customize/model-providers/more/kindo.mdx @@ -0,0 +1,69 @@ +import TabItem from "@theme/TabItem"; +import Tabs from "@theme/Tabs"; + +# Kindo + +Kindo offers centralized control over your organization's AI operations, ensuring data protection and compliance with internal policies while supporting various commercial and open-source models. To get started, sign up [here](https://app.kindo.ai/), create an API key in [Settings > API > API Keys](https://app.kindo.ai/settings/api), and choose a model from the list of supported models in the "Available Models" tab or copy and paste the config in [Plugins > Your Configuration](https://app.kindo.ai/plugins). + +## Config Example + + + + ```yaml title="config.yaml" + models: + - name: Claude 3.5 Sonnet + provider: kindo + model: claude-3-5-sonnet + apiKey: + ``` + + + ```json title="config.json" + { + "models": [ + { + "title": "Claude 3.5 Sonnet", + "provider": "kindo", + "model": "claude-3-5-sonnet", + "apiKey": "" + } + ] + } + ``` + + + +## Tab Autocomplete Config Example + + + + ```yaml title="config.yaml" + models: + - name: WhiteRabbitNeo + provider: kindo + model: /models/WhiteRabbitNeo-33B-DeepSeekCoder + apiKey: + roles: + - autocomplete + ``` + + + ```json title="config.json" + { + "tabAutocompleteModel": [ + { + "title": "WhiteRabbitNeo", + "provider": "kindo", + "model": "/models/WhiteRabbitNeo-33B-DeepSeekCoder", + "apiKey": "", + "template": "none" + } + ] + } + ``` + + + +## Security + +To update your organization's model access, adjust the controls in [security settings](https://app.kindo.ai/security-settings). diff --git a/docs/docs/customize/model-providers/more/llamacpp.md b/docs/docs/customize/model-providers/more/llamacpp.md deleted file mode 100644 index 7dbdd47ca..000000000 --- a/docs/docs/customize/model-providers/more/llamacpp.md +++ /dev/null @@ -1,24 +0,0 @@ -# LlamaCpp - -Run the llama.cpp server binary to start the API server. If running on a remote server, be sure to set host to 0.0.0.0: - -```shell -.\server.exe -c 4096 --host 0.0.0.0 -t 16 --mlock -m models\meta\llama\codellama-7b-instruct.Q8_0.gguf -``` - -After it's up and running, change `~/.continue/config.json` to look like this: - -```json title="config.json" -{ - "models": [ - { - "title": "Llama CPP", - "provider": "llama.cpp", - "model": "MODEL_NAME", - "apiBase": "http://localhost:8080" - } - ] -} -``` - -[View the source](https://github.com/continuedev/continue/blob/main/core/llm/llms/LlamaCpp.ts) diff --git a/docs/docs/customize/model-providers/more/llamacpp.mdx b/docs/docs/customize/model-providers/more/llamacpp.mdx new file mode 100644 index 000000000..5b210bb6b --- /dev/null +++ b/docs/docs/customize/model-providers/more/llamacpp.mdx @@ -0,0 +1,40 @@ +import TabItem from "@theme/TabItem"; +import Tabs from "@theme/Tabs"; + +# LlamaCpp + +Run the llama.cpp server binary to start the API server. If running on a remote server, be sure to set host to 0.0.0.0: + +```bash +.\server.exe -c 4096 --host 0.0.0.0 -t 16 --mlock -m models\meta\llama\codellama-7b-instruct.Q8_0.gguf +``` + +After it's up and running, change `~/.continue/config.json` to look like this: + + + + ```yaml title="config.yaml" + models: + - name: Llama CPP + provider: llama.cpp + model: MODEL_NAME + apiBase: http://localhost:8080 + ``` + + + ```json title="config.json" + { + "models": [ + { + "title": "Llama CPP", + "provider": "llama.cpp", + "model": "MODEL_NAME", + "apiBase": "http://localhost:8080" + } + ] + } + ``` + + + +[View the source](https://github.com/continuedev/continue/blob/main/core/llm/llms/LlamaCpp.ts) diff --git a/docs/docs/customize/model-providers/more/llamafile.md b/docs/docs/customize/model-providers/more/llamafile.md deleted file mode 100644 index 71f4f7f07..000000000 --- a/docs/docs/customize/model-providers/more/llamafile.md +++ /dev/null @@ -1,17 +0,0 @@ -# Llamafile - -A [llamafile](https://github.com/Mozilla-Ocho/llamafile#readme) is a self-contained binary that can run an open-source LLM. You can configure this provider in your config.json as follows: - -```json title="config.json" -{ - "models": [ - { - "title": "Llamafile", - "provider": "llamafile", - "model": "mistral-7b" - } - ] -} -``` - -[View the source](https://github.com/continuedev/continue/blob/main/core/llm/llms/Llamafile.ts) diff --git a/docs/docs/customize/model-providers/more/llamafile.mdx b/docs/docs/customize/model-providers/more/llamafile.mdx new file mode 100644 index 000000000..e674d2f83 --- /dev/null +++ b/docs/docs/customize/model-providers/more/llamafile.mdx @@ -0,0 +1,32 @@ +import Tabs from "@theme/Tabs"; +import TabItem from "@theme/TabItem"; + +# Llamafile + +A [llamafile](https://github.com/Mozilla-Ocho/llamafile#readme) is a self-contained binary that can run an open-source LLM. You can configure this provider in your config.json as follows: + + + + ```yaml title="config.yaml" + models: + - name: Llamafile + provider: llamafile + model: mistral-7b + ``` + + + ```json title="config.json" + { + "models": [ + { + "title": "Llamafile", + "provider": "llamafile", + "model": "mistral-7b" + } + ] + } + ``` + + + +[View the source](https://github.com/continuedev/continue/blob/main/core/llm/llms/Llamafile.ts) diff --git a/docs/docs/customize/model-providers/more/lmstudio.md b/docs/docs/customize/model-providers/more/lmstudio.md deleted file mode 100644 index a901f811a..000000000 --- a/docs/docs/customize/model-providers/more/lmstudio.md +++ /dev/null @@ -1,45 +0,0 @@ -# LM Studio - -[LM Studio](https://lmstudio.ai) is an application for Mac, Windows, and Linux that makes it easy to locally run open-source models and comes with a great UI. To get started with LM Studio, download from the website, use the UI to download a model, and then start the local inference server. Continue can then be configured to use the `LMStudio` LLM class: - -```json title="config.json" -{ - "models": [ - { - "title": "LM Studio", - "provider": "lmstudio", - "model": "llama2-7b" - } - ] -} -``` - -### Embeddings model - -LMStudio supports embeddings endpoints, and comes with the `nomic-ai/nomic-embed-text-v1.5-GGUF` model (as of Nov 2024, check your models) - -```json title="config.json" -{ - "embeddingsProvider": { - "provider": "lmstudio", - "model": "nomic-ai/nomic-embed-text-v1.5-GGUF" - } -} -``` - -## Setting up a remote instance - -To configure a remote instance of LM Studio, add the `"apiBase"` property to your model in config.json: - -```json title="config.json" -{ - "title": "LM Studio", - "model": "codestral", - "provider": "lmstudio", - "apiBase": "http://x.x.x.x:1234/v1/" -} -``` - -This `apiBase` will now be used instead of the default `http://localhost:1234/v1`. - -[View the source](https://github.com/continuedev/continue/blob/main/core/llm/llms/LMStudio.ts) diff --git a/docs/docs/customize/model-providers/more/lmstudio.mdx b/docs/docs/customize/model-providers/more/lmstudio.mdx new file mode 100644 index 000000000..6dedb0a88 --- /dev/null +++ b/docs/docs/customize/model-providers/more/lmstudio.mdx @@ -0,0 +1,88 @@ +import TabItem from "@theme/TabItem"; +import Tabs from "@theme/Tabs"; + +# LM Studio + +[LM Studio](https://lmstudio.ai) is an application for Mac, Windows, and Linux that makes it easy to locally run open-source models and comes with a great UI. To get started with LM Studio, download from the website, use the UI to download a model, and then start the local inference server. Continue can then be configured to use the `LMStudio` LLM class: + + + + ```yaml title="config.yaml" + models: + - name: LM Studio + provider: lmstudio + model: llama2-7b + ``` + + + ```json title="config.json" + { + "models": [ + { + "title": "LM Studio", + "provider": "lmstudio", + "model": "llama2-7b" + } + ] + } + ``` + + + +### Embeddings model + +LMStudio supports embeddings endpoints, and comes with the `nomic-ai/nomic-embed-text-v1.5-GGUF` model (as of Nov 2024, check your models) + + + + ```yaml title="config.yaml" + models: + - name: Nomic Embed Text + provider: lmstudio + model: nomic-ai/nomic-embed-text-v1.5-GGUF + roles: + - embed + ``` + + + ```json title="config.json" + { + "embeddingsProvider": { + "provider": "lmstudio", + "model": "nomic-ai/nomic-embed-text-v1.5-GGUF" + } + } + ``` + + + +## Setting up a remote instance + +To configure a remote instance of LM Studio, add the `"apiBase"` property to your model in config.json: + + + + ```yaml title="config.yaml" + models: + - name: Nomic Embed Text + provider: lmstudio + model: nomic-ai/nomic-embed-text-v1.5-GGUF + roles: + - embed + ``` + + + ```json title="config.json" + { + "embeddingsProvider": { + "provider": "lmstudio", + "model": "nomic-ai/nomic-embed-text-v1.5-GGUF" + } + } + ``` + + + +This `apiBase` will now be used instead of the default `http://localhost:1234/v1`. + +[View the source](https://github.com/continuedev/continue/blob/main/core/llm/llms/LMStudio.ts) diff --git a/docs/docs/customize/model-providers/more/moonshot.mdx b/docs/docs/customize/model-providers/more/moonshot.mdx new file mode 100644 index 000000000..0d9f838eb --- /dev/null +++ b/docs/docs/customize/model-providers/more/moonshot.mdx @@ -0,0 +1,94 @@ +import TabItem from "@theme/TabItem"; +import Tabs from "@theme/Tabs"; + +# 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: + + + + ```yaml title="config.yaml" + models: + - name: Moonshot + provider: moonshot + model: moonshot-v1-8k + apiKey: + ``` + + + ```json title="config.json" + { + "models": [ + { + "title": "Moonshot", + "provider": "moonshot", + "model": "moonshot-v1-8k", + "apiKey": "" + } + ] + } + ``` + + + +## 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: + + + + ```yaml title="config.yaml" + models: + - name: Moonshot-8K + provider: moonshot + model: moonshot-v1-8k + apiKey: + defaultCompletionOptions: + temperature: 0.7 + topP: 0.95 + maxTokens: 2048 + ``` + + + ```json title="config.json" + { + "models": [ + { + "title": "Moonshot-8K", + "provider": "moonshot", + "model": "moonshot-v1-8k", + "apiKey": "", + "completionOptions": { + "temperature": 0.7, + "topP": 0.95, + "maxTokens": 2048 + } + } + ] + } + ``` + + diff --git a/docs/docs/customize/model-providers/more/msty.md b/docs/docs/customize/model-providers/more/msty.mdx similarity index 67% rename from docs/docs/customize/model-providers/more/msty.md rename to docs/docs/customize/model-providers/more/msty.mdx index 1fda1d88b..d23955fd4 100644 --- a/docs/docs/customize/model-providers/more/msty.md +++ b/docs/docs/customize/model-providers/more/msty.mdx @@ -1,19 +1,33 @@ +import TabItem from "@theme/TabItem"; +import Tabs from "@theme/Tabs"; + # Msty [Msty](https://msty.app/) is an application for Windows, Mac, and Linux that makes it really easy to run online as well as local open-source models, including Llama-2, DeepSeek Coder, etc. No need to fidget with your terminal, run a command, or anything. Just download the app from the website, click a button, and you are up and running. Continue can then be configured to use the `Msty` LLM class: -```json title="config.json" -{ - "models": [ - { - "title": "Msty", - "provider": "msty", - "model": "deepseek-coder:6.7b", - "completionOptions": {} - } - ] -} -``` + + + ```yaml title="config.yaml" + models: + - name: Msty + provider: msty + model: deepseek-coder:6.7b + ``` + + + ```json title="config.json" + { + "models": [ + { + "title": "Msty", + "provider": "msty", + "model": "deepseek-coder:6.7b", + } + ] + } + ``` + + ## Completion Options @@ -30,21 +44,36 @@ In addition to the model type, you can also configure some of the parameters tha If you need to send custom headers for authentication, you may use the `requestOptions.headers` property like this: -```json title="config.json" -{ - "models": [ - { - "title": "Msty", - "provider": "msty", - "model": "deepseek-coder:6.7b", - "requestOptions": { - "headers": { - "Authorization": "Bearer xxx" + + + ```yaml title="config.yaml" + models: + - name: Msty + provider: msty + model: deepseek-coder:6.7b + requestOptions: + headers: + Authorization: Bearer xxx + ``` + + + ```json title="config.json" + { + "models": [ + { + "title": "Msty", + "provider": "msty", + "model": "deepseek-coder:6.7b", + "requestOptions": { + "headers": { + "Authorization": "Bearer xxx" + } } } - } - ] -} -``` + ] + } + ``` + + [View the source](https://github.com/continuedev/continue/blob/main/core/llm/llms/Msty.ts) diff --git a/docs/docs/customize/model-providers/more/ncompass.mdx b/docs/docs/customize/model-providers/more/ncompass.mdx new file mode 100644 index 000000000..e6f98c296 --- /dev/null +++ b/docs/docs/customize/model-providers/more/ncompass.mdx @@ -0,0 +1,34 @@ +import Tabs from "@theme/Tabs"; +import TabItem from "@theme/TabItem"; + +# nCompass + +The nCompass Technologies API exposes an extremely fast inference engine for open-source language models. You can sign up [here](https://app.ncompass.tech/api-settings), copy your API key on the initial welcome screen, and then hit the play button on any model from the [nCompass Models list](https://console.ncompass.tech/models). Change `~/.continue/config.json` to look like this: + + + + ```yaml title="Package or config.yaml" + models: + - name: Ncompass Qwen2.5 Coder + provider: ncompass + model: Qwen/Qwen2.5-Coder-32B-Instruct + apiKey: + ``` + + + ```json title="config.json" + { + "models": [ + { + "title": "Ncompass Qwen2.5 Coder", + "provider": "ncompass", + "model": "Qwen/Qwen2.5-Coder-32B-Instruct", + "apiKey": "" + } + ] + } + ``` + + + +[View the source](https://github.com/continuedev/continue/blob/main/core/llm/llms/NCompass.ts) diff --git a/docs/docs/customize/model-providers/more/nebius.md b/docs/docs/customize/model-providers/more/nebius.md deleted file mode 100644 index d4cfa344b..000000000 --- a/docs/docs/customize/model-providers/more/nebius.md +++ /dev/null @@ -1,36 +0,0 @@ -# Nebius AI Studio - -You can get an API key from the [Nebius AI Studio API keys page](https://studio.nebius.ai/settings/api-keys) - -## Availible models - -Available models can be found on the [Nebius AI Studio models page](https://studio.nebius.ai/models/text2text) - -## Chat model - -```json title="config.json" -{ - "models": [ - { - "title": "Llama 3.1 405b", - "provider": "nebius", - "model": "llama3.1-405b", - "apiKey": "[API_KEY]" - } - ] -} -``` - -## Embeddings model - -Available models can be found on the [Nebius AI Studio embeddings page](https://studio.nebius.ai/models/embedding) - -```json title="config.json" -{ - "embeddingsProvider": { - "provider": "nebius", - "model": "BAAI/bge-en-icl", - "apiKey": "[API_KEY]" - } -} -``` diff --git a/docs/docs/customize/model-providers/more/nebius.mdx b/docs/docs/customize/model-providers/more/nebius.mdx new file mode 100644 index 000000000..12a660ead --- /dev/null +++ b/docs/docs/customize/model-providers/more/nebius.mdx @@ -0,0 +1,67 @@ +import TabItem from "@theme/TabItem"; +import Tabs from "@theme/Tabs"; + +# Nebius AI Studio + +You can get an API key from the [Nebius AI Studio API keys page](https://studio.nebius.ai/settings/api-keys) + +## Availible models + +Available models can be found on the [Nebius AI Studio models page](https://studio.nebius.ai/models/text2text) + +## Chat model + + + + ```yaml title="config.yaml" + models: + - name: Llama 3.1 405b + provider: nebius + model: llama3.1-405b + apiKey: + ``` + + + ```json title="config.json" + { + "models": [ + { + "title": "Llama 3.1 405b", + "provider": "nebius", + "model": "llama3.1-405b", + "apiKey": "" + } + ] + } + ``` + + + +## Embeddings model + +Available models can be found on the [Nebius AI Studio embeddings page](https://studio.nebius.ai/models/embedding) + + + + ```yaml title="config.yaml" + models: + - name: BAAI Embedder + provider: nebius + model: BAAI/bge-en-icl + apiKey: + roles: + - embed + ``` + + + ```json title="config.json" + { + "embeddingsProvider": { + "provider": "nebius", + "model": "BAAI/bge-en-icl", + "apiKey": "" + } + } + ``` + + diff --git a/docs/docs/customize/model-providers/more/novita.md b/docs/docs/customize/model-providers/more/novita.mdx similarity index 65% rename from docs/docs/customize/model-providers/more/novita.md rename to docs/docs/customize/model-providers/more/novita.mdx index 02f7cefb5..ca2f603b0 100644 --- a/docs/docs/customize/model-providers/more/novita.md +++ b/docs/docs/customize/model-providers/more/novita.mdx @@ -1,18 +1,34 @@ +import TabItem from "@theme/TabItem"; +import Tabs from "@theme/Tabs"; + # Novita [Novita AI](https://novita.ai?utm_source=github_continuedev&utm_medium=github_readme&utm_campaign=github_link) offers an affordable, reliable, and simple inference platform with scalable [LLM API](https://novita.ai/docs/model-api/reference/introduction.html), empowering developers to build AI applications. Try the [Novita AI Llama 3 API Demo](https://novita.ai/model-api/product/llm-api/playground/meta-llama-llama-3.1-70b-instruct?utm_source=github_continuedev&utm_medium=github_readme&utm_campaign=github_link) today!. You can sign up [here](https://novita.ai/user/login?&redirect=/&utm_source=github_continuedev&utm_medium=github_readme&utm_campaign=github_link), copy your API key on the [Key Management](https://novita.ai/settings/key-management?utm_source=github_continuedev&utm_medium=github_readme&utm_campaign=github_link), and then hit the play button on any model from the [Novita AI Models list](https://novita.ai/llm-api?utm_source=github_continuedev&utm_medium=github_readme&utm_campaign=github_link). Change `~/.continue/config.json` to look like this: -```json title="config.json" -{ - "models": [ - { - "title": "Llama 3.1 8B", - "provider": "novita", - "model": "meta-llama/llama-3.1-8b-instruct", - "apiKey": "YOUR_API_KEY" - } - ] -} -``` + + + ```yaml title="config.yaml" + models: + - name: Llama 3.1 8B + provider: novita + model: meta-llama/llama-3.1-8b-instruct + apiKey: + ``` + + + ```json title="config.json" + { + "models": [ + { + "title": "Llama 3.1 8B", + "provider": "novita", + "model": "meta-llama/llama-3.1-8b-instruct", + "apiKey": "" + } + ] + } + ``` + + [View the source](https://github.com/continuedev/continue/blob/main/core/llm/llms/Novita.ts) diff --git a/docs/docs/customize/model-providers/more/nvidia.md b/docs/docs/customize/model-providers/more/nvidia.md deleted file mode 100644 index 049ff7754..000000000 --- a/docs/docs/customize/model-providers/more/nvidia.md +++ /dev/null @@ -1,52 +0,0 @@ ---- -title: NVIDIA ---- - -:::info - -[View the docs](https://docs.nvidia.com/nim/large-language-models/latest/getting-started.html#option-1-from-api-catalog) to learn how to get an API key. - -::: - -## Chat model - -We recommend configuring **Nemotron-4-340B-Instruct** as your chat model. - -```json title="config.json" -{ - "models": [ - { - "title": "Nemotron-4-340B-Instruct", - "provider": "nvidia", - "model": "nvidia-nemotron-4-340b-instruct", - "apiKey": "[API_KEY]" - } - ] -} -``` - -## Autocomplete model - -NVIDIA 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 **NVIDIA Retrieval QA Mistral 7B** as your embeddings model. - -```json title="config.json" -{ - "embeddingsProvider": { - "provider": "nvidia", - "model": "nvidia/nv-embedqa-mistral-7b-v2", - "apiKey": "[API_KEY]" - } -} -``` - -## Reranking model - -NVIDIA currently does not offer any reranking models. - -[Click here](../../model-types/reranking.md) to see a list of reranking model providers. diff --git a/docs/docs/customize/model-providers/more/nvidia.mdx b/docs/docs/customize/model-providers/more/nvidia.mdx new file mode 100644 index 000000000..27fdc9041 --- /dev/null +++ b/docs/docs/customize/model-providers/more/nvidia.mdx @@ -0,0 +1,81 @@ +--- +title: NVIDIA +--- + +import TabItem from "@theme/TabItem"; +import Tabs from "@theme/Tabs"; + +:::info +[View the docs](https://docs.nvidia.com/nim/large-language-models/latest/getting-started.html#option-1-from-api-catalog) to learn how to get an API key. +::: + +## Chat model + +We recommend configuring **Nemotron-4-340B-Instruct** as your chat model. + + + + ```yaml title="config.yaml" + models: + - name: Nemotron-4-340B-Instruct + provider: nvidia + model: nvidia-nemotron-4-340b-instruct + apiKey: + ``` + + + ```json title="config.json" + { + "models": [ + { + "title": "Nemotron-4-340B-Instruct", + "provider": "nvidia", + "model": "nvidia-nemotron-4-340b-instruct", + "apiKey": "" + } + ] + } + ``` + + + +## Autocomplete model + +NVIDIA currently does not offer any autocomplete models. + +[Click here](../../model-roles/autocomplete.md) to see a list of autocomplete model providers. + +## Embeddings model + +We recommend configuring **NVIDIA Retrieval QA Mistral 7B** as your embeddings model. + + + + ```yaml title="config.yaml" + models: + - name: Nvidia Embedder + provider: nvidia + model: nvidia/nv-embedqa-mistral-7b-v2 + apiKey: + roles: + - embed + ``` + + + ```json title="config.json" + { + "embeddingsProvider": { + "provider": "nvidia", + "model": "nvidia/nv-embedqa-mistral-7b-v2", + "apiKey": "" + } + } + ``` + + + +## Reranking model + +NVIDIA currently does not offer any reranking models. + +[Click here](../../model-roles/reranking.mdx) to see a list of reranking model providers. diff --git a/docs/docs/customize/model-providers/more/openrouter.md b/docs/docs/customize/model-providers/more/openrouter.md deleted file mode 100644 index d08f754f5..000000000 --- a/docs/docs/customize/model-providers/more/openrouter.md +++ /dev/null @@ -1,40 +0,0 @@ -# OpenRouter - -OpenRouter is a unified interface for commercial and open-source models, giving you access to the best models at the best prices. You can sign up [here](https://openrouter.ai/signup), create your API key on the [keys page](https://openrouter.ai/keys), and then choose a model from the [list of supported models](https://openrouter.ai/models). - -Change `~/.continue/config.json` to look like the following. - -```json title="config.json" -{ - "models": [ - { - "title": "OpenRouter LLaMA 70 8B", - "provider": "openrouter", - "model": "meta-llama/llama-3-70b-instruct", - "apiBase": "https://openrouter.ai/api/v1", - "apiKey": "..." - } - ] -} -``` - -To utilize features such as provider preferences or model routing configuration, include these parameters inside the `models[].requestsOptions.extraBodyProperties` field of your plugin config. - -For example, to prevent extra long prompts from being compressed, you can explicitly turn off the feature like so: - -```json title="config.json" -{ - "models": [ - { - ... - "requestOptions": { - "extraBodyProperties": { - "transforms": [] - } - } - } - ] -} -``` - -Learn more about available settings [here](https://openrouter.ai/docs). diff --git a/docs/docs/customize/model-providers/more/openrouter.mdx b/docs/docs/customize/model-providers/more/openrouter.mdx new file mode 100644 index 000000000..cc7902a65 --- /dev/null +++ b/docs/docs/customize/model-providers/more/openrouter.mdx @@ -0,0 +1,74 @@ +import TabItem from "@theme/TabItem"; +import Tabs from "@theme/Tabs"; + +# OpenRouter + +OpenRouter is a unified interface for commercial and open-source models, giving you access to the best models at the best prices. You can sign up [here](https://openrouter.ai/signup), create your API key on the [keys page](https://openrouter.ai/keys), and then choose a model from the [list of supported models](https://openrouter.ai/models). + +Change `~/.continue/config.json` to look like the following. + + + + ```yaml title="config.yaml" + models: + - name: OpenRouter LLaMA 70 8B + provider: openrouter + model: meta-llama/llama-3-70b-instruct + apiBase: https://openrouter.ai/api/v1 + apiKey: + ``` + + + ```json title="config.json" + { + "models": [ + { + "title": "OpenRouter LLaMA 70 8B", + "provider": "openrouter", + "model": "meta-llama/llama-3-70b-instruct", + "apiBase": "https://openrouter.ai/api/v1", + "apiKey": "" + } + ] + } + ``` + + + +To utilize features such as provider preferences or model routing configuration, include these parameters inside the `models[].requestsOptions.extraBodyProperties` field of your plugin config. + +For example, to prevent extra long prompts from being compressed, you can explicitly turn off the feature like so: + + + + ```yaml title="config.yaml" + models: + - name: Example Model + provider: exampleProvider + model: example-model + requestOptions: + extraBodyProperties: + transforms: [] + ``` + + + ```json title="config.json" + { + "models": [ + { + "title": "Example Model", + "provider": "exampleProvider", + "model": "example-model", + "requestOptions": { + "extraBodyProperties": { + "transforms": [] + } + } + } + ] + } + ``` + + + +Learn more about available settings [here](https://openrouter.ai/docs). diff --git a/docs/docs/customize/model-providers/more/replicatellm.md b/docs/docs/customize/model-providers/more/replicatellm.mdx similarity index 50% rename from docs/docs/customize/model-providers/more/replicatellm.md rename to docs/docs/customize/model-providers/more/replicatellm.mdx index 065825729..c7a58e076 100644 --- a/docs/docs/customize/model-providers/more/replicatellm.md +++ b/docs/docs/customize/model-providers/more/replicatellm.mdx @@ -1,19 +1,35 @@ +import TabItem from "@theme/TabItem"; +import Tabs from "@theme/Tabs"; + # ReplicateLLM Replicate is a great option for newly released language models or models that you've deployed through their platform. Sign up for an account [here](https://replicate.ai/), copy your API key, and then select any model from the [Replicate Streaming List](https://replicate.com/collections/streaming-language-models). Change `~/.continue/config.json` to look like this: -```json title="config.json" -{ - "models": [ - { - "title": "Replicate CodeLLama", - "provider": "replicate", - "model": "codellama-13b", - "apiKey": "YOUR_API_KEY" - } - ] -} -``` + + + ```yaml title="config.yaml" + models: + - name: Replicate CodeLLama + provider: replicate + model: codellama-13b + apiKey: + ``` + + + ```json title="config.json" + { + "models": [ + { + "title": "Replicate CodeLLama", + "provider": "replicate", + "model": "codellama-13b", + "apiKey": "" + } + ] + } + ``` + + If you don't specify the `model` parameter, it will default to `replicate/llama-2-70b-chat:58d078176e02c219e11eb4da5a02a7830a283b14cf8f94537af893ccff5ee781`. diff --git a/docs/docs/customize/model-providers/more/sagemaker.md b/docs/docs/customize/model-providers/more/sagemaker.md deleted file mode 100644 index 0c9eba812..000000000 --- a/docs/docs/customize/model-providers/more/sagemaker.md +++ /dev/null @@ -1,34 +0,0 @@ -# AWS SageMaker - -SageMaker can be used for both chat and embedding models. Chat models are supported for endpoints deployed with [LMI](https://docs.djl.ai/docs/serving/serving/docs/lmi/index.html), and embedding models are supported for endpoints deployed with [HuggingFace TEI](https://huggingface.co/blog/sagemaker-huggingface-embedding) - -To setup SageMaker as a chat model provider, add the following to your `config.json` file: - -```json title="config.json" -{ - "models": [ - { - "title": "deepseek-6.7b-instruct", - "provider": "sagemaker", - "model": "lmi-model-deepseek-coder-xxxxxxx", - "region": "us-west-2" - } - ], - "embeddingsProvider": { - "provider": "sagemaker", - "model": "mxbai-embed-large-v1-endpoint" - }, -} -``` - -The value in model should be the SageMaker endpoint name you deployed. - -Authentication will be through temporary or long-term credentials in -~/.aws/credentials under a profile called "sagemaker". - -```title="~/.aws/credentials -[sagemaker] -aws_access_key_id = abcdefg -aws_secret_access_key = hijklmno -aws_session_token = pqrstuvwxyz # Optional: means short term creds. -``` diff --git a/docs/docs/customize/model-providers/more/sagemaker.mdx b/docs/docs/customize/model-providers/more/sagemaker.mdx new file mode 100644 index 000000000..33aa6e253 --- /dev/null +++ b/docs/docs/customize/model-providers/more/sagemaker.mdx @@ -0,0 +1,57 @@ +import Tabs from "@theme/Tabs"; +import TabItem from "@theme/TabItem"; + +# AWS SageMaker + +SageMaker can be used for both chat and embedding models. Chat models are supported for endpoints deployed with [LMI](https://docs.djl.ai/docs/serving/serving/docs/lmi/index.html), and embedding models are supported for endpoints deployed with [HuggingFace TEI](https://huggingface.co/blog/sagemaker-huggingface-embedding) + +Here is an example Sagemaker configuration setup: + + + + ```yaml title="config.yaml" + models: + - name: deepseek-6.7b-instruct + provider: sagemaker + model: lmi-model-deepseek-coder-xxxxxxx + region: us-west-2 + roles: + - chat + - name: mxbai-embed + provider: sagemaker + model: mxbai-embed-large-v1-endpoint + roles: + - embed + ``` + + + ```json title="config.json" + { + "models": [ + { + "title": "deepseek-6.7b-instruct", + "provider": "sagemaker", + "model": "lmi-model-deepseek-coder-xxxxxxx", + "region": "us-west-2" + } + ], + "embeddingsProvider": { + "provider": "sagemaker", + "model": "mxbai-embed-large-v1-endpoint" + } + } + ``` + + + +The value in model should be the SageMaker endpoint name you deployed. + +Authentication will be through temporary or long-term credentials in +~/.aws/credentials under a profile called "sagemaker". + +```title="~/.aws/credentials +[sagemaker] +aws_access_key_id = abcdefg +aws_secret_access_key = hijklmno +aws_session_token = pqrstuvwxyz # Optional: means short term creds. +``` diff --git a/docs/docs/customize/model-providers/more/scaleway.md b/docs/docs/customize/model-providers/more/scaleway.md deleted file mode 100644 index 411e95f3a..000000000 --- a/docs/docs/customize/model-providers/more/scaleway.md +++ /dev/null @@ -1,49 +0,0 @@ ---- -title: Scaleway ---- - -:::info - -Scaleway Generative APIs give you instant access to leading AI models hosted in European data centers, ideal for developers requiring low latency, full data privacy, and compliance with EU AI Act. -You can generate your API key in [Scaleway's console](https://console.scaleway.com/generative-api/models). -Read the [quickstart documentation here](https://www.scaleway.com/en/docs/ai-data/generative-apis/quickstart/). - -::: - -## Chat model - -We recommend configuring **Qwen2.5-Coder-32B-Instruct** as your chat model. -[Click here](https://www.scaleway.com/en/docs/ai-data/generative-apis/reference-content/supported-models/) to see the list of available chat models. - -```json title="config.json" -{ - "models": [ - { - "title": "Qwen2.5-Coder-32B-Instruct", - "provider": "scaleway", - "model": "qwen2.5-coder-32b-instruct", - "apiKey": "[API_KEY]" - } - ] -} -``` - -## Autocomplete model - -Scaleway 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 **BGE-Multilingual-Gemma2** as your embeddings model. - -```json title="config.json" -{ - "embeddingsProvider": { - "provider": "scaleway", - "model": "bge-multilingual-gemma2", - "apiKey": "[API_KEY]" - } -} -``` \ No newline at end of file diff --git a/docs/docs/customize/model-providers/more/scaleway.mdx b/docs/docs/customize/model-providers/more/scaleway.mdx new file mode 100644 index 000000000..299c6cc19 --- /dev/null +++ b/docs/docs/customize/model-providers/more/scaleway.mdx @@ -0,0 +1,78 @@ +--- +title: Scaleway +--- + +import TabItem from "@theme/TabItem"; +import Tabs from "@theme/Tabs"; + +:::info +Scaleway Generative APIs give you instant access to leading AI models hosted in European data centers, ideal for developers requiring low latency, full data privacy, and compliance with EU AI Act. +You can generate your API key in [Scaleway's console](https://console.scaleway.com/generative-api/models). +Read the [quickstart documentation here](https://www.scaleway.com/en/docs/ai-data/generative-apis/quickstart/). +::: + +## Chat model + +We recommend configuring **Qwen2.5-Coder-32B-Instruct** as your chat model. +[Click here](https://www.scaleway.com/en/docs/ai-data/generative-apis/reference-content/supported-models/) to see the list of available chat models. + + + + ```yaml title="config.yaml" + models: + - name: Qwen2.5-Coder-32B-Instruct + provider: scaleway + model: qwen2.5-coder-32b-instruct + apiKey: + ``` + + + ```json title="config.json" + { + "models": [ + { + "title": "Qwen2.5-Coder-32B-Instruct", + "provider": "scaleway", + "model": "qwen2.5-coder-32b-instruct", + "apiKey": "" + } + ] + } + ``` + + + +## Autocomplete model + +Scaleway currently does not offer any autocomplete models. + +[Click here](../../model-roles/autocomplete.md) to see a list of autocomplete model providers. + +## Embeddings model + +We recommend configuring **BGE-Multilingual-Gemma2** as your embeddings model. + + + + ```yaml title="config.yaml" + models: + - name: BGE Multilingual Gemma2 + provider: scaleway + model: bge-multilingual-gemma2 + apiKey: + roles: + - embed + ``` + + + ```json title="config.json" + { + "embeddingsProvider": { + "provider": "scaleway", + "model": "bge-multilingual-gemma2", + "apiKey": "" + } + } + ``` + + diff --git a/docs/docs/customize/model-providers/more/siliconflow.md b/docs/docs/customize/model-providers/more/siliconflow.md deleted file mode 100644 index c27fbbdaf..000000000 --- a/docs/docs/customize/model-providers/more/siliconflow.md +++ /dev/null @@ -1,49 +0,0 @@ ---- -title: SiliconFlow ---- - -:::info - -You can get an API key from the [Silicon Cloud](https://cloud.siliconflow.cn/account/ak). - -::: - -## Chat model - -We recommend configuring **Qwen/Qwen2.5-Coder-32B-Instruct** as your chat model. - -```json title="config.json" -{ - "models": [ - { - "title": "Qwen", - "provider": "siliconflow", - "model": "Qwen/Qwen2.5-Coder-32B-Instruct", - "apiKey": "[API_KEY]" - } - ] -} -``` - -## Autocomplete model - -We recommend configuring **Qwen/Qwen2.5-Coder-7B-Instruct** as your autocomplete model. - -```json title="config.json" -{ - "tabAutocompleteModel": { - "title": "Qwen", - "provider": "siliconflow", - "model": "Qwen/Qwen2.5-Coder-7B-Instruct", - "apiKey": "[API_KEY]" - } -} -``` - -## Embeddings model - -SiliconFlow provide some embeddings models, [Click here](https://siliconflow.cn/models) to see a list of embeddings models. - -## Reranking model - -SiliconFlow provide some reranking models, [Click here](https://siliconflow.cn/models) to see a list of reranking models. diff --git a/docs/docs/customize/model-providers/more/siliconflow.mdx b/docs/docs/customize/model-providers/more/siliconflow.mdx new file mode 100644 index 000000000..a496d3757 --- /dev/null +++ b/docs/docs/customize/model-providers/more/siliconflow.mdx @@ -0,0 +1,88 @@ +--- +title: SiliconFlow +--- + +import Tabs from "@theme/Tabs"; +import TabItem from "@theme/TabItem"; + +:::info +You can get an API key from the [Silicon Cloud](https://cloud.siliconflow.cn/account/ak). +::: + +## Chat model + +We recommend configuring **Qwen/Qwen2.5-Coder-32B-Instruct** as your chat model. + + + + ```yaml title="config.yaml" + models: + - name: Qwen + provider: siliconflow + model: Qwen/Qwen2.5-Coder-32B-Instruct + apiKey: + roles: + - chat + ``` + + + ```json title="config.json" + { + "models": [ + { + "title": "Qwen", + "provider": "siliconflow", + "model": "Qwen/Qwen2.5-Coder-32B-Instruct", + "apiKey": "" + } + ] + } + ``` + + + +## Autocomplete model + +We recommend configuring **Qwen/Qwen2.5-Coder-7B-Instruct** as your autocomplete model. + + + + ```yaml title="config.yaml" + models: + - name: Qwen + provider: siliconflow + model: Qwen/Qwen2.5-Coder-32B-Instruct + apiKey: + roles: + - autocomplete + ``` + + + ```json title="config.json" + { + "models": [ + { + "title": "Qwen", + "provider": "siliconflow", + "model": "Qwen/Qwen2.5-Coder-32B-Instruct", + "apiKey": "" + } + ] + "tabAutocompleteModel": { + "title": "Qwen", + "provider": "siliconflow", + "model": "Qwen/Qwen2.5-Coder-7B-Instruct", + "apiKey": "" + } + } + ``` + + + +## Embeddings model + +SiliconFlow provide some embeddings models, [Click here](https://siliconflow.cn/models) to see a list of embeddings models. + +## Reranking model + +SiliconFlow provide some reranking models, [Click here](https://siliconflow.cn/models) to see a list of reranking models. diff --git a/docs/docs/customize/model-providers/more/textgenwebui.md b/docs/docs/customize/model-providers/more/textgenwebui.md deleted file mode 100644 index 723079735..000000000 --- a/docs/docs/customize/model-providers/more/textgenwebui.md +++ /dev/null @@ -1,16 +0,0 @@ -# TextGenWebUI - -TextGenWebUI is a comprehensive, open-source language model UI and local server. You can set it up with an OpenAI-compatible server plugin, and then configure it in your `config.json` like this: - -```json title="config.json" -{ - "models": [ - { - "title": "Text Generation WebUI", - "provider": "text-gen-webui", - "apiBase": "http://localhost:5000/v1", - "model": "MODEL_NAME" - } - ] -} -``` diff --git a/docs/docs/customize/model-providers/more/textgenwebui.mdx b/docs/docs/customize/model-providers/more/textgenwebui.mdx new file mode 100644 index 000000000..2f41c4ab9 --- /dev/null +++ b/docs/docs/customize/model-providers/more/textgenwebui.mdx @@ -0,0 +1,32 @@ +import TabItem from "@theme/TabItem"; +import Tabs from "@theme/Tabs"; + +# TextGenWebUI + +TextGenWebUI is a comprehensive, open-source language model UI and local server. You can set it up with an OpenAI-compatible server plugin, and then configure it like this: + + + + ```yaml title="config.yaml" + models: + - name: Text Generation WebUI + provider: text-gen-webui + apiBase: http://localhost:5000/v1 + model: MODEL_NAME + ``` + + + ```json title="config.json" + { + "models": [ + { + "title": "Text Generation WebUI", + "provider": "text-gen-webui", + "apiBase": "http://localhost:5000/v1", + "model": "MODEL_NAME" + } + ] + } + ``` + + diff --git a/docs/docs/customize/model-providers/more/together.md b/docs/docs/customize/model-providers/more/together.md deleted file mode 100644 index e5ed9abd0..000000000 --- a/docs/docs/customize/model-providers/more/together.md +++ /dev/null @@ -1,18 +0,0 @@ -# Together - -The Together API is a cloud platform for running large AI models. You can sign up [here](https://api.together.xyz/signup), copy your API key on the initial welcome screen, and then hit the play button on any model from the [Together Models list](https://docs.together.ai/docs/serverless-models). Change `~/.continue/config.json` to look like this: - -```json title="config.json" -{ - "models": [ - { - "title": "Together Qwen2.5 Coder", - "provider": "together", - "model": "Qwen/Qwen2.5-Coder-32B-Instruct", - "apiKey": "YOUR_API_KEY" - } - ] -} -``` - -[View the source](https://github.com/continuedev/continue/blob/main/core/llm/llms/Together.ts) diff --git a/docs/docs/customize/model-providers/more/together.mdx b/docs/docs/customize/model-providers/more/together.mdx new file mode 100644 index 000000000..7b2f3b829 --- /dev/null +++ b/docs/docs/customize/model-providers/more/together.mdx @@ -0,0 +1,34 @@ +import TabItem from "@theme/TabItem"; +import Tabs from "@theme/Tabs"; + +# Together + +The Together API is a cloud platform for running large AI models. You can sign up [here](https://api.together.xyz/signup), copy your API key on the initial welcome screen, and then hit the play button on any model from the [Together Models list](https://docs.together.ai/docs/serverless-models). Change `~/.continue/config.json` to look like this: + + + + ```yaml title="config.yaml" + models: + - name: Together Qwen2.5 Coder + provider: together + model: Qwen/Qwen2.5-Coder-32B-Instruct + apiKey: + ``` + + + ```json title="config.json" + { + "models": [ + { + "title": "Together Qwen2.5 Coder", + "provider": "together", + "model": "Qwen/Qwen2.5-Coder-32B-Instruct", + "apiKey": "" + } + ] + } + ``` + + + +[View the source](https://github.com/continuedev/continue/blob/main/core/llm/llms/Together.ts) diff --git a/docs/docs/customize/model-providers/more/vllm.md b/docs/docs/customize/model-providers/more/vllm.md deleted file mode 100644 index fe6932cc5..000000000 --- a/docs/docs/customize/model-providers/more/vllm.md +++ /dev/null @@ -1,59 +0,0 @@ -# vLLM - -vLLM is an open-source library for fast LLM inference which typically is used to serve multiple users at the same. It can also be used to run a large model on multiple GPU:s (e.g. when it doesn´t fit in a single GPU). Run their OpenAI-compatible server using `vllm serve`. See their [server documentation](https://docs.vllm.ai/en/latest/serving/openai_compatible_server.html) and the [engine arguments documentation](https://docs.vllm.ai/en/latest/usage/engine_args.html). - -```shell -vllm serve meta-llama/Meta-Llama-3.1-8B-Instruct -``` -## Chat model - -We recommend configuring **Llama3.1 8B** as your chat model. - -```json title="config.json" -{ - "models": [ - { - "title": "Llama3.1 8B Instruct", - "provider": "vllm", - "model": "meta-llama/Meta-Llama-3.1-8B-Instruct", - "apiBase": "http:///v1" - } - ] -} -``` - -## Autocomplete model - -We recommend configuring **Qwen2.5-Coder 1.5B** as your autocomplete model. - -```json title="config.json" -{ - "tabAutocompleteModel": { - "title": "Qwen2.5-Coder 1.5B", - "provider": "vllm", - "model": "Qwen/Qwen2.5-Coder-1.5B" - "apiBase": "http:///v1" - } -} -``` - -## Embeddings model - -We recommend configuring **Nomic Embed Text** as your embeddings model. - -```json title="config.json" -{ - "embeddingsProvider": { - "provider": "vllm", - "model": "nomic-ai/nomic-embed-text-v1" - "apiBase": "http:///v1" - } -} -``` - -## Reranking model - -[Click here](../../model-types/reranking.md) to see a list of reranking model providers. - - -The continue implementation uses [OpenAI](../top-level/openai.md) under the hood. [View the source](https://github.com/continuedev/continue/blob/main/core/llm/llms/Vllm.ts) diff --git a/docs/docs/customize/model-providers/more/vllm.mdx b/docs/docs/customize/model-providers/more/vllm.mdx new file mode 100644 index 000000000..58431ec7d --- /dev/null +++ b/docs/docs/customize/model-providers/more/vllm.mdx @@ -0,0 +1,105 @@ +import TabItem from "@theme/TabItem"; +import Tabs from "@theme/Tabs"; + +# vLLM + +vLLM is an open-source library for fast LLM inference which typically is used to serve multiple users at the same. It can also be used to run a large model on multiple GPU:s (e.g. when it doesn´t fit in a single GPU). Run their OpenAI-compatible server using `vllm serve`. See their [server documentation](https://docs.vllm.ai/en/latest/serving/openai_compatible_server.html) and the [engine arguments documentation](https://docs.vllm.ai/en/latest/usage/engine_args.html). + +```shell +vllm serve meta-llama/Meta-Llama-3.1-8B-Instruct +``` + +## Chat model + +We recommend configuring **Llama3.1 8B** as your chat model. + + + + ```yaml title="config.yaml" + models: + - name: Llama3.1 8B Instruct + provider: vllm + model: meta-llama/Meta-Llama-3.1-8B-Instruct + apiBase: http:///v1 + ``` + + + ```json title="config.json" + { + "models": [ + { + "title": "Llama3.1 8B Instruct", + "provider": "vllm", + "model": "meta-llama/Meta-Llama-3.1-8B-Instruct", + "apiBase": "http:///v1" + } + ] + } + ``` + + + +## Autocomplete model + +We recommend configuring **Qwen2.5-Coder 1.5B** as your autocomplete model. + + + + ```yaml title="config.yaml" + models: + - name: Qwen2.5-Coder 1.5B + provider: vllm + model: Qwen/Qwen2.5-Coder-1.5B + apiBase: http:///v1 + roles: + - autocomplete + ``` + + + ```json title="config.json" + { + "tabAutocompleteModel": { + "title": "Qwen2.5-Coder 1.5B", + "provider": "vllm", + "model": "Qwen/Qwen2.5-Coder-1.5B", + "apiBase": "http:///v1" + } + } + ``` + + + +## Embeddings model + +We recommend configuring **Nomic Embed Text** as your embeddings model. + + + + ```yaml title="config.yaml" + models: + - name: VLLM Nomad Embed Text + provider: vllm + model: nomic-ai/nomic-embed-text-v1 + apiBase: http:///v1 + roles: + - embed + ``` + + + ```json title="config.json" + { + "embeddingsProvider": { + "provider": "vllm", + "model": "nomic-ai/nomic-embed-text-v1", + "apiBase": "http:///v1" + } + } + ``` + + + +## Reranking model + +[Click here](../../model-roles/reranking.mdx) to see a list of reranking model providers. + +The continue implementation uses [OpenAI](../top-level/openai.mdx) under the hood. [View the source](https://github.com/continuedev/continue/blob/main/core/llm/llms/Vllm.ts) diff --git a/docs/docs/customize/model-providers/more/watsonx.md b/docs/docs/customize/model-providers/more/watsonx.md deleted file mode 100644 index eeeb6073f..000000000 --- a/docs/docs/customize/model-providers/more/watsonx.md +++ /dev/null @@ -1,146 +0,0 @@ -# IBM watsonx - -watsonx, developed by IBM, offers a variety of pre-trained AI foundation models that can be used for natural language processing (NLP), computer vision, and speech recognition tasks. - -## Setup - -Accessing watsonx models can be done either through watsonx SaaS on IBM Cloud or using a dedicated watsonx.ai Software instance. - -### watsonx.ai SaaS - IBM Cloud - -To get started with watsonx SaaS, visit the [registration page](https://dataplatform.cloud.ibm.com/registration/stepone?context=wx). If you do not have an existing IBM Cloud account, you can sign up for a free trial. - -To authenticate to watsonx.ai SaaS with Continue, you will need to create a project and [set up an API key](https://www.ibm.com/docs/en/mas-cd/continuous-delivery?topic=cli-creating-your-cloud-api-key). Then, in continue: - -- Set **apiBase** to your watsonx SaaS endpoint, e.g. `https://us-south.ml.cloud.ibm.com` for US South region. -- Set **projectId** to your watsonx project ID. -- Set **apiKey** to your watsonx API Key. - -### watsonx.ai Software - -To authenticate to your watsonx.ai Software instance with Continue, you can use either `username/password` or `ZenApiKey` method: - -1. _Option 1_ (Recommended): using `ZenApiKey` authentication: - - Set **apiBase** to your watsonx software endpoint, e.g. `https://cpd-watsonx.apps.example.com`. - - Set **projectId** to your watsonx project ID. - - Set **apiKey** to your watsonx Zen API Key. To generate it: - 1. Log in to the CPD web client. - 2. From the toolbar, click your avatar. - 3. Click **Profile and settings**. - 4. Click **API key** > **Generate new key**. - 5. Click **Generate**. - 6. Click **Copy** and save your key somewhere safe. You cannot recover this key if you lose it. - 7. Generate your ZenApiKey by running the following command in your preferred terminal: `echo ":" | base64`, replacing `` with your CPD username and `` with the API Key you just created. -2. _Option 2_: using `username/password` authentication: - - Set **apiBase** to your watsonx software endpoint, e.g. `https://cpd-watsonx.apps.example.com`. - - Set **projectId** to your watsonx project ID. - - Set **API Key** to your watsonx Username and Password using `username:password` as format. - -## Configuration - -Add the following configuration to your `config.json` file to use the watsonx provider. - -```json title="~/.continue/config.json" -{ - "models": [ - { - "model": "model ID", - "title": "watsonx - Model Name", - "provider": "watsonx", - "apiBase": "watsonx endpoint e.g. https://us-south.ml.cloud.ibm.com", - "projectId": "PROJECT_ID", - "apiKey": "API_KEY/ZENAPI_KEY/USERNAME:PASSWORD", - "apiVersion": "2024-03-14" - } - ] -} -``` - -`apiVersion` is optional and defaults to the latest version. - - -If you are using a custom deployment endpoint, set `deploymentID` to the model's deployment ID. You can find it in the watsonx.ai Prompt Lab UI by selecting the corresponding model and opening the `` tab on the right, which will display the endpoint's URL containing the deployment ID. - -```json title="~/.continue/config.json" -{ - "models": [ - { - "model": "model ID", - "title": "watsonx - Model Name", - "provider": "watsonx", - "apiBase": "watsonx endpoint e.g. https://us-south.ml.cloud.ibm.com", - "apiKey": "API_KEY/ZENAPI_KEY/USERNAME:PASSWORD", - "apiVersion": "2024-03-14", - "deploymentId": "DEPLOYMENT_ID" - } - ] -} -``` - -### Configuration Options - -Make sure to specify a template name, such as `granite` or `llama3`, and to set the `contextLength` to the model's context window size. -You can also configure generation parameters, such as temperature, topP, topK, frequency penalty, and stop sequences: - -```json title="~/.continue/config.json" -{ - "models": [ - { - "model": "ibm/granite-20b-code-instruct", - "title": "Granite Code 20b", - "provider": "watsonx", - "apiBase": "watsonx endpoint e.g. https://us-south.ml.cloud.ibm.com", - "projectId": "PROJECT_ID", - "apiKey": "API_KEY/ZENAPI_KEY/USERNAME:PASSWORD", - "apiVersion": "2024-03-14", - "template": "granite", - "contextLength": 8000, - "completionOptions": { - "temperature": 0.1, - "topP": 0.3, - "topK": 20, - "maxTokens": 2000, - "frequencyPenalty": 1.1, - "stop": [ - "Question:", - "\n\n\n" - ] - } - } - ] -} -``` - -## Tab Auto Complete Model - -Granite models are recommended for tab auto complete. The configuration is similar to that of the chat models: -```json title="~/.continue/config.json" -{ - "tabAutocompleteModel": { - "model": "ibm/granite-8b-code-instruct", - "title": "Granite Code 8b", - "provider": "watsonx", - "apiBase": "watsonx endpoint e.g. https://us-south.ml.cloud.ibm.com", - "projectId": "PROJECT_ID", - "apiKey": "API_KEY/ZENAPI_KEY/USERNAME:PASSWORD", - "apiVersion": "2024-03-14", - "contextLength": 4000 - } -} -``` - -## Embeddings Model - -To view the list of available embeddings models, visit [this page](https://dataplatform.cloud.ibm.com/docs/content/wsj/analyze-data/fm-models-embed.html?context=wx&pos=2#ibm-provided). -```json title="~/.continue/config.json -{ - "embeddingsProvider": { - "provider": "watsonx", - "model": "ibm/slate-30m-english-rtrvr-v2", - "apiBase": "watsonx endpoint e.g. https://us-south.ml.cloud.ibm.com", - "projectId": "PROJECT_ID", - "apiKey": "API_KEY/ZENAPI_KEY/USERNAME:PASSWORD", - "apiVersion": "2024-03-14" - } -} -``` diff --git a/docs/docs/customize/model-providers/more/watsonx.mdx b/docs/docs/customize/model-providers/more/watsonx.mdx new file mode 100644 index 000000000..0854e0cd6 --- /dev/null +++ b/docs/docs/customize/model-providers/more/watsonx.mdx @@ -0,0 +1,246 @@ +import TabItem from "@theme/TabItem"; +import Tabs from "@theme/Tabs"; + +# IBM watsonx + +watsonx, developed by IBM, offers a variety of pre-trained AI foundation models that can be used for natural language processing (NLP), computer vision, and speech recognition tasks. + +## Setup + +Accessing watsonx models can be done either through watsonx SaaS on IBM Cloud or using a dedicated watsonx.ai Software instance. + +### watsonx.ai SaaS - IBM Cloud + +To get started with watsonx SaaS, visit the [registration page](https://dataplatform.cloud.ibm.com/registration/stepone?context=wx). If you do not have an existing IBM Cloud account, you can sign up for a free trial. + +To authenticate to watsonx.ai SaaS with Continue, you will need to create a project and [set up an API key](https://www.ibm.com/docs/en/mas-cd/continuous-delivery?topic=cli-creating-your-cloud-api-key). Then, in continue: + +- Set **apiBase** to your watsonx SaaS endpoint, e.g. `https://us-south.ml.cloud.ibm.com` for US South region. +- Set **projectId** to your watsonx project ID. +- Set **apiKey** to your watsonx API Key. + +### watsonx.ai Software + +To authenticate to your watsonx.ai Software instance with Continue, you can use either `username/password` or `ZenApiKey` method: + +1. _Option 1_ (Recommended): using `ZenApiKey` authentication: + - Set **apiBase** to your watsonx software endpoint, e.g. `https://cpd-watsonx.apps.example.com`. + - Set **projectId** to your watsonx project ID. + - Set **apiKey** to your watsonx Zen API Key. To generate it: + 1. Log in to the CPD web client. + 2. From the toolbar, click your avatar. + 3. Click **Profile and settings**. + 4. Click **API key** > **Generate new key**. + 5. Click **Generate**. + 6. Click **Copy** and save your key somewhere safe. You cannot recover this key if you lose it. + 7. Generate your ZenApiKey by running the following command in your preferred terminal: `echo ":" | base64`, replacing `` with your CPD username and `` with the API Key you just created. +2. _Option 2_: using `username/password` authentication: + - Set **apiBase** to your watsonx software endpoint, e.g. `https://cpd-watsonx.apps.example.com`. + - Set **projectId** to your watsonx project ID. + - Set **API Key** to your watsonx Username and Password using `username:password` as format. + +## Configuration + +Add the following configuration: + + + + ```yaml title="config.yaml" + models: + - name: watsonx - Model Name + provider: watsonx + model: model ID + apiBase: https://us-south.ml.cloud.ibm.com + apiKey: API_KEY/ZENAPI_KEY/USERNAME:PASSWORD + env: + projectId: PROJECT_ID + apiVersion: 2024-03-14 + ``` + + + ```json title="config.json" + { + "models": [ + { + "model": "model ID", + "title": "watsonx - Model Name", + "provider": "watsonx", + "apiBase": "https://us-south.ml.cloud.ibm.com", + "projectId": "PROJECT_ID", + "apiKey": "API_KEY/ZENAPI_KEY/USERNAME:PASSWORD", + "apiVersion": "2024-03-14" + } + ] + } + ``` + + + +`apiVersion` is optional and defaults to the latest version. + +If you are using a custom deployment endpoint, set `deploymentID` to the model's deployment ID. You can find it in the watsonx.ai Prompt Lab UI by selecting the corresponding model and opening the `` tab on the right, which will display the endpoint's URL containing the deployment ID. + + + + ```yaml title="config.yaml" + models: + - name: watsonx - Model Name + provider: watsonx + model: model ID + apiBase: watsonx endpoint e.g. https://us-south.ml.cloud.ibm.com + apiKey: API_KEY/ZENAPI_KEY/USERNAME:PASSWORD + env: + apiVersion: 2024-03-14 + deploymentId: DEPLOYMENT_ID + ``` + + + ```json title="config.json" + { + "models": [ + { + "model": "model ID", + "title": "watsonx - Model Name", + "provider": "watsonx", + "apiBase": "watsonx endpoint e.g. https://us-south.ml.cloud.ibm.com", + "apiKey": "API_KEY/ZENAPI_KEY/USERNAME:PASSWORD", + "apiVersion": "2024-03-14", + "deploymentId": "DEPLOYMENT_ID" + } + ] + } + ``` + + + +### Configuration Options + +Make sure to specify a template name, such as `granite` or `llama3`, and to set the `contextLength` to the model's context window size. +You can also configure generation parameters, such as temperature, topP, topK, frequency penalty, and stop sequences: + + + + ```yaml title="config.yaml" + models: + - name: Granite Code 20b + provider: watsonx + model: ibm/granite-20b-code-instruct + apiBase: watsonx endpoint e.g. https://us-south.ml.cloud.ibm.com + apiKey: API_KEY/ZENAPI_KEY/USERNAME:PASSWORD + template: granite + contextLength: 8000 + defaultCompletionOptions: + temperature: 0.1 + topP: 0.3 + topK: 20 + maxTokens: 2000 + frequencyPenalty: 1.1 + stop: + - Question: + - "\n\n\n" + env: + projectId: PROJECT_ID + apiVersion: 2024-03-14 + + ``` + + + ```json title="config.json" + { + "models": [ + { + "model": "ibm/granite-20b-code-instruct", + "title": "Granite Code 20b", + "provider": "watsonx", + "apiBase": "watsonx endpoint e.g. https://us-south.ml.cloud.ibm.com", + "projectId": "PROJECT_ID", + "apiKey": "API_KEY/ZENAPI_KEY/USERNAME:PASSWORD", + "apiVersion": "2024-03-14", + "template": "granite", + "contextLength": 8000, + "completionOptions": { + "temperature": 0.1, + "topP": 0.3, + "topK": 20, + "maxTokens": 2000, + "frequencyPenalty": 1.1, + "stop": ["Question:", "\n\n\n"] + } + } + ] + } + ``` + + + +## Tab Auto Complete Model + +Granite models are recommended for tab auto complete. The configuration is similar to that of the chat models: + + + + ```yaml title="config.yaml" + models: + - name: Granite Code 8b + provider: watsonx + model: ibm/granite-8b-code-instruct + apiBase: watsonx endpoint e.g. https://us-south.ml.cloud.ibm.com + projectId: PROJECT_ID + apiKey: API_KEY/ZENAPI_KEY/USERNAME:PASSWORD + apiVersion: 2024-03-14 + roles: + - autocomplete + ``` + + + ```json title="config.json" + { + "tabAutocompleteModel": { + "model": "ibm/granite-8b-code-instruct", + "title": "Granite Code 8b", + "provider": "watsonx", + "apiBase": "watsonx endpoint e.g. https://us-south.ml.cloud.ibm.com", + "projectId": "PROJECT_ID", + "apiKey": "API_KEY/ZENAPI_KEY/USERNAME:PASSWORD", + "apiVersion": "2024-03-14", + "contextLength": 4000 + } + } + ``` + + + +## Embeddings Model + +To view the list of available embeddings models, visit [this page](https://dataplatform.cloud.ibm.com/docs/content/wsj/analyze-data/fm-models-embed.html?context=wx&pos=2#ibm-provided). + + + + ```yaml title="config.yaml" + models: + - name: Watsonx Embedder + provider: watsonx + model: ibm/slate-30m-english-rtrvr-v2 + apiBase: https://us-south.ml.cloud.ibm.com + projectId: PROJECT_ID + apiKey: API_KEY/ZENAPI_KEY/USERNAME:PASSWORD + apiVersion: 2024-03-14 + roles: + - embed + ``` + + + ```json title="config.json" + { + "embeddingsProvider": { + "provider": "watsonx", + "model": "ibm/slate-30m-english-rtrvr-v2", + "apiBase": "watsonx endpoint e.g. https://us-south.ml.cloud.ibm.com", + "projectId": "PROJECT_ID", + "apiKey": "API_KEY/ZENAPI_KEY/USERNAME:PASSWORD", + "apiVersion": "2024-03-14" + } + } + ``` + + diff --git a/docs/docs/customize/model-providers/top-level/anthropic.md b/docs/docs/customize/model-providers/top-level/anthropic.md deleted file mode 100644 index 9333a8e84..000000000 --- a/docs/docs/customize/model-providers/top-level/anthropic.md +++ /dev/null @@ -1,69 +0,0 @@ ---- -title: Anthropic -slug: ../anthropic ---- - -:::info - -You can get an API key from the [Anthropic console](https://console.anthropic.com/account/keys). - -::: - -## Chat model - -We recommend configuring **Claude 3.5 Sonnet** as your chat model. - -```json title="config.json" -{ - "models": [ - { - "title": "Claude 3.5 Sonnet", - "provider": "anthropic", - "model": "claude-3-5-sonnet-latest", - "apiKey": "[API_KEY]" - } - ] -} -``` - -## Autocomplete model - -Anthropic currently does not offer any autocomplete models. - -[Click here](../../model-types/autocomplete.md) to see a list of autocomplete model providers. - -## Embeddings model - -Anthropic currently does not offer any embeddings models. - -[Click here](../../model-types/embeddings.md) to see a list of embeddings model providers. - -## Reranking model - -Anthropic currently does not offer any reranking models. - -[Click here](../../model-types/reranking.md) to see a list of reranking model providers. - -## Prompt caching - -Anthropic supports [prompt caching with Claude](https://docs.anthropic.com/en/docs/build-with-claude/prompt-caching). - -To enable caching of the system message and the turn-by-turn conversation, update your your model configuration as following: - -```json -{ - "models": [ - { - // Enable prompt caching - "cacheBehavior": { - "cacheSystemMessage": true, - "cacheConversation": true - }, - "title": "Anthropic", - "provider": "anthropic", - "model": "claude-3-5-sonnet-latest", - "apiKey": "[API_KEY]" - } - ] -} -``` diff --git a/docs/docs/customize/model-providers/top-level/anthropic.mdx b/docs/docs/customize/model-providers/top-level/anthropic.mdx new file mode 100644 index 000000000..d7d1e325c --- /dev/null +++ b/docs/docs/customize/model-providers/top-level/anthropic.mdx @@ -0,0 +1,100 @@ +--- +title: Anthropic +slug: ../anthropic +--- + +import TabItem from "@theme/TabItem"; +import Tabs from "@theme/Tabs"; + +:::info +You can get an API key from the [Anthropic console](https://console.anthropic.com/account/keys). +::: + +## Chat model + +We recommend configuring **Claude 3.5 Sonnet** as your chat model. + + + + ```yaml title="config.yaml" + models: + - name: Claude 3.5 Sonnet + provider: anthropic + model: claude-3-5-sonnet-latest + apiKey: + ``` + + + ```json title="config.json" + { + "models": [ + { + "title": "Claude 3.5 Sonnet", + "provider": "anthropic", + "model": "claude-3-5-sonnet-latest", + "apiKey": "" + } + ] + } + ``` + + + +## Autocomplete model + +Anthropic currently does not offer any autocomplete models. + +[Click here](../../model-roles/autocomplete.md) to see a list of autocomplete model providers. + +## Embeddings model + +Anthropic currently does not offer any embeddings models. + +[Click here](../../model-roles/embeddings.mdx) to see a list of embeddings model providers. + +## Reranking model + +Anthropic currently does not offer any reranking models. + +[Click here](../../model-roles/reranking.mdx) to see a list of reranking model providers. + +## Prompt caching + +Anthropic supports [prompt caching with Claude](https://docs.anthropic.com/en/docs/build-with-claude/prompt-caching). + +To enable caching of the system message and the turn-by-turn conversation, update your your model configuration as following: + + + + ```yaml title="config.yaml" + models: + - name: Anthropic + provider: anthropic + model: claude-3-5-sonnet-latest + apiKey: + roles: + - chat + cacheBehavior: + cacheSystemMessage: true + cacheConversation: true + ``` + + + ```json title="config.json" + { + "models": [ + { + "cacheBehavior": { + "cacheSystemMessage": true, + "cacheConversation": true + }, + "title": "Anthropic", + "provider": "anthropic", + "model": "claude-3-5-sonnet-latest", + "apiKey": "" + } + ] + } + ``` + + diff --git a/docs/docs/customize/model-providers/top-level/azure.md b/docs/docs/customize/model-providers/top-level/azure.md deleted file mode 100644 index 45b49f734..000000000 --- a/docs/docs/customize/model-providers/top-level/azure.md +++ /dev/null @@ -1,92 +0,0 @@ ---- -title: Azure AI Foundry -slug: ../azure ---- - -Azure AI Foundry is a cloud-based service that provides access to models from OpenAI, Mistral AI, and others, integrated with the security and enterprise features of the Microsoft Azure platform. To get started, create an Azure AI Foundry resource in the [Azure portal](https://portal.azure.com). - -:::info - -For details on OpenAI model setup, see [Azure OpenAI Service configuration](#general-model-configuration). - -::: - -## Chat model - -We recommend configuring **GPT-4o** as your chat model. - -```json title="config.json" -"models": [{ - "title": "GPT-4o", - "provider": "azure", - "model": "gpt-4o", - "apiBase": "", - "deployment": "", - "apiKey": "" // If you use subscription key, try using Azure gateway to rename it apiKey -}] -``` - -## Autocomplete model - -We recommend configuring **Codestral** as your autocomplete model. - -```json title="config.json" -{ - "tabAutocompleteModel": { - "title": "Codestral", - "provider": "mistral", - "model": "codestral-latest" - } -} -``` - -## Embeddings model - -We recommend configuring **text-embedding-3-large** as your embeddings model. - -```json title="config.json" -"embeddingsProvider": { - "provider": "openai", - "model": "text-embedding-3-large", - "apiBase": "", - "deployment": "", - "apiType": "azure", - "apiKey": "" -} -``` - -## Reranking model - -Azure OpenAI currently does not offer any reranking models. - -[Click here](../../model-types/reranking.md) to see a list of reranking models. - -## Privacy - -If you'd like to use OpenAI models but are concerned about privacy, you can use the Azure OpenAI service, which is GDPR and HIPAA compliant. - -:::info[Getting access] -You need to apply for access to the Azure OpenAI service. Response times are typically within a few days. - -**[Click here to apply for access to the Azure OpenAI service](https://azure.microsoft.com/en-us/products/ai-services/openai-service)** -::: - -## Azure OpenAI Service configuration - -Azure OpenAI Service requires a handful of additional parameters to be configured, such as a deployment name and API base URL. - -To find this information in _Azure AI Foundry_, first select the model that you would like to connect. Then visit _Endpoint_ > _Target URI_. - -For example, a Target URI of `https://just-an-example.openai.azure.com/openai/deployments/gpt-4o-july/chat/completions?api-version=2023-03-15-preview` would map to the following: - -```json -{ - "title": "GPT-4o Azure", - "model": "gpt-4o", - "provider": "openai", - "apiBase": "https://just-an-example.openai.azure.com", - "deployment": "gpt-4o-july", - "apiVersion": "2023-03-15-preview", - "apiKey": "" -} -``` diff --git a/docs/docs/customize/model-providers/top-level/azure.mdx b/docs/docs/customize/model-providers/top-level/azure.mdx new file mode 100644 index 000000000..cbb955bca --- /dev/null +++ b/docs/docs/customize/model-providers/top-level/azure.mdx @@ -0,0 +1,165 @@ +--- +title: Azure AI Foundry +slug: ../azure +--- + +import TabItem from "@theme/TabItem"; +import Tabs from "@theme/Tabs"; + +Azure AI Foundry is a cloud-based service that provides access to models from OpenAI, Mistral AI, and others, integrated with the security and enterprise features of the Microsoft Azure platform. To get started, create an Azure AI Foundry resource in the [Azure portal](https://portal.azure.com). + +:::info + +For details on OpenAI model setup, see [Azure OpenAI Service configuration](#azure-openai-service-configuration). + +::: + +## Chat model + +We recommend configuring **GPT-4o** as your chat model. + + + + ```yaml title="config.yaml" + models: + - name: GPT-4o + provider: azure + model: gpt-4o + apiBase: + apiKey: # If you use subscription key, try using Azure gateway to rename it apiKey + env: + deployment: + apiType: azure-foundry # Or "azure-openai" if using OpenAI models + ``` + + + ```json title="config.json" + { + "models": [{ + "title": "GPT-4o", + "provider": "azure", + "model": "gpt-4o", + "apiBase": "", + "deployment": "", + "apiKey": "", // If you use subscription key, try using Azure gateway to rename it apiKey + "apiType": "azure-foundry" // Or "azure-openai" if using OpenAI models + }] + } + ``` + + + +## Autocomplete model + +We recommend configuring **Codestral** as your autocomplete model. + + + + ```yaml title="config.yaml" + models: + - name: Codestral + provider: mistral + model: codestral-latest + roles: + - autocomplete + ``` + + + ```json title="config.json" + { + "tabAutocompleteModel": { + "title": "Codestral", + "provider": "mistral", + "model": "codestral-latest" + } + } + ``` + + + +## Embeddings model + +We recommend configuring **text-embedding-3-large** as your embeddings model. + + + + ```yaml title="config.yaml" + models: + - name: Text Embedding-3 Large + provider: azure + model: text-embedding-3-large + apiBase: + apiKey: + env: + deployment: + apiType: azure + ``` + + + ```json title="config.json" + { + "embeddingsProvider": { + "provider": "azure", + "model": "text-embedding-3-large", + "apiBase": "", + "deployment": "", + "apiKey": "", + "apiType": "azure-foundry" // Or "azure-openai" if using OpenAI models + } + } + ``` + + + +## Reranking model + +Azure OpenAI currently does not offer any reranking models. + +[Click here](../../model-roles/reranking.mdx) to see a list of reranking models. + +## Privacy + +If you'd like to use OpenAI models but are concerned about privacy, you can use the Azure OpenAI service, which is GDPR and HIPAA compliant. + +:::info[Getting access] +[Click here](https://azure.microsoft.com/en-us/products/ai-services/openai-service) to apply for access to the Azure OpenAI service. Response times are typically within a few days. +::: + +## Azure OpenAI Service configuration + +Azure OpenAI Service requires a handful of additional parameters to be configured, such as a deployment name and API base URL. + +To find this information in _Azure AI Foundry_, first select the model that you would like to connect. Then visit _Endpoint_ > _Target URI_. + +For example, a Target URI of `https://just-an-example.openai.azure.com/openai/deployments/gpt-4o-july/chat/completions?api-version=2023-03-15-preview` would map to the following: + + + + ```yaml title="config.yaml" + models: + - name: GPT-4o Azure + model: gpt-4o + provider: openai + apiBase: https://just-an-example.openai.azure.com + apiKey: + env: + apiVersion: 2023-03-15-preview + deployment: gpt-4o-july + apiType: azure-openai + ``` + + + ```json title="config.json" + { + "title": "GPT-4o Azure", + "model": "gpt-4o", + "provider": "openai", + "apiBase": "https://just-an-example.openai.azure.com", + "deployment": "gpt-4o-july", + "apiVersion": "2023-03-15-preview", + "apiKey": "", + "apiType": "azure-openai" + } + ``` + + diff --git a/docs/docs/customize/model-providers/top-level/bedrock.md b/docs/docs/customize/model-providers/top-level/bedrock.md deleted file mode 100644 index c2fab040a..000000000 --- a/docs/docs/customize/model-providers/top-level/bedrock.md +++ /dev/null @@ -1,118 +0,0 @@ ---- -title: Amazon Bedrock -slug: ../bedrock ---- - -Amazon Bedrock is a fully managed service on AWS that provides access to foundation models from various AI companies through a single API. - -## Chat model - -We recommend configuring **Claude 3.5 Sonnet** as your chat model. - -```json title="config.json" -{ - "models": [ - { - "title": "Claude 3.5 Sonnet", - "provider": "bedrock", - "model": "anthropic.claude-3-5-sonnet-20240620-v1:0", - "region": "us-east-1", - "profile": "bedrock" - } - ] -} -``` -> If you run into the following error when connecting to the new Claude 3.5 Sonnet 2 models from AWS - `400 Invocation of model ID anthropic.claude-3-5-sonnet-20241022-v2:0 with on-demand throughput isn’t supported. Retry your request with the ID or ARN of an inference profile that contains this model.` - -> You can fix this using the following config.json -```json title="config.json" -{ - "models": [ - { - "title": "Claude 3.5 Sonnet", - "provider": "bedrock", - "model": "us.anthropic.claude-3-5-sonnet-20241022-v2:0", - "region": "us-east-1", - "profile": "bedrock" - } - ] -} -``` - -## Autocomplete model - -Bedrock currently does not offer any autocomplete models. However, [Codestral from Mistral](https://mistral.ai/news/codestral-2501/) and [Point from Poolisde](https://aws.amazon.com/bedrock/poolside/) will be supported in the near future. - -In the meantime, you can view a list of autocomplete model providers [here](../../model-types/autocomplete.md). - -## Embeddings model - -We recommend configuring [`amazon.titan-embed-text-v2:0`](https://docs.aws.amazon.com/bedrock/latest/devguide/models.html#amazon.titan-embed-text-v2-0) as your embeddings model. - -```json title="~/.continue/config.json" -{ - "embeddingsProvider": { - "title": "Embeddings Model", - "provider": "bedrock", - "model": "amazon.titan-embed-text-v2:0", - "region": "us-west-2" - } -} -``` - -## Reranking model - -We recommend configuring `cohere.rerank-v3-5:0` as your reranking model, you may also use `amazon.rerank-v1:0`. - -```json title="~/.continue/config.json" -{ - "reranker": { - "name": "bedrock", - "params": { - "model": "cohere.rerank-v3-5:0", - "region": "us-west-2" - } - } -} -``` - -## Authentication - -Authentication will be through temporary or long-term credentials in -`~/.aws/credentials` under a configured profile (e.g. "bedrock"). - -```title="~/.aws/credentials -[bedrock] -aws_access_key_id = abcdefg -aws_secret_access_key = hijklmno -aws_session_token = pqrstuvwxyz # Optional: means short term creds. -``` - -## Custom Imported Models - -To setup Bedrock using custom imported models, add the following to your `config.json` file: - -```json title="config.json" -{ - "models": [ - { - "title": "AWS Bedrock deepseek-coder-6.7b-instruct", - "provider": "bedrockimport", - "model": "deepseek-coder-6.7b-instruct", - "modelArn": "arn:aws:bedrock:us-west-2:XXXXX:imported-model/XXXXXX", - "region": "us-west-2", - "profile": "bedrock" - } - ] -} -``` - -Authentication will be through temporary or long-term credentials in -~/.aws/credentials under a configured profile (e.g. "bedrock"). - -```title="~/.aws/credentials -[bedrock] -aws_access_key_id = abcdefg -aws_secret_access_key = hijklmno -aws_session_token = pqrstuvwxyz # Optional: means short term creds. -``` diff --git a/docs/docs/customize/model-providers/top-level/bedrock.mdx b/docs/docs/customize/model-providers/top-level/bedrock.mdx new file mode 100644 index 000000000..9582428a4 --- /dev/null +++ b/docs/docs/customize/model-providers/top-level/bedrock.mdx @@ -0,0 +1,204 @@ +--- +title: Amazon Bedrock +slug: ../bedrock +--- + +import TabItem from "@theme/TabItem"; +import Tabs from "@theme/Tabs"; + +Amazon Bedrock is a fully managed service on AWS that provides access to foundation models from various AI companies through a single API. + +## Chat model + +We recommend configuring **Claude 3.5 Sonnet** as your chat model. + + + + ```yaml title="config.yaml" + models: + - name: Claude 3.5 Sonnet + provider: bedrock + model: anthropic.claude-3-5-sonnet-20240620-v1:0 + env: + region: us-east-1 + profile: bedrock + roles: + - chat + ``` + + + ```json title="config.json" + { + "models": [ + { + "title": "Claude 3.5 Sonnet", + "provider": "bedrock", + "model": "anthropic.claude-3-5-sonnet-20240620-v1:0", + "region": "us-east-1", + "profile": "bedrock" + } + ] + } + ``` + + + +> If you run into the following error when connecting to the new Claude 3.5 Sonnet 2 models from AWS - `400 Invocation of model ID anthropic.claude-3-5-sonnet-20241022-v2:0 with on-demand throughput isn't supported. Retry your request with the ID or ARN of an inference profile that contains this model.` + +> You can fix this using the following config: + + + + ```yaml title="config.yaml" + models: + - name: Claude 3.5 Sonnet + provider: bedrock + model: us.anthropic.claude-3-5-sonnet-20241022-v2:0 + env: + region: us-east-1 + profile: bedrock + roles: + - chat + ``` + + + ```json title="config.json" + { + "models": [ + { + "title": "Claude 3.5 Sonnet", + "provider": "bedrock", + "model": "us.anthropic.claude-3-5-sonnet-20241022-v2:0", + "region": "us-east-1", + "profile": "bedrock" + } + ] + } + ``` + + + +## Autocomplete model + +Bedrock currently does not offer any autocomplete models. However, [Codestral from Mistral](https://mistral.ai/news/codestral-2501/) and [Point from Poolisde](https://aws.amazon.com/bedrock/poolside/) will be supported in the near future. + +In the meantime, you can view a list of autocomplete model providers [here](../../model-roles/autocomplete.md). + +## Embeddings model + +We recommend configuring [`amazon.titan-embed-text-v2:0`](https://docs.aws.amazon.com/bedrock/latest/devguide/models.html#amazon.titan-embed-text-v2-0) as your embeddings model. + + + + ```yaml title="config.yaml" + models: + - name: Embeddings Model + provider: bedrock + model: amazon.titan-embed-text-v2:0 + env: + region: us-west-2 + roles: + - embed + ``` + + + ```json title="config.json" + { + "embeddingsProvider": { + "title": "Embeddings Model", + "provider": "bedrock", + "model": "amazon.titan-embed-text-v2:0", + "region": "us-west-2" + } + } + ``` + + + +## Reranking model + +We recommend configuring `cohere.rerank-v3-5:0` as your reranking model, you may also use `amazon.rerank-v1:0`. + + + + ```yaml title="config.yaml" + models: + - name: Bedrock Reranker + provider: bedrock + model: cohere.rerank-v3-5:0 + env: + region: us-west-2 + roles: + - rerank + ``` + + + ```json title="config.json" + { + "reranker": { + "name": "bedrock", + "params": { + "model": "cohere.rerank-v3-5:0", + "region": "us-west-2" + } + } + } + ``` + + + +## Authentication + +Authentication will be through temporary or long-term credentials in +`~/.aws/credentials` under a configured profile (e.g. "bedrock"). + +```title="~/.aws/credentials +[bedrock] +aws_access_key_id = abcdefg +aws_secret_access_key = hijklmno +aws_session_token = pqrstuvwxyz # Optional: means short term creds. +``` + +## Custom Imported Models + +To setup Bedrock using custom imported models, add the following to your config file: + + + + ```yaml title="config.yaml" + models: + - name: AWS Bedrock deepseek-coder-6.7b-instruct + provider: bedrockimport + model: deepseek-coder-6.7b-instruct + modelArn: arn:aws:bedrock:us-west-2:XXXXX:imported-model/XXXXXX + region: us-west-2 + profile: bedrock + ``` + + + ```json title="config.json" + { + "models": [ + { + "title": "AWS Bedrock deepseek-coder-6.7b-instruct", + "provider": "bedrockimport", + "model": "deepseek-coder-6.7b-instruct", + "modelArn": "arn:aws:bedrock:us-west-2:XXXXX:imported-model/XXXXXX", + "region": "us-west-2", + "profile": "bedrock" + } + ] + } + ``` + + + +Authentication will be through temporary or long-term credentials in +~/.aws/credentials under a configured profile (e.g. "bedrock"). + +```title="~/.aws/credentials +[bedrock] +aws_access_key_id = abcdefg +aws_secret_access_key = hijklmno +aws_session_token = pqrstuvwxyz # Optional: means short term creds. +``` diff --git a/docs/docs/customize/model-providers/top-level/deepseek.md b/docs/docs/customize/model-providers/top-level/deepseek.md deleted file mode 100644 index 1ea875785..000000000 --- a/docs/docs/customize/model-providers/top-level/deepseek.md +++ /dev/null @@ -1,53 +0,0 @@ ---- -title: DeepSeek -slug: ../deepseek ---- - -:::info - -You can get an API key from the [DeepSeek console](https://www.deepseek.com/). - -::: - -## Chat model - -We recommend configuring **DeepSeek Chat** as your chat model. - -```json title="config.json" -{ - "models": [ - { - "title": "DeepSeek Chat", - "provider": "deepseek", - "model": "deepseek-chat", - "apiKey": "[API_KEY]" - } - ] -} -``` - -## Autocomplete model - -We recommend configuring **DeepSeek Coder** as your autocomplete model. - -```json title="config.json" -{ - "tabAutocompleteModel": { - "title": "DeepSeek Coder", - "provider": "deepseek", - "model": "deepseek-coder" - } -} -``` - -## Embeddings model - -DeepSeek currently does not offer any embeddings models. - -[Click here](../../model-types/embeddings.md) to see a list of embeddings model providers. - -## Reranking model - -DeepSeek currently does not offer any reranking models. - -[Click here](../../model-types/reranking.md) to see a list of reranking model providers. diff --git a/docs/docs/customize/model-providers/top-level/deepseek.mdx b/docs/docs/customize/model-providers/top-level/deepseek.mdx new file mode 100644 index 000000000..28f885192 --- /dev/null +++ b/docs/docs/customize/model-providers/top-level/deepseek.mdx @@ -0,0 +1,83 @@ +--- +title: DeepSeek +slug: ../deepseek +--- + +import TabItem from "@theme/TabItem"; +import Tabs from "@theme/Tabs"; + +:::info +You can get an API key from the [DeepSeek console](https://www.deepseek.com/). +::: + +## Chat model + +We recommend configuring **DeepSeek Chat** as your chat model. + + + + ```yaml title="config.yaml" + models: + - name: DeepSeek Chat + provider: deepseek + model: deepseek-chat + apiKey: + ``` + + + ```json title="config.json" + { + "models": [ + { + "title": "DeepSeek Chat", + "provider": "deepseek", + "model": "deepseek-chat", + "apiKey": "" + } + ] + } + ``` + + + +## Autocomplete model + +We recommend configuring **DeepSeek Coder** as your autocomplete model. + + + + ```yaml title="config.yaml" + models: + - name: DeepSeek Coder + provider: deepseek + model: deepseek-coder + apiKey: + roles: + - autocomplete + ``` + + + ```json title="config.json" + { + "tabAutocompleteModel": { + "title": "DeepSeek Coder", + "provider": "deepseek", + "model": "deepseek-coder", + "apiKey": "" + } + } + ``` + + + +## Embeddings model + +DeepSeek currently does not offer any embeddings models. + +[Click here](../../model-roles/embeddings.mdx) to see a list of embeddings model providers. + +## Reranking model + +DeepSeek currently does not offer any reranking models. + +[Click here](../../model-roles/reranking.mdx) to see a list of reranking model providers. diff --git a/docs/docs/customize/model-providers/top-level/gemini.md b/docs/docs/customize/model-providers/top-level/gemini.md deleted file mode 100644 index eff3e91ac..000000000 --- a/docs/docs/customize/model-providers/top-level/gemini.md +++ /dev/null @@ -1,53 +0,0 @@ ---- -title: Gemini -slug: ../gemini ---- - -:::info - -You can get an API key from the [Google AI Studio](https://aistudio.google.com/). - -::: - -## Chat model - -We recommend configuring **Gemini 1.5 Pro** as your chat model. - -```json title="config.json" -{ - "models": [ - { - "title": "Gemini 1.5 Pro", - "provider": "gemini", - "model": "gemini-1.5-pro-latest", - "apiKey": "[API_KEY]" - } - ] -} -``` - -## Autocomplete model - -Gemini 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 **text-embedding-004** as your embeddings model. - -```json title="config.json" -{ - "embeddingsProvider": { - "provider": "gemini", - "model": "models/text-embedding-004", - "apiKey": "[API_KEY]" - } -} -``` - -## Reranking model - -Gemini currently does not offer any reranking models. - -[Click here](../../model-types/reranking.md) to see a list of reranking model providers. diff --git a/docs/docs/customize/model-providers/top-level/gemini.mdx b/docs/docs/customize/model-providers/top-level/gemini.mdx new file mode 100644 index 000000000..5bde15a79 --- /dev/null +++ b/docs/docs/customize/model-providers/top-level/gemini.mdx @@ -0,0 +1,82 @@ +--- +title: Gemini +slug: ../gemini +--- + +import TabItem from "@theme/TabItem"; +import Tabs from "@theme/Tabs"; + +:::info +You can get an API key from the [Google AI Studio](https://aistudio.google.com/). +::: + +## Chat model + +We recommend configuring **Gemini 2.0 Flash** as your chat model. + + + + ```yaml title="config.yaml" + models: + - name: Gemini 2.0 Flash + provider: gemini + model: gemini-2.0-flash + apiKey: + ``` + + + ```json title="config.json" + { + "models": [ + { + "title": "Gemini 2.0 Flash", + "provider": "gemini", + "model": "gemini-2.0-flash", + "apiKey": "" + } + ] + } + ``` + + + +## Autocomplete model + +Gemini currently does not offer any autocomplete models. + +[Click here](../../model-roles/autocomplete.md) to see a list of autocomplete model providers. + +## Embeddings model + +We recommend configuring **text-embedding-004** as your embeddings model. + + + + ```yaml title="config.yaml" + models: + - name: Gemini Embeddings + provider: gemini + model: models/text-embedding-004 + apiKey: + roles: + - embed + ``` + + + ```json title="config.json" + { + "embeddingsProvider": { + "provider": "gemini", + "model": "models/text-embedding-004", + "apiKey": "" + } + } + ``` + + + +## Reranking model + +Gemini currently does not offer any reranking models. + +[Click here](../../model-roles/reranking.mdx) to see a list of reranking model providers. diff --git a/docs/docs/customize/model-providers/top-level/mistral.md b/docs/docs/customize/model-providers/top-level/mistral.md deleted file mode 100644 index 2c1eb81e1..000000000 --- a/docs/docs/customize/model-providers/top-level/mistral.md +++ /dev/null @@ -1,63 +0,0 @@ ---- -title: Mistral -slug: ../mistral ---- - -:::info - -You can get an API key from the [Mistral Dashboard](https://console.mistral.ai). Note that the API key for Codestral (codestral.mistral.ai) is different from for all other models (api.mistral.ai). If you are using a Codestral API key, you should set the `apiBase` to `https://codestral.mistral.ai/v1`. Otherwise, we will default to using `https://api.mistral.ai/v1`. - -::: - -## Chat model - -We recommend configuring **Mistral Large** as your chat model. - -```json title="config.json" -{ - "models": [ - { - "title": "Mistral Large", - "provider": "mistral", - "model": "mistral-large-latest", - "apiKey": "[API_KEY]" - } - ] -} -``` - -## Autocomplete model - -We recommend configuring **Codestral** as your autocomplete model. - -```json title="config.json" -{ - "tabAutocompleteModel": { - "title": "Codestral", - "provider": "mistral", - "model": "codestral-latest" - // "apiBase": "https://codestral.mistral.ai/v1" // Do this if you are using a Codestral API key - } -} -``` - -## Embeddings model - -We recommend configuring **Mistral Embed** as your embeddings model. - -```json title="config.json" -{ - "embeddingsProvider": { - "provider": "mistral", - "model": "mistral-embed", - "apiKey": "[API_KEY]", - "apiBase": "https://api.mistral.ai/v1" - } -} -``` - -## Reranking model - -Mistral currently does not offer any reranking models. - -[Click here](../../model-types/reranking.md) to see a list of reranking model providers. diff --git a/docs/docs/customize/model-providers/top-level/mistral.mdx b/docs/docs/customize/model-providers/top-level/mistral.mdx new file mode 100644 index 000000000..df936fe54 --- /dev/null +++ b/docs/docs/customize/model-providers/top-level/mistral.mdx @@ -0,0 +1,110 @@ +--- +title: Mistral +slug: ../mistral +--- + +import TabItem from "@theme/TabItem"; +import Tabs from "@theme/Tabs"; + +:::info +You can get an API key from the [Mistral Dashboard](https://console.mistral.ai). Note that the API key for Codestral (codestral.mistral.ai) is different from for all other models (api.mistral.ai). If you are using a Codestral API key, you should set the `apiBase` to `https://codestral.mistral.ai/v1`. Otherwise, we will default to using `https://api.mistral.ai/v1`. +::: + +## Chat model + +We recommend configuring **Mistral Large** as your chat model. + + + + ```yaml title="config.yaml" + models: + - name: Mistral Large + provider: mistral + model: mistral-large-latest + apiKey: + roles: + - chat + ``` + + + ```json title="config.json" + { + "models": [ + { + "title": "Mistral Large", + "provider": "mistral", + "model": "mistral-large-latest", + "apiKey": "" + } + ] + } + ``` + + + +## Autocomplete model + +We recommend configuring **Codestral** as your autocomplete model. + + + + ```yaml title="config.yaml" + models: + - name: Codestral + provider: mistral + model: codestral-latest + # apiBase: https://codestral.mistral.ai/v1 # Do this if you are using a Codestral API key + roles: + - autocomplete + ``` + + + ```json title="config.json" + { + "tabAutocompleteModel": { + "title": "Codestral", + "provider": "mistral", + "model": "codestral-latest" + // "apiBase": "https://codestral.mistral.ai/v1" // Do this if you are using a Codestral API key + } + } + ``` + + + +## Embeddings model + +We recommend configuring **Mistral Embed** as your embeddings model. + + + + ```yaml title="config.yaml" + models: + - name: Mistral Embed + provider: mistral + model: mistral-embed + apiKey: + apiBase: https://api.mistral.ai/v1 + roles: + - embed + ``` + + + ```json title="config.json" + { + "embeddingsProvider": { + "provider": "mistral", + "model": "mistral-embed", + "apiKey": "", + "apiBase": "https://api.mistral.ai/v1" + } + } + ``` + + + +## Reranking model + +Mistral currently does not offer any reranking models. + +[Click here](../../model-roles/reranking.mdx) to see a list of reranking model providers. diff --git a/docs/docs/customize/model-providers/top-level/ollama.md b/docs/docs/customize/model-providers/top-level/ollama.md deleted file mode 100644 index 611c3dad8..000000000 --- a/docs/docs/customize/model-providers/top-level/ollama.md +++ /dev/null @@ -1,72 +0,0 @@ ---- -title: Ollama -slug: ../ollama ---- - -Ollama is an open-source tool that allows to run large language models (LLMs) locally on their own computers. To use Ollama, you can install it [here](https://ollama.ai/download) and download the model you want to run with the `ollama run` command. - -## Chat model - -We recommend configuring **Llama3.1 8B** as your chat model. - -```json title="config.json" -{ - "models": [ - { - "title": "Llama3.1 8B", - "provider": "ollama", - "model": "llama3.1:8b" - } - ] -} -``` - -## Autocomplete model - -We recommend configuring **Qwen2.5-Coder 1.5B** as your autocomplete model. - -```json title="config.json" -{ - "tabAutocompleteModel": { - "title": "Qwen2.5-Coder 1.5B", - "provider": "ollama", - "model": "qwen2.5-coder:1.5b-base" - } -} -``` - -## Embeddings model - -We recommend configuring **Nomic Embed Text** as your embeddings model. - -```json title="config.json" -{ - "embeddingsProvider": { - "provider": "ollama", - "model": "nomic-embed-text" - } -} -``` - -## Reranking model - -Ollama currently does not offer any reranking models. - -[Click here](../../model-types/reranking.md) to see a list of reranking model providers. - -## Using a remote instance - -To configure a remote instance of Ollama, add the `"apiBase"` property to your model in config.json: - -```json title="config.json" -{ - "models": [ - { - "title": "Llama3.1 8B", - "provider": "ollama", - "model": "llama3.1:8b", - "apiBase": "http://:11434" - } - ] -} -``` diff --git a/docs/docs/customize/model-providers/top-level/ollama.mdx b/docs/docs/customize/model-providers/top-level/ollama.mdx new file mode 100644 index 000000000..92759e2cb --- /dev/null +++ b/docs/docs/customize/model-providers/top-level/ollama.mdx @@ -0,0 +1,128 @@ +--- +title: Ollama +slug: ../ollama +--- + +import TabItem from "@theme/TabItem"; +import Tabs from "@theme/Tabs"; + +Ollama is an open-source tool that allows to run large language models (LLMs) locally on their own computers. To use Ollama, you can install it [here](https://ollama.ai/download) and download the model you want to run with the `ollama run` command. + +## Chat model + +We recommend configuring **Llama3.1 8B** as your chat model. + + + + ```yaml title="config.yaml" + models: + - name: Llama3.1 8B + provider: ollama + model: llama3.1:8b + ``` + + + ```json title="config.json" + { + "models": [ + { + "title": "Llama3.1 8B", + "provider": "ollama", + "model": "llama3.1:8b" + } + ] + } + ``` + + + +## Autocomplete model + +We recommend configuring **Qwen2.5-Coder 1.5B** as your autocomplete model. + + + + ```yaml title="config.yaml" + models: + - name: Qwen2.5-Coder 1.5B + provider: ollama + model: qwen2.5-coder:1.5b-base + roles: + - autocomplete + ``` + + + ```json title="config.json" + { + "tabAutocompleteModel": { + "title": "Qwen2.5-Coder 1.5B", + "provider": "ollama", + "model": "qwen2.5-coder:1.5b-base" + } + } + ``` + + + +## Embeddings model + +We recommend configuring **Nomic Embed Text** as your embeddings model. + + + + ```yaml title="config.yaml" + models: + - name: Nomic Embed Text + provider: ollama + model: nomic-embed-text + roles: + - embed + ``` + + + ```json title="config.json" + { + "embeddingsProvider": { + "provider": "ollama", + "model": "nomic-embed-text" + } + } + ``` + + + +## Reranking model + +Ollama currently does not offer any reranking models. + +[Click here](../../model-roles/reranking.mdx) to see a list of reranking model providers. + +## Using a remote instance + +To configure a remote instance of Ollama, add the `"apiBase"` property to your model in config.json: + + + + ```yaml title="config.yaml" + models: + - name: Llama3.1 8B + provider: ollama + model: llama3.1:8b + apiBase: http://:11434 + ``` + + + ```json title="config.json" + { + "models": [ + { + "title": "Llama3.1 8B", + "provider": "ollama", + "model": "llama3.1:8b", + "apiBase": "http://:11434" + } + ] + } + ``` + + diff --git a/docs/docs/customize/model-providers/top-level/openai.md b/docs/docs/customize/model-providers/top-level/openai.md deleted file mode 100644 index 6b31b0b22..000000000 --- a/docs/docs/customize/model-providers/top-level/openai.md +++ /dev/null @@ -1,93 +0,0 @@ ---- -title: OpenAI -slug: ../openai ---- - -:::info - -You can get an API key from the [OpenAI console](https://platform.openai.com/account/api-keys) - -::: - -## Chat model - -We recommend configuring **GPT-4o** as your chat model. - -```json title="config.json" -{ - "models": [ - { - "title": "GPT-4o", - "provider": "openai", - "model": "gpt-4o", - "apiKey": "[API_KEY]" - } - ] -} -``` - -## Autocomplete model - -OpenAI 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 **text-embedding-3-large** as your embeddings model. - -```json title="config.json" -{ - "embeddingsProvider": { - "provider": "openai", - "model": "text-embedding-3-large", - "apiKey": "[API_KEY]" - } -} -``` - -## Reranking model - -OpenAI currently does not offer any reranking models. - -[Click here](../../model-types/reranking.md) to see a list of reranking model providers. - -## OpenAI compatible servers / APIs - -OpenAI compatible servers - -- [KoboldCpp](https://github.com/lostruins/koboldcpp) -- [text-gen-webui](https://github.com/oobabooga/text-generation-webui/tree/main/extensions/openai#setup--installation) -- [FastChat](https://github.com/lm-sys/FastChat/blob/main/docs/openai_api.md) -- [LocalAI](https://localai.io/basics/getting_started/) -- [llama-cpp-python](https://github.com/abetlen/llama-cpp-python#web-server) -- [TensorRT-LLM](https://github.com/NVIDIA/trt-llm-as-openai-windows?tab=readme-ov-file#examples) -- [vLLM](https://docs.vllm.ai/en/latest/serving/openai_compatible_server.html) -- [BerriAI/litellm](https://github.com/BerriAI/litellm) - -OpenAI compatible APIs - -- [Anyscale Endpoints](https://github.com/continuedev/deploy-os-code-llm#others) -- [Anyscale Private Endpoints](https://github.com/continuedev/deploy-os-code-llm#anyscale-private-endpoints) - -If you are using an OpenAI compatible server / API, you can change the `apiBase` like this: - -```json title="config.json" -{ - "models": [ - { - "title": "OpenAI-compatible server / API", - "provider": "openai", - "model": "MODEL_NAME", - "apiKey": "EMPTY", - "apiBase": "http://localhost:8000/v1" - } - ] -} -``` - -To force usage of `chat/completions` instead of `completions` endpoint you can set - -```json -"useLegacyCompletionsEndpoint": false -``` diff --git a/docs/docs/customize/model-providers/top-level/openai.mdx b/docs/docs/customize/model-providers/top-level/openai.mdx new file mode 100644 index 000000000..8ed706213 --- /dev/null +++ b/docs/docs/customize/model-providers/top-level/openai.mdx @@ -0,0 +1,160 @@ +--- +title: OpenAI +slug: ../openai +--- + +import TabItem from "@theme/TabItem"; +import Tabs from "@theme/Tabs"; + +:::info +You can get an API key from the [OpenAI console](https://platform.openai.com/account/api-keys) +::: + +## Chat model + +We recommend configuring **GPT-4o** as your chat model. + + + + ```yaml title="config.yaml" + models: + - name: GPT-4o + provider: openai + model: gpt-4o + apiKey: + ``` + + + ```json title="config.json" + { + "models": [ + { + "title": "GPT-4o", + "provider": "openai", + "model": "gpt-4o", + "apiKey": "" + } + ] + } + ``` + + + +## Autocomplete model + +OpenAI currently does not offer any autocomplete models. + +[Click here](../../model-roles/autocomplete.md) to see a list of autocomplete model providers. + +## Embeddings model + +We recommend configuring **text-embedding-3-large** as your embeddings model. + + + + ```yaml title="config.yaml" + models: + - name: OpenAI Embeddings + provider: openai + model: text-embedding-3-large + apiKey: + roles: + - embed + ``` + + + ```json title="config.json" + { + "embeddingsProvider": { + "provider": "openai", + "model": "text-embedding-3-large", + "apiKey": "" + } + } + ``` + + + +## Reranking model + +OpenAI currently does not offer any reranking models. + +[Click here](../../model-roles/reranking.mdx) to see a list of reranking model providers. + +## OpenAI compatible servers / APIs + +OpenAI compatible servers + +- [KoboldCpp](https://github.com/lostruins/koboldcpp) +- [text-gen-webui](https://github.com/oobabooga/text-generation-webui/tree/main/extensions/openai#setup--installation) +- [FastChat](https://github.com/lm-sys/FastChat/blob/main/docs/openai_api.md) +- [LocalAI](https://localai.io/basics/getting_started/) +- [llama-cpp-python](https://github.com/abetlen/llama-cpp-python#web-server) +- [TensorRT-LLM](https://github.com/NVIDIA/trt-llm-as-openai-windows?tab=readme-ov-file#examples) +- [vLLM](https://docs.vllm.ai/en/latest/serving/openai_compatible_server.html) +- [BerriAI/litellm](https://github.com/BerriAI/litellm) + +OpenAI compatible APIs + +- [Anyscale Endpoints](https://github.com/continuedev/deploy-os-code-llm#others) +- [Anyscale Private Endpoints](https://github.com/continuedev/deploy-os-code-llm#anyscale-private-endpoints) + +If you are using an OpenAI compatible server / API, you can change the `apiBase` like this: + + + + ```yaml title="config.yaml" + models: + - name: OpenAI-compatible server / API + provider: openai + model: MODEL_NAME + apiBase: http://localhost:8000/v1 + apiKey: + ``` + + + ```json title="config.json" + { + "models": [ + { + "title": "OpenAI-compatible server / API", + "provider": "openai", + "model": "MODEL_NAME", + "apiKey": "", + "apiBase": "http://localhost:8000/v1" + } + ] + } + ``` + + + +To force usage of `chat/completions` instead of `completions` endpoint you can set: + + + + ```yaml title="config.yaml" + models: + - name: OpenAI-compatible server / API + provider: openai + model: MODEL_NAME + apiBase: http://localhost:8000/v1 + useLegacyCompletionsEndpoint: true + ``` + + + ```json title="config.json" + { + "models": [ + { + "title": "OpenAI-compatible server / API", + "provider": "openai", + "model": "MODEL_NAME", + "apiBase": "http://localhost:8000/v1", + "useLegacyCompletionsEndpoint": true + } + ] + } + ``` + + diff --git a/docs/docs/customize/model-providers/top-level/vertexai.md b/docs/docs/customize/model-providers/top-level/vertexai.md deleted file mode 100644 index 50958cae0..000000000 --- a/docs/docs/customize/model-providers/top-level/vertexai.md +++ /dev/null @@ -1,65 +0,0 @@ ---- -title: Vertex AI -slug: ../vertexai ---- - -:::info - -You need to enable the [Vertex AI API](https://console.cloud.google.com/marketplace/product/google/aiplatform.googleapis.com) and set up the [Google Application Default Credentials](https://cloud.google.com/docs/authentication/provide-credentials-adc). - -::: - -## Chat model - -We recommend configuring **Claude 3.5 Sonnet** as your chat model. - -```json title="config.json" -{ - "models": [ - { - "title": "Claude 3.5 Sonnet", - "provider": "vertexai", - "model": "claude-3-5-sonnet-20240620", - "projectId": "[PROJECT_ID]", - "region": "us-east5" - } - ] -} -``` - -## Autocomplete model - -We recommend configuring **Codestral** or **code-gecko** as your autocomplete model. - -```json title="config.json" -{ - "tabAutocompleteModel": { - "title": "Codestral (Vertex AI)", - "provider": "vertexai", - "model": "codestral", - "projectId": "[PROJECT_ID]", - "region": "us-central1" - } -} -``` - -## Embeddings model - -We recommend configuring **text-embedding-004** as your embeddings model. - -```json title="config.json" -{ - "embeddingsProvider": { - "provider": "vertexai", - "model": "text-embedding-004", - "projectId": "[PROJECT_ID]", - "region": "us-central1" - } -} -``` - -## Reranking model - -Vertex AI currently does not offer any reranking models. - -[Click here](../../model-types/reranking.md) to see a list of reranking model providers. diff --git a/docs/docs/customize/model-providers/top-level/vertexai.mdx b/docs/docs/customize/model-providers/top-level/vertexai.mdx new file mode 100644 index 000000000..2863acc31 --- /dev/null +++ b/docs/docs/customize/model-providers/top-level/vertexai.mdx @@ -0,0 +1,116 @@ +--- +title: Vertex AI +slug: ../vertexai +--- + +import TabItem from "@theme/TabItem"; +import Tabs from "@theme/Tabs"; + +:::info +You need to enable the [Vertex AI API](https://console.cloud.google.com/marketplace/product/google/aiplatform.googleapis.com) and set up the [Google Application Default Credentials](https://cloud.google.com/docs/authentication/provide-credentials-adc). +::: + +## Chat model + +We recommend configuring **Claude 3.5 Sonnet** as your chat model. + + + + ```yaml title="config.yaml" + models: + - name: Claude 3.5 Sonnet + provider: vertexai + model: claude-3-5-sonnet-20240620 + env: + projectId: + region: us-east5 + ``` + + + ```json title="config.json" + { + "models": [ + { + "title": "Claude 3.5 Sonnet", + "provider": "vertexai", + "model": "claude-3-5-sonnet-20240620", + "projectId": "[PROJECT_ID]", + "region": "us-east5" + } + ] + } + ``` + + + +## Autocomplete model + +We recommend configuring **Codestral** or **code-gecko** as your autocomplete model. + + + + ```yaml title="config.yaml" + models: + - name: Codestral (Vertex AI) + provider: vertexai + model: codestral + roles: + - autocomplete + env: + projectId: + region: us-central1 + + ``` + + + ```json title="config.json" + { + "tabAutocompleteModel": { + "title": "Codestral (Vertex AI)", + "provider": "vertexai", + "model": "codestral", + "projectId": "[PROJECT_ID]", + "region": "us-central1" + } + } + ``` + + + +## Embeddings model + +We recommend configuring **text-embedding-004** as your embeddings model. + + + + ```yaml title="config.yaml" + models: + - name: Text Embedding-004 + provider: vertexai + model: text-embedding-004 + env: + projectId: + region: us-central1 + roles: + - embed + ``` + + + ```json title="config.json" + { + "embeddingsProvider": { + "provider": "vertexai", + "model": "text-embedding-004", + "projectId": "[PROJECT_ID]", + "region": "us-central1" + } + } + ``` + + + +## Reranking model + +Vertex AI currently does not offer any reranking models. + +[Click here](../../model-roles/reranking.mdx) to see a list of reranking model providers. diff --git a/docs/docs/customize/model-providers/top-level/xAI.md b/docs/docs/customize/model-providers/top-level/xAI.md deleted file mode 100644 index 550cc0641..000000000 --- a/docs/docs/customize/model-providers/top-level/xAI.md +++ /dev/null @@ -1,53 +0,0 @@ ---- -title: xAI -slug: ../xai ---- - -:::info - -You can get an API key from the [xAI console](https://console.x.ai/) - -::: - -## Chat model - -We recommend configuring **grok-2-latest** as your chat model. For information on other available models, visit [xAI Documentation](https://docs.x.ai/docs/models). - -```json title="config.json" -{ - "models": [ - { - "title": "Grok 2", - "provider": "xAI", - "model": "grok-2-latest", - "apiKey": "[API_KEY]" - } - ] -} -``` - -## Autocomplete model - -xAI currently does not offer any autocomplete models. - -[Click here](../../model-types/autocomplete.md) to see a list of autocomplete model providers. - -## Embeddings model - -xAI currently does not offer any embeddings models. - -[Click here](../../model-types/embeddings.md) to see a list of embeddings model providers. - -## Reranking model - -xAI currently does not offer any reranking models. - -[Click here](../../model-types/reranking.md) to see a list of reranking model providers. - -## Legacy Completions - -To force usage of `chat/completions` instead of `completions` endpoint you can set - -```json -"useLegacyCompletionsEndpoint": false -``` diff --git a/docs/docs/customize/model-providers/top-level/xAI.mdx b/docs/docs/customize/model-providers/top-level/xAI.mdx new file mode 100644 index 000000000..3c049790d --- /dev/null +++ b/docs/docs/customize/model-providers/top-level/xAI.mdx @@ -0,0 +1,62 @@ +--- +title: xAI +slug: ../xai +--- + +import TabItem from "@theme/TabItem"; +import Tabs from "@theme/Tabs"; + +:::info +You can get an API key from the [xAI console](https://console.x.ai/) +::: + +## Chat model + +We recommend configuring **grok-2-latest** as your chat model. For information on other available models, visit [xAI Documentation](https://docs.x.ai/docs/models). + + + + Add the [xAI Grok 2 model block](https://hub.continue.dev/xai/grok-2) on the hub. + + + ```yaml title="config.yaml" + models: + - name: Grok 2 + provider: xAI + model: grok-2-latest + apiKey: + ``` + + + ```json title="config.json" + { + "models": [ + { + "title": "Grok 2", + "provider": "xAI", + "model": "grok-2-latest", + "apiKey": "" + } + ] + } + ``` + + + +## Autocomplete model + +xAI currently does not offer any autocomplete models. + +[Click here](../../model-roles/autocomplete.md) to see a list of autocomplete model providers. + +## Embeddings model + +xAI currently does not offer any embeddings models. + +[Click here](../../model-roles/embeddings.mdx) to see a list of embeddings model providers. + +## Reranking model + +xAI currently does not offer any reranking models. + +[Click here](../../model-roles/reranking.mdx) to see a list of reranking model providers. diff --git a/docs/docs/customize/model-roles/apply.mdx b/docs/docs/customize/model-roles/apply.mdx new file mode 100644 index 000000000..1ecace184 --- /dev/null +++ b/docs/docs/customize/model-roles/apply.mdx @@ -0,0 +1,15 @@ +--- +title: Apply Role +description: Apply model role +keywords: [apply, model, role] +sidebar_position: 4 +--- + +import TabItem from "@theme/TabItem"; +import Tabs from "@theme/Tabs"; + +When editing code, Chat and Edit model output often doesn't clearly align with existing code. A model with the `apply` role is used to generate a more precise diff to apply changes to a file. + +Generally speaking, models proficient in chat and edit can also be used for applying code. + +Explore apply models in [the hub](https://hub.continue.dev/explore/models?roles=apply). diff --git a/docs/docs/customize/model-roles/autocomplete.md b/docs/docs/customize/model-roles/autocomplete.md new file mode 100644 index 000000000..9641d5dcb --- /dev/null +++ b/docs/docs/customize/model-roles/autocomplete.md @@ -0,0 +1,14 @@ +--- +title: Autocomplete Role +description: Autocomplete model role +keywords: [autocomplete, model, role] +sidebar_position: 2 +--- + +An "autocomplete model" is an LLM that is trained on a special format called fill-in-the-middle (FIM). This format is designed to be given the prefix and suffix of a code file and predict what goes between. This task is very specific, which on one hand means that the models can be smaller (even a 3B parameter model can perform well). On the other hand, this means that Chat models, though larger, will often perform poorly even with extensive prompting. + +In Continue, autocomplete models are used to display inline [Autocomplete](../../autocomplete/how-to-use-it.md) suggestions as you type. Autocomplete models are designated by adding the `autocomplete` to the model's `roles` in `config.yaml`. + +## Recommended Autocomplete models + +Visit the [Autocomplete Deep Dive](../deep-dives/autocomplete.mdx) for recommended models and more details. diff --git a/docs/docs/customize/model-roles/chat.mdx b/docs/docs/customize/model-roles/chat.mdx new file mode 100644 index 000000000..90b97e17c --- /dev/null +++ b/docs/docs/customize/model-roles/chat.mdx @@ -0,0 +1,416 @@ +--- +title: Chat Role +description: Chat model role +keywords: [chat, model, role] +sidebar_position: 1 +--- + +import TabItem from "@theme/TabItem"; +import Tabs from "@theme/Tabs"; + +A "chat model" is an LLM that is trained to respond in a conversational format. Because they should be able to answer general questions and generate complex code, the best chat models are typically large, often 405B+ parameters. + +In Continue, these models are used for [Chat](../../chat/how-to-use-it.md) and [Actions](../../actions/how-to-use-it.md). The selected chat model will also be used for [Edit](../../edit/how-to-use-it.md) and [Apply](./apply.mdx) if no `edit` or `apply` models are specified, respectively. + +## Recommended Chat models + +## Best overall experience + +For the best overall Chat experience, you will want to use a 400B+ parameter model or one of the frontier models. + +### Claude Sonnet 3.5 from Anthropic + +Our current top recommendation is Claude 3.7 Sonnet from [Anthropic](../model-providers/top-level/anthropic.mdx). + + + + View the [Claude 3.7 Sonnet model block](https://hub.continue.dev/anthropic/claude-3-7-sonnet) on the hub. + + + ```yaml title="config.yaml" + models: + - name: Claude 3.7 Sonnet + provider: anthropic + model: claude-3-7-sonnet-latest + apiKey: + ``` + + + ```json title="config.json" + { + "models": [ + { + "title": "Claude 3.5 Sonnet", + "provider": "anthropic", + "model": "claude-3-5-sonnet-latest", + "apiKey": "" + } + ] + } + ``` + + + +### 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](../model-providers/more/together.mdx) or [Groq](../model-providers/more/groq.mdx)) or self-host it (e.g. using [vLLM](../model-providers//more/vllm.mdx) or [Ollama](../model-providers/top-level/ollama.mdx)). + + + {/* HUB_TODO nonexistent blocks */} + {/* + + + Add the [Together Llama 3.1 405b block](https://hub.continue.dev/explore/assistants) from the hub + + + Add the [Groq Llama 3.1 405b block](https://hub.continue.dev/explore/assistants) from the hub + + + Add the [vLLM Llama 3.1 405b block](https://hub.continue.dev/explore/assistants) from the hub + + + Add the [Ollama Llama 3.1 405b block](https://hub.continue.dev/explore/assistants) from the hub + + + */} + + + + ```yaml title="config.yaml" + models: + - name: "Llama 3.1 405B" + provider: "together" + model: "llama3.1-405b" + apiKey: + ``` + + + ```yaml title="config.yaml" + models: + - name: "Llama 3.1 405B" + provider: "groq" + model: "llama3.1-405b" + apiKey: + ``` + + + ```yaml title="config.yaml" + models: + - name: "Llama 3.1 405B" + provider: "vllm" + model: "llama3.1-405b" + ``` + + + ```yaml title="config.yaml" + models: + - name: "Llama 3.1 405B" + provider: "ollama" + model: "llama3.1:405b" + ``` + + + + + + + ```json title="config.json" + { + "models": [ + { + "title": "Llama 3.1 405B", + "provider": "together", + "model": "llama3.1-405b", + "apiKey": "" + } + ] + } + ``` + + + ```json title="config.json" + { + "models": [ + { + "title": "Llama 3.1 405B", + "provider": "groq", + "model": "llama3.1-405b", + "apiKey": "" + } + ] + } + ``` + + + ```json title="config.json" + { + "models": [ + { + "title": "Llama 3.1 405B", + "provider": "vllm", + "model": "llama3.1-405b" + } + ] + } + ``` + + + ```json title="config.json" + { + "models": [ + { + "title": "Llama 3.1 405B", + "provider": "ollama", + "model": "llama3.1:405b" + } + ] + } + ``` + + + + + +### GPT-4o from OpenAI + +If you prefer to use a model from [OpenAI](../model-providers/top-level/openai.mdx), then we recommend GPT-4o. + + + + Add the [OpenAI GPT-4o block](https://hub.continue.dev/openai/gpt-4o) from the hub + + + ```yaml title="config.yaml" + models: + - name: GPT-4o + provider: openai + model: '' + apiKey: + ``` + + + ```json title="config.json" + { + "models": [ + { + "title": "GPT-4o", + "provider": "openai", + "model": "", + "apiKey": "" + } + ] + } + ``` + + + +### Grok-2 from xAI + +If you prefer to use a model from [xAI](../model-providers/top-level/xAI.mdx), then we recommend Grok-2. + + + + Add the [xAI Grok-2 block](https://hub.continue.dev/xai/grok-2) from the hub + + + ```yaml title="config.yaml" + models: + - name: Grok-2 + provider: xAI + model: grok-2-latest + apiKey: + ``` + + + ```json title="config.json" + { + "models": [ + { + "title": "Grok-2", + "provider": "xAI", + "model": "grok-2-latest", + "apiKey": "" + } + ] + } + ``` + + + +### Gemini 2.0 Flash from Google + +If you prefer to use a model from [Google](../model-providers/top-level/gemini.mdx), then we recommend Gemini 2.0 Flash. + + + + Add the [Gemini 2.0 Flash block](https://hub.continue.dev/google/gemini-2.0-flash) from the hub + + + ```yaml title="config.yaml" + models: + - name: Gemini 2.0 Flash + provider: gemini + model: gemini-2.0-flash + apiKey: + ``` + + + ```json title="config.json" + { + "models": [ + { + "title": "Gemini 2.0 Flash", + "provider": "gemini", + "model": "gemini-2.0-flash", + "apiKey": "" + } + ] + } + ``` + + + +## Local, offline experience + +For the best local, offline Chat experience, you will want to use a model that is large but fast enough on your machine. + +### 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](../model-providers/top-level/ollama.mdx) or [LM Studio](../model-providers/more/lmstudio.mdx)). + + + + + + Add the [Ollama Llama 3.1 8b block](https://hub.continue.dev/ollama/llama3.1-8b) from the hub + + {/* HUB_TODO nonexistent block */} + {/* + Add the [LM Studio Llama 3.1 8b block](https://hub.continue.dev/explore/models) from the hub + */} + + + + + + ```yaml title="config.yaml" + models: + - name: Llama 3.1 8B + provider: ollama + model: llama3.1:8b + ``` + + + ```yaml title="config.yaml" + models: + - name: Llama 3.1 8B + provider: lmstudio + model: llama3.1:8b + ``` + + + + + + + ```json title="config.json" + { + "models": [ + { + "title": "Llama 3.1 8B", + "provider": "ollama", + "model": "llama3.1:8b" + } + ] + } + ``` + + + ```json title="config.json" + { + "models": [ + { + "title": "Llama 3.1 8B", + "provider": "lmstudio", + "model": "llama3.1-8b" + } + ] + } + ``` + + + + + +### 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](../model-providers/top-level/ollama.mdx) or [LM Studio](../model-providers/more/lmstudio.mdx)). + + + {/* HUB_TODO nonexistent blocks */} + {/* + + + Add the [Ollama Deepseek Coder 2 16B block](https://hub.continue.dev/explore/models) from the hub + + + Add the [LM Studio Deepseek Coder 2 16B block](https://hub.continue.dev/explore/models) from the hub + + + */} + + + + ```yaml title="config.yaml" + models: + - name: DeepSeek Coder 2 16B + provider: ollama + model: deepseek-coder-v2:16b + ``` + + + ```yaml title="config.yaml" + models: + - name: DeepSeek Coder 2 16B + provider: lmstudio + model: deepseek-coder-v2:16b + ``` + + + + + + + ```json title="config.json" + { + "models": [ + { + "title": "DeepSeek Coder 2 16B", + "provider": "ollama", + "model": "deepseek-coder-v2:16b", + "apiBase": "http://localhost:11434" + } + ] + } + ``` + + + ```json title="config.json" + { + "models": [ + { + "title": "DeepSeek Coder 2 16B", + "provider": "lmstudio", + "model": "deepseek-coder-v2:16b" + } + ] + } + ``` + + + + + +## Other experiences + +There are many more models and providers you can use with Chat beyond those mentioned above. Read more [here](../model-roles/chat.mdx) diff --git a/docs/docs/customize/model-roles/edit.mdx b/docs/docs/customize/model-roles/edit.mdx new file mode 100644 index 000000000..57bbc76aa --- /dev/null +++ b/docs/docs/customize/model-roles/edit.mdx @@ -0,0 +1,48 @@ +--- +title: Edit Role +description: Edit model role +keywords: [edit, editing, model, role] +sidebar_position: 3 +--- + +import TabItem from "@theme/TabItem"; +import Tabs from "@theme/Tabs"; + +It's often useful to select a different model to respond to Edit prompts than for chat prompts, as Edits are often more code-specific and may require less conversational readability. + +In Continue, you can add `edit` to a model's roles to specify that it can be used for Edit requests. If no edit models are specified, the selected `chat` model is used. + + + + Use model roles. + ```yaml title="config.yaml" + models: + - name: Claude 3.5 Sonnet + provider: anthropic + model: claude-3-5-sonnet-latest + apiKey: + roles: + - edit + ``` + + + Set the `experimental.modelRoles.inlineEdit` property in `config.json`. + ```json title="config.json" + { + "models": { + "name": "Claude 3.5 Sonnet", + "provider": "anthropic", + "model": "claude-3-5-sonnet-latest", + "apiKey": "" + }, + "experimental": { + "modelRoles": { + "inlineEdit": "Claude 3.5 Sonnet", + } + } + } + ``` + + + +Explore edit models in [the hub](https://hub.continue.dev/explore/models?roles=edit). Generally, we our recommendations for Edit overlap with recommendations for Chat. diff --git a/docs/docs/customize/model-roles/embeddings.mdx b/docs/docs/customize/model-roles/embeddings.mdx new file mode 100644 index 000000000..a58cd520d --- /dev/null +++ b/docs/docs/customize/model-roles/embeddings.mdx @@ -0,0 +1,152 @@ +--- +title: Embed Role +description: Embed model role +keywords: [embedding, model, role, embeddings] +sidebar_position: 5 +--- + +import TabItem from "@theme/TabItem"; +import Tabs from "@theme/Tabs"; + +An "embeddings model" is trained to convert a piece of text into a vector, which can later be rapidly compared to other vectors to determine similarity between the pieces of text. Embeddings models are typically much smaller than LLMs, and will be extremely fast and cheap in comparison. + +In Continue, embeddings are generated during indexing and then used by [@Codebase](../deep-dives/codebase.mdx) to perform similarity search over your codebase. + +You can add `embed` to a model's `roles` to specify that it can be used to embed. + +:::info[Built-in model (VS Code only)] +`transformers.js` is used as a built-in embeddings model in VS Code. In JetBrains, there currently is no built-in embedder. +::: + +## Recommended embedding models + +If you have the ability to use any model, we recommend `voyage-code-3`, which is listed below along with the rest of the options for embeddings models. + +If you want to generate embeddings locally, we recommend using `nomic-embed-text` with [Ollama](../model-providers/top-level/ollama.mdx#embeddings-model). + +### Voyage AI + +After obtaining an API key from [here](https://www.voyageai.com/), you can configure like this: + + + + [Voyage Code 3 Embedder Block](https://hub.continue.dev/voyageai/voyage-code-3) + + + ```yaml title="config.yaml" + models: + - name: Voyage Code 3 + provider: voyage + model: voyage-code-3 + apiKey: + roles: + - embed + ``` + + + ```json title="config.json" + { + "embeddingsProvider": { + "provider": "voyage", + "model": "voyage-code-3", + "apiKey": "" + } + } + ``` + + + +### Ollama + +See [here](../model-providers/top-level/ollama.mdx#embeddings-model) for instructions on how to use Ollama for embeddings. + +### Transformers.js (currently VS Code only) + +[Transformers.js](https://huggingface.co/docs/transformers.js/index) is a JavaScript port of the popular [Transformers](https://huggingface.co/transformers/) library. It allows embeddings to be calculated entirely locally. The model used is `all-MiniLM-L6-v2`, which is shipped alongside the Continue extension. + + + + ```yaml title="config.yaml" + models: + - name: default-transformers + provider: transformers.js + roles: + - embed + ``` + + + ```json title="config.json" + { + "embeddingsProvider": { + "provider": "transformers.js" + } + } + ``` + + + +### Text Embeddings Inference + +[Hugging Face Text Embeddings Inference](https://huggingface.co/docs/text-embeddings-inference/en/index) enables you to host your own embeddings endpoint. You can configure embeddings to use your endpoint as follows: + + + {/* HUB_TODO nonexistent block */} + {/* + [HuggingFace Text Embedder Block](https://hub.continue.dev/) + */} + + ```yaml title="config.yaml" + models: + - name: Huggingface TEI Embedder + provider: huggingface-tei + apiBase: http://localhost:8080 + roles: [embed] + ``` + + + ```json title="config.json" + { + "embeddingsProvider": { + "provider": "huggingface-tei", + "apiBase": "http://localhost:8080" + } + } + ``` + + + +### OpenAI + +See [here](../model-providers/top-level/openai.mdx#embeddings-model) for instructions on how to use OpenAI for embeddings. + +### Cohere + +See [here](../model-providers/more/cohere.mdx#embeddings-model) for instructions on how to use Cohere for embeddings. + +### Gemini + +See [here](../model-providers/top-level/gemini.mdx#embeddings-model) for instructions on how to use Gemini for embeddings. + +### Vertex + +See [here](../model-providers/top-level/vertexai.mdx#embeddings-model) for instructions on how to use Vertex for embeddings. + +### Mistral + +See [here](../model-providers/top-level/mistral.mdx#embeddings-model) for instructions on how to use Mistral for embeddings. + +### NVIDIA + +See [here](../model-providers/more/nvidia.mdx#embeddings-model) for instructions on how to use NVIDIA for embeddings. + +### Bedrock + +See [here](../model-providers/top-level/bedrock.mdx#embeddings-model) for instructions on how to use Bedrock for embeddings. + +### WatsonX + +See [here](../model-providers/more/watsonx.mdx#embeddings-model) for instructions on how to use WatsonX for embeddings. + +### LMStudio + +See [here](../model-providers/more/lmstudio.mdx#embeddings-model) for instructions on how to use LMStudio for embeddings. diff --git a/docs/docs/customize/model-roles/intro.mdx b/docs/docs/customize/model-roles/intro.mdx new file mode 100644 index 000000000..3c3a6476e --- /dev/null +++ b/docs/docs/customize/model-roles/intro.mdx @@ -0,0 +1,31 @@ +--- +title: Intro to Roles +description: Apply model role +keywords: [apply, model, role] +sidebar_position: 0 +sidebar_label: Introduction +--- + +import TabItem from "@theme/TabItem"; +import Tabs from "@theme/Tabs"; + +Models in Continue can be configured to be used for various roles in the extension. + +- [`chat`](./chat.mdx): Used for chat conversations in the extension sidebar +- [`autocomplete`](./autocomplete.md): Used for autocomplete code suggestions in the editor +- [`edit`](./edit.mdx): Used to generate code based on edit prompts +- [`apply`](./apply.mdx): Used to decide how to apply edits to a file +- [`embed`](./embeddings.mdx): Used to generate embeddings used for vector search (@Codebase and @Docs context providers) +- [`rerank`](./reranking.mdx): Used to rerank results from vector search + +These roles can be specified for a `config.yaml` model block using `roles`. See the [YAML Specification](../../yaml-reference.md#models) for more details. + +## Selecting model roles + +You can control which of the models in your assistant for a given role will be currently used for that role. Visit the [Settings page](../settings.md) and go to the **Active Models** section. + +![Settings Active Models Section](/img/settings-model-roles.png) + +:::info +Note that `roles` do not exist within `config.json` - they are infered by the top level keys like `embeddingsProvider` +::: diff --git a/docs/docs/customize/model-roles/reranking.mdx b/docs/docs/customize/model-roles/reranking.mdx new file mode 100644 index 000000000..c16dab7a0 --- /dev/null +++ b/docs/docs/customize/model-roles/reranking.mdx @@ -0,0 +1,156 @@ +--- +title: Rerank Role +description: Rerank model role +keywords: [rerank, reranking, model, role] +sidebar_position: 6 +--- + +import TabItem from "@theme/TabItem"; +import Tabs from "@theme/Tabs"; + +A "reranking model" is trained to take two pieces of text (often a user question and a document) and return a relevancy score between 0 and 1, estimating how useful the document will be in answering the question. Rerankers are typically much smaller than LLMs, and will be extremely fast and cheap in comparison. + +In Continue, rerankers are designated using the `rerank` role and used by [@Codebase](../deep-dives/codebase.mdx) in order to select the most relevant code snippets after vector search. + +## Recommended reranking models + +If you have the ability to use any model, we recommend `rerank-2` by Voyage AI, which is listed below along with the rest of the options for rerankers. + +### Voyage AI + +Voyage AI offers the best reranking model for code with their `rerank-2` model. After obtaining an API key from [here](https://www.voyageai.com/), you can configure a reranker as follows: + + + + [Voyage Rerank 2 Block](https://hub.continue.dev/voyageai/rerank-2) + + + ```yaml title="config.yaml" + models: + - name: My Voyage Reranker + provider: voyage + apiKey: + model: rerank-2 + roles: + - rerank + ``` + + + ```json title="config.json" + { + "reranker": { + "name": "voyage", + "params": { + "model": "rerank-2", + "apiKey": "" + } + } + } + ``` + + + +### Cohere + +See Cohere's documentation for rerankers [here](https://docs.cohere.com/docs/rerank-2). + + + {/* HUB_TODO block doesn't exist */} + {/* + [Cohere Reranker English v3](https://hub.continue.dev/) + */} + + ```yaml title="config.yaml" + models: + - name: Cohere Reranker + provider: cohere + model: rerank-english-v3.0 + apiKey: + roles: + - rerank + ``` + + + ```json title="config.json" + { + "reranker": { + "name": "cohere", + "params": { + "model": "rerank-english-v3.0", + "apiKey": "" + } + } + } + ``` + + + +### LLM + +If you only have access to a single LLM, then you can use it as a reranker. This is discouraged unless truly necessary, because it will be much more expensive and still less accurate than any of the above models trained specifically for the task. Note that this will not work if you are using a local model, for example with Ollama, because too many parallel requests need to be made. + + + {/* HUB_TODO block doesn't exist */} + {/* + [GPT-4o LLM Reranker Block](https://hub.continue.dev/) + */} + + ```yaml title="config.yaml" + models: + - name: LLM Reranker + provider: openai + model: gpt-4o + roles: + - rerank + ``` + + + ```json title="config.json" + { + "reranker": { + "name": "llm", + "params": { + "modelTitle": "My Model Title" + } + } + } + ``` + + + +The `"modelTitle"` field must match one of the models in your "models" array in config.json. + +### Text Embeddings Inference + +[Hugging Face Text Embeddings Inference](https://huggingface.co/docs/text-embeddings-inference/en/index) enables you to host your own [reranker endpoint](https://huggingface.github.io/text-embeddings-inference/#/Text%20Embeddings%20Inference/rerank). You can configure your reranker as follows: + + + {/* HUB_TODO */} + {/* + [HuggingFace TEI Reranker block](https://hub.continue.dev/) + */} + + ```yaml title="config.yaml" + models: + - name: Huggingface-tei Reranker + provider: huggingface-tei + apiBase: http://localhost:8080 + apiKey: + roles: + - rerank + ``` + + + ```json title="config.json" + { + "reranker": { + "name": "huggingface-tei", + "params": { + "apiBase": "http://localhost:8080", + "apiKey": "" + } + } + } + ``` + + diff --git a/docs/docs/customize/model-types/autocomplete.md b/docs/docs/customize/model-types/autocomplete.md deleted file mode 100644 index d85920605..000000000 --- a/docs/docs/customize/model-types/autocomplete.md +++ /dev/null @@ -1,16 +0,0 @@ ---- -title: Autocomplete model -description: Autocomplete model -keywords: [autocomplete] -sidebar_position: 1 ---- - -An "autocomplete model" is an LLM that is trained on a special format called fill-in-the-middle (FIM). This format is designed to be given the prefix and suffix of a code file and predict what goes between. This task is very specific, which on one hand means that the models can be smaller (even a 3B parameter model can perform well). On the other hand, this means that Chat models, though larger, will perform poorly. - -In Continue, these models are used to display inline [Autocomplete](../../autocomplete/how-to-use-it.md) suggestions as you type. - -## Recommended Autocomplete models - -If you have the ability to use any model, we recommend `Codestral` with [Mistral](../model-providers/top-level/mistral.md#autocomplete-model) or [Vertex AI](../model-providers/top-level/vertexai.md#autocomplete-model). - -If you want to run a model locally, we recommend `Qwen2.5-Coder 1.5B` with [Ollama](../model-providers/top-level/ollama.md#autocomplete-model). diff --git a/docs/docs/customize/model-types/chat.md b/docs/docs/customize/model-types/chat.md deleted file mode 100644 index d94f2ce2d..000000000 --- a/docs/docs/customize/model-types/chat.md +++ /dev/null @@ -1,19 +0,0 @@ ---- -title: Chat model -description: Chat model -keywords: [chat] -sidebar_position: 2 ---- - -A "chat model" is an LLM that is trained to respond in a conversational format. Because they should be able to answer general questions and generate complex code, the best chat models are typically large, often 405B+ parameters. In Continue, these models are used for [Chat](../../chat/how-to-use-it.md), [Edit](../../edit/how-to-use-it.md), and [Actions](../../actions/how-to-use-it.md). - -## Recommended Chat models - -If you have the ability to use any model, we recommend [Claude 3.5 Sonnet](../model-providers/top-level/anthropic.md). - -Otherwise, some of the next best options are: - -- [GPT-4o](../model-providers/top-level/openai.md) -- [Grok-2](../model-providers/top-level/xAI.md) -- [Gemini 1.5 Pro](../model-providers/top-level/gemini.md) -- [Llama3.1 405B](../tutorials/llama3.1.md) diff --git a/docs/docs/customize/model-types/embeddings.md b/docs/docs/customize/model-types/embeddings.md deleted file mode 100644 index 137f6c260..000000000 --- a/docs/docs/customize/model-types/embeddings.md +++ /dev/null @@ -1,103 +0,0 @@ ---- -title: Embeddings model -description: Embeddings model -keywords: [embedding] -sidebar_position: 3 ---- - -An "embeddings model" is trained to convert a piece of text into a vector, which can later be rapidly compared to other vectors to determine similarity between the pieces of text. Embeddings models are typically much smaller than LLMs, and will be extremely fast and cheap in comparison. - -In Continue, embeddings are generated during indexing and then used by [@Codebase](../deep-dives/codebase.md) to perform similarity search over your codebase. - -:::info[Default model (VS Code only)] -`transformers.js` is used as a default embeddings model in VS Code. In JetBrains, there currently is no default. -::: - -:::info[Free Trial] -The free trial supports embeddings (provider: `free-trial`) -::: - -## Recommended embedding models - -If you have the ability to use any model, we recommend `voyage-code-3`, which is listed below along with the rest of the options for embeddings models. - -If you want to generate embeddings locally, we recommend using `nomic-embed-text` with [Ollama](../model-providers/top-level/ollama.md#embeddings-model). - -### Voyage AI - -After obtaining an API key from [here](https://www.voyageai.com/), you can configure like this: - -```json title="config.json" -{ - "embeddingsProvider": { - "provider": "voyage", - "model": "voyage-code-3", - "apiKey": "" - } -} -``` - -### Ollama - -See [here](../model-providers/top-level/ollama.md#embeddings-model) for instructions on how to use Ollama for embeddings. - -### Transformers.js (currently VS Code only) - -[Transformers.js](https://huggingface.co/docs/transformers.js/index) is a JavaScript port of the popular [Transformers](https://huggingface.co/transformers/) library. It allows embeddings to be calculated entirely locally. The model used is `all-MiniLM-L6-v2`, which is shipped alongside the Continue extension. - -```json title="config.json" -{ - "embeddingsProvider": { - "provider": "transformers.js" - } -} -``` - -### Text Embeddings Inference - -[Hugging Face Text Embeddings Inference](https://huggingface.co/docs/text-embeddings-inference/en/index) enables you to host your own embeddings endpoint. You can configure embeddings to use your endpoint as follows: - -```json title="config.json" -{ - "embeddingsProvider": { - "provider": "huggingface-tei", - "apiBase": "http://localhost:8080" - } -} -``` - -### OpenAI - -See [here](../model-providers/top-level/openai.md#embeddings-model) for instructions on how to use OpenAI for embeddings. - -### Cohere - -See [here](../model-providers/more/cohere.md#embeddings-model) for instructions on how to use Cohere for embeddings. - -### Gemini - -See [here](../model-providers/top-level/gemini.md#embeddings-model) for instructions on how to use Gemini for embeddings. - -### Vertex - -See [here](../model-providers/top-level/vertexai.md#embeddings-model) for instructions on how to use Vertex for embeddings. - -### Mistral - -See [here](../model-providers/top-level/mistral.md#embeddings-model) for instructions on how to use Mistral for embeddings. - -### NVIDIA - -See [here](../model-providers/more/nvidia.md#embeddings-model) for instructions on how to use NVIDIA for embeddings. - -### Bedrock - -See [here](../model-providers/top-level/bedrock.md#embeddings-model) for instructions on how to use Bedrock for embeddings. - -### WatsonX - -See [here](../model-providers/more/watsonx.md#embeddings-model) for instructions on how to use WatsonX for embeddings. - -### LMStudio - -See [here](../model-providers/more/lmstudio.md#embeddings-model) for instructions on how to use LMStudio for embeddings. diff --git a/docs/docs/customize/model-types/reranking.md b/docs/docs/customize/model-types/reranking.md deleted file mode 100644 index a87918cb2..000000000 --- a/docs/docs/customize/model-types/reranking.md +++ /dev/null @@ -1,93 +0,0 @@ ---- -title: Reranking model -description: Reranking model -keywords: [rerank] -sidebar_position: 4 ---- - -A "reranking model" is trained to take two pieces of text (often a user question and a document) and return a relevancy score between 0 and 1, estimating how useful the document will be in answering the question. Rerankers are typically much smaller than LLMs, and will be extremely fast and cheap in comparison. - -In Continue, reranking is used by [@Codebase](../deep-dives/codebase.md) in order to select the most relevant code snippets after vector search. - -## Recommended reranking models - -If you have the ability to use any model, we recommend `rerank-2` by Voyage AI, which is listed below along with the rest of the options for rerankers. - -### Voyage AI - -Voyage AI offers the best reranking model for code with their `rerank-2` model. After obtaining an API key from [here](https://www.voyageai.com/), you can configure like this: - -```json title="config.json" -{ - "reranker": { - "name": "voyage", - "params": { - "model": "rerank-2", - "apiKey": "" - } - } -} -``` - -### Cohere - -See Cohere's documentation for rerankers [here](https://docs.cohere.com/docs/rerank-2). - -```json title="config.json" -{ - "reranker": { - "name": "cohere", - "params": { - "model": "rerank-english-v3.0", - "apiKey": "" - } - } -} -``` - -### LLM - -If you only have access to a single LLM, then you can use it as a reranker. This is discouraged unless truly necessary, because it will be much more expensive and still less accurate than any of the above models trained specifically for the task. Note that this will not work if you are using a local model, for example with Ollama, because too many parallel requests need to be made. - -```json title="config.json" -{ - "reranker": { - "name": "llm", - "params": { - "modelTitle": "My Model Title" - } - } -} -``` - -The `"modelTitle"` field must match one of the models in your "models" array in config.json. - -### Text Embeddings Inference - -[Hugging Face Text Embeddings Inference](https://huggingface.co/docs/text-embeddings-inference/en/index) enables you to host your own [reranker endpoint](https://huggingface.github.io/text-embeddings-inference/#/Text%20Embeddings%20Inference/rerank). You can configure your reranker as follows: - -```json title="config.json" -{ - "reranker": { - "name": "huggingface-tei", - "params": { - "apiBase": "http://localhost:8080", - "apiKey": "", - "truncate": true, - "truncation_direction": "Right" - } - } -} -``` - -### Free Trial (Voyage AI) - -Continue offers a free trial of Voyage AI's reranking model. - -```json title="config.json" -{ - "reranker": { - "name": "free-trial" - } -} -``` diff --git a/docs/docs/customize/overview.md b/docs/docs/customize/overview.md index 80c18846a..2024673f9 100644 --- a/docs/docs/customize/overview.md +++ b/docs/docs/customize/overview.md @@ -6,22 +6,22 @@ keywords: [customize, configure, config] Continue can be deeply customized. For example you might: -- **Change your Model Provider**. Continue allows you to choose your favorite or even add multiple model providers. This allows you to use different models for different tasks, or to try another model if you're not happy with the results from your current model. Continue supports all of the popular model providers, including OpenAI, Anthropic, Microsoft/Azure, Mistral, and more. You can even self host your own model provider if you'd like. Learn more about [model providers](/customize/model-providers). -- **Select different model providers for each Compose feature**. Different Continue features can use different model providers. We call these _model types_. For example, you can use a different model provider for chat than you do for autocomplete. Learn more about [model types](/customize/model-types) . +- **Change your Model Provider**. Continue allows you to choose your favorite or even add multiple model providers. This allows you to use different models for different tasks, or to try another model if you're not happy with the results from your current model. Continue supports all of the popular model providers, including OpenAI, Anthropic, Microsoft/Azure, Mistral, and more. You can even self host your own model provider if you'd like. Learn more about [model providers](../customize/model-providers/). +- **Select different model providers for each Compose feature**. Different Continue features can use different model providers. We call these _model types_. For example, you can use a different model provider for chat than you do for autocomplete. Learn more about [model types](../customize/model-roles/) . - **Add a Context Provider**. Context providers allow you to add information to your prompts, giving your LLM additional context to work with. Context providers allow you to reference snippets from your codebase, or lookup relevant documentation, or use a search engine to find information and much more. Learn more about [context providers](/customize/context-providers). - **Create a Slash Command**. Slash commands allow you to easily add custom functionality to Continue. You can use a slash command that allows you to generate a shell command from natural language, or perhaps generate a commit message, or create your own custom command to do whatever you want. Learn more about [slash commands](/customize/slash-commands). - **Call external tools and functions**. Unchain your LLM with the power of _Tools_. You can call any external tool or function from your prompts. Currently only available with Anthropic. Learn more about [Tools](/customize/tools). -Whatever you choose, you'll probably start by editing `config.json`. +Whatever you choose, you'll probably start by editing `config.yaml`. ## Editing config.json -Most custom configuration is done by editing `config.json`. This file is a JSON file that allows you to customize Continue to your liking. It is found at: +Most custom configuration is done by editing `config.yaml` (or the older `config.json`). This is a YAML file that allows you to customize Continue to your liking. It is found at: -- MacOS and Linux: `~/.continue/config.json` -- Windows: `%USERPROFILE%\.continue\config.json` +- MacOS and Linux: `~/.continue/config.yaml` +- Windows: `%USERPROFILE%\.continue\config.yaml` -You can easily access `config.json` from the Continue Chat sidebar. Open the sidebar by pressing cmd/ctrl + L (VS Code) or cmd/ctrl + J (JetBrains) and click the "gear" icon in header to open the Settings page. Then click the button labeled `Open [your config profile]`. +You can easily access config file from the Continue Chat sidebar. Open the sidebar by pressing cmd/ctrl + L (VS Code) or cmd/ctrl + J (JetBrains) and click the "gear" icon in header to open the Settings page. Then click the button labeled `Open configuration file`. ![configure-continue](/img/configure-continue.png) @@ -29,13 +29,13 @@ When editing this file, you can see the available options suggested as you type, :::info -`config.json` is created the first time you use Continue. If you'd like to reset your configuration to the default, you can delete this file and Continue will automatically recreate it with the default settings. +A configuration file is created the first time you use Continue. If you'd like to reset your configuration to the default, you can delete this file and Continue will automatically recreate it with the default settings. ::: :::info -When you save `config.json`, Continue will automatically refresh to take into account your changes. +When you save a configuration file from the IDE, Continue will automatically refresh to take into account your changes. ::: @@ -45,6 +45,6 @@ If you'd like to scope certain settings to a particular workspace, you can add a ## Programmatic configuration -`config.json` can handle the vast majority of necessary configuration, so we recommend using it whenever possible. However, if you need to programmatically configure Continue, you can use `config.ts`, which is located at `~/.continue/config.ts` (MacOS / Linux) or `%USERPROFILE%\.continue\config.ts` (Windows). +`config.yaml` or `config.json` can handle the vast majority of necessary configuration, so we recommend using it whenever possible. However, if you need to programmatically configure Continue, you can use `config.ts`, which is located at `~/.continue/config.ts` (MacOS / Linux) or `%USERPROFILE%\.continue\config.ts` (Windows). -For examples of how to use `config.ts`, see [writing custom slash commands](./tutorials/build-your-own-slash-command.md#custom-slash-commands) or [writing custom context providers](./tutorials/build-your-own-context-provider.md). +For examples of how to use `config.ts`, see [writing custom slash commands](./tutorials/build-your-own-slash-command.md#custom-slash-commands) or [writing custom context providers](./tutorials/build-your-own-context-provider.mdx). diff --git a/docs/docs/customize/slash-commands.md b/docs/docs/customize/slash-commands.mdx similarity index 76% rename from docs/docs/customize/slash-commands.md rename to docs/docs/customize/slash-commands.mdx index bc3bac24a..e1890ba81 100644 --- a/docs/docs/customize/slash-commands.md +++ b/docs/docs/customize/slash-commands.mdx @@ -4,6 +4,13 @@ description: Shortcuts that can be activated by prefacing your input with '/' keywords: [slash command, custom commands, step] --- +import TabItem from "@theme/TabItem"; +import Tabs from "@theme/Tabs"; + +:::info +Slash commands can currently only be added using [`config.json`](../reference.md). The [`YAML Config Format`](../reference.md) is the new and preferred format. We recommend looking into [Prompt Files](../customize/deep-dives/prompt-files.md) to achieve similar functionality. +::: + Slash commands are shortcuts that can be activated by typing '/' and selecting from the dropdown. For example, the built-in '/edit' slash command lets you stream edits directly into your editor. ![slash-commands](/img/slash-commands.png) @@ -109,23 +116,39 @@ The onboard slash command helps to familiarize yourself with a new project by an ### 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 MCP "prompts" by creating slash commands. Read their [quickstart](https://modelcontextprotocol.io/quickstart) to learn how to set up a local server and then configure your `config.json` like this: +The [Model Context Protocol](https://modelcontextprotocol.io/introduction) is a standard proposed by Anthropic to unify prompts, context, and tool use. Continue supports MCP "prompts" by creating slash commands. Read their [quickstart](https://modelcontextprotocol.io/quickstart) to learn how to set up a local server and then set up your configuration like this: -```json -{ - "experimental": { - "modelContextProtocolServers": [ - { - "transport": { - "type": "stdio", - "command": "uvx", - "args": ["mcp-server-sqlite", "--db-path", "/Users/NAME/test.db"] + + + ```yaml title="config.yaml" + mcpServers: + - name: My MCP Server + command: uvx + args: + - mcp-server-sqlite + - --db-path + - /Users/NAME/test.db + ``` + + + ```json title="config.json" + { + "experimental": { + "modelContextProtocolServers": [ + { + "transport": { + "type": "stdio", + "command": "uvx", + "args": ["mcp-server-sqlite", "--db-path", "/Users/NAME/test.db"] + } } - } - ] + ] + } } -} -``` + ``` + + ### Build your own Slash Command -You can build your own slash command by following [this tutorial](/customize/tutorials/build-your-own-slash-command). \ No newline at end of file + +You can build your own slash command by following [this tutorial](/customize/tutorials/build-your-own-slash-command). diff --git a/docs/docs/customize/tools.md b/docs/docs/customize/tools.md deleted file mode 100644 index 020c38459..000000000 --- a/docs/docs/customize/tools.md +++ /dev/null @@ -1,40 +0,0 @@ ---- -title: Tools -description: Tool use and customization -keywords: [tool, use, function calling, claude, automatic] ---- - -Tools allow Continue to take action in your IDE and beyond (when you give permission). Currently, they are only supported for the following providers: - -- [Anthropic](./model-providers/top-level/anthropic.md) - see recommended models [here](https://docs.anthropic.com/en/docs/build-with-claude/tool-use#choosing-a-model). -- [Ollama](./model-providers/top-level/ollama.md) - see recommended models [here](https://ollama.com/search?c=tools). - -To use tools, click on the icon in the input toolbar like below. - -![tools](/img/tool-use-example.png) - -To let you balance speed and safety, each tool can be set to 1 of 3 modes: - -- `Automatic`: When the LLM requests to use the tool, Continue will automatically call it and send the response to the LLM. -- `Allowed`: When the LLM requests to use the tool, Continue will first give you the opportunity to "Cancel" or "Continue" with the tool. -- `Disabled`: The LLM will not know about or be able to use the tool. - -### Custom tools - -Currently custom tools can be configured using the [Model Context Protocol](https://modelcontextprotocol.io/introduction), a standard proposed by Anthropic to unify prompts, context, and tool use. 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 title="~/.continue/config.json" -{ - "experimental": { - "modelContextProtocolServers": [ - { - "transport": { - "type": "stdio", - "command": "uvx", - "args": ["mcp-server-sqlite", "--db-path", "/Users/NAME/test.db"] - } - } - ] - } -} -``` diff --git a/docs/docs/customize/tools.mdx b/docs/docs/customize/tools.mdx new file mode 100644 index 000000000..45280697e --- /dev/null +++ b/docs/docs/customize/tools.mdx @@ -0,0 +1,64 @@ +--- +title: Tools +description: Tool use and customization +keywords: [tool, use, function calling, claude, automatic] +--- + +import TabItem from "@theme/TabItem"; +import Tabs from "@theme/Tabs"; + +Tools allow Continue to take action in your IDE and beyond (when you give permission). Currently, they are only supported for the following providers: + +- [Anthropic](./model-providers/top-level/anthropic.mdx) - see recommended models [here](https://docs.anthropic.com/en/docs/build-with-claude/tool-use#choosing-a-model). +- [Ollama](./model-providers/top-level/ollama.mdx) - see recommended models [here](https://ollama.com/search?c=tools). +- [OpenAI](./model-providers/top-level/openai.mdx) +- [Gemini](./model-providers/top-level/gemini.mdx) + +To use tools, click on the icon in the input toolbar like below. + +![tools](/img/tool-use-example.png) + +To let you balance speed and safety, each tool can be set to 1 of 3 modes: + +- `Automatic`: When the LLM requests to use the tool, Continue will automatically call it and send the response to the LLM. +- `Allowed`: When the LLM requests to use the tool, Continue will first give you the opportunity to "Cancel" or "Continue" with the tool. +- `Disabled`: The LLM will not know about or be able to use the tool. + +### Custom tools + +Currently custom tools can be configured using the [Model Context Protocol](https://modelcontextprotocol.io/introduction), a standard proposed by Anthropic to unify prompts, context, and tool use. + +MCP Servers can be added to hub Assistants using `mcpServers` blocks. You can explore available MCP server blocks [here](https://hub.continue.dev/explore/mcp). + +To set up your own MCP server, read the [MCP quickstart](https://modelcontextprotocol.io/quickstart) and then [create an `mcpServers` block](https://hub.continue.dev/new?type=block&block=mcpServers) or add the following to your [config file](../customize/deep-dives/configuration.md): + + + + ```yaml title="config.yaml" + mcpServers: + - name: My MCP Server + command: uvx + args: + - mcp-server-sqlite + - --db-path + - /Users/NAME/test.db + ``` + + + ```json title="config.json" + { + "experimental": { + "modelContextProtocolServers": [ + { + "transport": { + "type": "stdio", + "command": "uvx", + "args": ["mcp-server-sqlite", "--db-path", "/Users/NAME/test.db"] + } + } + ] + } + } + ``` + + diff --git a/docs/docs/customize/tutorials/build-your-own-context-provider.md b/docs/docs/customize/tutorials/build-your-own-context-provider.mdx similarity index 80% rename from docs/docs/customize/tutorials/build-your-own-context-provider.md rename to docs/docs/customize/tutorials/build-your-own-context-provider.mdx index 3d37790cd..7710a84c2 100644 --- a/docs/docs/customize/tutorials/build-your-own-context-provider.md +++ b/docs/docs/customize/tutorials/build-your-own-context-provider.mdx @@ -2,10 +2,60 @@ title: Build your own context provider --- -## Introductory Example +import TabItem from "@theme/TabItem"; +import Tabs from "@theme/Tabs"; -To write your own context provider, you just have to implement the `CustomContextProvider` -interface: +# Build Your Own Context Provider + +Continue offers several way to provide your custom context to the extension. + +## HTTP Context Provider + +Continue can retrieve context from a custom HTTP server that you create and serve. Add the `@HTTP` context provider to your configuration like this: + + + + ```yaml title="config.yaml" + context: + provider: http + params: + url: https://myserver.com/context-provider + title: http + displayTitle: My Custom Context + description: Gets things from my private list + options: + maxItems: 20 + ``` + + + ```json title="config.json" + { + "name": "http", + "params": { + "url": "https://myserver.com/context-provider", + "title": "http", + "description": "Custom HTTP Context Provider", + "displayTitle": "My Custom Context", + "options": { + "maxItems": 20 + } + } + } + ``` + + + +Then, create a server that responds to requests as are made from [HttpContextProvider.ts](https://github.com/continuedev/continue/blob/main/core/context/providers/HttpContextProvider.ts). See the `hello` endpoint in [context_provider_server.py](https://github.com/continuedev/continue/blob/main/core/context/providers/context_provider_server.py) for an example that uses FastAPI. + +The `"options"` property can be used to send additional parameters to your endpoint, which will be included in the request body. + +:::info +The following methods for creating custom context providers are deprecated. We recommend using HTTP context providers, [MCP Servers](../context-providers.mdx#model-context-protocol), and [Prompt files](../deep-dives/prompt-files.md) where possible. +::: + +## Using CustomContextProvider + +Custom context providers can be implemented in a `config.ts` placed in your Continue global directory (`~/.continue` for MacOS, `%USERPROFILE%/.continue` for Windows). You can implement the `CustomContextProvider` interface in your `config.ts` ```typescript interface CustomContextProvider { @@ -69,9 +119,9 @@ export function modifyConfig(config: Config): Config { } ``` -No modification in `config.json` is necessary. +This is automatically appended to your configuration. -## Custom Context Providers with Submenu or Query +### Custom Context Providers with Submenu or Query There are 3 types of context providers: "normal", "query", and "submenu". The "normal" type is the default, and is what we've seen so far. @@ -107,17 +157,19 @@ const ReadMeContextProvider: CustomContextProvider = { const { ide } = args; // Filter all workspace files for READMEs - const workspaceDirs = await ide.getWorkspaceDirs() + const workspaceDirs = await ide.getWorkspaceDirs(); const allFiles = await Promise.all( - workspaceDirs.map(dir => ide.subprocess(`find ${dir} -name "README.md"`)), + workspaceDirs.map((dir) => + ide.subprocess(`find ${dir} -name "README.md"`), + ), ); // 'readmes' now contains an array of file paths for each README.md file found in the workspace, // excluding those in 'node_modules' const readmes = allFiles - .flatMap(mds => mds[0].split("\n")) - .filter(file => file.trim() !== '' && !file.includes("/node_modules/")) + .flatMap((mds) => mds[0].split("\n")) + .filter((file) => file.trim() !== "" && !file.includes("/node_modules/")); // Return the items that will be shown in the dropdown return readmes.map((filepath) => { @@ -157,13 +209,13 @@ The flow of information in the above example is as follows: 3. The `id` of the chosen `ContextSubmenuItem` is passed to `getContextItems` as the `query` argument. In this case it is the filepath of the README. 4. The `getContextItems` function can then use the `query` to retrieve the full contents of the README and format the content before returning the context item which will be included in the prompt. -## Importing outside modules +### Importing outside modules To include outside Node modules in your config.ts, run `npm install ` from the `~/.continue` directory, and then import them in config.ts. Continue will use [esbuild](https://esbuild.github.io/) to bundle your `config.ts` and any dependencies into a single Javascript file. The exact configuration used can be found [here](https://github.com/continuedev/continue/blob/5c9874400e223bbc9786a8823614a2e501fbdaf7/extensions/vscode/src/ideProtocol.ts#L45-L52). -## `CustomContextProvider` Reference +### `CustomContextProvider` Reference - `title`: An identifier for the context provider - `displayTitle` (optional): The title displayed in the dropdown @@ -177,27 +229,7 @@ Continue will use [esbuild](https://esbuild.github.io/) to bundle your `config.t - `extras.ide`: An instance of the `IDE` class, which lets you gather various sources of information from the IDE, including the contents of the terminal, the list of open files, or any warnings in the currently open file. - `query`: (not currently used) A string representing the query - `loadSubmenuItems` (optional): A function that returns a list of `ContextSubmenuItem`s to display in a submenu. It is given access to an `IDE`, the same that is passed to `getContextItems`. - -## Writing Context Providers in Other Languages - -If you'd like to write a context provider in a language other than TypeScript, you can use the "http" context provider to call a server that hosts your own code. Add the context provider to `config.json` like this: - -```json -{ - "name": "http", - "params": { - "url": "https://myserver.com/context-provider", - "title": "http", - "description": "Custom HTTP Context Provider", - "displayTitle": "My Custom Context", - "options": {} - } -} -``` - -Then, create a server that responds to requests as are made from [HttpContextProvider.ts](../../../../core/context/providers/HttpContextProvider.ts). See the `hello` endpoint in [context_provider_server.py](../../../../core/context/providers/context_provider_server.py) for an example that uses FastAPI. - -The `"options"` property can be used to send additional parameters to your endpoint, which will be included in the request body. + . ## Extension API for VSCode diff --git a/docs/docs/customize/tutorials/build-your-own-slash-command.md b/docs/docs/customize/tutorials/build-your-own-slash-command.md index dc450cdd4..f0cc1147f 100644 --- a/docs/docs/customize/tutorials/build-your-own-slash-command.md +++ b/docs/docs/customize/tutorials/build-your-own-slash-command.md @@ -2,6 +2,10 @@ title: Build your own slash command --- +:::info +Slash commands can currently only be added using [`config.json`](../../reference.md) or `config.ts`. The [`YAML Config Format`](../../reference.md) is the new and preferred format. We recommend looking into [Prompt Files](../deep-dives/prompt-files.md) to achieve similar functionality. +::: + There are two ways to add custom slash commands: 1. With natural language prompts - this is simpler and only requires writing a string or string template. @@ -18,11 +22,15 @@ You can add custom slash commands by adding to the `customCommands` property in Custom commands are great when you are frequently reusing a prompt. For example, if you've crafted a great prompt and frequently ask the LLM to check for mistakes in your code, you could add a command like this: ```json title="config.json" -customCommands=[{ - "name": "check", - "description": "Check for mistakes in my code", - "prompt": "{{{ input }}}\n\nPlease read the highlighted code and check for any mistakes. You should look for the following, and be extremely vigilant:\n- Syntax errors\n- Logic errors\n- Security vulnerabilities\n- Performance issues\n- Anything else that looks wrong\n\nOnce you find an error, please explain it as clearly as possible, but without using extra words. For example, instead of saying 'I think there is a syntax error on line 5', you should say 'Syntax error on line 5'. Give your answer as one bullet point per mistake found." -}] +{ + "customCommands": [ + { + "name": "check", + "description": "Check for mistakes in my code", + "prompt": "{{{ input }}}\n\nPlease read the highlighted code and check for any mistakes. You should look for the following, and be extremely vigilant:\n- Syntax errors\n- Logic errors\n- Security vulnerabilities\n- Performance issues\n- Anything else that looks wrong\n\nOnce you find an error, please explain it as clearly as possible, but without using extra words. For example, instead of saying 'I think there is a syntax error on line 5', you should say 'Syntax error on line 5'. Give your answer as one bullet point per mistake found." + } + ] +} ``` #### Templating diff --git a/docs/docs/customize/tutorials/custom-code-rag.md b/docs/docs/customize/tutorials/custom-code-rag.mdx similarity index 86% rename from docs/docs/customize/tutorials/custom-code-rag.md rename to docs/docs/customize/tutorials/custom-code-rag.mdx index b6f1cc251..f5e43dc8e 100644 --- a/docs/docs/customize/tutorials/custom-code-rag.md +++ b/docs/docs/customize/tutorials/custom-code-rag.mdx @@ -1,6 +1,9 @@ +import Tabs from "@theme/Tabs"; +import TabItem from "@theme/TabItem"; + # Custom code RAG -While Continue comes with [@Codebase](../deep-dives/codebase.md) out of the box, you might wish to set up your own vector database and build a custom retrieval-augmented generation (RAG) system. This can allow you to access code that is not available locally, to index code a single time across all users, or to include custom logic. In this guide, we'll walk you through the steps it takes to build this. +While Continue comes with [@Codebase](../deep-dives/codebase.mdx) out of the box, you might wish to set up your own vector database and build a custom retrieval-augmented generation (RAG) system. This can allow you to access code that is not available locally, to index code a single time across all users, or to include custom logic. In this guide, we'll walk you through the steps it takes to build this. ## Step 1: Choose an embeddings model @@ -122,19 +125,38 @@ async def create_item(item: ContextProviderInput): return context_items ``` -After you've set up your server, you can configure Continue to use it by adding the "http" context provider to your `contextProviders` array in `config.json`: +After you've set up your server, you can configure Continue to use it by adding the "http" context provider to your `contextProviders` array in your configuration: -```json title="config.json" -{ - "name": "http", - "params": { - "url": "https://myserver.com/retrieve", - "title": "http", - "description": "Custom HTTP Context Provider", - "displayTitle": "My Custom Context" + + + ```yaml title="config.yaml" + context: + - provider: http + params: + url: https://myserver.com/retrieve + name: http + description: Custom HTTP Context Provider + displayTitle: My Custom Context + ``` + + + ```json title="config.json" + { + "contextProviders": [ + { + "name": "http", + "params": { + "url": "https://myserver.com/retrieve", + "title": "http", + "description": "Custom HTTP Context Provider", + "displayTitle": "My Custom Context" + } + } + ] } -} -``` + ``` + + ## Step 7 (Bonus): Set up reranking diff --git a/docs/docs/customize/tutorials/how-to-self-host-a-model.md b/docs/docs/customize/tutorials/how-to-self-host-a-model.md deleted file mode 100644 index 4f97824d1..000000000 --- a/docs/docs/customize/tutorials/how-to-self-host-a-model.md +++ /dev/null @@ -1,76 +0,0 @@ ---- -title: How to self-host a model ---- - -You can deploy a model in your [AWS](https://github.com/continuedev/deploy-os-code-llm#aws), [GCP](https://github.com/continuedev/deploy-os-code-llm#gcp), [Azure](https://github.com/continuedev/deploy-os-code-llm#azure), [Lambda](https://lambdalabs.com/), or [other clouds](https://github.com/continuedev/deploy-os-code-llm#others-2) using: - -- [HuggingFace TGI](https://github.com/continuedev/deploy-os-code-llm#tgi) -- [vLLM](https://github.com/continuedev/deploy-os-code-llm#vllm) -- [SkyPilot](https://github.com/continuedev/deploy-os-code-llm#skypilot) -- [Anyscale Private Endpoints](https://github.com/continuedev/deploy-os-code-llm#anyscale-private-endpoints) (OpenAI compatible API) -- [Lambda](https://github.com/continuedev/deploy-os-code-llm#lambda) - -## Self-hosting an open-source model - -For many cases, either Continue will have a built-in provider or the API you use will be OpenAI-compatible, in which case you can use the "openai" provider and change the "baseUrl" to point to the server. - -However, if neither of these are the case, you will need to wire up a new LLM object. - -## Authentication - -Basic authentication can be done with any provider using the `apiKey` field: - -```json title="config.json" -{ - "models": [ - { - "title": "Ollama", - "provider": "ollama", - "model": "llama2-7b", - "apiKey": "xxx" - } - ] -} -``` - -This translates to the header `"Authorization": "Bearer xxx"`. - -If you need to send custom headers for authentication, you may use the `requestOptions.headers` property like in this example with Ollama: - -```json title="config.json" -{ - "models": [ - { - "title": "Ollama", - "provider": "ollama", - "model": "llama2-7b", - "requestOptions": { - "headers": { - "X-Auth-Token": "xxx" - } - } - } - ] -} -``` - -Similarly if your model requires a Certificate for authentication, you may use the `requestOptions.clientCertificate` property like in the example below: - -```json title="config.json" -{ - "models": [ - { - "title": "Ollama", - "provider": "ollama", - "model": "llama2-7b", - "requestOptions": { - "clientCertificate": { - "cert": "C:\tempollama.pem", - "key": "C:\tempollama.key", - "passphrase": "c0nt!nu3" - } - } - } - ] -} -``` diff --git a/docs/docs/customize/tutorials/how-to-self-host-a-model.mdx b/docs/docs/customize/tutorials/how-to-self-host-a-model.mdx new file mode 100644 index 000000000..ab3c9b1b5 --- /dev/null +++ b/docs/docs/customize/tutorials/how-to-self-host-a-model.mdx @@ -0,0 +1,124 @@ +--- +title: How to self-host a model +--- + +import TabItem from "@theme/TabItem"; +import Tabs from "@theme/Tabs"; + +You can deploy a model in your [AWS](https://github.com/continuedev/deploy-os-code-llm#aws), [GCP](https://github.com/continuedev/deploy-os-code-llm#gcp), [Azure](https://github.com/continuedev/deploy-os-code-llm#azure), [Lambda](https://lambdalabs.com/), or [other clouds](https://github.com/continuedev/deploy-os-code-llm#others-2) using: + +- [HuggingFace TGI](https://github.com/continuedev/deploy-os-code-llm#tgi) +- [vLLM](https://github.com/continuedev/deploy-os-code-llm#vllm) +- [SkyPilot](https://github.com/continuedev/deploy-os-code-llm#skypilot) +- [Anyscale Private Endpoints](https://github.com/continuedev/deploy-os-code-llm#anyscale-private-endpoints) (OpenAI compatible API) +- [Lambda](https://github.com/continuedev/deploy-os-code-llm#lambda) + +## Self-hosting an open-source model + +For many cases, either Continue will have a built-in provider or the API you use will be OpenAI-compatible, in which case you can use the "openai" provider and change the "baseUrl" to point to the server. + +However, if neither of these are the case, you will need to wire up a new LLM object. + +## Authentication + +Basic authentication can be done with any provider using the `apiKey` field: + + + + ```yaml title="config.yaml" + models: + - name: Ollama + provider: ollama + model: llama2-7b + apiKey: + ``` + + + ```json title="config.json" + { + "models": [ + { + "title": "Ollama", + "provider": "ollama", + "model": "llama2-7b", + "apiKey": "" + } + ] + } + ``` + + + +This translates to the header `"Authorization": "Bearer xxx"`. + +If you need to send custom headers for authentication, you may use the `requestOptions.headers` property like in this example with Ollama: + + + + ```yaml title="config.yaml" + models: + - name: Ollama + provider: ollama + model: llama2-7b + requestOptions: + headers: + X-Auth-Token: xxx + ``` + + + ```json title="config.json" + { + "models": [ + { + "title": "Ollama", + "provider": "ollama", + "model": "llama2-7b", + "requestOptions": { + "headers": { + "X-Auth-Token": "xxx" + } + } + } + ] + } + ``` + + + +Similarly if your model requires a Certificate for authentication, you may use the `requestOptions.clientCertificate` property like in the example below: + + + + ```yaml title="config.yaml" + models: + - name: Ollama + provider: ollama + model: llama2-7b + requestOptions: + clientCertificate: + cert: C:\tempollama.pem + key: C:\tempollama.key + passphrase: c0nt!nu3 + ``` + + + ```json title="config.json" + { + "models": [ + { + "title": "Ollama", + "provider": "ollama", + "model": "llama2-7b", + "requestOptions": { + "clientCertificate": { + "cert": "C:\\tempollama.pem", + "key": "C:\\tempollama.key", + "passphrase": "c0nt!nu3" + } + } + } + ] + } + ``` + + diff --git a/docs/docs/customize/tutorials/llama3.1.md b/docs/docs/customize/tutorials/llama3.1.md deleted file mode 100644 index bd40ad585..000000000 --- a/docs/docs/customize/tutorials/llama3.1.md +++ /dev/null @@ -1,140 +0,0 @@ ---- -title: Using Llama 3.1 with Continue -description: How to use Llama 3.1 with Continue -keywords: [llama, meta, togetherai, novita, ollama, replicate] ---- - -Continue makes it easy to code with the latest open-source models, including the entire Llama 3.1 family of models. Llama 3.2 models are also supported but not recommended for chat, because they are specifically designed to be small or multi-modal. - -If you haven't already installed Continue, you can do that [here for VS Code](https://marketplace.visualstudio.com/items?itemName=Continue.continue) or [here for JetBrains](https://plugins.jetbrains.com/plugin/22707-continue). For more general information on customizing Continue, read [our customization docs](../overview.md). - -Below we share some of the easiest ways to get up and running, depending on your use-case. - -## Ollama - -Ollama is the fastest way to get up and running with local language models. We recommend trying Llama 3.1 8b, which is impressive for its size and will perform well on most hardware. - -1. Download Ollama [here](https://ollama.ai/) (it should walk you through the rest of these steps) -2. Open a terminal and run `ollama run llama3.1:8b` -3. Change your Continue config file like this: - -```json title="config.json" -{ - "models": [ - { - "title": "Llama 3.1 8b", - "provider": "ollama", - "model": "llama3.1-8b" - } - ] -} -``` - -## 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": "" - } - ] -} -``` - -## Together AI - -Together AI provides fast and reliable inference of open-source models. You'll be able to run the 405b model with good speed. - -1. Create an account [here](https://api.together.xyz/signup) -2. Copy your API key that appears on the welcome screen -3. Update your Continue config file like this: - -```json title="config.json" -{ - "models": [ - { - "title": "Llama 3.1 405b", - "provider": "together", - "model": "llama3.1-405b", - "apiKey": "" - } - ] -} -``` - -## Replicate - -Replicate makes it easy to host and run open-source AI with an API. - -1. Get your Replicate API key [here](https://replicate.ai/) -2. Change your Continue config file like this: - -```json title="config.json" -{ - "models": [ - { - "title": "Llama 3.1 405b", - "provider": "replicate", - "model": "llama3.1-405b", - "apiKey": "" - } - ] -} -``` - -## SambaNova - -SambaNova Cloud provides world record Llama3.1 70B/405B serving. - -1. Create an account [here](https://cloud.sambanova.ai/) -2. Copy your API key -3. Update your Continue config file like this: - -```json title="~/.continue/config.json" -{ - "models": [ - { - "title": "SambaNova Llama 3.1 405B", - "provider": "sambanova", - "model": "llama3.1-405b", - "apiKey": "YOUR_API_KEY" - } - ] -} -``` - -## Cerebras Inference - -Cerebras Inference uses specialized silicon to provides fast inference for the Llama3.1 8B/70B. - -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" - } - ] -} -``` diff --git a/docs/docs/customize/tutorials/llama3.1.mdx b/docs/docs/customize/tutorials/llama3.1.mdx new file mode 100644 index 000000000..413214fb4 --- /dev/null +++ b/docs/docs/customize/tutorials/llama3.1.mdx @@ -0,0 +1,218 @@ +--- +title: Using Llama 3.1 with Continue +description: How to use Llama 3.1 with Continue +keywords: [llama, meta, togetherai, ollama, replicate] +--- + +import TabItem from "@theme/TabItem"; +import Tabs from "@theme/Tabs"; + +Continue makes it easy to code with the latest open-source models, including the entire Llama 3.1 family of models. Llama 3.2 models are also supported but not recommended for chat, because they are specifically designed to be small or multi-modal. + +If you haven't already installed Continue, you can do that [here for VS Code](https://marketplace.visualstudio.com/items?itemName=Continue.continue) or [here for JetBrains](https://plugins.jetbrains.com/plugin/22707-continue). For more general information on customizing Continue, read [our customization docs](../overview.md). + +Below we share some of the easiest ways to get up and running, depending on your use-case. + +## Ollama + +Ollama is the fastest way to get up and running with local language models. We recommend trying Llama 3.1 8b, which is impressive for its size and will perform well on most hardware. + +1. Download Ollama [here](https://ollama.ai/) (it should walk you through the rest of these steps) +2. Open a terminal and run `ollama run llama3.1:8b` +3. Change your Continue config file like this: + + + + ```yaml title="config.yaml" + models: + - name: Llama 3.1 8b + provider: ollama + model: llama3.1-8b + ``` + + + ```json title="config.json" + { + "models": [ + { + "title": "Llama 3.1 8b", + "provider": "ollama", + "model": "llama3.1-8b" + } + ] + } + ``` + + + +## 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: + + + + ```yaml title="config.yaml" + models: + - name: Llama 3.3 70b Versatile + provider: groq + model: llama-3.3-70b-versatile + apiKey: + ``` + + + ```json title="config.json" + { + "models": [ + { + "title": "Llama 3.3 70b Versatile", + "provider": "groq", + "model": "llama-3.3-70b-versatile", + "apiKey": "" + } + ] + } + ``` + + + +## Together AI + +Together AI provides fast and reliable inference of open-source models. You'll be able to run the 405b model with good speed. + +1. Create an account [here](https://api.together.xyz/signup) +2. Copy your API key that appears on the welcome screen +3. Update your Continue config file like this: + + + + ```yaml title="config.yaml" + models: + - name: Llama 3.1 405b + provider: together + model: llama3.1-405b + apiKey: + ``` + + + ```json title="config.json" + { + "models": [ + { + "title": "Llama 3.1 405b", + "provider": "together", + "model": "llama3.1-405b", + "apiKey": "" + } + ] + } + ``` + + + +## Replicate + +Replicate makes it easy to host and run open-source AI with an API. + +1. Get your Replicate API key [here](https://replicate.ai/) +2. Change your Continue config file like this: + + + + ```yaml title="config.yaml" + models: + - name: Llama 3.1 405b + provider: replicate + model: llama3.1-405b + apiKey: + ``` + + + ```json title="config.json" + { + "models": [ + { + "title": "Llama 3.1 405b", + "provider": "replicate", + "model": "llama3.1-405b", + "apiKey": "" + } + ] + } + ``` + + + +## SambaNova + +SambaNova Cloud provides world record Llama3.1 70B/405B serving. + +1. Create an account [here](https://cloud.sambanova.ai/) +2. Copy your API key +3. Update your Continue config file like this: + + + + ```yaml title="config.yaml" + models: + - name: SambaNova Llama 3.1 405B + provider: sambanova + model: llama3.1-405b + apiKey: + ``` + + + ```json title="config.json" + { + "models": [ + { + "title": "SambaNova Llama 3.1 405B", + "provider": "sambanova", + "model": "llama3.1-405b", + "apiKey": "" + } + ] + } + ``` + + + +## Cerebras Inference + +Cerebras Inference uses specialized silicon to provides fast inference for the Llama3.1 8B/70B. + +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: + + + + ```yaml title="config.yaml" + models: + - name: Cerebras Llama 3.1 70B + provider: cerebras + model: llama3.1-70b + apiKey: + ``` + + + ```json title="config.json" + { + "models": [ + { + "title": "Cerebras Llama 3.1 70B", + "provider": "cerebras", + "model": "llama3.1-70b", + "apiKey": "" + } + ] + } + ``` + + diff --git a/docs/docs/customize/tutorials/running-continue-without-internet.md b/docs/docs/customize/tutorials/running-continue-without-internet.md index 277272767..e3de1e79e 100644 --- a/docs/docs/customize/tutorials/running-continue-without-internet.md +++ b/docs/docs/customize/tutorials/running-continue-without-internet.md @@ -9,4 +9,4 @@ Continue can be run even on an air-gapped computer if you use a local model. Onl 1. Download the latest .vsix file from the [Open VSX Registry](https://open-vsx.org/extension/Continue/continue) and [install it to VS Code](https://code.visualstudio.com/docs/editor/extension-marketplace#_install-from-a-vsix). 2. Open the [User Settings Page](../settings.md) and turn off "Allow Anonymous Telemetry". This will stop Continue from attempting requests to PostHog for [anonymous telemetry](../../telemetry.md). 3. Also in `config.json`, set the default model to a local model. You can available options [here](../model-providers/). -4. Restart VS Code to ensure that the changes to `config.json` take effect. +4. Restart VS Code to ensure that the changes to `config.json` or `config.yaml` take effect. diff --git a/docs/docs/customize/tutorials/set-up-codestral.md b/docs/docs/customize/tutorials/set-up-codestral.mdx similarity index 50% rename from docs/docs/customize/tutorials/set-up-codestral.md rename to docs/docs/customize/tutorials/set-up-codestral.mdx index c48fea653..97ec3c981 100644 --- a/docs/docs/customize/tutorials/set-up-codestral.md +++ b/docs/docs/customize/tutorials/set-up-codestral.mdx @@ -4,6 +4,9 @@ description: How to set up Codestral keywords: [codestral, mistral, model setup] --- +import Tabs from "@theme/Tabs"; +import TabItem from "@theme/TabItem"; + ![mistral x continue](../../../static/img/mistral-x-continue.png) **Here is a step-by-step guide on how to set up Codestral with Continue using the Mistral AI API:** @@ -14,28 +17,45 @@ keywords: [codestral, mistral, model setup] 3. Log in and create an API key on Mistral AI's La Plateforme [here](https://console.mistral.ai/codestral). Make sure you get an API key from the "Codestral" page. -4. To use Codestral as your model for both `autocomplete` and `chat`, replace `[API_KEY]` with your Mistral API key below and add it to your `config.json` file: +4. To use Codestral as your model for both `autocomplete` and `chat`, insert your Mistral API key below and add it to your configuration file: -```json title="config.json" -{ - "models": [ + + + ```yaml title="config.yaml" + models: + - name: Codestral + provider: mistral + model: codestral-latest + apiKey: + apiBase: https://codestral.mistral.ai/v1 + roles: + - chat + - autocomplete + ``` + + + ```json title="config.json" { - "title": "Codestral", - "provider": "mistral", - "model": "codestral-latest", - "apiKey": "[API_KEY]", - "apiBase": "https://codestral.mistral.ai/v1" + "models": [ + { + "title": "Codestral", + "provider": "mistral", + "model": "codestral-latest", + "apiKey": "", + "apiBase": "https://codestral.mistral.ai/v1" + } + ], + "tabAutocompleteModel": { + "title": "Codestral", + "provider": "mistral", + "model": "codestral-latest", + "apiKey": "", + "apiBase": "https://codestral.mistral.ai/v1" + } } - ], - "tabAutocompleteModel": { - "title": "Codestral", - "provider": "mistral", - "model": "codestral-latest", - "apiKey": "[API_KEY]", - "apiBase": "https://codestral.mistral.ai/v1" - } -} -``` + ``` + + 5. If you run into any issues or have any questions, please join our Discord and post in the `#help` channel [here](https://discord.gg/EfJEfdFnDQ) diff --git a/docs/docs/edit/how-it-works.md b/docs/docs/edit/how-it-works.md index 19f107782..453d1e98f 100644 --- a/docs/docs/edit/how-it-works.md +++ b/docs/docs/edit/how-it-works.md @@ -11,4 +11,4 @@ The model response is then streamed directly back to the highlighted range in yo If you accept the diff, we remove the previously highlighted lines, and if you reject the diff, we remove the proposed changes. -If you would like to view the exact prompt that is sent to the model during an edit, you can [view this in the prompt logs](troubleshooting.md#check-the-logs). +If you would like to view the exact prompt that is sent to the model during an edit, you can [view this in the prompt logs](../troubleshooting.mdx#check-the-logs). diff --git a/docs/docs/edit/how-to-customize.md b/docs/docs/edit/how-to-customize.md deleted file mode 100644 index aa9d464c7..000000000 --- a/docs/docs/edit/how-to-customize.md +++ /dev/null @@ -1,16 +0,0 @@ ---- -title: How to customize -sidebar_position: 5 -description: How to customize Edit -keywords: [edit, cmd i, works] ---- - -You can configure a particular model to be used for Edit using the `inlineEdit` property. - -```json title="config.json" -"experimental": { - "modelRoles": { - "inlineEdit": "MODEL_TITLE", - } -} -``` \ No newline at end of file diff --git a/docs/docs/edit/how-to-customize.mdx b/docs/docs/edit/how-to-customize.mdx new file mode 100644 index 000000000..35b918393 --- /dev/null +++ b/docs/docs/edit/how-to-customize.mdx @@ -0,0 +1,11 @@ +--- +title: How to customize +sidebar_position: 5 +description: How to customize Edit +keywords: [edit, cmd i, works] +--- + +import TabItem from "@theme/TabItem"; +import Tabs from "@theme/Tabs"; + +You can configure a particular model to be used for Edit by setting/overriding `roles` in the model's YAML config. See [Edit role](../customize/model-roles/edit.mdx) for more details. diff --git a/docs/docs/edit/model-setup.md b/docs/docs/edit/model-setup.md index ded10c2a4..606bd0654 100644 --- a/docs/docs/edit/model-setup.md +++ b/docs/docs/edit/model-setup.md @@ -5,6 +5,8 @@ description: How to set up an Edit model keywords: [edit, cmd l, model] --- -By default, Edit uses the [same model as Chat](chat/model-setup.mdx) since we recommend a similar, 400B+ parameter model or one of the frontier model for code edits. +By default, Edit uses the [same model as Chat](../chat/model-setup.mdx) since we recommend a similar, 400B+ parameter model or one of the frontier model for code edits. -You can configure a different model to be used for edits by updating your [`config.json`](../reference.md). +Visit [the hub](https://hub.continue.dev/explore/models?roles=edit) to explore Edit models. + +You can configure a different model to be used for edits by updating your [configuration](../customize/model-roles/edit.mdx). diff --git a/docs/docs/getting-started/install.md b/docs/docs/getting-started/install.md index 3729edbfd..b62dbacd8 100644 --- a/docs/docs/getting-started/install.md +++ b/docs/docs/getting-started/install.md @@ -9,11 +9,12 @@ keywords: [install, installation, getting started, vs code, jetbrains] 1. Click `Install` on the [Continue extension page in the Visual Studio Marketplace](https://marketplace.visualstudio.com/items?itemName=Continue.continue) 2. This will open the Continue extension page in VS Code, where you will need to click `Install` again 3. The Continue logo will appear on the left sidebar. For a better experience, move Continue to the right sidebar +4. [Sign in to the hub](#signing-in) to get started with your first assistant. ![move-to-right-sidebar](/img/move-to-right-sidebar.gif) :::info[Troubleshooting] -If you have any problems, see the [troubleshooting guide](troubleshooting.md) or ask for help in [our Discord](https://discord.gg/NWtdYexhMs) +If you have any problems, see the [troubleshooting guide](../troubleshooting.mdx) or ask for help in [our Discord](https://discord.gg/NWtdYexhMs) ::: ## JetBrains @@ -21,9 +22,16 @@ If you have any problems, see the [troubleshooting guide](troubleshooting.md) or 1. Open your JetBrains IDE and open **Settings** using Ctrl + Alt + S 2. Select **Plugins** on the sidebar and search for "Continue" in the marketplace 3. Click `Install`, which will cause the Continue logo to show up on the right toolbar +4. [Sign in to the hub](#signing-in) to get started with your first assistant. ![jetbrains-getting-started.png](/img/jetbrains-getting-started.png) :::info[Troubleshooting] -If you have any problems, see the [troubleshooting guide](troubleshooting.md) or ask for help in [our Discord](https://discord.com/invite/EfJEfdFnDQ) +If you have any problems, see the [troubleshooting guide](../troubleshooting.mdx) or ask for help in [our Discord](https://discord.com/invite/EfJEfdFnDQ) ::: + +## Signing in + +Click "Get started" to sign in to the hub and start using assistants. + +![Hub Onboarding in the Extension](/img/hub/hub-onboarding-card.png) diff --git a/docs/docs/hub/assistants/create-an-assistant.md b/docs/docs/hub/assistants/create-an-assistant.md new file mode 100644 index 000000000..207f1c955 --- /dev/null +++ b/docs/docs/hub/assistants/create-an-assistant.md @@ -0,0 +1,38 @@ +--- +title: Create an assistant +sidebar_label: Create an assistant +description: How to create a custom AI code assistant +keywords: [assistants, creation, guide] +--- + +# Create an assistant + +## Remix an assistant + +You should remix an assistant if you want to use it after some modifications. + +By clicking the “remix” button, you’ll be taken to the “Create a remix” page. + +![Remix Assistant Button](/img/hub/assistant-remix-button.png) + +Once here, you’ll be able to + +1. add or remove blocks in YAML configuration +2. change the name, description, icon, etc. + +Clicking “Create assistant” will make this assistant available for use. + +## Create an assistant from scratch + +To create an assistant from scratch, select “New assistant” in the top bar. + +![New assistant button](/img/hub/assistant-new-button.png) + +Choose a name, slug, description, and icon for your assistant. + +The easiest way to create an assistant is to click "Create assistant" with the default configuration and then add / remove blocks using the sidebar. + +Alternatively, you can edit the assistant YAML directly before clicking "Create assistant". Refer to examples of assistants on [hub.continue.dev](https://hub.continue.dev/explore/assistants) and visit the [YAML Reference](../../yaml-reference.md#complete-yaml-config-example) docs for more details. + +![New assistant YAML](/img/hub/assistant-create-yaml.png) + diff --git a/docs/docs/hub/assistants/edit-an-assistant.md b/docs/docs/hub/assistants/edit-an-assistant.md new file mode 100644 index 000000000..9a4c8aeee --- /dev/null +++ b/docs/docs/hub/assistants/edit-an-assistant.md @@ -0,0 +1,26 @@ +--- +title: Edit an Assistant +sidebar_label: Edit an Assistant +description: How to edit a custom AI coding assistant. +keywords: [assistants, creation, guide] +--- + +# Edit an Assistant + +New versions of an assistant can be created and published using the sidebar. + +![Remix Assistant Button](/img/hub/assistant-create-sidebar.png) + +First, select an assistant from the dropdown at the top. + +While editing an assistant, you can explore the hub and click "Add Block" from a block page to add it to your assistant. + +For blocks that require secret values like API keys, you will see a small notification on the block's tile in the sidebar that will indicate if action is needed. + +To delete a block, click the trash icon. + +If a block you want to use does not exist yet, you can [create a new block](../blocks/create-a-block.md). + +When you are done editing, click "Publish" to publish a new version of the assistant. + +Click "Open VS Code" or "Open JetBrains" to open your IDE for using the assistant. \ No newline at end of file diff --git a/docs/docs/hub/assistants/intro.md b/docs/docs/hub/assistants/intro.md new file mode 100644 index 000000000..716e8f0d8 --- /dev/null +++ b/docs/docs/hub/assistants/intro.md @@ -0,0 +1,14 @@ +--- +title: Assistants Introduction +sidebar_label: Introduction +description: Overview of assistants functionality. +keywords: [assistants, overview, customization] +--- + +# Introduction to Assistants + +Custom AI code assistants are configurations of building [blocks](../blocks/intro.md) that enable a coding experience tailored to your specific use cases. + +`config.yaml` is a format for defining custom AI code assistants. An assistant has some top-level properties (e.g. `name`, `version`), but otherwise consists of composable lists of **blocks** such as `models` and `rules`, which are the atomic building blocks of an assistant. + +The `config.yaml` is parsed by the open-source Continue IDE extensions to create custom assistant experiences. When you log in to [hub.continue.dev](https://hub.continue.dev/), your assistants will automatically be synced with the IDE extensions. diff --git a/docs/docs/hub/assistants/use-an-assistant.md b/docs/docs/hub/assistants/use-an-assistant.md new file mode 100644 index 000000000..081118c23 --- /dev/null +++ b/docs/docs/hub/assistants/use-an-assistant.md @@ -0,0 +1,20 @@ +--- +title: Use an assistant +sidebar_label: Use an assistant +description: Guide to using assistants in your Continue workflow. +keywords: [assistants, usage, use, guide] +--- + +# Use an assistant + +To use an existing assistant, you can explore other assistants [here](https://hub.continue.dev/explore/assistants). + +Once you've found the assistant you want to use + +1. Click “Add Assistant” on its page +2. Add any required inputs (e.g. secrets like API keys) +3. Select “Save changes” in assistant sidebar on the right hand side + +After this, you can then go to your IDE extension and begin using the assistant by selecting it from the assistant dropdown. + +[Extension Assistant Selector](/img/hub/assistant-extension-select.png) \ No newline at end of file diff --git a/docs/docs/hub/blocks/block-types.md b/docs/docs/hub/blocks/block-types.md new file mode 100644 index 000000000..51ec97b10 --- /dev/null +++ b/docs/docs/hub/blocks/block-types.md @@ -0,0 +1,55 @@ +--- +title: Block Types +description: Overview of different block types +keywords: [blocks, types, overview] +sidebar_label: Types +--- + +# Block Types + +## Models + +Models are blocks that let you specify Large Language Models (LLMs) and other deep learning models to be used for various roles in the open-source IDE extension like Chat, Autocomplete, Edit, Embed, Rerank, etc. You can explore available models on [the hub](https://hub.continue.dev/explore/models). + +Continue supports [many model providers](../../customize/model-providers), including Anthropic, OpenAI, Gemini, Ollama, Amazon Bedrock, Azure, xAI, DeepSeek, and more. Models can have one or more of the following roles depending on its capabilities, including `chat`, `edit`, `apply`, `autocomplete`, `embed`, and `rerank`. Read more about roles [here](../../customize/model-roles). View [`models`](../../yaml-reference.md#models) in the YAML Reference for more details. + +## Context + +Context blocks define a context provider which can be referenced in Chat with `@` to pull in data from external sources such as files and folders, a URL, Jira or Confluence, and Github issues, among others. [Explore context provider blocks](https://hub.continue.dev/explore/context) on the hub. + +Learn more about context providers [here](../../yaml-reference.md#context), and check out [this guide](../../customize/tutorials/build-your-own-context-provider.mdx) to creating your own custom context provider. The `config.yaml` spec for context can be found [`here`](../../yaml-reference.md#context). + +## Docs + +Docs are blocks that point to documentation sites, which will be indexed locally and then can be referenced as context using @Docs in Chat. [Explore docs](https://hub.continue.dev/explore/docs) on the hub. + +Learn more in the [@Docs deep dive](../../customize/deep-dives/docs.mdx), and view [`docs`](../../yaml-reference.md#docs) in the YAML Reference for more details. + +## MCP Servers + +Model Context Protocol (MCP) is a standard way of building and sharing tools for language models. MCP Servers can be defined in `mcpServers` blocks. [Explore MCP Servers](https://hub.continue.dev/explore/mcp) on the hub. + +Learn more in the [Tools deep dive](../../customize/tools.mdx), and view [`mcpServers`](../../yaml-reference.md#mcpservers) in the YAML Reference for more details. + +## Rules + +Rules blocks are instructions that your custom AI code assistant will always keep in mind - the contents of rules are inserted into the system message for all Chat requests. [Explore rules](https://hub.continue.dev/explore/rules) on the hub. + +Learn more in the [rules deep dive](../../customize/deep-dives/rules.md), and view [`rules`](../../yaml-reference.md#rules) in the YAML Reference for more details. + +## Prompts + +Prompts blocks are pre-written, reusable prompts that can be referenced at any time during chat. They are especially useful as context for repetitive and/or complex tasks. [Explore prompts](https://hub.continue.dev/explore/prompts) on the hub. + +Prompt blocks have the same syntax as [prompt files](../../customize/deep-dives/prompt-files.md). There are two important differences between prompt blocks and prompt files: + +1. Prompt blocks are stored within `config.yaml` rather than `.continue/prompts` in project directory and +2. Prompt blocks only show up as slash commands in Chat, not under the `@Prompt Files` context provider + +The `config.yaml` spec for `prompts` can be found [here](../../yaml-reference.md#prompts). + +## Data + +Data blocks allow you send your development data to custom destinations of your choice. Development data can be used for a variety of purposes, including analyzing usage, gathering insights, or fine-tuning models. You can read more about development data [here](../../customize/deep-dives/development-data.md). Explore data block examples [here](https://hub.continue.dev/explore/data). + +Data destinations are configured in the[`data`](../../yaml-reference.md#data) section of `config.yaml`. \ No newline at end of file diff --git a/docs/docs/hub/blocks/bundles.md b/docs/docs/hub/blocks/bundles.md new file mode 100644 index 000000000..6d54ed519 --- /dev/null +++ b/docs/docs/hub/blocks/bundles.md @@ -0,0 +1,39 @@ +--- +title: Bundles +sidebar_label: Bundles +description: Introduction to bundles +keywords: [blocks, bundles] +--- + +# Bundles + +Bundles are collections of blocks that are commonly used together. You can use them to add multiple building blocks to your custom AI code assistants at once. They are only a concept on [hub.continue.dev](https://hub.continue.dev), so they are not represented in `config.yaml`. + +## Use a bundle + +Once you know which bundle you want to use, you’ll need to + +1. Make sure the correct assistant is in the sidebar +2. Click “Add all blocks". This adds the individual blocks to your assistant. +3. Add any required inputs (e.g. secrets) for each block. +4. Select “Save changes” in assistant sidebar on the right hand side + +After this, you can then go to your IDE extension using the "Open VS Code" or "Open Jetbrains" buttons and begin using the new blocks. + +## Create a bundle + +To create a bundle, click “New bundle” in the header. + +![New bundle button](/img/hub/bundle-new-button.png) + +Choose a name, slug, description, and visibility for your bundle. + +Then, search blocks using the "Search blocks" input and add them to your bundle. + +![Create bundle page](/img/hub/bundle-create-page.png) + +Once you have added all the blocks you want in your bundle, click "Create Bundle" to save it and make it available for use. + +## Remix a bundle + +It is not currently possible to remix a bundle. \ No newline at end of file diff --git a/docs/docs/hub/blocks/create-a-block.md b/docs/docs/hub/blocks/create-a-block.md new file mode 100644 index 000000000..870295c99 --- /dev/null +++ b/docs/docs/hub/blocks/create-a-block.md @@ -0,0 +1,32 @@ +--- +title: Create a block +sidebar_label: Create a block +description: Guide to creating blocks +keywords: [blocks, creation, create, use] +--- + +# Create a block + +## Remix a block + +You should remix a block if you want to use it after some modifications. + +By clicking the “remix” button, you’ll be taken to the “Create a remix” page. + +![Remix block button](/img/hub/block-remix-button.png) + +Once here, you’ll be able to 1) edit YAML configuration for the block and 2) change name, description, icon, etc. Clicking “Create block” will make this block available for use in an assistant. + +## Create a block from scratch + +To create a block from scratch, you will need to click “New block” in the top bar. + +![New block button](/img/hub/block-new-button.png) + +After filling out information on the block, you will want to create a block following the `config.yaml` [reference documentation](../../yaml-reference.md). Refer to examples of blocks on [hub.continue.dev](https://hub.continue.dev/explore/models) and visit the [YAML Reference](../../yaml-reference.md#complete-yaml-config-example) docs for more details. + +![New block page](/img/hub/block-new-page.png) + +### Block inputs + +Blocks can receive values, including secrets, as inputs through templating. For values that the user of the block needs to set, you can use template variables (e.g. `${{ inputs.API_KEY}}`). Then, the user can set `API_KEY: ${{ secrets.MY_API_KEY }}` in the `with` clause of their assistant. \ No newline at end of file diff --git a/docs/docs/hub/blocks/intro.md b/docs/docs/hub/blocks/intro.md new file mode 100644 index 000000000..919aa9f7d --- /dev/null +++ b/docs/docs/hub/blocks/intro.md @@ -0,0 +1,12 @@ +--- +title: Introduction +sidebar_label: Introduction +description: Introduction to blocks +keywords: [blocks, introduction, basics] +--- + +# Introduction + +Blocks are the components you use to build a custom AI code assistant. These include [models](./block-types.md#models), [rules](./block-types.md#rules), [context providers](./block-types.md#context), [prompts](./block-types.md#prompts), [docs](./block-types.md#docs), [data destinations](./block-types.md#data), and [MCP servers](./block-types.md#mcp-servers). + +Blocks follow the [`config.yaml`](../../yaml-reference.md) format. When combined with other blocks into a complete `config.yaml`, they form a custom AI code assistant. diff --git a/docs/docs/hub/blocks/use-a-block.md b/docs/docs/hub/blocks/use-a-block.md new file mode 100644 index 000000000..ca4b6e067 --- /dev/null +++ b/docs/docs/hub/blocks/use-a-block.md @@ -0,0 +1,15 @@ +--- +title: Use a block +description: Guide to using blocks +keywords: [blocks, usage, use] +--- + +# Use a block + +Blocks can be used by adding them to assistants: +- [Create an assistant](../assistants/create-an-assistant.md) +- [Edit an assistant](../assistants/edit-an-assistant.md) + +Some blocks require inputs. If you are missing an input for a block, a notification icon will show up in the sidebar next to the block. Click the notification to select which secret to use for the block input: + +![Block inputs](/img/hub/block-inputs.png) \ No newline at end of file diff --git a/docs/docs/hub/governance/org-permissions.md b/docs/docs/hub/governance/org-permissions.md new file mode 100644 index 000000000..85d4f613e --- /dev/null +++ b/docs/docs/hub/governance/org-permissions.md @@ -0,0 +1,18 @@ +--- +title: Org Permissions +description: Org Permissions +keywords: [governance, organization, org, permissions] +--- + +# Organization Permissions + +**Users can have the following roles within an organization:** + +1. Admins are users who can manage members, secrets, blocks, assistants, etc. +2. Members are users who can use assistants, blocks, secrets, etc. + +**User permissions for each role depend on the pricing plan:** + +- [Solo](./pricing.md#solo) +- [Teams](./pricing.md#teams) +- [Enterprise](./pricing.md#enterprise) \ No newline at end of file diff --git a/docs/docs/hub/governance/pricing.md b/docs/docs/hub/governance/pricing.md new file mode 100644 index 000000000..06dd03c1e --- /dev/null +++ b/docs/docs/hub/governance/pricing.md @@ -0,0 +1,35 @@ +--- +title: Pricing +description: Solo, Teams, Enterprise, and Models Add-On pricing +keywords: [solo, teams, enterprise, models add-on] +--- + +# Pricing + +## Solo + +**Solo** is best suited for individuals and small teams with "single-player" problems. + +You can read more about what **Solo** includes [here](https://hub.continue.dev/pricing). + +## Teams + +**Teams** is best suited for growing teams with "multiplayer" problems. + +You can read more about what **Teams** includes [here](https://hub.continue.dev/pricing). + +## Enterprise + +**Enterprise** is best suited for large teams with enterprise-grade requirements. + +You can read more about what **Enterprise** includes [here](https://hub.continue.dev/pricing). + +## Models Add-On + +The **Models Add-On** allows you to use a variety of frontier models for a flat monthly fee. It’s designed to cover the usage of most developers. + +You can read more about usage limits and what models are included [here](https://hub.continue.dev/pricing). + +### Free Trial + +To try out Continue, we offer a free trial of the **Models Add-On** that allows you to use 50 Chat requests and 2,000 autocomplete requests. \ No newline at end of file diff --git a/docs/docs/hub/introduction.md b/docs/docs/hub/introduction.md new file mode 100644 index 000000000..88cca05f0 --- /dev/null +++ b/docs/docs/hub/introduction.md @@ -0,0 +1,16 @@ +--- +title: Introduction +description: Introduction +keywords: [continue, hub, introduction] +sidebar_label: Introduction +--- + +# Introduction + +![Continue Hub](/img/hub/models-page.png) + +[Continue Hub](https://hub.continue.dev) makes it simple to create custom AI code [assistants](./assistants/intro.md), providing a registry for defining, managing, and sharing assistant [building blocks](./blocks/intro.md). + +Assistants can contain several types of blocks, including [models](./blocks/block-types.md#models), [rules](./blocks/block-types.md#rules), [context providers](./blocks/block-types.md#context), [prompts](./blocks/block-types.md#prompts), [docs](./blocks/block-types.md#docs), [data destinations](./blocks/block-types.md#data), and [MCP servers](./blocks/block-types.md#mcp-servers). + +Continue Hub also makes it easy for engineering leaders to centrally [configure](./secrets/secret-types.md) and [govern](./governance/org-permissions.md) blocks and assistants for their organization. diff --git a/docs/docs/hub/secrets/secret-resolution.md b/docs/docs/hub/secrets/secret-resolution.md new file mode 100644 index 000000000..7fe357c8f --- /dev/null +++ b/docs/docs/hub/secrets/secret-resolution.md @@ -0,0 +1,22 @@ +--- +title: Secret Resolution +description: Intro to Secret Resolution +keywords: [secrets, resolution] +sidebar_label: Resolution +--- + +# Secret Resolution + +[User or Org secrets](./secret-types.md) should be used depending on how users want them to be shared within their organization and assistants. + +For individual users and [Solo](../governance/pricing.md#solo) organizations, secret resolution is performed in the following order: + +1. User [models add-on](../governance/pricing.md#models-add-on) (if subscribed) +2. [User secrets](../secrets/secret-types.md#user-secrets) (if set) +3. [Free trial](../governance/pricing.md#free-trial) (if below limit) + +For [Teams](../governance/pricing.md#teams) and [Enterprise](../governance/pricing.md#enterprise) organizations, secret resolution is performed in the following order: + +1. Org [models add-on](../governance/pricing.md#models-add-on) (if subscribed) +2. [Org secrets](../secrets/secret-types.md#org-secrets) (if set) +3. [User secrets](../secrets/secret-types.md#user-secrets) (if set) \ No newline at end of file diff --git a/docs/docs/hub/secrets/secret-types.md b/docs/docs/hub/secrets/secret-types.md new file mode 100644 index 000000000..655825ca9 --- /dev/null +++ b/docs/docs/hub/secrets/secret-types.md @@ -0,0 +1,22 @@ +--- +title: Secret Types +description: Intro to Secret Types +keywords: [secrets, types] +sidebar_label: Types +--- + +# Secret Types + +The Continue Hub comes with secrets management built-in. Secrets are values such as API keys or endpoints that can be shared across assistants and within organizations. + +## User secrets + +User secrets are defined by the user for themselves. This means that user secrets are available only to the user that created them. User secrets are assumed to be safe for the user to know, so they will be sent to the IDE extensions alongside the assistant `config.yaml`. + +This allows API requests to be made directly from the IDE extensions. You can use user secrets with [Solo](../governance/pricing.md#solo), [Teams](../governance/pricing.md#teams), and [Enterprise](../governance/pricing.md#enterprise). User secrets can be managed [here](https://hub.continue.dev/settings/secrets) in the hub. + +## Org secrets + +Org secrets are defined by admins for their organization. Org secrets are available to anyone in the organization to use with assistants in that organization. Org secrets are assumed to not be shareable with the user (e.g. you are a team lead who wants to give team members access to models without passing out API keys). + +This is why LLM requests are proxied through api.continue.dev / on-premise proxy and secrets are never sent to the IDE extensions. You can only use org secrets on [Teams](../governance/pricing.md#teams) and [Enterprise](../governance/pricing.md#enterprise). If you are an admin, you can manage secrets for your organization from the org settings page. \ No newline at end of file diff --git a/docs/docs/introduction.md b/docs/docs/introduction.md index 64f83436d..9628dd4cb 100644 --- a/docs/docs/introduction.md +++ b/docs/docs/introduction.md @@ -1,6 +1,6 @@ --- title: Introduction -description: The open-source AI code assistant for developers +description: Create, share, and use custom AI code assistants slug: / keywords: [ @@ -17,9 +17,9 @@ keywords: ![Continue Logo](../static/img/intro.png) -**Continue is the leading open-source AI code assistant inside of [VS Code](https://marketplace.visualstudio.com/items?itemName=Continue.continue) and [JetBrains](https://plugins.jetbrains.com/plugin/22707-continue-extension)** +**Continue enables developers to create, share, and use custom AI code assistants with our open-source [VS Code](https://marketplace.visualstudio.com/items?itemName=Continue.continue) and [JetBrains](https://plugins.jetbrains.com/plugin/22707-continue-extension) extensions and [hub of models, rules, prompts, docs, and other building blocks](https://hub.continue.dev)** -- [Chat](chat/how-to-use-it.md) to understand and iterate on code in the sidebar -- [Autocomplete](autocomplete/how-to-use-it.md) to receive inline code suggestions as you type -- [Edit](edit/how-to-use-it.md) to modify code without leaving your current file -- [Actions](actions/how-to-use-it.md) to establish shortcuts for common use cases +- [Chat](chat/how-to-use-it) to understand and iterate on code in the sidebar +- [Autocomplete](autocomplete/how-to-use-it) to receive inline code suggestions as you type +- [Edit](edit/how-to-use-it) to modify code without leaving your current file +- [Actions](actions/how-to-use-it) to establish shortcuts for common use cases diff --git a/docs/docs/json-reference.md b/docs/docs/json-reference.md new file mode 100644 index 000000000..ba21ccb65 --- /dev/null +++ b/docs/docs/json-reference.md @@ -0,0 +1,438 @@ +--- +title: config.json Reference +description: Reference for the Continue _config.json_ configuration file +keywords: [config, config_schema.json, json] +--- + +:::info +`config.json` is the original Continue configuration format. The newer and preferred format is [`YAML Config`](./reference). See the [migration guide](./yaml-migration). +::: + +Below are details for each property that can be set in `config.json`. The config schema code is found in [`extensions/vscode/config_schema.json`](https://github.com/continuedev/continue/blob/main/extensions/vscode/config_schema.json). + +**All properties at all levels are optional unless explicitly marked required** + +### `models` + +Your **chat** models are defined here, which are used for [Chat](./chat/how-to-use-it), [Edit](./edit/how-to-use-it), and [Actions](./actions/how-to-use-it). +Each model has specific configuration options tailored to its provider and functionality, which can be seen as suggestions while editing the json. + +**Properties:** + +- `title` (**required**): The title to assign to your model, shown in dropdowns, etc. +- `provider` (**required**): The provider of the model, which determines the type and interaction method. Options inclued `openai`, `ollama`, `xAI`, etc., see IntelliJ suggestions. +- `model` (**required**): The name of the model, used for prompt template auto-detection. Use `AUTODETECT` special name to get all available models. +- `apiKey`: API key required by providers like OpenAI, Anthropic, Cohere, and xAI. +- `apiBase`: The base URL of the LLM API. +- `contextLength`: Maximum context length of the model, typically in tokens (default: 2048). +- `maxStopWords`: Maximum number of stop words allowed, to avoid API errors with extensive lists. +- `template`: Chat template to format messages. Auto-detected for most models but can be overridden. See intelliJ suggestions. +- `promptTemplates`: A mapping of prompt template names (e.g., `edit`) to template strings. [Customization Guide](https://docs.continue.dev/model-setup/configuration#customizing-the-edit-prompt). +- `completionOptions`: Model-specific completion options, same format as top-level [`completionOptions`](#completionoptions), which they override. +- `systemMessage`: A system message that will precede responses from the LLM. +- `requestOptions`: Model-specific HTTP request options, same format as top-level [`requestOptions`](#requestoptions), which they override. +- `apiType`: Specifies the type of API (`openai` or `azure`). +- `apiVersion`: Azure API version (e.g., `2023-07-01-preview`). +- `engine`: Engine for Azure OpenAI requests. +- `capabilities`: Override auto-detected capabilities: + - `uploadImage`: Boolean indicating if the model supports image uploads. + +_(AWS Only)_ + +- `profile`: AWS security profile for authorization. +- `modelArn`: AWS ARN for imported models (e.g., for `bedrockimport` provider). +- `region`: Region where the model is hosted (e.g., `us-east-1`, `eu-central-1`). + +Example: + +```json title="config.json" +{ + "models": [ + { + "title": "Ollama", + "provider": "ollama", + "model": "AUTODETECT" + }, + { + "model": "gpt-4o", + "contextLength": 128000, + "title": "GPT-4o", + "provider": "openai", + "apiKey": "" + } + ] +} +``` + +### `tabAutocompleteModel` + +Specifies the model or models for tab autocompletion, defaulting to an Ollama instance. This property uses the same format as `models`. Can be an array of models or an object for one model. + +Example + +```json title="config.json" +{ + "tabAutocompleteModel": { + "title": "My Starcoder", + "provider": "ollama", + "model": "starcoder2:3b" + } +} +``` + +### `tabAutocompleteOptions` + +Specifies options for tab autocompletion behavior. + +**Properties:** + +- `disable`: If `true`, disables tab autocomplete (default: `false`). +- `maxPromptTokens`: Maximum number of tokens for the prompt (default: `1024`). +- `debounceDelay`: Delay (in ms) before triggering autocomplete (default: `350`). +- `maxSuffixPercentage`: Maximum percentage of prompt for suffix (default: `0.2`). +- `prefixPercentage`: Percentage of input for prefix (default: `0.3`). +- `template`: Template string for autocomplete, using Mustache templating. You can use the `{{{ prefix }}}`, `{{{ suffix }}}`, `{{{ filename }}}`, `{{{ reponame }}}`, and `{{{ language }}}` variables. +- `onlyMyCode`: If `true`, only includes code within the repository (default: `true`). + +Example + +````json title="config.json" +{ + "tabAutocompleteOptions": { + "debounceDelay": 500, + "maxPromptTokens": 1500, + "disableInFiles": ["*.md"] + } +} + +### `embeddingsProvider` + +Embeddings model settings - the model used for @Codebase and @docs. + +**Properties:** + +- `provider` (**required**): Specifies the embeddings provider, with options including `transformers.js`, `ollama`, `openai`, `cohere`, `gemini`, etc +- `model`: Model name for embeddings. +- `apiKey`: API key for the provider. +- `apiBase`: Base URL for API requests. +- `requestOptions`: Additional HTTP request settings specific to the embeddings provider. +- `maxChunkSize`: Maximum tokens per document chunk. Minimum is 128 tokens. +- `maxBatchSize`: Maximum number of chunks per request. Minimum is 1 chunk. + +(AWS ONLY) + +- `region`: Specifies the region hosting the model. +- `profile`: AWS security profile. + +Example: + +```json title="config.json" +{ + "embeddingsProvider": { + "provider": "openai", + "model": "text-embedding-ada-002", + "apiKey": "", + "maxChunkSize": 256, + "maxBatchSize": 5 + } +} +```` + +### `completionOptions` + +Parameters that control the behavior of text generation and completion settings. Top-level `completionOptions` apply to all models, _unless overridden at the model level_. + +**Properties:** + +- `stream`: Whether to stream the LLM response. Currently only respected by the `anthropic` and `ollama` providers; other providers will always stream (default: `true`). +- `temperature`: Controls the randomness of the completion. Higher values result in more diverse outputs. +- `topP`: The cumulative probability for nucleus sampling. Lower values limit responses to tokens within the top probability mass. +- `topK`: The maximum number of tokens considered at each step. Limits the generated text to tokens within this probability. +- `presencePenalty`: Discourages the model from generating tokens that have already appeared in the output. +- `frequencePenalty`: Penalizes tokens based on their frequency in the text, reducing repetition. +- `mirostat`: Enables Mirostat sampling, which controls the perplexity during text generation. Supported by Ollama, LM Studio, and llama.cpp providers (default: `0`, where `0` = disabled, `1` = Mirostat, and `2` = Mirostat 2.0). +- `stop`: An array of stop tokens that, when encountered, will terminate the completion. Allows specifying multiple end conditions. +- `maxTokens`: The maximum number of tokens to generate in a completion (default: `2048`). +- `numThreads`: The number of threads used during the generation process. Available only for Ollama as `num_thread`. +- `keepAlive`: For Ollama, this parameter sets the number of seconds to keep the model loaded after the last request, unloading it from memory if inactive (default: `1800` seconds, or 30 minutes). +- `useMmap`: For Ollama, this parameter allows the model to be mapped into memory. If disabled can enhance response time on low end devices but will slow down the stream. + +Example + +```json title="config.json" +{ + "completionOptions": { + "stream": false, + "temperature": 0.5 + } +} +``` + +### `requestOptions` + +Default HTTP request options that apply to all models and context providers, unless overridden at the model level. + +**Properties:** + +- `timeout`: Timeout for each request to the LLM (default: 7200 seconds). +- `verifySsl`: Whether to verify SSL certificates for requests. +- `caBundlePath`: Path to a custom CA bundle for HTTP requests - path to `.pem` file (or array of paths) +- `proxy`: Proxy URL to use for HTTP requests. +- `headers`: Custom headers for HTTP requests. +- `extraBodyProperties`: Additional properties to merge with the HTTP request body. +- `noProxy`: List of hostnames that should bypass the specified proxy. +- `clientCertificate`: Client certificate for HTTP requests. + + - `cert`: Path to the client certificate file. + - `key`: Path to the client certificate key file. + - `passphrase`: Optional passphrase for the client certificate key file. + +Example + +```json title="config.json" +{ + "requestOptions": { + "headers": { + "X-Auth-Token": "xxx" + } + } +} +``` + +### `reranker` + +Configuration for the reranker model used in response ranking. + +**Properties:** + +- `name` (**required**): Reranker name, e.g., `cohere`, `voyage`, `llm`, `huggingface-tei`, `bedrock` +- `params`: + - `model`: Model name + - `apiKey`: Api key + - `region`: Region (for Bedrock only) + +Example + +```json title="config.json" +{ + "reranker": { + "name": "voyage", + "params": { + "model": "rerank-2", + "apiKey": "" + } + } +} +``` + +### `docs` + +List of documentation sites to index. + +**Properties:** + +- `title` (**required**): Title of the documentation site, displayed in dropdowns, etc. +- `startUrl` (**required**): Start page for crawling - usually root or intro page for docs +- `rootUrl`: Crawler will only index docs within this domain - pages that contain this URL +- `maxDepth`: Maximum depth for crawling. Default `3` +- `favicon`: URL for site favicon (default is `/favicon.ico` from `startUrl`). + +Example + +```json title="config.json" +{ + "docs": [ + { + "title": "Continue", + "startUrl": "https://docs.continue.dev/intro", + "rootUrl": "https://docs.continue.dev", + "faviconUrl": "https://docs.continue.dev/favicon.ico" + } + ] +} +``` + +### `slashCommands` + +Custom commands initiated by typing "/" in the sidebar. Commands include predefined functionality or may be user-defined. + +**Properties:** + +- `name`: The command name. Options include "issue", "share", "cmd", "http", "commit", and "review". +- `description`: Brief description of the command. +- `step`: Used for built-in commands; set the name for pre-configured options. +- `params`: Additional parameters to configure command behavior (command-specific - see code for command) + +Example: + +```json title="config.json" +{ + "slashCommands": [ + { + "name": "commit", + "description": "Generate a commit message" + }, + { + "name": "share", + "description": "Export this session as markdown" + }, + { + "name": "cmd", + "description": "Generate a shell command" + } + ] +} +``` + +### `customCommands` + +User-defined commands for prompt shortcuts in the sidebar, allowing quick access to common actions. + +**Properties:** + +- `name`: The name of the custom command. +- `prompt`: Text prompt for the command. +- `description`: Brief description explaining the command's function. + +Example: + +```json title="config.json" +{ + "customCommands": [ + { + "name": "test", + "prompt": "Write a comprehensive set of unit tests for the selected code. It should setup, run tests that check for correctness including important edge cases, and teardown. Ensure that the tests are complete and sophisticated. Give the tests just as chat output, don't edit any file.", + "description": "Write unit tests for highlighted code" + } + ] +} +``` + +### `contextProviders` + +List of the pre-defined context providers that will show up as options while typing in the chat, and their customization with `params`. + +**Properties:** + +- `name`: Name of the context provider, e.g. `docs` or `web` +- `params`: A context-provider-specific record of params to configure the context behavior + +Example + +```json title="config.json" +{ + "contextProviders": [ + { + "name": "code", + "params": {} + }, + { + "name": "docs", + "params": {} + }, + { + "name": "diff", + "params": {} + }, + { + "name": "open", + "params": {} + } + ] +} +``` + +### `disableSessionTitles` + +Prevents generating summary titles for each chat session when set to `true`. + +### `ui` + +Customizable UI settings to control interface appearance and behavior. + +**Properties:** + +- `codeBlockToolbarPosition`: Sets the toolbar position within code blocks, either `top` (default) or `bottom`. +- `fontSize`: Specifies font size for UI elements. +- `displayRawMarkdown`: If `true`, shows raw markdown in responses. +- `showChatScrollbar`: If `true`, enables a scrollbar in the chat window. +- `codeWrap`: If `true`, enables text wrapping in code blocks. + +Example: + +```json title="config.json" +{ + "ui": { + "codeBlockToolbarPosition": "bottom", + "fontSize": 14, + "displayRawMarkdown": false, + "showChatScrollbar": false, + "codeWrap": false + } +} +``` + +### `allowAnonymousTelemetry` + +When `true`, anonymous usage data is collected using Posthog, to improve features. Default is `true`. + +### `userToken` + +An optional token that identifies the user, primarily for authenticated services. + +### `systemMessage` + +Defines a system message that appears before every response from the language model, providing guidance or context. + +### `experimental` + +Several experimental config parameters are available, as described below: + +`experimental`: + +- `defaultContext`: Defines the default context for the LLM. Uses the same format as `contextProviders` but includes an additional `query` property to specify custom query parameters.= +- `modelRoles`: + - `inlineEdit`: Model title for inline edits. + - `applyCodeBlock`: Model title for applying code blocks. + - `repoMapFileSelection`: Model title for repo map selections. +- `quickActions`: Array of custom quick actions + - `title` (**required**): Display title for the quick action. + - `prompt` (**required**): Prompt for quick action. + - `sendToChat`: If `true`, sends result to chat; else inserts in document. Default is `false`. +- `contextMenuPrompts`: + - `comment`: Prompt for commenting code. + - `docstring`: Prompt for adding docstrings. + - `fix`: Prompt for fixing code. + - `optimize`: Prompt for optimizing code. +- `modelContextProtocolServers`: See [Model Context Protocol](/customize/context-providers#model-context-protocol) + +Example + +```json title="config.json" +{ + "experimental": { + "modelRoles": { + "inlineEdit": "Edit Model" + }, + "quickActions": [ + { + "title": "Tags", + "prompt": "Return a list of any function and class names from the included code block", + "sendToChat": true + } + ], + "contextMenuPrompts": { + "fixGrammar": "Fix grammar in the above but allow for typos." + }, + "modelContextProtocolServers": [ + { + "transport": { + "type": "stdio", + "command": "uvx", + "args": ["mcp-server-sqlite", "--db-path", "/Users/NAME/test.db"] + } + } + ] + } +} +``` diff --git a/docs/docs/reference.md b/docs/docs/reference.md index a14da2944..143fec98b 100644 --- a/docs/docs/reference.md +++ b/docs/docs/reference.md @@ -4,6 +4,10 @@ description: Reference for the Continue _config.json_ configuration file keywords: [config, config_schema.json, json] --- +:::info +We recently introduced a new configuration format, `config.yaml`, to replace `config.json`. See the `config.yaml` reference and migration guide [here](./yaml-reference.md). +::: + Below are details for each property that can be set in `config.json`. The config schema code is found in [`extensions/vscode/config_schema.json`](https://github.com/continuedev/continue/blob/main/extensions/vscode/config_schema.json). **All properties at all levels are optional unless explicitly marked required** @@ -32,6 +36,7 @@ Each model has specific configuration options tailored to its provider and funct - `engine`: Engine for Azure OpenAI requests. - `capabilities`: Override auto-detected capabilities: - `uploadImage`: Boolean indicating if the model supports image uploads. + - `tools`: Boolean indicating if the model supports tool use. _(AWS Only)_ @@ -108,13 +113,13 @@ Embeddings model settings - the model used for @Codebase and @docs. **Properties:** -- `provider` (**required**): Specifies the embeddings provider, with options including `transformers.js`, `ollama`, `openai`, `cohere`, `free-trial`, `gemini`, etc +- `provider` (**required**): Specifies the embeddings provider, with options including `transformers.js`, `ollama`, `openai`, `cohere`, `gemini`, etc - `model`: Model name for embeddings. - `apiKey`: API key for the provider. - `apiBase`: Base URL for API requests. - `requestOptions`: Additional HTTP request settings specific to the embeddings provider. -- `maxChunkSize`: Maximum tokens per document chunk. Minimum is 128 tokens. -- `maxBatchSize`: Maximum number of chunks per request. Minimum is 1 chunk. +- `maxEmbeddingChunkSize`: Maximum tokens per document chunk. Minimum is 128 tokens. +- `maxEmbeddingBatchSize`: Maximum number of chunks per request. Minimum is 1 chunk. (AWS ONLY) @@ -129,8 +134,8 @@ Example: "provider": "openai", "model": "text-embedding-ada-002", "apiKey": "", - "maxChunkSize": 256, - "maxBatchSize": 5 + "maxEmbeddingChunkSize": 256, + "maxEmbeddingBatchSize": 5 } } ``` @@ -146,7 +151,7 @@ Parameters that control the behavior of text generation and completion settings. - `topP`: The cumulative probability for nucleus sampling. Lower values limit responses to tokens within the top probability mass. - `topK`: The maximum number of tokens considered at each step. Limits the generated text to tokens within this probability. - `presencePenalty`: Discourages the model from generating tokens that have already appeared in the output. -- `frequencePenalty`: Penalizes tokens based on their frequency in the text, reducing repetition. +- `frequencyPenalty`: Penalizes tokens based on their frequency in the text, reducing repetition. - `mirostat`: Enables Mirostat sampling, which controls the perplexity during text generation. Supported by Ollama, LM Studio, and llama.cpp providers (default: `0`, where `0` = disabled, `1` = Mirostat, and `2` = Mirostat 2.0). - `stop`: An array of stop tokens that, when encountered, will terminate the completion. Allows specifying multiple end conditions. - `maxTokens`: The maximum number of tokens to generate in a completion (default: `2048`). @@ -202,7 +207,7 @@ Configuration for the reranker model used in response ranking. **Properties:** -- `name` (**required**): Reranker name, e.g., `cohere`, `voyage`, `llm`, `free-trial`, `huggingface-tei`, `bedrock` +- `name` (**required**): Reranker name, e.g., `cohere`, `voyage`, `llm`, `huggingface-tei`, `bedrock` - `params`: - `model`: Model name - `apiKey`: Api key diff --git a/docs/docs/telemetry.md b/docs/docs/telemetry.md index 3d59ebf74..e21a93164 100644 --- a/docs/docs/telemetry.md +++ b/docs/docs/telemetry.md @@ -6,13 +6,13 @@ keywords: [telemetry, anonymous, usage info, opt out] ## Overview -Continue collects and reports **anonymous** usage information to help us improve our product. This data enables us to understand user interactions and optimize the user experience effectively. You can opt out of telemetry collection at any time if you prefer not to share your usage information. +The open-source Continue Extensions collect and report **anonymous** usage information to help us improve our product. This data enables us to understand user interactions and optimize the user experience effectively. You can opt out of telemetry collection at any time if you prefer not to share your usage information. We utilize [Posthog](https://posthog.com/), an open-source platform for product analytics, to gather and store this data. For transparency, you can review the implementation code [here](https://github.com/continuedev/continue/blob/main/gui/src/hooks/CustomPostHogProvider.tsx) or read our [official privacy policy](https://continue.dev/privacy). ## Tracking Policy -All data collected by Continue is anonymized and stripped of personally identifiable information (PII) before being sent to PostHog. We are committed to maintaining the privacy and security of your data. +All data collected by the open-source Continue extensions is anonymized and stripped of personally identifiable information (PII) before being sent to PostHog. We are committed to maintaining the privacy and security of your data. ## What We Track @@ -28,4 +28,4 @@ The following usage information is collected and reported: You can disable anonymous telemetry by visiting the [User Settings Page](./customize/settings.md) and toggling "Allow Anonymous Telemetry" off. -Alternatively in VS Code, you can disable telemetry through your VS Code settings by unchecking the "Continue: Telemetry Enabled" box (this will override the Settings Page settings). +Alternatively in VS Code, you can disable telemetry through your VS Code settings by unchecking the "Continue: Telemetry Enabled" box (this will override the Settings Page settings). VS Code settings can be accessed with `File` > `Preferences` > `Settings` (or use the keyboard shortcut ctrl + , on Windows/Linux or cmd + , on macOS). diff --git a/docs/docs/troubleshooting.md b/docs/docs/troubleshooting.mdx similarity index 90% rename from docs/docs/troubleshooting.md rename to docs/docs/troubleshooting.mdx index 52dc785b2..ae54ee8ac 100644 --- a/docs/docs/troubleshooting.md +++ b/docs/docs/troubleshooting.mdx @@ -4,6 +4,9 @@ description: Troubleshooting while waiting for help during beta / alpha testing keywords: [reload, delete, manually, logs, server, console] --- +import Tabs from "@theme/Tabs"; +import TabItem from "@theme/TabItem"; + The Continue VS Code extension is currently in beta, and the JetBrains extension is in Alpha. If you are having trouble, please follow the steps below. 1. [Check the logs](#check-the-logs) @@ -24,7 +27,9 @@ To solve many problems, the first step is reading the logs to find the relevant In order to view debug logs, which contain extra information, click the dropdown at the top that says "Default levels" and select "Verbose". ::: -1. cmd + shift + P for MacOS or ctrl + shift + P for Windows +1. cmd + shift + P for MacOS or ctrl + + shift + + P for Windows 2. Search for and then select "Developer: Toggle Developer Tools" 3. This will open the [Chrome DevTools window](https://developer.chrome.com/docs/devtools/) 4. Select the `Console` tab @@ -83,22 +88,34 @@ If your keyboard shortcuts are not resolving, you may have other commands that a #### Configure Certificates -If you're seeing a `fetch failed` error and your network requires custom certificates, you will need to configure them in `config.json`. In each of the objects in the `"models"` array, add `requestOptions.caBundlePath` like this: +If you're seeing a `fetch failed` error and your network requires custom certificates, you will need to configure them in your config file. In each of the objects in the `"models"` array, add `requestOptions.caBundlePath` like this: -```json -{ - "models": [ - { - "title": "My Model", + + + ```yaml title="config.yaml" + models: + - name: My Model ... - "requestOptions": { - "caBundlePath": "/path/to/cert.pem" + requestOptions: + caBundlePath: /path/to/cert.pem + ``` + + + ```json title="config.json" + { + "models": [ + { + "title": "My Model", + ... + "requestOptions": { + "caBundlePath": "/path/to/cert.pem" + } } - } - ], - ... -} -``` + ], + } + ``` + + You may also set `requestOptions.caBundlePath` to an array of paths to multiple certificates. diff --git a/docs/docs/yaml-migration.md b/docs/docs/yaml-migration.md index 04f1b4e15..0a7773670 100644 --- a/docs/docs/yaml-migration.md +++ b/docs/docs/yaml-migration.md @@ -11,8 +11,8 @@ Continue's YAML configuration format provides more readable, maintainable, consi See also - [Intro to YAML](https://yaml.org/) -- [JSON Continue Config Reference](/reference) -- [YAML Continue Config Reference](/yaml-reference) +- [JSON Continue Config Reference](/json-reference) +- [YAML Continue Config Reference](/reference) ## Create YAML file @@ -37,23 +37,22 @@ Add all model configurations in `config.json`, including models in `models`, `ta - `inlineEdit` -> e.g. `roles: [chat, edit]` - `applyCodeBlock` -> e.g. `roles: [chat, apply]` -Model-level `requestOptions` remain, with minor changes. See [YAML Continue Config Reference](/yaml-reference#requestoptions) +Model-level `requestOptions` remain, with minor changes. See [YAML Continue Config Reference](/reference#requestoptions) -Model-level `completionOptions` are replaced by `defaultCompletionOptions`, with minor changes. See [YAML Continue Config Reference](/yaml-reference#completionoptions) +Model-level `completionOptions` are replaced by `defaultCompletionOptions`, with minor changes. See [YAML Continue Config Reference](/reference#completionoptions) - **Before** -```json title="config.json" +```json title="config.json"" { "models": [ { "title": "GPT-4", "provider": "openai", "model": "gpt-4", - "apiKey": "YOUR_API_KEY", + "apiKey": "", "completionOptions": { "temperature": 0.5, "maxTokens": 2000 @@ -82,15 +81,15 @@ Model-level `completionOptions` are replaced by `defaultCompletionOptions`, with "embeddingsProvider": { "provider": "openai", "model": "text-embedding-ada-002", - "apiKey": "", - "maxChunkSize": 256, - "maxBatchSize": 5 + "apiKey": "", + "maxEmbeddingChunkSize": 256, + "maxEmbeddingBatchSize": 5 }, "reranker": { "name": "voyage", "params": { "model": "rerank-2", - "apiKey": "" + "apiKey": "" } } } @@ -103,7 +102,7 @@ models: - name: GPT-4 provider: openai model: gpt-4 - apiKey: + apiKey: defaultCompletionOptions: temperature: 0.5 maxTokens: 2000 @@ -113,8 +112,7 @@ models: - name: My Voyage Reranker provider: voyage - apiKey: - roles: + apiKey: - rerank - name: My Starcoder @@ -125,9 +123,12 @@ models: - name: My Ada Embedder provider: openai - apiKey: + apiKey: roles: - embed + embedOptions: + - maxChunkSize: 256 + - maxBatchSize: 5 - name: Ollama Autodetect provider: ollama @@ -139,13 +140,13 @@ models: apiBase: http://3.3.3.3/v1 requestOptions: headers: - X-Auth-Token: + X-Auth-Token: roles: - chat - apply ``` -Note that the `repoMapFileSelection` experimental model role has been deprecated. +Note that the `repoMapFileSelection` experimental model role has been deprecated and is only available in `config.json`. ### Context Providers @@ -156,7 +157,7 @@ The JSON `contextProviders` field is replaced by the YAML `context` array. **Before** -```json title="config.json" +```json title="config.json"" { "contextProviders": [ { @@ -188,7 +189,7 @@ context: nRetrieve: 30 nFinal: 3 - - params: diff + - provider: diff ``` ### System Message @@ -197,7 +198,7 @@ The `systemMessage` property has been replaced with a `rules` property that take **Before** -```json title="config.json" +```json title="config.json"" { "systemMessage": "Always give concise responses" } @@ -216,7 +217,7 @@ Rather than with `customCommands`, you can now use the `prompts` field to define **Before** -```json title="config.json" +```json title="config.json"" { "customCommands": [ { @@ -251,7 +252,7 @@ Documentation is largely the same, but the `title` property has been replaced wi **Before** -```json title="config.json" +```json title="config.json"" { "docs": [ { @@ -279,8 +280,6 @@ docs: ### MCP Servers - - **Properties:** - `name` (**required**): The name of the MCP server. @@ -290,7 +289,7 @@ docs: **Before** -```json title="config.json" +```json title="config.json"" { "experimental": { "modelContextProtocolServers": [ @@ -345,10 +344,13 @@ The following top-level fields from `config.json` still work when using `config. - `template` - `onlyMyCode` - `analytics` + +The following top-level fields from `config.json` have been deprecated. Most UI-related and user-specific options will move into a settings page in the UI + - `customCommands` - `experimental` - `userToken` ## New Configuration options -The YAML configuration format offers new configuration options not available in the JSON format. See the [YAML Config Reference](/yaml-reference) for more information. +The YAML configuration format offers new configuration options not available in the JSON format. See the [YAML Config Reference](./reference) for more information. diff --git a/docs/docs/yaml-reference.md b/docs/docs/yaml-reference.md index e504c95fd..9de133cd7 100644 --- a/docs/docs/yaml-reference.md +++ b/docs/docs/yaml-reference.md @@ -4,34 +4,103 @@ description: Reference for the Continue configuration YAML file keywords: [config, yaml, configuration, customize, customization] --- -# Config YAML Reference +# confg.yaml Reference - +## Introduction -Continue can be configured using a YAML file `config.yaml` which for local configuration can be placed in your global `.continue` folder (`~/.continue` on Mac, `%USERPROFILE%\.continue`) +Continue hub assistants are defined using the `config.yaml` specification. Local assistants can also be configured using a YAML file `config.yaml` placed in your global `.continue` folder (`~/.continue` on Mac, `%USERPROFILE%\.continue`) + +:::info +Config YAML replaces `config.json`. View the **[Migration Guide](/yaml-migration)**. +::: + +An assistant is made up of: + +1. **Top level properties**, which specify the `name`, `version`, and `config.yaml` `schema` for the assistant +2. **Block lists**, which are composable arrays of coding assistant building blocks available to the assistant, such as models, docs, and context providers. + +A block is a single standalone building block of a coding assistants, e.g., one model or one documentation source. In `config.yaml` syntax, a block consists of the same top-level properties as assistants (`name`, `version`, and `schema`), but only has **ONE** item under whichever block type it is. + +Examples of blocks and assistants can be found on the [Continue hub](https://hub.continue.dev/explore/assistants). + +Assistants can either explicitly define blocks - see [Properties](#properties) below - or import and configure existing hub blocks. + +### Using Blocks + +Hub blocks and assistants are identified with a slug in the format `owner-slug/block-or-assistant-slug`, where an owner can be a user or organization. + +Blocks can be imported into an assistant by adding a `uses` clause under the block type. This can be alongside other `uses` clauses or explicit blocks of that type. + +For example, the following assistant imports an Anthropic model and defines an Ollama DeepSeek one. + +```yaml title="Assistant models section" +models: + - uses: anthropic/claude-3.5-sonnet # an imported model block + - model: deepseek-reasoner # an explicit model block + provider: ollama +``` + +### Inputs + +Blocks can be passed user inputs, including hub secrets and raw text values. To create a block that has an input, use mustache templating as follows: + +```yaml title="Block config.yaml" +name: myprofile/custom-model +models: + - name: My Favorite Model + provider: anthropic + apiKey: ${{ inputs.ANTHROPIC_API_KEY }} + defaultCompletionOptions: + temperature: ${{ inputs.TEMP }} +``` + +Which can then be imported like + +```yaml title="Assistant config.yaml" +name: myprofile/custom-assistant +models: + - uses: myprofile/custom-model + with: + ANTHROPIC_API_KEY: ${{ secrets.MY_ANTHROPIC_API_KEY }} + TEMP: 0.9 +``` + +Note that hub secrets can be passed as inputs, using the a similar mustache format: `secrets.SECRET_NAME`. + +### Overrides + +Block properties can be also be directly overriden using `override`. For example: + +```yaml title="Assistant config.yaml" +name: myprofile/custom-assistant +models: + - uses: myprofile/custom-model + with: + ANTHROPIC_API_KEY: ${{ secrets.MY_ANTHROPIC_API_KEY }} + TEMP: 0.9 + override: + roles: + - chat +``` + +## Properties Below are details for each property that can be set in `config.yaml`. -:::info -Config YAML does not work alongside `config.json` - it replaces it. View the **[Migration Guide](/yaml-migration)**. `config.yaml` currently only works in VS Code pre-release. -::: - **All properties at all levels are optional unless explicitly marked as required.** -## Properties - The top-level properties in the `config.yaml` configuration file are: - [`name`](#name) (**required**) - [`version`](#version) (**required**) +- [`schema`](#schema) (**required**) - [`models`](#models) - [`context`](#context) - [`rules`](#rules) - [`prompts`](#prompts) - [`docs`](#docs) - - - [`mcpServers`](#mcpservers) +- [`data`](#data) --- @@ -43,10 +112,16 @@ The `name` property specifies the name of your project or configuration. name: MyProject ``` +--- + ### `version` The `version` property specifies the version of your project or configuration. +### `schema` + +The `schema` property specifies the schema version used for the `config.yaml`, e.g. `v1` + --- ### `models` @@ -58,7 +133,12 @@ The `models` section defines the language models used in your configuration. Mod - `name` (**required**): A unique name to identify the model within your configuration. - `provider` (**required**): The provider of the model (e.g., `openai`, `ollama`). - `model` (**required**): The specific model name (e.g., `gpt-4`, `starcoder`). -- `roles`: An array specifying the roles this model can fulfill, such as `chat`, `autocomplete`, `embed`, `rerank`, `edit`, `apply`, `summarize`. +- `roles`: An array specifying the roles this model can fulfill, such as `chat`, `autocomplete`, `embed`, `rerank`, `edit`, `apply`, `summarize`. The default value is `[chat, edit, apply, summarize]`. Note that the `summarize` role is not currently used. +- `embedOptions`: If the model includes role `embed`, these settings apply for embeddings: + + - `maxChunkSize`: Maximum tokens per document chunk. Minimum is 128 tokens. + - `maxBatchSize`: Maximum number of chunks per request. Minimum is 1 chunk. + - `defaultCompletionOptions`: Default completion options for model settings. **Properties:** @@ -115,7 +195,7 @@ models: The `context` section defines context providers, which supply additional information or context to the language models. Each context provider can be configured with specific parameters. -More information about usage/params for each context provider can be found [here](/customize/context-providers) +More information about usage/params for each context provider can be found [here](/customize/context-providers.mdx) **Properties:** @@ -147,6 +227,9 @@ Example ```yaml title="config.yaml" rules: + - uses: myprofile/my-mood-setter + with: + MOOD: happy - Always annotate Python functions with their parameter and return types - Always write Google style docstrings for functions and classes ``` @@ -179,9 +262,9 @@ List of documentation sites to index. - `name` (**required**): Name of the documentation site, displayed in dropdowns, etc. - `startUrl` (**required**): Start page for crawling - usually root or intro page for docs +- `maxDepth`: Maximum link depth for crawling. Default `4` - `favicon`: URL for site favicon (default is `/favicon.ico` from `startUrl`). -- `maxDepth`: M -- `useLocalCrawling`: Force use of local crawling +- `useLocalCrawling`: Skip the default crawler and only crawl using a local crawler. Example @@ -194,25 +277,6 @@ docs: --- - - ### `mcpServers` @@ -238,23 +302,39 @@ mcpServers: - /Users/NAME/test.db ``` - - --- ## Complete YAML Config Example @@ -264,8 +344,15 @@ Putting it all together, here's a complete example of a `config.yaml` configurat ```yaml title="config.yaml" name: MyProject version: 0.0.1 +schema: v1 models: + - uses: anthropic/claude-3.5-sonnet + with: + ANTHROPIC_API_KEY: ${{ secrets.ANTHROPIC_API_KEY }} + override: + defaultCompletionOptions: + temperature: 0.8 - name: GPT-4 provider: openai model: gpt-4 @@ -298,6 +385,7 @@ prompts: description: Unit test a function prompt: | Please write a complete suite of unit tests for this function. You should use the Jest testing framework. The tests should cover all possible edge cases and should be as thorough as possible. You should also include a description of each test case. + - uses: myprofile/my-favorite-prompt context: - provider: diff @@ -307,6 +395,7 @@ context: - provider: docs params: startUrl: https://docs.example.com/introduction + rootUrl: https://docs.example.com maxDepth: 3 mcpServers: @@ -317,4 +406,78 @@ mcpServers: - dev env: PORT: "3000" + +data: + - name: My Private Company + destination: https://mycompany.com/ingest + schema: 0.2.0 + level: noCode + events: + - autocomplete + - chatInteraction ``` + +## Using YAML anchors to avoid config duplication + +You can also use node anchors to avoid duplication of properties. To do so, +adding the YAML version header `%YAML 1.1` is needed, here's an example of +a `config.yaml` configuration file using anchors: + +```yaml title="config.yaml" +%YAML 1.1 +--- +name: MyProject +version: 0.0.1 + +model_defaults: &model_defaults + provider: openai + apiKey: my-api-key + apiBase: https://api.example.com/llm + +models: + - name: mistral + <<: *model_defaults + model: mistral-7b-instruct + roles: + - chat + - edit + + - name: qwen2.5-coder-7b-instruct + <<: *model_defaults + model: qwen2.5-coder-7b-instruct + roles: + - chat + - edit + + - name: qwen2.5-coder-7b + <<: *model_defaults + model: qwen2.5-coder-7b + useLegacyCompletionsEndpoint: false + roles: + - autocomplete +``` + +### Fully deprecated settings + +Some deprecated `config.json` settings are no longer stored in config and have been moved to be editable through the [User Settings Page](./customize/settings.md). If found in `config.json`, they will be migrated to the [User Settings Page](./customize/settings.md) and removed from `config.json`. + +- `allowAnonymousTelemetry`: This value will be migrated to the safest merged value (`false` if either are `false`). +- `promptPath`: This value will override during migration. +- `disableIndexing`: This value will be migrated to the safest merged value (`true` if either are `true`). +- `disableSessionTitles`/`ui.getChatTitles`: This value will be migrated to the safest merged value (`true` if either are `true`). `getChatTitles` takes precedence if set to false +- `tabAutocompleteOptions` + - `useCache`: This value will override during migration. + - `disableInFiles`: This value will be migrated to the safest merged value (arrays of file matches merged/deduplicated) + - `multilineCompletions`: This value will override during migration. +- `experimental` + - `useChromiumForDocsCrawling`: This value will override during migration. + - `readResponseTTS`: This value will override during migration. +- `ui` - all will override during migration + + - `codeBlockToolbarPosition` + - `fontSize` + - `codeWrap` + - `displayRawMarkdown` + - `showChatScrollbar` + + See [User Settings Page](./customize/settings.md) for more information about each option. diff --git a/docs/docusaurus.config.js b/docs/docusaurus.config.js index c97113a0a..8216da215 100644 --- a/docs/docusaurus.config.js +++ b/docs/docusaurus.config.js @@ -107,6 +107,13 @@ const config = { label: "Reference", href: "/reference", }, + { + type: "docSidebar", + sidebarId: "hubSidebar", + position: "left", + label: "Hub", + href: "/hub/introduction", + }, { to: "https://github.com/continuedev/continue", label: "GitHub", @@ -193,6 +200,30 @@ const config = { "@docusaurus/plugin-client-redirects", { redirects: [ + { + to: "/hub/introduction", + from: "/hub", + }, + { + to: "/hub/governance/org-permissions", + from: "/hub/governance", + }, + { + to: "/hub/secrets/secret-types", + from: "/hub/secrets", + }, + { + to: "/hub/assistants/intro", + from: "/hub/assistants", + }, + { + to: "/hub/blocks/intro", + from: "/hub/blocks", + }, + { + to: "/customize/overview", + from: "/customize", + }, { to: "/customize/overview", from: "/customization", @@ -206,8 +237,24 @@ const config = { // from: "/getting-started", // }, { - to: "/customize/model-types", - from: "/setup/overview", + to: "/customize/model-roles", + from: ["/customize/model-types", "/setup/overview"], + }, + { + to: "/customize/model-roles/embeddings", + from: "/customize/model-types/embeddings", + }, + { + to: "/customize/model-roles/autocomplete", + from: "/customize/model-types/autocomplete", + }, + { + to: "/customize/model-roles/chat", + from: "/customize/model-types/chat", + }, + { + to: "/customize/model-roles/reranking", + from: "/customize/model-types/reranking", }, { to: "/getting-started/overview", @@ -255,11 +302,11 @@ const config = { }, { to: "/customize/context-providers", - from: "/customization/context-providers", + from: ["/customization/context-providers"], }, { - to: "/customize/development-data", - from: "/development-data", + to: "/customize/deep-dives/development-data", + from: ["/development-data", "/customize/development-data"], }, { to: "/customize/deep-dives/docs", @@ -282,7 +329,7 @@ const config = { from: "/reference/Model Providers/deepseek", }, { - to: "/customize/model-providers/free-trial", + to: "/customize/model-providers", from: "/reference/Model Providers/freetrial", }, { diff --git a/docs/i18n/zh-CN/docusaurus-plugin-content-docs/current/autocomplete/model-setup.md b/docs/i18n/zh-CN/docusaurus-plugin-content-docs/current/autocomplete/model-setup.md index 01747b24c..ba803e149 100644 --- a/docs/i18n/zh-CN/docusaurus-plugin-content-docs/current/autocomplete/model-setup.md +++ b/docs/i18n/zh-CN/docusaurus-plugin-content-docs/current/autocomplete/model-setup.md @@ -9,7 +9,7 @@ sidebar_position: 2 为了最好的自动补全体验,我们推荐通过 [Mistral API](https://console.mistral.ai/) 使用 Codestral 。这个模型提供高质量的补全,使用极好的代码上下文理解: -```json title="config.json"" +```json title="config.json" { "tabAutocompleteModel": { "title": "Codestral", @@ -28,7 +28,7 @@ Codestral 的 API key 和通常的 Mistral API 是不同的。如果你使用 Co 对于倾向于本地执行或自托管的, `StarCoder2-3b` 提供了一个对于大多数用户性能和质量的平衡: -```json title="config.json"" +```json title="config.json" { "tabAutocompleteModel": { "title": "StarCoder2-3b", @@ -49,4 +49,4 @@ Codestral 的 API key 和通常的 Mistral API 是不同的。如果你使用 Co ## 其他体验 -有很多更多的模型或提供者可以用来补全。在 [这里](../customize/model-types/autocomplete.md) 查看它们。 +有很多更多的模型或提供者可以用来补全。在 [这里](../customize/model-roles/autocomplete.md) 查看它们。 diff --git a/docs/i18n/zh-CN/docusaurus-plugin-content-docs/current/chat/context-selection.md b/docs/i18n/zh-CN/docusaurus-plugin-content-docs/current/chat/context-selection.md index a52a5a3d7..301de5524 100644 --- a/docs/i18n/zh-CN/docusaurus-plugin-content-docs/current/chat/context-selection.md +++ b/docs/i18n/zh-CN/docusaurus-plugin-content-docs/current/chat/context-selection.md @@ -19,28 +19,28 @@ sidebar_position: 3 ## 指定文件 -你可以通过输入 [`@Files`](../customize/context-providers.md#file) 并选择文件,包含当前工作区中的指定文件作为上下文。 +你可以通过输入 [`@Files`](../customize/context-providers.mdx#file) 并选择文件,包含当前工作区中的指定文件作为上下文。 ## 指定目录 -你可以通过输入 [`@Folder`](../customize/context-providers.md#folder) 并选择目录,包含当前工作区中指定目录作为上下文。它像 [`@Codebase`](../customize/deep-dives/codebase.md) 一样工作,但是只包含指定目录中的文件。 +你可以通过输入 [`@Folder`](../customize/context-providers.mdx#folder) 并选择目录,包含当前工作区中指定目录作为上下文。它像 [`@Codebase`](../customize/deep-dives/codebase.md) 一样工作,但是只包含指定目录中的文件。 ## 整个代码库 -你可以通过输入 [`@Codebase`](../customize/context-providers.md#codebase) 包含整个代码库作为上下文。你可以 [在这里](../customize/deep-dives/codebase.md) 了解 `@Codebase` 是如何工作的。 +你可以通过输入 [`@Codebase`](../customize/context-providers.mdx#codebase) 包含整个代码库作为上下文。你可以 [在这里](../customize/deep-dives/codebase.md) 了解 `@Codebase` 是如何工作的。 ## 文档网址 -你可以通过输入 [`@Docs`](../customize/context-providers.md#docs) 并选择文档网址,包含文档网址作文上下文。你可以 [在这里](../customize/deep-dives/docs.md) 了解 `@Docs` 是如何工作的。 +你可以通过输入 [`@Docs`](../customize/context-providers.mdx#docs) 并选择文档网址,包含文档网址作文上下文。你可以 [在这里](../customize/deep-dives/docs.md) 了解 `@Docs` 是如何工作的。 ## 终端内容 -你可以通过输入 [`@Terminal`](../customize/context-providers.md#terminal) ,包含 IDE 中终端的内容作为上下文。 +你可以通过输入 [`@Terminal`](../customize/context-providers.mdx#terminal) ,包含 IDE 中终端的内容作为上下文。 ## Git diff -你可以通过输入 [`@Git Diff`](../customize/context-providers.md#git-diff) ,包含当前分支中你做的所有变更作为上下文。 +你可以通过输入 [`@Git Diff`](../customize/context-providers.mdx#git-diff) ,包含当前分支中你做的所有变更作为上下文。 ## 其他上下文 -你可以 [在这里](../customize/context-providers.md) 看到完整的内置上下文提供者列表,以及 [在这里](../customize/tutorials/build-your-own-context-provider.md) 看到如何创建你自己定制的上下文提供者。 +你可以 [在这里](../customize/context-providers.mdx) 看到完整的内置上下文提供者列表,以及 [在这里](../customize/tutorials/build-your-own-context-provider.md) 看到如何创建你自己定制的上下文提供者。 diff --git a/docs/i18n/zh-CN/docusaurus-plugin-content-docs/current/chat/model-setup.mdx b/docs/i18n/zh-CN/docusaurus-plugin-content-docs/current/chat/model-setup.mdx index cbbef8761..32f9ab63f 100644 --- a/docs/i18n/zh-CN/docusaurus-plugin-content-docs/current/chat/model-setup.mdx +++ b/docs/i18n/zh-CN/docusaurus-plugin-content-docs/current/chat/model-setup.mdx @@ -5,8 +5,8 @@ keywords: [模型] sidebar_position: 2 --- -import Tabs from "@theme/Tabs"; import TabItem from "@theme/TabItem"; +import Tabs from "@theme/Tabs"; :::info 这个页面推荐聊天的模型和提供者。在 [这里](../reference.md) 了解更多关于如何设置你的 `config.json` 。 @@ -111,16 +111,16 @@ import TabItem from "@theme/TabItem"; ] ``` -### 来自 Google 的 Gemini 1.5 Pro +### 来自 Google 的 Gemini 2.0 Flash -如果你倾向于使用来自 [Google](../customize/model-providers/top-level/gemini.md) 的模型,那么我们推荐 Gemini 1.5 Pro 。 +如果你倾向于使用来自 [Google](../customize/model-providers/top-level/gemini.md) 的模型,那么我们推荐 Gemini 2.0 Flash。 ```json title="config.json" "models": [ { - "title": "Gemini 1.5 Pro", + "title": "Gemini 2.0 Flash", "provider": "gemini", - "model": "gemini-1.5-pro-latest", + "model": "gemini-2.0-flash", "apiKey": "[GEMINI_API_KEY]" } ] @@ -193,4 +193,4 @@ import TabItem from "@theme/TabItem"; ## 其他体验 -除了以上提到的这些,还有更多的模型和提供者,你可以使用来聊天。在 [这里](../customize/model-types/chat.md) 了解更多。 +除了以上提到的这些,还有更多的模型和提供者,你可以使用来聊天。在 [这里](../customize/model-roles/chat.md) 了解更多。 diff --git a/docs/i18n/zh-CN/docusaurus-plugin-content-docs/current/customize/deep-dives/codebase.md b/docs/i18n/zh-CN/docusaurus-plugin-content-docs/current/customize/deep-dives/codebase.md index eb55aa668..969e394a0 100644 --- a/docs/i18n/zh-CN/docusaurus-plugin-content-docs/current/customize/deep-dives/codebase.md +++ b/docs/i18n/zh-CN/docusaurus-plugin-content-docs/current/customize/deep-dives/codebase.md @@ -73,4 +73,4 @@ Continue 遵守 `.gitignore` 文件,为了确定哪些文件不需要索引。 ## 仓库 map -Claude 3, Llama 3.1, Gemini 1.5 和 GPT-4o 家族的模型在代码库检索时会自动地使用 [仓库 map](../context-providers.md#repository-map) ,允许模型理解你的代码库的结构,并使用它回答问题。当前,仓库 map 仅包含代码库中的文件路径。 +Claude 3, Llama 3.1, Gemini 1.5 和 GPT-4o 家族的模型在代码库检索时会自动地使用 [仓库 map](../context-providers.mdx#repository-map) ,允许模型理解你的代码库的结构,并使用它回答问题。当前,仓库 map 仅包含代码库中的文件路径。 diff --git a/docs/i18n/zh-CN/docusaurus-plugin-content-docs/current/customize/development-data.md b/docs/i18n/zh-CN/docusaurus-plugin-content-docs/current/customize/deep-dives/development-data.md similarity index 100% rename from docs/i18n/zh-CN/docusaurus-plugin-content-docs/current/customize/development-data.md rename to docs/i18n/zh-CN/docusaurus-plugin-content-docs/current/customize/deep-dives/development-data.md diff --git a/docs/i18n/zh-CN/docusaurus-plugin-content-docs/current/customize/deep-dives/prompt-files.md b/docs/i18n/zh-CN/docusaurus-plugin-content-docs/current/customize/deep-dives/prompt-files.md index bbcd0d36b..b419231fe 100644 --- a/docs/i18n/zh-CN/docusaurus-plugin-content-docs/current/customize/deep-dives/prompt-files.md +++ b/docs/i18n/zh-CN/docusaurus-plugin-content-docs/current/customize/deep-dives/prompt-files.md @@ -79,7 +79,7 @@ Write unit tests for the above selected code, following each of these instructio ### 上下文提供者 -任何你添加到配置中的 [上下文提供者](../context-providers.md) ,可以使用上下文提供者的名称引用。接收输入的上下文提供者也支持。 +任何你添加到配置中的 [上下文提供者](../context-providers.mdx) ,可以使用上下文提供者的名称引用。接收输入的上下文提供者也支持。 - `{{{ terminal }}}` - 终端的内容 - `{{{ url "https://github.com/continuedev/continue" }}}` - URL 的内容 diff --git a/docs/i18n/zh-CN/docusaurus-plugin-content-docs/current/customize/model-providers/more/cohere.md b/docs/i18n/zh-CN/docusaurus-plugin-content-docs/current/customize/model-providers/more/cohere.md index 274c1942d..e69029b00 100644 --- a/docs/i18n/zh-CN/docusaurus-plugin-content-docs/current/customize/model-providers/more/cohere.md +++ b/docs/i18n/zh-CN/docusaurus-plugin-content-docs/current/customize/model-providers/more/cohere.md @@ -23,7 +23,7 @@ Cohere 当前没有提供任何自动补全模型。 -[点击这里](../../model-types/autocomplete.md) 查看自动补全模型提供者列表。 +[点击这里](../../model-roles/autocomplete.md) 查看自动补全模型提供者列表。 ## 嵌入模型 diff --git a/docs/i18n/zh-CN/docusaurus-plugin-content-docs/current/customize/model-providers/more/free-trial.md b/docs/i18n/zh-CN/docusaurus-plugin-content-docs/current/customize/model-providers/more/free-trial.md deleted file mode 100644 index 746038bdf..000000000 --- a/docs/i18n/zh-CN/docusaurus-plugin-content-docs/current/customize/model-providers/more/free-trial.md +++ /dev/null @@ -1,31 +0,0 @@ ---- -title: 免费试用 -slug: ../free-trial ---- - -`"免费试用"` 提供者提供新用户在 Continue 快速尝试最好的体验,通过一个安全的代理服务器使用我们的 API key 。为了避免滥用,我们要求你使用 Github 登录,你可以在下面看到更多。 - -虽然 Continue 扩展总是免费使用,我们不能为所有用户提供无限免费 LLM 使用。你最终需要: - -1. 选择一个开源模型免费使用 [本地的](../top-level/ollama.md), 或者 -2. 添加你自己的 [Anthropic](../top-level/anthropic.md) API key 或者 [其他的 LLM 提供者](/customize/model-providers) - -## 试用的常见问题 - -Continue 要求免费试用用户登录,让我们可以避免我们的 API 端点滥用。如果你不使用免费试用,我们不会要求你登录。 - -### 我如何停止 Continue 询问我登录? - -移除 "models" 列表或 "tabAutocompleteModel" 中 `"provider": "free-trial"` 的所有模型,我们将不会再请求登录。 - -### 什么信息被收集? - -Continue 使用你的 GitHub 用户名,没有其他信息,唯一的目的是限制请求。 - -### 如果我没有登录,会发生什么? - -如果你没有登录,你仍然可以使用 Continue 的每个特性,你只需要提供自己的 LLM ,不论使用 API key 或运行本地的模型。 - -### 遥测与登录有什么关系? - -它没有。我们没有关联你的 GitHub 用户名到遥测数据。 diff --git a/docs/i18n/zh-CN/docusaurus-plugin-content-docs/current/customize/model-providers/more/nvidia.md b/docs/i18n/zh-CN/docusaurus-plugin-content-docs/current/customize/model-providers/more/nvidia.md index 049ff7754..6d8e1269b 100644 --- a/docs/i18n/zh-CN/docusaurus-plugin-content-docs/current/customize/model-providers/more/nvidia.md +++ b/docs/i18n/zh-CN/docusaurus-plugin-content-docs/current/customize/model-providers/more/nvidia.md @@ -29,7 +29,7 @@ We recommend configuring **Nemotron-4-340B-Instruct** as your chat model. NVIDIA currently does not offer any autocomplete models. -[Click here](../../model-types/autocomplete.md) to see a list of autocomplete model providers. +[Click here](../../model-roles/autocomplete.md) to see a list of autocomplete model providers. ## Embeddings model @@ -49,4 +49,4 @@ We recommend configuring **NVIDIA Retrieval QA Mistral 7B** as your embeddings m NVIDIA currently does not offer any reranking models. -[Click here](../../model-types/reranking.md) to see a list of reranking model providers. +[Click here](../../model-roles/reranking.md) to see a list of reranking model providers. diff --git a/docs/i18n/zh-CN/docusaurus-plugin-content-docs/current/customize/model-providers/top-level/anthropic.md b/docs/i18n/zh-CN/docusaurus-plugin-content-docs/current/customize/model-providers/top-level/anthropic.md index 7380e7673..f419f0def 100644 --- a/docs/i18n/zh-CN/docusaurus-plugin-content-docs/current/customize/model-providers/top-level/anthropic.md +++ b/docs/i18n/zh-CN/docusaurus-plugin-content-docs/current/customize/model-providers/top-level/anthropic.md @@ -28,19 +28,19 @@ slug: ../anthropic Anthropic 当前没有提供任何自动补全模型。 -[点击这里](../../model-types/autocomplete.md) 查看自动补全模型提供者列表。 +[点击这里](../../model-roles/autocomplete.md) 查看自动补全模型提供者列表。 ## 嵌入模型 Anthropic 当前没有提供任何嵌入模型。 -[点击这里](../../model-types/embeddings.md) 查看嵌入模型提供者列表。 +[点击这里](../../model-roles/embeddings.md) 查看嵌入模型提供者列表。 ## 重排序模型 Anthropic 当前没有提供任何重排序模型。 -[点击这里](../../model-types/reranking.md) 查看重排序模型提供者列表。 +[点击这里](../../model-roles/reranking.md) 查看重排序模型提供者列表。 ## 提示词缓存 diff --git a/docs/i18n/zh-CN/docusaurus-plugin-content-docs/current/customize/model-providers/top-level/azure.md b/docs/i18n/zh-CN/docusaurus-plugin-content-docs/current/customize/model-providers/top-level/azure.md index 6fa50faaa..3a5a48614 100644 --- a/docs/i18n/zh-CN/docusaurus-plugin-content-docs/current/customize/model-providers/top-level/azure.md +++ b/docs/i18n/zh-CN/docusaurus-plugin-content-docs/current/customize/model-providers/top-level/azure.md @@ -57,7 +57,7 @@ slug: ../azure Azure OpenAI 当前没有提供任何重排序模型。 -[点击这里](../../model-types/reranking.md) 查看重排序模型列表。 +[点击这里](../../model-roles/reranking.md) 查看重排序模型列表。 ## 隐私 diff --git a/docs/i18n/zh-CN/docusaurus-plugin-content-docs/current/customize/model-providers/top-level/bedrock.md b/docs/i18n/zh-CN/docusaurus-plugin-content-docs/current/customize/model-providers/top-level/bedrock.md index a1a4d6234..e13bc715d 100644 --- a/docs/i18n/zh-CN/docusaurus-plugin-content-docs/current/customize/model-providers/top-level/bedrock.md +++ b/docs/i18n/zh-CN/docusaurus-plugin-content-docs/current/customize/model-providers/top-level/bedrock.md @@ -25,7 +25,7 @@ slug: ../bedrock Bedrock 当前不支持任何自动补全模型。 -[点击这里](../../model-types/autocomplete.md) 查看自动补全模型提供者列表。 +[点击这里](../../model-roles/autocomplete.md) 查看自动补全模型提供者列表。 ## 嵌入模型 @@ -46,7 +46,7 @@ Bedrock 当前不支持任何自动补全模型。 Bedrock 当前没有任何重排序模型。 -[点击这里](../../model-types/reranking.md) 查看重排序模型提供者列表。 +[点击这里](../../model-roles/reranking.md) 查看重排序模型提供者列表。 ## 认证 diff --git a/docs/i18n/zh-CN/docusaurus-plugin-content-docs/current/customize/model-providers/top-level/deepseek.md b/docs/i18n/zh-CN/docusaurus-plugin-content-docs/current/customize/model-providers/top-level/deepseek.md index 61e01e701..10c0baeb8 100644 --- a/docs/i18n/zh-CN/docusaurus-plugin-content-docs/current/customize/model-providers/top-level/deepseek.md +++ b/docs/i18n/zh-CN/docusaurus-plugin-content-docs/current/customize/model-providers/top-level/deepseek.md @@ -42,10 +42,10 @@ slug: ../deepseek DeepSeek 当前没有提供任何嵌入模型。 -[点击这里](../../model-types/embeddings.md) 查看嵌入模型提供者列表。 +[点击这里](../../model-roles/embeddings.md) 查看嵌入模型提供者列表。 ## 重排序模型 DeepSeek 当前没有提供任何重排序模型。 -[点击这里](../../model-types/reranking.md) 查看重排序模型提供者列表。 +[点击这里](../../model-roles/reranking.md) 查看重排序模型提供者列表。 diff --git a/docs/i18n/zh-CN/docusaurus-plugin-content-docs/current/customize/model-providers/top-level/gemini.md b/docs/i18n/zh-CN/docusaurus-plugin-content-docs/current/customize/model-providers/top-level/gemini.md index 13778e379..8caec3c1f 100644 --- a/docs/i18n/zh-CN/docusaurus-plugin-content-docs/current/customize/model-providers/top-level/gemini.md +++ b/docs/i18n/zh-CN/docusaurus-plugin-content-docs/current/customize/model-providers/top-level/gemini.md @@ -28,7 +28,7 @@ slug: ../gemini Gemini 当前没有提供任何自动补全模型。 -[点击这里](../../model-types/autocomplete.md) 查看自动补全模型提供者列表。 +[点击这里](../../model-roles/autocomplete.md) 查看自动补全模型提供者列表。 ## 嵌入模型 @@ -48,4 +48,4 @@ Gemini 当前没有提供任何自动补全模型。 Gemini 当前没有提供任何重排序模型。 -[点击这里](../../model-types/reranking.md) 查看重排序模型提供者列表。 +[点击这里](../../model-roles/reranking.md) 查看重排序模型提供者列表。 diff --git a/docs/i18n/zh-CN/docusaurus-plugin-content-docs/current/customize/model-providers/top-level/mistral.md b/docs/i18n/zh-CN/docusaurus-plugin-content-docs/current/customize/model-providers/top-level/mistral.md index 2e853affc..8b9963fbb 100644 --- a/docs/i18n/zh-CN/docusaurus-plugin-content-docs/current/customize/model-providers/top-level/mistral.md +++ b/docs/i18n/zh-CN/docusaurus-plugin-content-docs/current/customize/model-providers/top-level/mistral.md @@ -57,4 +57,4 @@ slug: ../mistral Mistral 当前没有提供任何重排序模型。 -[点击这里](../../model-types/reranking.md) 查看重排序模型提供者列表。 +[点击这里](../../model-roles/reranking.md) 查看重排序模型提供者列表。 diff --git a/docs/i18n/zh-CN/docusaurus-plugin-content-docs/current/customize/model-providers/top-level/ollama.md b/docs/i18n/zh-CN/docusaurus-plugin-content-docs/current/customize/model-providers/top-level/ollama.md index 9119116ef..69ea9752d 100644 --- a/docs/i18n/zh-CN/docusaurus-plugin-content-docs/current/customize/model-providers/top-level/ollama.md +++ b/docs/i18n/zh-CN/docusaurus-plugin-content-docs/current/customize/model-providers/top-level/ollama.md @@ -50,4 +50,4 @@ slug: ../ollama Ollama 当前没有提供任何重排序模型。 -[点击这里](../../model-types/reranking.md) 查看重排序模型提供者列表。 +[点击这里](../../model-roles/reranking.md) 查看重排序模型提供者列表。 diff --git a/docs/i18n/zh-CN/docusaurus-plugin-content-docs/current/customize/model-providers/top-level/openai.md b/docs/i18n/zh-CN/docusaurus-plugin-content-docs/current/customize/model-providers/top-level/openai.md index ba84723da..18f3312a7 100644 --- a/docs/i18n/zh-CN/docusaurus-plugin-content-docs/current/customize/model-providers/top-level/openai.md +++ b/docs/i18n/zh-CN/docusaurus-plugin-content-docs/current/customize/model-providers/top-level/openai.md @@ -28,7 +28,7 @@ slug: ../openai OpenAI 当前没有提供任何自动补全模型。 -[点击这里](../../model-types/autocomplete.md) 查看自动补全模型提供者列表。 +[点击这里](../../model-roles/autocomplete.md) 查看自动补全模型提供者列表。 ## 嵌入模型 @@ -48,7 +48,7 @@ OpenAI 当前没有提供任何自动补全模型。 OpenAI 当前没有提供任何重排序模型。 -[点击这里](../../model-types/reranking.md) 查看重排序模型提供者列表。 +[点击这里](../../model-roles/reranking.md) 查看重排序模型提供者列表。 ## OpenAI 兼容服务器 / API diff --git a/docs/i18n/zh-CN/docusaurus-plugin-content-docs/current/customize/model-providers/top-level/vertexai.md b/docs/i18n/zh-CN/docusaurus-plugin-content-docs/current/customize/model-providers/top-level/vertexai.md index daf966d9e..0a280cda8 100644 --- a/docs/i18n/zh-CN/docusaurus-plugin-content-docs/current/customize/model-providers/top-level/vertexai.md +++ b/docs/i18n/zh-CN/docusaurus-plugin-content-docs/current/customize/model-providers/top-level/vertexai.md @@ -62,4 +62,4 @@ We recommend configuring **text-embedding-004** as your embeddings model. +[Click here](../../model-roles/reranking.md) to see a list of reranking model providers. --> diff --git a/docs/i18n/zh-CN/docusaurus-plugin-content-docs/current/customize/model-providers/top-level/xai.md b/docs/i18n/zh-CN/docusaurus-plugin-content-docs/current/customize/model-providers/top-level/xai.md index fbdfa83ad..866e7108d 100644 --- a/docs/i18n/zh-CN/docusaurus-plugin-content-docs/current/customize/model-providers/top-level/xai.md +++ b/docs/i18n/zh-CN/docusaurus-plugin-content-docs/current/customize/model-providers/top-level/xai.md @@ -30,24 +30,32 @@ We recommend configuring **grok-beta** as your chat model. xAI currently does not offer any autocomplete models. -[Click here](../../model-types/autocomplete.md) to see a list of autocomplete model providers. +[Click here](../../model-roles/autocomplete.md) to see a list of autocomplete model providers. ## Embeddings model xAI currently does not offer any embeddings models. -[Click here](../../model-types/embeddings.md) to see a list of embeddings model providers. +[Click here](../../model-roles/embeddings.md) to see a list of embeddings model providers. ## Reranking model xAI currently does not offer any reranking models. -[Click here](../../model-types/reranking.md) to see a list of reranking model providers. +[Click here](../../model-roles/reranking.md) to see a list of reranking model providers. ## Legacy Completions -To force usage of `chat/completions` instead of `completions` endpoint you can set +To force usage of `chat/completions` instead of `completions` endpoint you can set `useLegacyCompletionsEndpoint` to `true`: -```json -"useLegacyCompletionsEndpoint": false +```json title="config.json" + "models": [ + { + "title": "Grok Beta", + "provider": "xAI", + "model": "grok-beta", + "apiKey": "[API_KEY]", + "useLegacyCompletionsEndpoint": false + } + ] ``` diff --git a/docs/i18n/zh-CN/docusaurus-plugin-content-docs/current/customize/model-types/autocomplete.md b/docs/i18n/zh-CN/docusaurus-plugin-content-docs/current/customize/model-roles/autocomplete.md similarity index 100% rename from docs/i18n/zh-CN/docusaurus-plugin-content-docs/current/customize/model-types/autocomplete.md rename to docs/i18n/zh-CN/docusaurus-plugin-content-docs/current/customize/model-roles/autocomplete.md diff --git a/docs/i18n/zh-CN/docusaurus-plugin-content-docs/current/customize/model-types/chat.md b/docs/i18n/zh-CN/docusaurus-plugin-content-docs/current/customize/model-roles/chat.md similarity index 92% rename from docs/i18n/zh-CN/docusaurus-plugin-content-docs/current/customize/model-types/chat.md rename to docs/i18n/zh-CN/docusaurus-plugin-content-docs/current/customize/model-roles/chat.md index c49051360..a294cfaa1 100644 --- a/docs/i18n/zh-CN/docusaurus-plugin-content-docs/current/customize/model-types/chat.md +++ b/docs/i18n/zh-CN/docusaurus-plugin-content-docs/current/customize/model-roles/chat.md @@ -14,5 +14,5 @@ sidebar_position: 2 否则,以下是一些最好的选择: - [GPT-4o](../model-providers/top-level/openai.md) -- [Gemini 1.5 Pro](../model-providers/top-level/gemini.md) +- [Gemini 2.0 Flash](../model-providers/top-level/gemini.md) - [Llama3.1 405B](../tutorials/llama3.1.md) diff --git a/docs/i18n/zh-CN/docusaurus-plugin-content-docs/current/customize/model-types/embeddings.md b/docs/i18n/zh-CN/docusaurus-plugin-content-docs/current/customize/model-roles/embeddings.md similarity index 100% rename from docs/i18n/zh-CN/docusaurus-plugin-content-docs/current/customize/model-types/embeddings.md rename to docs/i18n/zh-CN/docusaurus-plugin-content-docs/current/customize/model-roles/embeddings.md diff --git a/docs/i18n/zh-CN/docusaurus-plugin-content-docs/current/customize/model-types/reranking.md b/docs/i18n/zh-CN/docusaurus-plugin-content-docs/current/customize/model-roles/reranking.md similarity index 93% rename from docs/i18n/zh-CN/docusaurus-plugin-content-docs/current/customize/model-types/reranking.md rename to docs/i18n/zh-CN/docusaurus-plugin-content-docs/current/customize/model-roles/reranking.md index 4e530b985..b5f1c835a 100644 --- a/docs/i18n/zh-CN/docusaurus-plugin-content-docs/current/customize/model-types/reranking.md +++ b/docs/i18n/zh-CN/docusaurus-plugin-content-docs/current/customize/model-roles/reranking.md @@ -78,15 +78,3 @@ Voyage AI 提供代码最好的重排序模型, 使用他们的 `rerank-1` 模 } } ``` - -### 免费试用 (Voyage AI) - -Continue 提供 Voyage AI 重排序模型的免费试用。 - -```json title="config.json" -{ - "reranker": { - "name": "free-trial" - } -} -``` diff --git a/docs/i18n/zh-CN/docusaurus-plugin-content-docs/current/customize/tutorials/build-your-own-context-provider.md b/docs/i18n/zh-CN/docusaurus-plugin-content-docs/current/customize/tutorials/build-your-own-context-provider.md index 735f405de..abe3612ce 100644 --- a/docs/i18n/zh-CN/docusaurus-plugin-content-docs/current/customize/tutorials/build-your-own-context-provider.md +++ b/docs/i18n/zh-CN/docusaurus-plugin-content-docs/current/customize/tutorials/build-your-own-context-provider.md @@ -68,7 +68,7 @@ export function modifyConfig(config: Config): Config { } ``` -不需要对 `config.json` 做修改。 +不需要对 `config.json` 做修改。 ## 定制有 submenu 或 query 的上下文提供者 @@ -174,7 +174,7 @@ Continue 将使用 [esbuild](https://esbuild.github.io/) 打包你的 `config.ts 如果你想要用除了 TypeScript 的其他语言编写上下文提供者,你可以使用 "http" 上下文提供者,来调用一个托管你自己代码的服务器。添加上下文提供者到 `config.json` ,像这样: -```json +```json title="config.json" { "name": "http", "params": { diff --git a/docs/i18n/zh-CN/docusaurus-plugin-content-docs/current/customize/tutorials/llama3.1.md b/docs/i18n/zh-CN/docusaurus-plugin-content-docs/current/customize/tutorials/llama3.1.md index e02ba6741..877864a15 100644 --- a/docs/i18n/zh-CN/docusaurus-plugin-content-docs/current/customize/tutorials/llama3.1.md +++ b/docs/i18n/zh-CN/docusaurus-plugin-content-docs/current/customize/tutorials/llama3.1.md @@ -99,7 +99,7 @@ SambaNova Cloud 提供 Llama3.1 70B/405B 服务的世界记录。 2. 复制你的 API key 3. 更新你的 Continue 配置文件像这样: -```json title="~/.continue/config.json" +```json title="config.json" { "models": [ { diff --git a/docs/i18n/zh-CN/docusaurus-plugin-content-docs/current/reference.md b/docs/i18n/zh-CN/docusaurus-plugin-content-docs/current/reference.md index 98addf212..00e72eb42 100644 --- a/docs/i18n/zh-CN/docusaurus-plugin-content-docs/current/reference.md +++ b/docs/i18n/zh-CN/docusaurus-plugin-content-docs/current/reference.md @@ -111,13 +111,13 @@ Embeddings model settings - the model used for @Codebase and @docs. **Properties:** -- `provider` (**required**): Specifies the embeddings provider, with options including `transformers.js`, `ollama`, `openai`, `cohere`, `free-trial`, `gemini`, etc +- `provider` (**required**): Specifies the embeddings provider, with options including `transformers.js`, `ollama`, `openai`, `cohere`, `gemini`, etc - `model`: Model name for embeddings. - `apiKey`: API key for the provider. - `apiBase`: Base URL for API requests. - `requestOptions`: Additional HTTP request settings specific to the embeddings provider. -- `maxChunkSize`: Maximum tokens per document chunk. Minimum is 128 tokens. -- `maxBatchSize`: Maximum number of chunks per request. Minimum is 1 chunk. +- `maxEmbeddingChunkSize`: Maximum tokens per document chunk. Minimum is 128 tokens. +- `maxEmbeddingBatchSize`: Maximum number of chunks per request. Minimum is 1 chunk. (AWS ONLY) @@ -132,8 +132,8 @@ Example: "provider": "openai", "model": "text-embedding-ada-002", "apiKey": "", - "maxChunkSize": 256, - "maxBatchSize": 5 + "maxEmbeddingChunkSize": 256, + "maxEmbeddingBatchSize": 5 } } ``` @@ -149,7 +149,7 @@ Parameters that control the behavior of text generation and completion settings. - `topP`: The cumulative probability for nucleus sampling. Lower values limit responses to tokens within the top probability mass. - `topK`: The maximum number of tokens considered at each step. Limits the generated text to tokens within this probability. - `presencePenalty`: Discourages the model from generating tokens that have already appeared in the output. -- `frequencePenalty`: Penalizes tokens based on their frequency in the text, reducing repetition. +- `frequencyPenalty`: Penalizes tokens based on their frequency in the text, reducing repetition. - `mirostat`: Enables Mirostat sampling, which controls the perplexity during text generation. Supported by Ollama, LM Studio, and llama.cpp providers (default: `0`, where `0` = disabled, `1` = Mirostat, and `2` = Mirostat 2.0). - `stop`: An array of stop tokens that, when encountered, will terminate the completion. Allows specifying multiple end conditions. - `maxTokens`: The maximum number of tokens to generate in a completion (default: `2048`). @@ -205,7 +205,7 @@ Configuration for the reranker model used in response ranking. **Properties:** -- `name` (**required**): Reranker name, e.g., `cohere`, `voyage`, `llm`, `free-trial`, `huggingface-tei` +- `name` (**required**): Reranker name, e.g., `cohere`, `voyage`, `llm`, `huggingface-tei` - `params`: - `model`: Model name - `apiKey`: Api key diff --git a/docs/sidebars.js b/docs/sidebars.js index 380377f8a..0e83628a4 100644 --- a/docs/sidebars.js +++ b/docs/sidebars.js @@ -96,22 +96,18 @@ const sidebars = { }, { type: "category", - label: "Model types", + label: "Model roles", link: { - slug: "/customize/model-types", + slug: "/customize/model-roles", type: "generated-index", }, items: [ { type: "autogenerated", - dirName: "customize/model-types", + dirName: "customize/model-roles", }, ], }, - "customize/context-providers", - "customize/slash-commands", - "customize/tools", - "customize/development-data", { type: "category", label: "Deep dives", @@ -138,17 +134,46 @@ const sidebars = { label: "Reference", href: "/reference", }, + { + type: "link", + label: "YAML Reference", + href: "/yaml-reference", + }, "customize/changelog", - // { - // type: "link", - // label: "YAML Reference", - // href: "/yaml-reference", - // }, - // { - // type: "link", - // label: "YAML Migration", - // href: "/yaml-migration", - // }, + ], + hubSidebar: [ + "hub/introduction", + { + type: "category", + label: "Assistants", + items: [ + "hub/assistants/intro", + "hub/assistants/use-an-assistant", + "hub/assistants/create-an-assistant", + "hub/assistants/edit-an-assistant", + ], + }, + { + type: "category", + label: "Blocks", + items: [ + "hub/blocks/intro", + "hub/blocks/block-types", + "hub/blocks/use-a-block", + "hub/blocks/create-a-block", + "hub/blocks/bundles", + ], + }, + { + type: "category", + label: "Secrets", + items: ["hub/secrets/secret-types", "hub/secrets/secret-resolution"], + }, + { + type: "category", + label: "Governance", + items: ["hub/governance/org-permissions", "hub/governance/pricing"], + }, ], }; diff --git a/docs/src/theme/Root.js b/docs/src/theme/Root.js new file mode 100644 index 000000000..88a8947e4 --- /dev/null +++ b/docs/src/theme/Root.js @@ -0,0 +1,21 @@ +import React from "react"; + +function TabsSetDefaultValue() { + React.useEffect(() => { + // Only set if it's not already set + if (!localStorage.getItem("docusaurus.tab.config-example")) { + localStorage.setItem("docusaurus.tab.config-example", "json"); + } + }, []); + + return null; +} + +export default function Root({ children }) { + return ( + <> + + {children} + + ); +} diff --git a/docs/static/img/actions.gif b/docs/static/img/actions.gif index 3a90748f1..1ad37ad93 100644 Binary files a/docs/static/img/actions.gif and b/docs/static/img/actions.gif differ diff --git a/docs/static/img/autocomplete.gif b/docs/static/img/autocomplete.gif index 7340b3cb9..cede26acf 100644 Binary files a/docs/static/img/autocomplete.gif and b/docs/static/img/autocomplete.gif differ diff --git a/docs/static/img/chat.gif b/docs/static/img/chat.gif index 2979f6c28..f9eedc300 100644 Binary files a/docs/static/img/chat.gif and b/docs/static/img/chat.gif differ diff --git a/docs/static/img/edit.gif b/docs/static/img/edit.gif index 286cf2e5c..a1629930c 100644 Binary files a/docs/static/img/edit.gif and b/docs/static/img/edit.gif differ diff --git a/docs/static/img/hub/assistant-create-page.png b/docs/static/img/hub/assistant-create-page.png new file mode 100644 index 000000000..2d70f956e Binary files /dev/null and b/docs/static/img/hub/assistant-create-page.png differ diff --git a/docs/static/img/hub/assistant-create-sidebar.png b/docs/static/img/hub/assistant-create-sidebar.png new file mode 100644 index 000000000..159806d31 Binary files /dev/null and b/docs/static/img/hub/assistant-create-sidebar.png differ diff --git a/docs/static/img/hub/assistant-create-yaml.png b/docs/static/img/hub/assistant-create-yaml.png new file mode 100644 index 000000000..6806c808c Binary files /dev/null and b/docs/static/img/hub/assistant-create-yaml.png differ diff --git a/docs/static/img/hub/assistant-extension-select.png b/docs/static/img/hub/assistant-extension-select.png new file mode 100644 index 000000000..e1365d304 Binary files /dev/null and b/docs/static/img/hub/assistant-extension-select.png differ diff --git a/docs/static/img/hub/assistant-new-button.png b/docs/static/img/hub/assistant-new-button.png new file mode 100644 index 000000000..d6088a061 Binary files /dev/null and b/docs/static/img/hub/assistant-new-button.png differ diff --git a/docs/static/img/hub/assistant-remix-button.png b/docs/static/img/hub/assistant-remix-button.png new file mode 100644 index 000000000..02c9d34ef Binary files /dev/null and b/docs/static/img/hub/assistant-remix-button.png differ diff --git a/docs/static/img/hub/block-inputs.png b/docs/static/img/hub/block-inputs.png new file mode 100644 index 000000000..9af87002c Binary files /dev/null and b/docs/static/img/hub/block-inputs.png differ diff --git a/docs/static/img/hub/block-new-button.png b/docs/static/img/hub/block-new-button.png new file mode 100644 index 000000000..456db04a9 Binary files /dev/null and b/docs/static/img/hub/block-new-button.png differ diff --git a/docs/static/img/hub/block-new-page.png b/docs/static/img/hub/block-new-page.png new file mode 100644 index 000000000..9addc9238 Binary files /dev/null and b/docs/static/img/hub/block-new-page.png differ diff --git a/docs/static/img/hub/block-remix-button.png b/docs/static/img/hub/block-remix-button.png new file mode 100644 index 000000000..16a682e9d Binary files /dev/null and b/docs/static/img/hub/block-remix-button.png differ diff --git a/docs/static/img/hub/bundle-create-page.png b/docs/static/img/hub/bundle-create-page.png new file mode 100644 index 000000000..693070326 Binary files /dev/null and b/docs/static/img/hub/bundle-create-page.png differ diff --git a/docs/static/img/hub/bundle-new-button.png b/docs/static/img/hub/bundle-new-button.png new file mode 100644 index 000000000..60ccc23d6 Binary files /dev/null and b/docs/static/img/hub/bundle-new-button.png differ diff --git a/docs/static/img/hub/hub-onboarding-card.png b/docs/static/img/hub/hub-onboarding-card.png new file mode 100644 index 000000000..8c75631fe Binary files /dev/null and b/docs/static/img/hub/hub-onboarding-card.png differ diff --git a/docs/static/img/hub/models-page.png b/docs/static/img/hub/models-page.png new file mode 100644 index 000000000..647504941 Binary files /dev/null and b/docs/static/img/hub/models-page.png differ diff --git a/docs/static/img/settings-model-roles.png b/docs/static/img/settings-model-roles.png new file mode 100644 index 000000000..7a2d24407 Binary files /dev/null and b/docs/static/img/settings-model-roles.png differ diff --git a/extensions/intellij/CHANGELOG.md b/extensions/intellij/CHANGELOG.md index 391d722c7..c5378bd45 100644 --- a/extensions/intellij/CHANGELOG.md +++ b/extensions/intellij/CHANGELOG.md @@ -5,8 +5,16 @@ adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html), and is generated by [Changie](https://github.com/miniscruff/changie). -Pre-release Changes -### Fixed +## 1.0.0 - 2025-02-26 +### Added +* Introduces hub.continue.dev +* Improved theme matching +### Fixed +* Fixes interference between SonarQube and Continue autocomplete +* Numerous reliability improvements + +## 0.0.92 - 2025-02-26 +### Fixed * Off-screen rendering to solve white flash on load and lack of changing cursor type * OSR-related fixes for non-Mac users * Fixes for inline edit in JetBrains diff --git a/extensions/intellij/README.md b/extensions/intellij/README.md index 79b0d6cab..dccf4a7f1 100644 --- a/extensions/intellij/README.md +++ b/extensions/intellij/README.md @@ -4,9 +4,7 @@
-[**Continue**](https://docs.continue.dev) is the leading open-source AI code assistant. - -You can connect any models and any context to build custom autocomplete and chat experiences inside [**VS Code**](https://marketplace.visualstudio.com/items?itemName=Continue.continue) and [**JetBrains**](https://plugins.jetbrains.com/plugin/22707-continue-extension) IDEs. +[**Continue**](https://docs.continue.dev) enables developers to create, share, and use custom AI code assistants with our open-source [JetBrains](https://plugins.jetbrains.com/plugin/22707-continue-extension) extension and [hub of models, rules, prompts, docs, and other building blocks](https://hub.continue.dev).
diff --git a/extensions/intellij/gradle.properties b/extensions/intellij/gradle.properties index 7028aa723..8553d3528 100644 --- a/extensions/intellij/gradle.properties +++ b/extensions/intellij/gradle.properties @@ -3,7 +3,7 @@ pluginGroup=com.github.continuedev.continueintellijextension pluginName=continue-intellij-extension pluginRepositoryUrl=https://github.com/continuedev/continue # SemVer format -> https://semver.org -pluginVersion=0.0.87 +pluginVersion=1.0.2 # Supported build number ranges and IntelliJ Platform versions -> https://plugins.jetbrains.com/docs/intellij/build-number-ranges.html pluginSinceBuild=223 # IntelliJ Platform Properties -> https://plugins.jetbrains.com/docs/intellij/tools-gradle-intellij-plugin.html#configuration-intellij-extension diff --git a/extensions/intellij/src/main/kotlin/com/github/continuedev/continueintellijextension/actions/ContinuePluginActions.kt b/extensions/intellij/src/main/kotlin/com/github/continuedev/continueintellijextension/actions/ContinuePluginActions.kt index b93d294e1..3c6b27f05 100644 --- a/extensions/intellij/src/main/kotlin/com/github/continuedev/continueintellijextension/actions/ContinuePluginActions.kt +++ b/extensions/intellij/src/main/kotlin/com/github/continuedev/continueintellijextension/actions/ContinuePluginActions.kt @@ -113,7 +113,8 @@ class NewContinueSessionAction : AnAction() { class ViewHistoryAction : AnAction() { override fun actionPerformed(e: AnActionEvent) { val continuePluginService = getContinuePluginService(e.project) ?: return - continuePluginService.sendToWebview("viewHistory", null) + val params = mapOf("path" to "/history", "toggle" to true) + continuePluginService.sendToWebview("navigateTo", params) } } @@ -133,11 +134,4 @@ class OpenMorePageAction : AnAction() { val params = mapOf("path" to "/more", "toggle" to true) continuePluginService.sendToWebview("navigateTo", params) } -} - -class OpenAccountDialogAction : AnAction() { - override fun actionPerformed(e: AnActionEvent) { - val continuePluginService = getContinuePluginService(e.project) ?: return - continuePluginService.sendToWebview("openDialogMessage", "account") - } } \ No newline at end of file diff --git a/extensions/intellij/src/main/kotlin/com/github/continuedev/continueintellijextension/activities/ContinuePluginStartupActivity.kt b/extensions/intellij/src/main/kotlin/com/github/continuedev/continueintellijextension/activities/ContinuePluginStartupActivity.kt index bae7857a4..b65266016 100644 --- a/extensions/intellij/src/main/kotlin/com/github/continuedev/continueintellijextension/activities/ContinuePluginStartupActivity.kt +++ b/extensions/intellij/src/main/kotlin/com/github/continuedev/continueintellijextension/activities/ContinuePluginStartupActivity.kt @@ -37,6 +37,7 @@ import com.intellij.openapi.vfs.newvfs.BulkFileListener import com.intellij.openapi.vfs.newvfs.events.VFileEvent import com.intellij.openapi.vfs.newvfs.events.VFileDeleteEvent import com.intellij.openapi.vfs.newvfs.events.VFileContentChangeEvent +import com.intellij.ide.ui.LafManagerListener fun showTutorial(project: Project) { val tutorialFileName = getTutorialFileName() @@ -182,7 +183,7 @@ class ContinuePluginStartupActivity : StartupActivity, DumbAware { val changedURIs = events.filterIsInstance() .mapNotNull { event -> event.file.toUriOrNull() } - // Send "files/changed" message if there are any content changes + // Notify core of content changes if (changedURIs.isNotEmpty()) { val data = mapOf("files" to changedURIs) continuePluginService.coreMessenger?.request("files/changed", data, null) { _ -> } @@ -190,6 +191,15 @@ class ContinuePluginStartupActivity : StartupActivity, DumbAware { } }) + // Listen for theme changes + connection.subscribe(LafManagerListener.TOPIC, LafManagerListener { + val colors = GetTheme().getTheme(); + continuePluginService.sendToWebview( + "jetbrains/setColors", + colors + ) + }) + // Listen for clicking settings button to start the auth flow val authService = service() val initialSessionInfo = authService.loadControlPlaneSessionInfo() @@ -204,7 +214,7 @@ class ContinuePluginStartupActivity : StartupActivity, DumbAware { connection.subscribe(AuthListener.TOPIC, object : AuthListener { override fun startAuthFlow() { - authService.startAuthFlow(project) + authService.startAuthFlow(project, false) } override fun handleUpdatedSessionInfo(sessionInfo: ControlPlaneSessionInfo?) { diff --git a/extensions/intellij/src/main/kotlin/com/github/continuedev/continueintellijextension/auth/ContinueAuthDialog.kt b/extensions/intellij/src/main/kotlin/com/github/continuedev/continueintellijextension/auth/ContinueAuthDialog.kt index b8a862fad..b9faf65d7 100644 --- a/extensions/intellij/src/main/kotlin/com/github/continuedev/continueintellijextension/auth/ContinueAuthDialog.kt +++ b/extensions/intellij/src/main/kotlin/com/github/continuedev/continueintellijextension/auth/ContinueAuthDialog.kt @@ -7,7 +7,8 @@ import javax.swing.JComponent import javax.swing.JPanel import java.awt.BorderLayout -class ContinueAuthDialog(private val onTokenEntered: (String) -> Unit) : DialogWrapper(true) { +class ContinueAuthDialog(private val useOnboarding: Boolean, private val onTokenEntered: (String) -> Unit) : + DialogWrapper(true) { private val tokenField = JBTextField() init { @@ -17,7 +18,9 @@ class ContinueAuthDialog(private val onTokenEntered: (String) -> Unit) : DialogW override fun createCenterPanel(): JComponent { val panel = JPanel(BorderLayout()) - panel.add(JBLabel("Please enter your Continue authentication token:"), BorderLayout.NORTH) + val message = + if (useOnboarding) "After onboarding you will be shown an authentication token. Please enter it here:" else "Please enter your Continue authentication token:" + panel.add(JBLabel(message), BorderLayout.NORTH) panel.add(tokenField, BorderLayout.CENTER) return panel } diff --git a/extensions/intellij/src/main/kotlin/com/github/continuedev/continueintellijextension/auth/ContinueAuthService.kt b/extensions/intellij/src/main/kotlin/com/github/continuedev/continueintellijextension/auth/ContinueAuthService.kt index d23308cf1..23b6b66bd 100644 --- a/extensions/intellij/src/main/kotlin/com/github/continuedev/continueintellijextension/auth/ContinueAuthService.kt +++ b/extensions/intellij/src/main/kotlin/com/github/continuedev/continueintellijextension/auth/ContinueAuthService.kt @@ -33,8 +33,18 @@ class ContinueAuthService { private const val REFRESH_TOKEN_KEY = "ContinueRefreshToken" private const val ACCOUNT_ID_KEY = "ContinueAccountId" private const val ACCOUNT_LABEL_KEY = "ContinueAccountLabel" - private const val CONTROL_PLANE_URL = "https://control-plane-api-service-i3dqylpbqa-uc.a.run.app" -// private const val CONTROL_PLANE_URL = "http://localhost:3001" + } + + private fun getControlPlaneUrl(): String { + val env = service().continueState.continueTestEnvironment; + when (env) { + "none" -> return "https://control-plane-api-service-i3dqylpbqa-uc.a.run.app" + "local" -> return "http://localhost:3001" + "production" -> return "https://api.continue.dev" + "test" -> return "https://api-test.continue.dev" + } + + return "https://control-plane-api-service-i3dqylpbqa-uc.a.run.app" } init { @@ -44,13 +54,13 @@ class ContinueAuthService { } } - fun startAuthFlow(project: Project) { + fun startAuthFlow(project: Project, useOnboarding: Boolean) { // Open login page - openSignInPage(project) + openSignInPage(project, useOnboarding) // Open a dialog where the user should paste their sign-in token ApplicationManager.getApplication().invokeLater { - val dialog = ContinueAuthDialog() { token -> + val dialog = ContinueAuthDialog(useOnboarding) { token -> // Store the token updateRefreshToken(token) } @@ -78,10 +88,12 @@ class ContinueAuthService { val lastName = user?.get("lastName") as? String val label = "$firstName $lastName" val id = user?.get("id") as? String + val email = user?.get("email") as? String // Persist the session info setRefreshToken(refreshToken!!) - val sessionInfo = ControlPlaneSessionInfo(accessToken!!, ControlPlaneSessionInfo.Account(id!!, label)) + val sessionInfo = + ControlPlaneSessionInfo(accessToken!!, ControlPlaneSessionInfo.Account(email!!, label)) setControlPlaneSessionInfo(sessionInfo) // Notify listeners @@ -111,7 +123,7 @@ class ContinueAuthService { private suspend fun refreshToken(refreshToken: String) = withContext(Dispatchers.IO) { val client = OkHttpClient() - val url = URL(CONTROL_PLANE_URL).toURI().resolve("/auth/refresh").toURL() + val url = URL(getControlPlaneUrl()).toURI().resolve("/auth/refresh").toURL() val jsonBody = mapOf("refreshToken" to refreshToken) val jsonString = Gson().toJson(jsonBody) val requestBody = jsonString.toRequestBody("application/json".toMediaType()) @@ -132,9 +144,13 @@ class ContinueAuthService { } - private fun openSignInPage(project: Project) { + private fun openSignInPage(project: Project, useOnboarding: Boolean) { val coreMessenger = project.service().coreMessenger - coreMessenger?.request("auth/getAuthUrl", null, null) { response -> + coreMessenger?.request( + "auth/getAuthUrl", mapOf( + "useOnboarding" to useOnboarding + ), null + ) { response -> val authUrl = ((response as? Map<*, *>)?.get("content") as? Map<*, *>)?.get("url") as? String if (authUrl != null) { // Open the auth URL in the browser @@ -208,7 +224,7 @@ class ContinueAuthService { val accountId = getAccountId() val accountLabel = getAccountLabel() - return if (accessToken != null && accountId != null && accountLabel != null) { + return if ((accessToken != null && accessToken != "") && accountId != null && accountLabel != null) { ControlPlaneSessionInfo( accessToken = accessToken, account = ControlPlaneSessionInfo.Account( diff --git a/extensions/intellij/src/main/kotlin/com/github/continuedev/continueintellijextension/autocomplete/AutocompleteEditorListener.kt b/extensions/intellij/src/main/kotlin/com/github/continuedev/continueintellijextension/autocomplete/AutocompleteEditorListener.kt index f4ef8128b..19b0dfa3a 100644 --- a/extensions/intellij/src/main/kotlin/com/github/continuedev/continueintellijextension/autocomplete/AutocompleteEditorListener.kt +++ b/extensions/intellij/src/main/kotlin/com/github/continuedev/continueintellijextension/autocomplete/AutocompleteEditorListener.kt @@ -3,6 +3,7 @@ package com.github.continuedev.continueintellijextension.autocomplete import com.intellij.openapi.application.invokeLater import com.intellij.openapi.components.service import com.intellij.openapi.editor.Editor +import com.intellij.openapi.editor.EditorKind import com.intellij.openapi.editor.event.* import com.intellij.openapi.fileEditor.FileEditorManager import com.intellij.openapi.fileEditor.FileEditorManagerEvent @@ -11,6 +12,10 @@ import com.intellij.openapi.util.TextRange class AutocompleteCaretListener : CaretListener { override fun caretPositionChanged(event: CaretEvent) { + if(event.editor.editorKind != EditorKind.MAIN_EDITOR) { + return + } + val caret = event.caret ?: return val offset = caret.offset val editor = caret.editor diff --git a/extensions/intellij/src/main/kotlin/com/github/continuedev/continueintellijextension/autocomplete/CancelAutocompleteAction.kt b/extensions/intellij/src/main/kotlin/com/github/continuedev/continueintellijextension/autocomplete/CancelAutocompleteAction.kt index 93eb805b3..8b5159d4d 100644 --- a/extensions/intellij/src/main/kotlin/com/github/continuedev/continueintellijextension/autocomplete/CancelAutocompleteAction.kt +++ b/extensions/intellij/src/main/kotlin/com/github/continuedev/continueintellijextension/autocomplete/CancelAutocompleteAction.kt @@ -1,5 +1,6 @@ package com.github.continuedev.continueintellijextension.autocomplete +import com.intellij.openapi.actionSystem.ActionUpdateThread import com.intellij.openapi.actionSystem.AnAction import com.intellij.openapi.actionSystem.AnActionEvent import com.intellij.openapi.actionSystem.CommonDataKeys @@ -27,4 +28,8 @@ class CancelAutocompleteAction : AnAction() { val editor: Editor? = e.getData(CommonDataKeys.EDITOR) return project != null && editor != null && editor.contentComponent.hasFocus() } + + override fun getActionUpdateThread(): ActionUpdateThread { + return ActionUpdateThread.BGT + } } diff --git a/extensions/intellij/src/main/kotlin/com/github/continuedev/continueintellijextension/constants/MessageTypes.kt b/extensions/intellij/src/main/kotlin/com/github/continuedev/continueintellijextension/constants/MessageTypes.kt index d3f69bc7a..e71401b15 100644 --- a/extensions/intellij/src/main/kotlin/com/github/continuedev/continueintellijextension/constants/MessageTypes.kt +++ b/extensions/intellij/src/main/kotlin/com/github/continuedev/continueintellijextension/constants/MessageTypes.kt @@ -41,6 +41,18 @@ class MessageTypes { "logoutOfControlPlane", "getTerminalContents", "showToast", + "openUrl", + + // These only come from the GUI for now but should be here to prevent confusion + "toggleDevTools", + "showTutorial", + + // These are jetbrains only and only come from the GUI for now + // But again including for consistency + "copyText", + "jetbrains/isOSREnabled", + "jetbrains/getColors", + "jetbrains/onLoad" ) // Note: If updating these values, make a corresponding update in @@ -58,8 +70,6 @@ class MessageTypes { "setTTSActive", "getWebviewHistoryLength", "getCurrentSessionId", - "signInToControlPlane", - "openDialogMessage", "docs/suggestions", ) @@ -79,8 +89,10 @@ class MessageTypes { "config/getSerializedProfileInfo", "config/deleteModel", "config/listProfiles", + "config/refreshProfiles", "config/openProfile", "config/updateSharedConfig", + "config/updateSelectedModel", "context/getContextItems", "context/getSymbolsForFiles", "context/loadSubmenuItems", @@ -111,10 +123,10 @@ class MessageTypes { "indexing/setPaused", "docs/getSuggestedDocs", "docs/initStatuses", + "docs/getDetails", // "completeOnboarding", "addAutocompleteModel", - "profiles/switch", "didChangeSelectedProfile", "didChangeSelectedOrg", "tools/call", diff --git a/extensions/intellij/src/main/kotlin/com/github/continuedev/continueintellijextension/continue/GetTheme.kt b/extensions/intellij/src/main/kotlin/com/github/continuedev/continueintellijextension/continue/GetTheme.kt index 7eb4ab700..6aecca81b 100644 --- a/extensions/intellij/src/main/kotlin/com/github/continuedev/continueintellijextension/continue/GetTheme.kt +++ b/extensions/intellij/src/main/kotlin/com/github/continuedev/continueintellijextension/continue/GetTheme.kt @@ -1,15 +1,12 @@ package com.github.continuedev.continueintellijextension.`continue` -import com.intellij.codeInsight.template.impl.TemplateColors -import com.intellij.openapi.editor.DefaultLanguageHighlighterColors import com.intellij.openapi.editor.colors.EditorColors import com.intellij.openapi.editor.colors.EditorColorsManager -import com.intellij.openapi.editor.colors.EditorColorsScheme -import com.intellij.openapi.editor.colors.TextAttributesKey import java.awt.Color import kotlin.math.max import kotlin.math.min - +import com.intellij.ui.JBColor +import com.intellij.ui.ColorUtil class GetTheme { fun getSecondaryDark(): Color { @@ -42,53 +39,60 @@ class GetTheme { } fun getTheme(): Map { + fun toHex(color: Color): String { + return String.format("#%02x%02x%02x", color.red, color.green, color.blue) + } try { - val globalScheme = EditorColorsManager.getInstance().globalScheme - val defaultBackground = globalScheme.defaultBackground - val defaultForeground = globalScheme.defaultForeground - val highlight = globalScheme.getColor(EditorColors.MODIFIED_TAB_ICON_COLOR) ?: defaultForeground - val defaultBackgroundHex = - String.format("#%02x%02x%02x", defaultBackground.red, defaultBackground.green, defaultBackground.blue) - val defaultForegroundHex = - String.format("#%02x%02x%02x", defaultForeground.red, defaultForeground.green, defaultForeground.blue) - val highlightHex = String.format("#%02x%02x%02x", highlight.red, highlight.green, highlight.blue) + val background = JBColor.background() + val foreground = JBColor.foreground() - val grayscale = - (defaultBackground.red * 0.3 + defaultBackground.green * 0.59 + defaultBackground.blue * 0.11).toInt() + val buttonBackground = JBColor.namedColor("Button.background", Color(230, 230, 230)) + val buttonForeground = JBColor.namedColor("Button.foreground", Color(0, 0, 0)) - val adjustedRed: Int - val adjustedGreen: Int - val adjustedBlue: Int + val badgeBackground = JBColor.namedColor("Badge.background", Color(150, 150, 150)) + val badgeForeground = JBColor.namedColor("Badge.foreground", Color(0, 0, 0)) - val tint: Int = 20 - if (grayscale > 128) { // if closer to white - adjustedRed = max(0, defaultBackground.red - tint) - adjustedGreen = max(0, defaultBackground.green - tint) - adjustedBlue = max(0, defaultBackground.blue - tint) - } else { // if closer to black - adjustedRed = min(255, defaultBackground.red + tint) - adjustedGreen = min(255, defaultBackground.green + tint) - adjustedBlue = min(255, defaultBackground.blue + tint) - } + val inputBackground = JBColor.namedColor("TextField.background", Color(255, 255, 255)) - val secondaryDarkHex = String.format("#%02x%02x%02x", adjustedRed, adjustedGreen, adjustedBlue) + val border = JBColor.border() + val focusBorder = JBColor.namedColor("Focus.borderColor", Color(100, 100, 255)) + val editorScheme = EditorColorsManager.getInstance().globalScheme - return mapOf( - "--vscode-editor-foreground" to defaultForegroundHex, - "--vscode-sideBar-background" to defaultBackgroundHex, - "--vscode-input-background" to secondaryDarkHex, - "--vscode-editor-background" to defaultBackgroundHex, - "--vscode-button-background" to defaultBackgroundHex, - "--vscode-list-activeSelectionBackground" to defaultBackgroundHex, - "--vscode-focusBorder" to highlightHex, - "--vscode-quickInputList-focusForeground" to defaultForegroundHex, - "--vscode-quickInput-background" to secondaryDarkHex, - "--vscode-input-border" to "#80808080", - "--vscode-badge-background" to highlightHex, - "--vscode-badge-foreground" to defaultForegroundHex, - "--vscode-sideBar-border" to "#80808080" + val editorBackground = editorScheme.defaultBackground + val editorForeground = editorScheme.defaultForeground + + val actionHoverBackground = JBColor.namedColor("ActionButton.hoverBackground", Color(220, 220, 220)) + + val findMatchBackground = editorScheme.getAttributes(EditorColors.SEARCH_RESULT_ATTRIBUTES)?.backgroundColor ?: Color(255, 221, 0) + + val theme = mapOf( + "--vscode-editor-foreground" to toHex(editorForeground), + "--vscode-editor-background" to toHex(editorBackground), + + "--vscode-button-background" to toHex(buttonBackground), + "--vscode-button-foreground" to toHex(buttonForeground), + + "--vscode-list-activeSelectionBackground" to toHex(actionHoverBackground) + "50", + + "--vscode-quickInputList-focusForeground" to toHex(foreground), + "--vscode-quickInput-background" to toHex(inputBackground), + + "--vscode-badge-background" to toHex(badgeBackground), + "--vscode-badge-foreground" to toHex(badgeForeground), + + "--vscode-input-background" to toHex(inputBackground), + "--vscode-input-border" to toHex(border), + "--vscode-sideBar-background" to toHex(background), + "--vscode-sideBar-border" to toHex(border), + "--vscode-focusBorder" to toHex(focusBorder), + + "--vscode-commandCenter-activeBorder" to toHex(focusBorder), + "--vscode-commandCenter-inactiveBorder" to toHex(border), + + "--vscode-editor-findMatchHighlightBackground" to toHex(findMatchBackground) + "40" ) + return theme } catch (error: Error) { return mapOf() } diff --git a/extensions/intellij/src/main/kotlin/com/github/continuedev/continueintellijextension/continue/IdeProtocolClient.kt b/extensions/intellij/src/main/kotlin/com/github/continuedev/continueintellijextension/continue/IdeProtocolClient.kt index efffc54ee..46be13797 100644 --- a/extensions/intellij/src/main/kotlin/com/github/continuedev/continueintellijextension/continue/IdeProtocolClient.kt +++ b/extensions/intellij/src/main/kotlin/com/github/continuedev/continueintellijextension/continue/IdeProtocolClient.kt @@ -43,27 +43,12 @@ class IdeProtocolClient( ) } - private fun send(messageType: String, data: Any?, messageId: String? = null) { - val id = messageId ?: uuid() - continuePluginService.sendToWebview(messageType, data, id) - } - fun handleMessage(msg: String, respond: (Any?) -> Unit) { coroutineScope.launch(Dispatchers.IO) { val message = Gson().fromJson(msg, Message::class.java) val messageType = message.messageType val dataElement = message.data - // A couple oddball messages respond directly to GUI, expect a different message format - // e.g. jetbrains/isOSREnabled - fun respondToWebview(content: Any) { - respond(mutableMapOf( - "done" to true, - "status" to "success", - "content" to content - )) - } - try { when (messageType) { "toggleDevTools" -> { @@ -77,12 +62,12 @@ class IdeProtocolClient( "jetbrains/isOSREnabled" -> { val isOSREnabled = ServiceManager.getService(ContinueExtensionSettings::class.java).continueState.enableOSR - respondToWebview(isOSREnabled) + respond(isOSREnabled) } "jetbrains/getColors" -> { val colors = GetTheme().getTheme(); - respondToWebview(colors) + respond(colors) } "jetbrains/onLoad" -> { @@ -92,7 +77,7 @@ class IdeProtocolClient( "vscMachineId" to getMachineUniqueID(), "vscMediaUrl" to "http://continue", ) - respondToWebview(jsonData) + respond(jsonData) } "getIdeSettings" -> { @@ -111,7 +96,7 @@ class IdeProtocolClient( val sessionInfo = authService.loadControlPlaneSessionInfo() respond(sessionInfo) } else { - authService.startAuthFlow(project) + authService.startAuthFlow(project, params.useOnboarding) respond(null) } } @@ -121,6 +106,10 @@ class IdeProtocolClient( authService.signOut() ApplicationManager.getApplication().messageBus.syncPublisher(AuthListener.TOPIC) .handleUpdatedSessionInfo(null) + + // Tell the webview that session info changed + continuePluginService.sendToWebview("didChangeControlPlaneSessionInfo", null, uuid()) + respond(null) } @@ -439,7 +428,7 @@ class IdeProtocolClient( if (editor.document.text.trim().isEmpty()) { WriteCommandAction.runWriteCommandAction(project) { - editor.document.insertString(0, msg) + editor.document.insertString(0, params.text) } respond(null) return@launch @@ -458,7 +447,8 @@ class IdeProtocolClient( val result = responseContent["result"] as Map<*, *> val config = result["config"] as Map - val applyCodeBlockModel = getModelByRole(config, "applyCodeBlock") + val selectedModels = config["selectedModelByRole"] as Map + val applyCodeBlockModel = selectedModels["apply"] as Map if (applyCodeBlockModel != null) { continuation.resume(applyCodeBlockModel) @@ -593,25 +583,10 @@ class IdeProtocolClient( fun sendAcceptRejectDiff(accepted: Boolean, stepIndex: Int) { - send("acceptRejectDiff", AcceptRejectDiff(accepted, stepIndex), uuid()) + continuePluginService.sendToWebview("acceptRejectDiff", AcceptRejectDiff(accepted, stepIndex), uuid()) } fun deleteAtIndex(index: Int) { - send("deleteAtIndex", DeleteAtIndex(index), uuid()) - } - - private fun getModelByRole( - config: Any, - role: Any - ): Any? { - val experimental = (config as? Map<*, *>)?.get("experimental") as? Map<*, *> - val roleTitle = (experimental?.get("modelRoles") as? Map<*, *>)?.get(role) as? String ?: return null - - val models = (config as? Map<*, *>)?.get("models") as? List<*> - val matchingModel = models?.find { model -> - (model as? Map<*, *>)?.get("title") == roleTitle - } - - return matchingModel + continuePluginService.sendToWebview("deleteAtIndex", DeleteAtIndex(index), uuid()) } } \ No newline at end of file diff --git a/extensions/intellij/src/main/kotlin/com/github/continuedev/continueintellijextension/continue/IntelliJIde.kt b/extensions/intellij/src/main/kotlin/com/github/continuedev/continueintellijextension/continue/IntelliJIde.kt index 4482aa5fe..796b3aac6 100644 --- a/extensions/intellij/src/main/kotlin/com/github/continuedev/continueintellijextension/continue/IntelliJIde.kt +++ b/extensions/intellij/src/main/kotlin/com/github/continuedev/continueintellijextension/continue/IntelliJIde.kt @@ -6,6 +6,7 @@ import com.github.continuedev.continueintellijextension.utils.OS import com.github.continuedev.continueintellijextension.utils.getMachineUniqueID import com.github.continuedev.continueintellijextension.utils.getOS import com.github.continuedev.continueintellijextension.utils.toUriOrNull +import com.google.gson.Gson import com.intellij.codeInsight.daemon.impl.HighlightInfo import com.intellij.execution.configurations.GeneralCommandLine import com.intellij.execution.util.ExecUtil @@ -31,6 +32,10 @@ import com.intellij.psi.PsiDocumentManager import com.intellij.testFramework.LightVirtualFile import com.intellij.util.containers.toArray import kotlinx.coroutines.* +import okhttp3.MediaType.Companion.toMediaType +import okhttp3.OkHttpClient +import okhttp3.Request +import okhttp3.RequestBody.Companion.toRequestBody import java.awt.Desktop import java.awt.Toolkit import java.awt.datatransfer.DataFlavor @@ -39,6 +44,7 @@ import java.io.File import java.io.FileInputStream import java.io.InputStreamReader import java.net.URI +import java.net.URL import java.nio.charset.Charset import java.nio.file.Paths @@ -85,16 +91,21 @@ class IntelliJIDE( ) } + suspend fun enableHubContinueDev(): Boolean { + return true + } + override suspend fun getIdeSettings(): IdeSettings { val settings = service() + return IdeSettings( remoteConfigServerUrl = settings.continueState.remoteConfigServerUrl, remoteConfigSyncPeriod = settings.continueState.remoteConfigSyncPeriod, userToken = settings.continueState.userToken ?: "", enableControlServerBeta = settings.continueState.enableContinueTeamsBeta, + continueTestEnvironment = "production", pauseCodebaseIndexOnStart = false, // TODO: Needs to be implemented - continueTestEnvironment = "none" ) } diff --git a/extensions/intellij/src/main/kotlin/com/github/continuedev/continueintellijextension/editor/InlineEditAction.kt b/extensions/intellij/src/main/kotlin/com/github/continuedev/continueintellijextension/editor/InlineEditAction.kt index 9f314ede6..faaf7d058 100644 --- a/extensions/intellij/src/main/kotlin/com/github/continuedev/continueintellijextension/editor/InlineEditAction.kt +++ b/extensions/intellij/src/main/kotlin/com/github/continuedev/continueintellijextension/editor/InlineEditAction.kt @@ -29,7 +29,6 @@ import java.awt.geom.AffineTransform import java.awt.geom.Path2D import java.awt.geom.RoundRectangle2D import javax.swing.* -import javax.swing.border.EmptyBorder import javax.swing.event.DocumentEvent import javax.swing.event.DocumentListener import javax.swing.event.ListDataListener @@ -73,8 +72,8 @@ fun makePanel( onReject: () -> Unit ): JPanel { val topPanel = - ShadowPanel(MigLayout("wrap 1, insets 2 ${leftInset} 2 2, gap 0!")).apply { - background = JBColor(0x20888888.toInt(), 0x20888888.toInt()) + ShadowPanel(MigLayout("wrap 1, insets 2 $leftInset 2 2, gap 0!")).apply { + background = JBColor(0x20888888, 0x20888888) isOpaque = false } @@ -138,7 +137,10 @@ fun openInlineEdit(project: Project?, editor: Editor) { modelTitles.addAll(models.map { it["title"] as String }) } - val maxWaitTime = 200 + // This is a hacky way to not complicate getting model titles with coroutines + // 1500 feels like way upper limit of "would be weird if panel showed up after that long" + // And should always allow enough time to load config + val maxWaitTime = 1500 val startTime = System.currentTimeMillis() while (modelTitles.isEmpty() && System.currentTimeMillis() - startTime < maxWaitTime) { Thread.sleep(20) @@ -374,7 +376,7 @@ class CustomPanel( val closeIcon = IconLoader.getIcon("/icons/close.svg", javaClass) return JLabel(closeIcon).apply { background = Color(0, 0, 0, 0) - border = EmptyBorder(2, 6, 2, 0) + border = JBUI.Borders.empty(2, 6, 2, 0) toolTipText = "`esc` to cancel" isOpaque = false addMouseListener( @@ -406,7 +408,7 @@ class CustomPanel( background = defaultBackground foreground = Color(128, 128, 128, 200) font = UIUtil.getFontWithFallback("Arial", Font.PLAIN, 12) - border = EmptyBorder(8, 8, 8, 8) + border = JBUI.Borders.empty(8) isOpaque = false isEditable = false cursor = Cursor.getPredefinedCursor(Cursor.HAND_CURSOR) @@ -423,7 +425,7 @@ class CustomPanel( val component = super.getListCellRendererComponent(list, value, index, isSelected, cellHasFocus) if (component is JLabel) { - component.border = EmptyBorder(4, 6, 4, 6) + component.border = JBUI.Borders.empty(4, 6) } return component } @@ -451,9 +453,9 @@ class CustomPanel( val rightButton = CustomButton("⏎ Enter") { onEnter() } .apply { - background = JBColor(0x999998.toInt(), 0x999998.toInt()) - foreground = JBColor(0xF5F5F5.toInt(), 0xF5F5F5.toInt()) - border = EmptyBorder(2, 6, 2, 6) + background = globalScheme.defaultForeground + foreground = globalScheme.defaultBackground + border = JBUI.Borders.empty(2, 6) } val rightPanel = JPanel(MigLayout("insets 0, fillx")).apply { @@ -461,7 +463,7 @@ class CustomPanel( add(rightButton, "align right") } - border = EmptyBorder(0, 0, 16, 12) + border = JBUI.Borders.empty(0, 0, 16, 12) isOpaque = false add(dropdown, "align left") @@ -477,7 +479,7 @@ class CustomPanel( val progressBar = JProgressBar().apply { isIndeterminate = true } add(progressBar, BorderLayout.CENTER) - border = BorderFactory.createEmptyBorder(0, 0, 16, 12) + border = JBUI.Borders.empty(0, 0, 16, 12) } private val subPanelC: JPanel = @@ -486,21 +488,19 @@ class CustomPanel( JLabel("Type to re-prompt").apply { foreground = Color(156, 163, 175) // text-gray-400 font = UIUtil.getFontWithFallback("Arial", Font.PLAIN, 11) - border = EmptyBorder(0, 4, 0, 0) + border = JBUI.Borders.emptyLeft(4) } val leftButton = CustomButton("Reject All (${getMetaKeyLabel()}${getShiftKeyLabel()}⌫)") { onReject() } .apply { - background = JBColor(0x30FF0000.toInt(), 0x30FF0000.toInt()) - foreground = JBColor(0xF5F5F5.toInt(), 0xF5F5F5.toInt()) + background = JBColor(0x30FF0000, 0x30FF0000) } val rightButton = CustomButton("Accept All (${getMetaKeyLabel()}${getShiftKeyLabel()}⏎)") { onAccept() } .apply { - background = JBColor(0x3000FF00.toInt(), 0x3000FF00.toInt()) - foreground = JBColor(0xF5F5F5.toInt(), 0xF5F5F5.toInt()) + background = JBColor(0x3000FF00, 0x3000FF00) } val rightPanel = @@ -508,12 +508,12 @@ class CustomPanel( isOpaque = false add(leftButton, "align right") add(rightButton, "align right") - border = EmptyBorder(0, 0, 0, 0) + border = JBUI.Borders.empty() } add(leftLabel, "align left") add(rightPanel, "align right") - border = BorderFactory.createEmptyBorder(0, 0, 16, 12) + border = JBUI.Borders.empty(0, 0, 16, 12) isOpaque = false } @@ -625,7 +625,7 @@ class CustomButton(text: String, onClick: () -> Unit) : JLabel(text, CENTER) { }) font = UIUtil.getFontWithFallback("Arial", Font.PLAIN, 11) - border = EmptyBorder(2, 6, 2, 6) + border = JBUI.Borders.empty(2, 6) } override fun paintComponent(g: Graphics) { @@ -694,7 +694,7 @@ class TransparentArrowButtonUI : BasicComboBoxUI() { } override fun getInsets(): Insets { - return JBUI.insets(0, 6, 0, 0) + return JBUI.insetsLeft(6) } override fun installUI(c: JComponent?) { diff --git a/extensions/intellij/src/main/kotlin/com/github/continuedev/continueintellijextension/editor/VerticalDiffBlock.kt b/extensions/intellij/src/main/kotlin/com/github/continuedev/continueintellijextension/editor/VerticalDiffBlock.kt index 6f311c29b..035c52db8 100644 --- a/extensions/intellij/src/main/kotlin/com/github/continuedev/continueintellijextension/editor/VerticalDiffBlock.kt +++ b/extensions/intellij/src/main/kotlin/com/github/continuedev/continueintellijextension/editor/VerticalDiffBlock.kt @@ -13,8 +13,8 @@ import com.intellij.openapi.project.Project import com.intellij.openapi.util.TextRange import com.intellij.ui.JBColor import com.intellij.util.application +import com.intellij.util.ui.JBUI import java.awt.* -import javax.swing.BorderFactory import javax.swing.JButton import javax.swing.JTextArea import kotlin.math.min @@ -25,8 +25,8 @@ class VerticalDiffBlock( var startLine: Int, private val onAcceptReject: (VerticalDiffBlock, Boolean) -> Unit ) { - val deletedLines: MutableList = mutableListOf(); - val addedLines: MutableList = mutableListOf(); + val deletedLines: MutableList = mutableListOf() + val addedLines: MutableList = mutableListOf() private val acceptButton: JButton private val rejectButton: JButton private var deletionInlay: Disposable? = null @@ -155,10 +155,10 @@ class VerticalDiffBlock( val rejectBtn = createButton( "${getAltKeyLabel()}${getShiftKeyLabel()}N", - JBColor(0x99FF0000.toInt(), 0x99FF0000.toInt()) + JBColor(0x77FF0000, 0x77FF0000) ).apply { addActionListener { - handleReject(); + handleReject() onAcceptReject(this@VerticalDiffBlock, false) } @@ -168,10 +168,10 @@ class VerticalDiffBlock( createButton( "${getAltKeyLabel()}${ getShiftKeyLabel() - }Y", JBColor(0x7700BB00.toInt(), 0x7700BB00.toInt()) + }Y", JBColor(0x7700BB00, 0x7700BB00) ).apply { addActionListener { - handleAccept(); + handleAccept() onAcceptReject(this@VerticalDiffBlock, true) } } @@ -192,10 +192,12 @@ class VerticalDiffBlock( private fun revertDiff() { WriteCommandAction.runWriteCommandAction(project) { - // Delete the added lines val startOffset = editor.document.getLineStartOffset(startLine) - val endOffset = editor.document.getLineEndOffset(startLine + addedLines.size - 1) + 1 - editor.document.deleteString(startOffset, endOffset) + // Delete the added lines + if (addedLines.isNotEmpty()) { + val endOffset = editor.document.getLineEndOffset(startLine + addedLines.size - 1) + 1 + editor.document.deleteString(startOffset, endOffset) + } // Add the deleted lines back if (deletedLines.isNotEmpty()) { @@ -215,9 +217,9 @@ class VerticalDiffBlock( private fun createDeletionTextArea(text: String) = JTextArea(text).apply { isEditable = false - background = JBColor(0x30FF0000.toInt(), 0x30FF0000.toInt()) + background = JBColor(0x30FF0000, 0x30FF0000) foreground = JBColor.GRAY - border = BorderFactory.createEmptyBorder() + border = JBUI.Borders.empty() lineWrap = false wrapStyleWord = false font = editor.colorsScheme.getFont(EditorFontType.PLAIN) @@ -250,7 +252,7 @@ class VerticalDiffBlock( font = Font("Arial", Font.BOLD, 9) isContentAreaFilled = false isOpaque = false - border = BorderFactory.createEmptyBorder(4, 2, 4, 2) + border = JBUI.Borders.empty(4, 2) preferredSize = Dimension(preferredSize.width - 30, 14) cursor = Cursor(Cursor.HAND_CURSOR) } diff --git a/extensions/intellij/src/main/kotlin/com/github/continuedev/continueintellijextension/protocol/ide.kt b/extensions/intellij/src/main/kotlin/com/github/continuedev/continueintellijextension/protocol/ide.kt index 4aa433f52..5ce49e80a 100644 --- a/extensions/intellij/src/main/kotlin/com/github/continuedev/continueintellijextension/protocol/ide.kt +++ b/extensions/intellij/src/main/kotlin/com/github/continuedev/continueintellijextension/protocol/ide.kt @@ -2,7 +2,7 @@ package com.github.continuedev.continueintellijextension.protocol import com.github.continuedev.continueintellijextension.* -data class GetControlPlaneSessionInfoParams(val silent: Boolean) +data class GetControlPlaneSessionInfoParams(val silent: Boolean, val useOnboarding: Boolean) data class WriteFileParams( val path: String, diff --git a/extensions/intellij/src/main/kotlin/com/github/continuedev/continueintellijextension/services/ContinueExtensionSettingsService.kt b/extensions/intellij/src/main/kotlin/com/github/continuedev/continueintellijextension/services/ContinueExtensionSettingsService.kt index 7430f2bcb..f20096d81 100644 --- a/extensions/intellij/src/main/kotlin/com/github/continuedev/continueintellijextension/services/ContinueExtensionSettingsService.kt +++ b/extensions/intellij/src/main/kotlin/com/github/continuedev/continueintellijextension/services/ContinueExtensionSettingsService.kt @@ -2,6 +2,7 @@ package com.github.continuedev.continueintellijextension.services import com.github.continuedev.continueintellijextension.constants.getConfigJsPath import com.github.continuedev.continueintellijextension.constants.getConfigJsonPath +import com.intellij.execution.target.value.constant import com.intellij.openapi.application.ApplicationInfo import com.intellij.openapi.application.ApplicationManager import com.intellij.openapi.components.* @@ -98,7 +99,7 @@ open class ContinueExtensionSettings : PersistentStateComponent - - - - - diff --git a/extensions/vscode/.gitignore b/extensions/vscode/.gitignore index 05afd11d4..29ad0b023 100644 --- a/extensions/vscode/.gitignore +++ b/extensions/vscode/.gitignore @@ -11,7 +11,6 @@ bin assets gui/** -!gui/onigasm.wasm .devcontainer .github diff --git a/extensions/vscode/CHANGELOG.md b/extensions/vscode/CHANGELOG.md index 88f9906e3..f575f6735 100644 --- a/extensions/vscode/CHANGELOG.md +++ b/extensions/vscode/CHANGELOG.md @@ -5,6 +5,13 @@ adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html), and is generated by [Changie](https://github.com/miniscruff/changie). +## 1.0.0 - 2025-02-26 +### Added +* Introduces hub.continue.dev +* Improved apply quality +### Fixed +* Numerous reliability improvements + ## 0.8.66 - 2024-12-20 ### Changed * Improved autocomplete in untitled files diff --git a/extensions/vscode/README.md b/extensions/vscode/README.md index 8bfc32b73..9470b2d5e 100644 --- a/extensions/vscode/README.md +++ b/extensions/vscode/README.md @@ -8,7 +8,7 @@
-**[Continue](https://docs.continue.dev) is the leading open-source AI code assistant. You can connect any models and any context to build custom autocomplete and chat experiences inside [VS Code](https://marketplace.visualstudio.com/items?itemName=Continue.continue) and [JetBrains](https://plugins.jetbrains.com/plugin/22707-continue-extension)** +**[Continue](https://docs.continue.dev) enables to developers create, share, and use custom AI code assistants with our open-source [VS Code](https://marketplace.visualstudio.com/items?itemName=Continue.continue) extension and [hub of models, rules, prompts, docs, and other building blocks](https://hub.continue.dev)**
diff --git a/extensions/vscode/config_schema.json b/extensions/vscode/config_schema.json index d9dab076b..a6b7cf2de 100644 --- a/extensions/vscode/config_schema.json +++ b/extensions/vscode/config_schema.json @@ -33,7 +33,7 @@ "description": "The presence penalty Aof the completion.", "type": "number" }, - "frequencePenalty": { + "frequencyPenalty": { "title": "Frequency Penalty", "description": "The frequency penalty of the completion.", "type": "number" @@ -193,6 +193,7 @@ "deepinfra", "groq", "fireworks", + "ncompass", "cloudflare", "deepseek", "azure", @@ -238,6 +239,7 @@ "### DeepInfra\n\n> [Reference](https://docs.continue.dev/reference/Model%20Providers/deepinfra)", "### Groq\nGroq provides extremely fast inference of open-source language models. To get started, obtain an API key from [their console](https://console.groq.com/keys).", "### Fireworks\nFireworks is a fast inference engine for open-source language models. To get started, obtain an API key from [their console](https://fireworks.ai/api-keys).", + "### Ncompass\nnCompass is an extremely fast inference engine for open-source language models. To get started, obtain an API key from [their console](https://app.ncompass.tech/api-settings).", "### Cloudflare Workers AI\n\n[Reference](https://developers.cloudflare.com/workers-ai/)", "### Deepseek\n Deepseek's API provides the best pricing for their state-of-the-art Deepseek Coder models. To get started, obtain an API key from [their console](https://platform.deepseek.com/api_keys)", "### Azure OpenAI\n Azure OpenAI lets you securely run OpenAI's models on Azure. To get started, follow the steps [here](https://docs.continue.dev/reference/Model%20Providers/azure)", @@ -264,7 +266,7 @@ }, "apiKey": { "title": "Api Key", - "description": "OpenAI, Anthropic, Cohere, Together, Novita AI, or other API key", + "description": "OpenAI, Anthropic, Cohere, Together, Novita AI, nCompass, or other API key", "type": "string" }, "apiBase": { @@ -440,6 +442,10 @@ "uploadImage": { "type": "boolean", "description": "Indicates whether the model can upload images." + }, + "tools": { + "type": "boolean", + "description": "Indicates whether the model can use tools" } } } @@ -477,6 +483,7 @@ "huggingface-inference-api", "replicate", "together", + "ncompass", "novita", "cloudflare", "sambanova", @@ -831,6 +838,7 @@ "claude-2", "claude-instant-1", "claude-3-5-sonnet-latest", + "claude-3-7-sonnet-20250219", "claude-3-opus-20240229", "claude-3-sonnet-20240229", "claude-3-haiku-20240307", @@ -1365,6 +1373,23 @@ } } }, + { + "if": { + "properties": { + "provider": { + "enum": ["ncompass"] + } + }, + "required": ["provider"] + }, + "then": { + "properties": { + "model": { + "enum": ["qwen2.5-coder-32b", "qwen2.5-72b", "llama3.3-70b"] + } + } + } + }, { "if": { "properties": { @@ -1395,23 +1420,6 @@ } } }, - { - "if": { - "properties": { - "provider": { - "const": "llamafile" - } - }, - "required": ["provider"] - }, - "then": { - "properties": { - "llamafileCommand": { - "type": "string" - } - } - } - }, { "if": { "properties": { @@ -1429,23 +1437,6 @@ } } }, - { - "if": { - "properties": { - "provider": { - "enum": ["text-gen-webui"] - } - }, - "required": ["provider"] - }, - "then": { - "properties": { - "streamingUrl": { - "type": "string" - } - } - } - }, { "if": { "properties": { @@ -1683,33 +1674,6 @@ } ] }, - "ModelRoles": { - "title": "ModelRoles", - "type": "object", - "properties": { - "default": { - "title": "Default", - "description": "The default model. If other model roles are not set, they will fall back to default.", - "type": "string" - }, - "chat": { - "title": "Chat", - "description": "The model to use for chat. If not set, will fall back to default.", - "type": "string" - }, - "edit": { - "title": "Edit", - "description": "The model to use for editing. If not set, will fall back to default.", - "type": "string" - }, - "summarize": { - "title": "Summarize", - "description": "The model to use for summarization. If not set, will fall back to default.", - "type": "string" - } - }, - "required": ["default"] - }, "SlashCommand": { "title": "SlashCommand", "type": "object", @@ -2778,14 +2742,14 @@ "description": "Request options to be used in any fetch requests made by the embeddings provider", "$ref": "#/$defs/RequestOptions" }, - "maxChunkSize": { + "maxEmbeddingChunkSize": { "title": "Maximum Chunk Size", "description": "The maximum number of tokens that each chunk of a document is allowed to have", "type": "integer", "minimum": 128, "exclusiveMaximum": 2147483647 }, - "maxBatchSize": { + "maxEmbeddingBatchSize": { "title": "Maximum Batch Size", "description": "The maximum number of chunks that can be sent to the embeddings provider in a single request", "type": "integer", diff --git a/extensions/vscode/e2e/selectors/GUI.selectors.ts b/extensions/vscode/e2e/selectors/GUI.selectors.ts index 319157500..43f5a2db4 100644 --- a/extensions/vscode/e2e/selectors/GUI.selectors.ts +++ b/extensions/vscode/e2e/selectors/GUI.selectors.ts @@ -4,7 +4,7 @@ import { SelectorUtils } from "./SelectorUtils"; export class GUISelectors { public static getDescription(view: WebView) { - return view.findWebElement(By.xpath("//*[contains(text(), 'Quickly')]")); + return view.findWebElement(By.xpath("//*[contains(text(), 'quickly')]")); } public static getMessageInputFields(view: WebView) { diff --git a/extensions/vscode/e2e/tests/GUI.test.ts b/extensions/vscode/e2e/tests/GUI.test.ts index 4369a917f..7abe736cd 100644 --- a/extensions/vscode/e2e/tests/GUI.test.ts +++ b/extensions/vscode/e2e/tests/GUI.test.ts @@ -47,52 +47,56 @@ describe("GUI Test", () => { }); describe("Onboarding", () => { - it("should display correct panel description", async () => { + it.skip("should display correct panel description", async () => { const description = await GUISelectors.getDescription(view); expect(await description.getText()).has.string( - "Quickly get up and running using our API keys.", + "Log in to quickly build your first custom AI code assistant", ); }).timeout(DEFAULT_TIMEOUT.XL); - it("should display tutorial card after accepting onboarding quick start", async () => { - // Get paragraph with text Best - const bestTab = await GUISelectors.getOnboardingTabButton(view, "Best"); - await bestTab.click(); + // We no longer have a quick start button + it.skip( + "should display tutorial card after accepting onboarding quick start", + async () => { + // Get paragraph with text Best + const bestTab = await GUISelectors.getOnboardingTabButton(view, "Best"); + await bestTab.click(); - const anthropicInput = await TestUtils.waitForSuccess( - async () => await GUISelectors.getBestChatApiKeyInput(view), - ); - anthropicInput.sendKeys("invalid_api_key"); + const anthropicInput = await TestUtils.waitForSuccess( + async () => await GUISelectors.getBestChatApiKeyInput(view), + ); + anthropicInput.sendKeys("invalid_api_key"); - const mistralInput = - await GUISelectors.getBestAutocompleteApiKeyInput(view); - mistralInput.sendKeys("invalid_api_key"); + const mistralInput = + await GUISelectors.getBestAutocompleteApiKeyInput(view); + mistralInput.sendKeys("invalid_api_key"); - // Get button with text "Connect" and click it - const connectButton = await view.findWebElement( - By.xpath("//button[text()='Connect']"), - ); - await connectButton.click(); + // Get button with text "Connect" and click it + const connectButton = await view.findWebElement( + By.xpath("//button[text()='Connect']"), + ); + await connectButton.click(); - await TestUtils.waitForSuccess( - async () => await GUISelectors.getTutorialCard(view), - ); + await TestUtils.waitForSuccess( + async () => await GUISelectors.getTutorialCard(view), + ); - // TODO validate that claude has been added to list + // TODO validate that claude has been added to list - // Skip testing Quick Start because github auth opens external app and breaks test - // const quickStartButton = await view.findWebElement( - // By.xpath("//*[contains(text(), 'Get started using our API keys')]") - // ); - // await quickStartButton.click(); - // await view.switchBack(); - // const allowButton = await TestUtils.waitForSuccess( - // async () => await driver.findElement(By.xpath(`//a[contains(text(), "Allow")]`)) - // ); - // await allowButton.click(); - // ({ view, driver } = await GUIActions.switchToReactIframe()); - }).timeout(DEFAULT_TIMEOUT.XL); + // Skip testing Quick Start because github auth opens external app and breaks test + // const quickStartButton = await view.findWebElement( + // By.xpath("//*[contains(text(), 'Get started using our API keys')]") + // ); + // await quickStartButton.click(); + // await view.switchBack(); + // const allowButton = await TestUtils.waitForSuccess( + // async () => await driver.findElement(By.xpath(`//a[contains(text(), "Allow")]`)) + // ); + // await allowButton.click(); + // ({ view, driver } = await GUIActions.switchToReactIframe()); + }, + ).timeout(DEFAULT_TIMEOUT.XL); }); describe("Chat", () => { diff --git a/extensions/vscode/package-lock.json b/extensions/vscode/package-lock.json index 78a61be2b..9b61f1900 100644 --- a/extensions/vscode/package-lock.json +++ b/extensions/vscode/package-lock.json @@ -1,12 +1,12 @@ { "name": "continue", - "version": "0.9.260", + "version": "1.1.2", "lockfileVersion": 3, "requires": true, "packages": { "": { "name": "continue", - "version": "0.9.260", + "version": "1.1.2", "license": "Apache-2.0", "dependencies": { "@continuedev/fetch": "^1.0.3", @@ -22,7 +22,7 @@ "dbinfoz": "^0.14.0", "diff": "^7.0.0", "downshift": "^7.6.0", - "esbuild": "^0.17.19", + "esbuild": "0.17.19", "express": "^4.18.2", "fkill": "^8.1.0", "follow-redirects": "^1.15.4", @@ -50,7 +50,7 @@ "socket.io-client": "^4.7.2", "strip-ansi": "^7.1.0", "svg-builder": "^2.0.0", - "systeminformation": "^5.22.10", + "systeminformation": "^5.23.7", "tailwindcss": "^3.3.2", "undici": "^6.2.0", "uuid": "^9.0.1", @@ -106,13 +106,13 @@ "@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.23", + "@continuedev/config-yaml": "^1.0.52", "@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", + "@octokit/rest": "^20.1.1", "@typescript-eslint/eslint-plugin": "^7.8.0", "@xenova/transformers": "2.14.0", "adf-to-md": "^1.1.0", @@ -165,7 +165,7 @@ "wink-nlp-utils": "^2.1.0", "workerpool": "^9.1.3", "yaml": "^2.4.2", - "zod": "^3.23.8" + "zod": "^3.24.2" }, "devDependencies": { "@babel/preset-env": "^7.24.7", @@ -5735,9 +5735,10 @@ "integrity": "sha512-dX7e/LHVJ6W3DE1MHWi9S1EYzDESENfLrYohG2G++ovZrYOkm4Knwa0mc1cn84xJOR4KEU0WSchhLbd0UklbHw==" }, "node_modules/express": { - "version": "4.21.1", - "resolved": "https://registry.npmjs.org/express/-/express-4.21.1.tgz", - "integrity": "sha512-YSFlK1Ee0/GC8QaO91tHcDxJiE/X4FbpAyQWkxAvG6AXCuR65YzK8ua6D9hvi/TzUfZMpc+BwuM1IPw8fmQBiQ==", + "version": "4.21.2", + "resolved": "https://registry.npmjs.org/express/-/express-4.21.2.tgz", + "integrity": "sha512-28HqgMZAmih1Czt9ny7qr6ek2qddF4FclbMzwhCREB6OFfH+rXAnuNCwo1/wFvrtbgsQDb4kSbX9de9lFbrXnA==", + "license": "MIT", "dependencies": { "accepts": "~1.3.8", "array-flatten": "1.1.1", @@ -5758,7 +5759,7 @@ "methods": "~1.1.2", "on-finished": "2.4.1", "parseurl": "~1.3.3", - "path-to-regexp": "0.1.10", + "path-to-regexp": "0.1.12", "proxy-addr": "~2.0.7", "qs": "6.13.0", "range-parser": "~1.2.1", @@ -5773,6 +5774,10 @@ }, "engines": { "node": ">= 0.10.0" + }, + "funding": { + "type": "opencollective", + "url": "https://opencollective.com/express" } }, "node_modules/express/node_modules/debug": { @@ -9098,15 +9103,16 @@ } }, "node_modules/nanoid": { - "version": "3.3.7", - "resolved": "https://registry.npmjs.org/nanoid/-/nanoid-3.3.7.tgz", - "integrity": "sha512-eSRppjcPIatRIMC1U6UngP8XFcz8MQWGQdt1MTBQ7NaAmvXDfvNxbvWV3x2y6CdEUciCSsDHDQZbhYaB8QEo2g==", + "version": "3.3.8", + "resolved": "https://registry.npmjs.org/nanoid/-/nanoid-3.3.8.tgz", + "integrity": "sha512-WNLf5Sd8oZxOm+TzppcYk8gVOgP+l58xNy58D0nbUnOxOWRWvlcCV4kUF7ltmI6PsrLl/BgKEyS4mqsGChFN0w==", "funding": [ { "type": "github", "url": "https://github.com/sponsors/ai" } ], + "license": "MIT", "bin": { "nanoid": "bin/nanoid.cjs" }, @@ -10059,9 +10065,10 @@ } }, "node_modules/path-to-regexp": { - "version": "0.1.10", - "resolved": "https://registry.npmjs.org/path-to-regexp/-/path-to-regexp-0.1.10.tgz", - "integrity": "sha512-7lf7qcQidTku0Gu3YDPc8DJ1q7OOucfa/BSsIwjuh56VU7katFvuM8hULfkwB3Fns/rsVF7PwPKVw1sl5KQS9w==" + "version": "0.1.12", + "resolved": "https://registry.npmjs.org/path-to-regexp/-/path-to-regexp-0.1.12.tgz", + "integrity": "sha512-RA1GjUVMnvYFxuqovrEqZoxxW5NUZqbwKtYz/Tt7nXerk0LbLblQmrsgdeOxV5SFHf0UDggjS/bSeOZwt1pmEQ==", + "license": "MIT" }, "node_modules/path-type": { "version": "4.0.0", @@ -12168,9 +12175,10 @@ } }, "node_modules/systeminformation": { - "version": "5.23.5", - "resolved": "https://registry.npmjs.org/systeminformation/-/systeminformation-5.23.5.tgz", - "integrity": "sha512-PEpJwhRYxZgBCAlWZhWIgfMTjXLqfcaZ1pJsJn9snWNfBW/Z1YQg1mbIUSWrEV3ErAHF7l/OoVLQeaZDlPzkpA==", + "version": "5.25.11", + "resolved": "https://registry.npmjs.org/systeminformation/-/systeminformation-5.25.11.tgz", + "integrity": "sha512-jI01fn/t47rrLTQB0FTlMCC+5dYx8o0RRF+R4BPiUNsvg5OdY0s9DKMFmJGrx5SwMZQ4cag0Gl6v8oycso9b/g==", + "license": "MIT", "os": [ "darwin", "linux", @@ -12911,9 +12919,10 @@ "dev": true }, "node_modules/undici": { - "version": "6.20.1", - "resolved": "https://registry.npmjs.org/undici/-/undici-6.20.1.tgz", - "integrity": "sha512-AjQF1QsmqfJys+LXfGTNum+qw4S88CojRInG/6t31W/1fk6G59s92bnAvGz5Cmur+kQv2SURXEvvudLmbrE8QA==", + "version": "6.21.1", + "resolved": "https://registry.npmjs.org/undici/-/undici-6.21.1.tgz", + "integrity": "sha512-q/1rj5D0/zayJB2FraXdaWxbhWiNKDvu8naDT2dl1yTlvJp4BLtOcp2a5BvgGNQpYYJzau7tf1WgKv3b+7mqpQ==", + "license": "MIT", "engines": { "node": ">=18.17" } @@ -13309,10 +13318,11 @@ } }, "node_modules/vite": { - "version": "4.5.5", - "resolved": "https://registry.npmjs.org/vite/-/vite-4.5.5.tgz", - "integrity": "sha512-ifW3Lb2sMdX+WU91s3R0FyQlAyLxOzCSCP37ujw0+r5POeHPwe6udWVIElKQq8gk3t7b8rkmvqC6IHBpCff4GQ==", + "version": "4.5.9", + "resolved": "https://registry.npmjs.org/vite/-/vite-4.5.9.tgz", + "integrity": "sha512-qK9W4xjgD3gXbC0NmdNFFnVFLMWSNiR3swj957yutwzzN16xF/E7nmtAyp1rT9hviDroQANjE4HK3H4WqWdFtw==", "dev": true, + "license": "MIT", "dependencies": { "esbuild": "^0.18.10", "postcss": "^8.4.27", diff --git a/extensions/vscode/package.json b/extensions/vscode/package.json index bb45a07be..366da7ff5 100644 --- a/extensions/vscode/package.json +++ b/extensions/vscode/package.json @@ -2,7 +2,7 @@ "name": "continue", "icon": "media/icon.png", "author": "Continue Dev, Inc", - "version": "0.9.261", + "version": "1.1.3", "repository": { "type": "git", "url": "https://github.com/continuedev/continue" @@ -94,12 +94,7 @@ "continue.enableContinueForTeams": { "type": "boolean", "default": false, - "markdownDescription": "Enable Continue for teams beta features. To sign in, click the person icon in the bottom right of the sidebar." - }, - "continue.enableContinueHub": { - "type": "boolean", - "default": false, - "description": "Enable Continue Hub (internal)" + "markdownDescription": "Enable Continue for teams beta features. To sign in, click the gear icon to go to the settings page, and click Sign In." }, "continue.showInlineTip": { "type": "boolean", @@ -213,7 +208,7 @@ { "command": "continue.toggleFullScreen", "category": "Continue", - "title": "Toggle Full Screen", + "title": "Open in new window", "icon": "$(link-external)", "group": "Continue" }, @@ -328,20 +323,6 @@ "category": "Continue", "title": "Focus Continue Chat", "group": "Continue" - }, - { - "command": "continue.signInToControlPlane", - "title": "Sign In", - "category": "Continue", - "group": "Continue", - "icon": "$(account)" - }, - { - "command": "continue.openAccountDialog", - "title": "Account", - "category": "Continue", - "group": "Continue", - "icon": "$(account)" } ], "keybindings": [ @@ -481,27 +462,27 @@ { "command": "continue.writeCommentsForCode", "group": "Continue", - "when": "editorHasSelection" + "when": "editorHasSelection && !editorReadonly" }, { "command": "continue.writeDocstringForCode", "group": "Continue", - "when": "editorHasSelection" + "when": "editorHasSelection && !editorReadonly" }, { "command": "continue.fixCode", "group": "Continue", - "when": "editorHasSelection" + "when": "editorHasSelection && !editorReadonly" }, { "command": "continue.optimizeCode", "group": "Continue", - "when": "editorHasSelection" + "when": "editorHasSelection && !editorReadonly" }, { "command": "continue.fixGrammar", "group": "Continue", - "when": "editorHasSelection && editorLangId == 'markdown'" + "when": "editorHasSelection && editorLangId == 'markdown' && !editorReadonly" } ], "explorer/context": [ @@ -531,16 +512,6 @@ "group": "navigation@4", "when": "view == continue.continueGUIView" }, - { - "command": "continue.signInToControlPlane", - "group": "navigation@5", - "when": "(view == continue.continueGUIView) && (config.continue.enableContinueForTeams || config.continue.enableContinueHub) && !continue.isSignedInToControlPlane" - }, - { - "command": "continue.openAccountDialog", - "group": "navigation@5", - "when": "(view == continue.continueGUIView) && (config.continue.enableContinueForTeams || config.continue.enableContinueHub) && continue.isSignedInToControlPlane" - }, { "command": "continue.openMorePage", "group": "navigation@6", @@ -624,7 +595,7 @@ "e2e:build": "npm --prefix ../../gui run build && npm run package", "e2e:create-storage": "mkdir -p ./e2e/storage", "e2e:get-chromedriver": "extest get-chromedriver --storage ./e2e/storage", - "e2e:get-vscode": "extest get-vscode --storage ./e2e/storage", + "e2e:get-vscode": "CODE_VERSION=\"1.95.0\" extest get-vscode --storage ./e2e/storage", "e2e:sign-vscode": "codesign --entitlements entitlements.plist --deep --force -s - './e2e/storage/Visual Studio Code.app'", "e2e:copy-vsix": "chmod +x ./e2e/get-latest-vsix.sh && bash ./e2e/get-latest-vsix.sh", "e2e:install-vsix": "extest install-vsix -f ./e2e/vsix/continue.vsix --extensions_dir ./e2e/.test-extensions --storage ./e2e/storage", @@ -683,7 +654,7 @@ "dbinfoz": "^0.14.0", "diff": "^7.0.0", "downshift": "^7.6.0", - "esbuild": "^0.17.19", + "esbuild": "0.17.19", "express": "^4.18.2", "fkill": "^8.1.0", "follow-redirects": "^1.15.4", @@ -711,7 +682,7 @@ "socket.io-client": "^4.7.2", "strip-ansi": "^7.1.0", "svg-builder": "^2.0.0", - "systeminformation": "^5.22.10", + "systeminformation": "^5.23.7", "tailwindcss": "^3.3.2", "undici": "^6.2.0", "uuid": "^9.0.1", diff --git a/extensions/vscode/scripts/prepackage.js b/extensions/vscode/scripts/prepackage.js index 4f3650ff0..aeab677ca 100644 --- a/extensions/vscode/scripts/prepackage.js +++ b/extensions/vscode/scripts/prepackage.js @@ -1,12 +1,15 @@ const fs = require("fs"); -const ncp = require("ncp").ncp; const path = require("path"); + +const ncp = require("ncp").ncp; const { rimrafSync } = require("rimraf"); + const { validateFilesPresent, execCmdSync, autodetectPlatformAndArch, } = require("../../../scripts/util/index"); + const { copyConfigSchema } = require("./utils"); // Clear folders that will be packaged to ensure clean slate @@ -46,6 +49,17 @@ console.log("[info] Using target: ", target); const exe = os === "win32" ? ".exe" : ""; +const isInGitHubAction = !!process.env.GITHUB_ACTIONS; + +const isArmTarget = + target === "darwin-arm64" || + target === "linux-arm64" || + target === "win32-arm64"; + +const isWinTarget = target?.startsWith("win"); +const isLinuxTarget = target?.startsWith("linux"); +const isMacTarget = target?.startsWith("darwin"); + (async () => { console.log("[info] Packaging extension for target ", target); @@ -66,7 +80,7 @@ const exe = os === "win32" ? ".exe" : ""; execCmdSync("npm install"); console.log("[info] npm install in gui completed"); - if (ghAction()) { + if (isInGitHubAction) { execCmdSync("npm run build"); } @@ -106,12 +120,6 @@ const exe = os === "win32" ? ".exe" : ""; fs.copyFileSync("tmp_index.html", indexHtmlPath); fs.unlinkSync("tmp_index.html"); - // Copy over other misc. files - fs.copyFileSync( - "../extensions/vscode/gui/onigasm.wasm", - path.join(intellijExtensionWebviewPath, "onigasm.wasm"), - ); - console.log("[info] Copied gui build to JetBrains extension"); // Then copy over the dist folder to the VSCode extension // @@ -222,7 +230,7 @@ const exe = os === "win32" ? ".exe" : ""; "../../../core/llm/llamaTokenizerWorkerPool.mjs", "../../../core/llm/llamaTokenizer.mjs", "../../../core/llm/tiktokenWorkerPool.mjs", - "../../../core/util/start_ollama.sh" + "../../../core/util/start_ollama.sh", ]; for (const f of filesToCopy) { @@ -262,22 +270,6 @@ const exe = os === "win32" ? ".exe" : ""; ); }); - function ghAction() { - return !!process.env.GITHUB_ACTIONS; - } - - function isArm() { - return ( - target === "darwin-arm64" || - target === "linux-arm64" || - target === "win32-arm64" - ); - } - - function isWin() { - return target?.startsWith("win"); - } - async function installNodeModuleInTempDirAndCopyToCurrent( packageName, toCopy, @@ -341,42 +333,40 @@ const exe = os === "win32" ? ".exe" : ""; } // GitHub Actions doesn't support ARM, so we need to download pre-saved binaries - if (ghAction() && isArm()) { - // sqlite3 - if (!isWin()) { - // Neither lancedb nor sqlite3 have pre-built windows arm64 binaries + // 02/07/25 - the above comment is out of date, there is now support for ARM runners on GitHub Actions + if (isInGitHubAction && isArmTarget) { + // lancedb binary + const packageToInstall = { + "darwin-arm64": "@lancedb/vectordb-darwin-arm64", + "linux-arm64": "@lancedb/vectordb-linux-arm64-gnu", + "win32-arm64": "@lancedb/vectordb-win32-arm64-msvc", + }[target]; + console.log( + "[info] Downloading pre-built lancedb binary: " + packageToInstall, + ); - // lancedb binary - const packageToInstall = { - "darwin-arm64": "@lancedb/vectordb-darwin-arm64", - "linux-arm64": "@lancedb/vectordb-linux-arm64-gnu", - }[target]; - console.log( - "[info] Downloading pre-built lancedb binary: " + packageToInstall, - ); + await installNodeModuleInTempDirAndCopyToCurrent( + packageToInstall, + "@lancedb", + ); - await installNodeModuleInTempDirAndCopyToCurrent( - packageToInstall, - "@lancedb", - ); - - // Replace the installed with pre-built - console.log("[info] Downloading pre-built sqlite3 binary"); - rimrafSync("../../core/node_modules/sqlite3/build"); - const downloadUrl = { - "darwin-arm64": - "https://github.com/TryGhost/node-sqlite3/releases/download/v5.1.7/sqlite3-v5.1.7-napi-v6-darwin-arm64.tar.gz", - "linux-arm64": - "https://github.com/TryGhost/node-sqlite3/releases/download/v5.1.7/sqlite3-v5.1.7-napi-v3-linux-arm64.tar.gz", - }[target]; - execCmdSync( - `curl -L -o ../../core/node_modules/sqlite3/build.tar.gz ${downloadUrl}`, - ); - execCmdSync( - "cd ../../core/node_modules/sqlite3 && tar -xvzf build.tar.gz", - ); - fs.unlinkSync("../../core/node_modules/sqlite3/build.tar.gz"); - } + // Replace the installed with pre-built + console.log("[info] Downloading pre-built sqlite3 binary"); + rimrafSync("../../core/node_modules/sqlite3/build"); + const downloadUrl = { + "darwin-arm64": + "https://github.com/TryGhost/node-sqlite3/releases/download/v5.1.7/sqlite3-v5.1.7-napi-v6-darwin-arm64.tar.gz", + "linux-arm64": + "https://github.com/TryGhost/node-sqlite3/releases/download/v5.1.7/sqlite3-v5.1.7-napi-v3-linux-arm64.tar.gz", + // node-sqlite3 doesn't have a pre-built binary for win32-arm64 + "win32-arm64": + "https://continue-server-binaries.s3.us-west-1.amazonaws.com/win32-arm64/node_sqlite3.tar.gz", + }[target]; + execCmdSync( + `curl -L -o ../../core/node_modules/sqlite3/build.tar.gz ${downloadUrl}`, + ); + execCmdSync("cd ../../core/node_modules/sqlite3 && tar -xvzf build.tar.gz"); + fs.unlinkSync("../../core/node_modules/sqlite3/build.tar.gz"); // Download and unzip esbuild console.log("[info] Downloading pre-built esbuild binary"); @@ -483,9 +473,9 @@ const exe = os === "win32" ? ".exe" : ""; // onnx runtime bindngs `bin/napi-v3/${os}/${arch}/onnxruntime_binding.node`, `bin/napi-v3/${os}/${arch}/${ - os === "darwin" + isMacTarget ? "libonnxruntime.1.14.0.dylib" - : os === "linux" + : isLinuxTarget ? "libonnxruntime.so.1.14.0" : "onnxruntime.dll" }`, @@ -528,11 +518,7 @@ const exe = os === "win32" ? ".exe" : ""; ? "win32-x64/esbuild.exe" : `${target}/bin/esbuild` }`, - `out/node_modules/@lancedb/vectordb-${ - os === "win32" - ? "win32-x64-msvc" - : `${target}${os === "linux" ? "-gnu" : ""}` - }/index.node`, + `out/node_modules/@lancedb/vectordb-${target}${isWinTarget ? "-msvc" : ""}${isLinuxTarget ? "-gnu" : ""}/index.node`, `out/node_modules/esbuild/lib/main.js`, `out/node_modules/esbuild/bin/esbuild`, ]); diff --git a/extensions/vscode/scripts/utils.js b/extensions/vscode/scripts/utils.js index 4f9ce187c..c4d392cfa 100644 --- a/extensions/vscode/scripts/utils.js +++ b/extensions/vscode/scripts/utils.js @@ -18,8 +18,10 @@ function copyConfigSchema() { enum: ["merge", "overwrite"], default: "merge", title: "Merge behavior", - markdownDescription: "If set to 'merge', .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.", - "x-intellij-html-description": "

If set to merge, .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.

" + markdownDescription: + "If set to 'merge', .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.", + "x-intellij-html-description": + "

If set to merge, .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.

", }; fs.writeFileSync("continue_rc_schema.json", JSON.stringify(schema, null, 2)); @@ -123,12 +125,6 @@ async function buildGui(isGhAction) { fs.copyFileSync("tmp_index.html", indexHtmlPath); fs.unlinkSync("tmp_index.html"); - // Copy over other misc. files - fs.copyFileSync( - "../extensions/vscode/gui/onigasm.wasm", - path.join(intellijExtensionWebviewPath, "onigasm.wasm"), - ); - console.log("[info] Copied gui build to JetBrains extension"); // Then copy over the dist folder to the VSCode extension // @@ -508,21 +504,11 @@ async function installNodeModuleInTempDirAndCopyToCurrent(packageName, toCopy) { async function copyScripts() { process.chdir(path.join(continueDir, "extensions", "vscode")); console.log("[info] Copying scripts from core"); - await new Promise((resolve, reject) => { - ncp( - path.join(__dirname, "../../../core/scripts"), - path.join(__dirname, "../out"), - { dereference: true }, - (error) => { - if (error) { - console.warn("[error] Error copying script files", error); - reject(error); - } else { - resolve(); - } - }, - ); - }); + fs.copyFileSync( + path.join(__dirname, "../../../core/util/start_ollama.sh"), + path.join(__dirname, "../out/start_ollama.sh"), + ); + console.log("[info] Copied script files"); } module.exports = { @@ -539,5 +525,5 @@ module.exports = { downloadSqliteBinary, downloadRipgrepBinary, copyTokenizers, - copyScripts + copyScripts, }; diff --git a/extensions/vscode/src/VsCodeIde.ts b/extensions/vscode/src/VsCodeIde.ts index 7f9f561f6..cd4589b9c 100644 --- a/extensions/vscode/src/VsCodeIde.ts +++ b/extensions/vscode/src/VsCodeIde.ts @@ -33,6 +33,7 @@ import { SecretStorage } from "./stubs/SecretStorage"; class VsCodeIde implements IDE { ideUtils: VsCodeIdeUtils; secretStorage: SecretStorage; + private lastFileSaveTimestamp: number = Date.now(); constructor( private readonly vscodeWebviewProtocolPromise: Promise, @@ -42,6 +43,14 @@ class VsCodeIde implements IDE { this.secretStorage = new SecretStorage(context); } + public updateLastFileSaveTimestamp(): void { + this.lastFileSaveTimestamp = Date.now(); + } + + public getLastFileSaveTimestamp(): number { + return this.lastFileSaveTimestamp; + } + async readSecrets(keys: string[]): Promise> { const secretValuePromises = keys.map((key) => this.secretStorage.get(key)); const secretValues = await Promise.all(secretValuePromises); @@ -619,7 +628,7 @@ class VsCodeIde implements IDE { return vscode.workspace.fs.readDirectory(vscode.Uri.parse(dir)) as any; } - getIdeSettingsSync(): IdeSettings { + private getIdeSettingsSync(): IdeSettings { const settings = vscode.workspace.getConfiguration(EXTENSION_NAME); const remoteConfigServerUrl = settings.get( "remoteConfigServerUrl", @@ -636,9 +645,7 @@ class VsCodeIde implements IDE { "enableContinueForTeams", false, ), - continueTestEnvironment: settings.get("enableContinueHub") - ? "production" - : "none", + continueTestEnvironment: "production", pauseCodebaseIndexOnStart: settings.get( "pauseCodebaseIndexOnStart", false, @@ -652,7 +659,8 @@ class VsCodeIde implements IDE { } async getIdeSettings(): Promise { - return this.getIdeSettingsSync(); + const ideSettings = this.getIdeSettingsSync(); + return ideSettings; } } diff --git a/extensions/vscode/src/activation/InlineTipManager.ts b/extensions/vscode/src/activation/InlineTipManager.ts index 0ea078c21..b5158758a 100644 --- a/extensions/vscode/src/activation/InlineTipManager.ts +++ b/extensions/vscode/src/activation/InlineTipManager.ts @@ -12,13 +12,13 @@ const SVG_CONFIG = { strokeWidth: 1, shortcutColor: "#999998", filter: "drop-shadow(0 2px 2px rgba(0,0,0,0.2))", - radius: 4, + radius: 3, leftMargin: 40, debounceDelay: 500, chatLabel: "Chat", - chatShortcut: `${getMetaKeyLabel()}L`, + chatShortcut: `${getMetaKeyLabel()}+L`, editLabel: "Edit", - editShortcut: `${getMetaKeyLabel()}I`, + editShortcut: `${getMetaKeyLabel()}+I`, get fontSize() { return Math.ceil( @@ -32,14 +32,11 @@ const SVG_CONFIG = { "helvetica" ); }, - get paddingY() { - return Math.ceil(this.fontSize * 0.4); - }, get paddingX() { - return Math.ceil(this.fontSize * 0.8); + return Math.ceil(this.getEstimatedTextWidth(" ")); }, get gap() { - return this.fontSize * 2.5; + return this.fontSize * 0.5; }, get tipWidth() { return ( @@ -49,22 +46,22 @@ const SVG_CONFIG = { ); }, get tipHeight() { - return this.fontSize + this.paddingY * 2; + return this.fontSize; }, get textY() { - return this.tipHeight / 2 + this.fontSize * 0.35; + return (this.tipHeight + this.fontSize)/2; }, get chatLabelX() { return this.paddingX; }, get chatShortcutX() { - return this.chatLabelX + this.getEstimatedTextWidth(this.chatLabel) + 4; + return this.chatLabelX + this.getEstimatedTextWidth(this.chatLabel + " "); }, get editLabelX() { - return this.chatShortcutX + this.gap; + return this.chatShortcutX + this.getEstimatedTextWidth(this.chatShortcut) + this.gap; }, get editShortcutX() { - return this.editLabelX + this.getEstimatedTextWidth(this.editLabel) + 4; + return this.editLabelX + this.getEstimatedTextWidth(this.editLabel + " "); }, getEstimatedTextWidth(text: string): number { return text.length * this.fontSize * 0.6; @@ -234,10 +231,17 @@ export class InlineTipManager { } private createSvgTooltipDecoration() { + var backgroundColour = 0; + if (this.theme) { + backgroundColour = this.theme.colors["editor.background"]; + } return vscode.window.createTextEditorDecorationType({ after: { contentIconPath: this.svgTooltip, - margin: `-5px 0 0 ${SVG_CONFIG.leftMargin}px`, + border: `;box-shadow: inset 0 0 0 ${SVG_CONFIG.strokeWidth}px ${SVG_CONFIG.stroke}, inset 0 0 0 ${SVG_CONFIG.tipHeight}px ${backgroundColour}; + border-radius: ${SVG_CONFIG.radius}px; + filter: ${SVG_CONFIG.filter}`, + margin: `0 0 0 ${SVG_CONFIG.leftMargin}px`, width: `${SVG_CONFIG.tipWidth}px`, }, }); @@ -258,19 +262,6 @@ export class InlineTipManager { const svgContent = svgBuilder .width(SVG_CONFIG.tipWidth) .height(SVG_CONFIG.tipHeight) - // Main rectangle - .rect({ - x: 0, - y: 0, - width: SVG_CONFIG.tipWidth, - height: SVG_CONFIG.tipHeight, - rx: SVG_CONFIG.radius, - ry: SVG_CONFIG.radius, - fill: this.theme.colors["editor.background"], - stroke: SVG_CONFIG.stroke, - "stroke-width": SVG_CONFIG.strokeWidth, - filter: SVG_CONFIG.filter, - }) // Chat .text( { diff --git a/extensions/vscode/src/autocomplete/RecentlyVisitedRangesService.ts b/extensions/vscode/src/autocomplete/RecentlyVisitedRangesService.ts index 2dba327ef..a20e88ac3 100644 --- a/extensions/vscode/src/autocomplete/RecentlyVisitedRangesService.ts +++ b/extensions/vscode/src/autocomplete/RecentlyVisitedRangesService.ts @@ -16,10 +16,10 @@ export class RecentlyVisitedRangesService { Array >; // Default value, we override in initWithPostHog - private numSurroundingLines = 5; + private numSurroundingLines = 20; private maxRecentFiles = 3; private maxSnippetsPerFile = 3; - private isEnabled = false; + private isEnabled = true; constructor(private readonly ide: IDE) { this.cache = new LRUCache< @@ -38,12 +38,11 @@ export class RecentlyVisitedRangesService { PosthogFeatureFlag.RecentlyVisitedRangesNumSurroundingLines, ); - if (!recentlyVisitedRangesNumSurroundingLines) { - return; + if (recentlyVisitedRangesNumSurroundingLines) { + this.isEnabled = true; + this.numSurroundingLines = recentlyVisitedRangesNumSurroundingLines; } - this.isEnabled = true; - this.numSurroundingLines = recentlyVisitedRangesNumSurroundingLines; vscode.window.onDidChangeTextEditorSelection( this.cacheCurrentSelectionContext, ); @@ -114,7 +113,10 @@ export class RecentlyVisitedRangesService { } return allSnippets - .filter((s) => !currentFilepath || s.filepath !== currentFilepath) + .filter((s) => !currentFilepath || (s.filepath !== currentFilepath && + // 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 + !s.filepath.startsWith("output:extension-output-Continue.continue"))) .sort((a, b) => b.timestamp - a.timestamp) .map(({ timestamp, ...snippet }) => snippet); } diff --git a/extensions/vscode/src/autocomplete/completionProvider.ts b/extensions/vscode/src/autocomplete/completionProvider.ts index 6049d9259..28a3da45e 100644 --- a/extensions/vscode/src/autocomplete/completionProvider.ts +++ b/extensions/vscode/src/autocomplete/completionProvider.ts @@ -23,7 +23,6 @@ import { stopStatusBarLoading, } from "./statusBar"; -import type { TabAutocompleteModel } from "../util/loadAutocompleteModel"; import type { IDE } from "core"; interface VsCodeCompletionInput { @@ -74,13 +73,19 @@ export class ContinueCompletionProvider constructor( private readonly configHandler: ConfigHandler, private readonly ide: IDE, - private readonly tabAutocompleteModel: TabAutocompleteModel, private readonly webviewProtocol: VsCodeWebviewProtocol, ) { + async function getAutocompleteModel() { + const { config } = await configHandler.loadConfig(); + if (!config) { + return; + } + return config.selectedModelByRole.autocomplete ?? undefined; + } this.completionProvider = new CompletionProvider( this.configHandler, this.ide, - this.tabAutocompleteModel.get.bind(this.tabAutocompleteModel), + getAutocompleteModel, this.onError.bind(this), getDefinitionsFromLsp, ); diff --git a/extensions/vscode/src/autocomplete/lsp.ts b/extensions/vscode/src/autocomplete/lsp.ts index 6d3b27543..5a56925cc 100644 --- a/extensions/vscode/src/autocomplete/lsp.ts +++ b/extensions/vscode/src/autocomplete/lsp.ts @@ -33,7 +33,7 @@ function gotoInputKey(input: GotoInput) { return `${input.name}${input.uri.toString()}${input.line}${input.character}`; } -const MAX_CACHE_SIZE = 50; +const MAX_CACHE_SIZE = 500; const gotoCache = new Map(); export async function executeGotoProvider( @@ -151,28 +151,32 @@ async function crawlTypes( identifierNodes.forEach((node) => searchedLabels.add(node.text)); // Use LSP to get the definitions of those types - const definitions = await Promise.all( - identifierNodes.map(async (node) => { - const [typeDef] = await executeGotoProvider({ - uri: vscode.Uri.parse(rif.filepath), - // TODO: tree-sitter is zero-indexed, but there seems to be an off-by-one - // error at least with the .ts parser sometimes - line: - rif.range.start.line + - Math.min(node.startPosition.row, astLineCount - 1), - character: rif.range.start.character + node.startPosition.column, - name: "vscode.executeDefinitionProvider", - }); + const definitions = []; - if (!typeDef) { - return undefined; - } - return { - ...typeDef, - contents: await ide.readRangeInFile(typeDef.filepath, typeDef.range), - }; - }), - ); + for (const node of identifierNodes) { + const [typeDef] = await executeGotoProvider({ + uri: vscode.Uri.parse(rif.filepath), + // TODO: tree-sitter is zero-indexed, but there seems to be an off-by-one + // error at least with the .ts parser sometimes + line: + rif.range.start.line + + Math.min(node.startPosition.row, astLineCount - 1), + character: rif.range.start.character + node.startPosition.column, + name: "vscode.executeDefinitionProvider", + }); + + if (!typeDef) { + definitions.push(undefined); + continue; + } + + const contents = await ide.readRangeInFile(typeDef.filepath, typeDef.range); + + definitions.push({ + ...typeDef, + contents, + }); + } // TODO: Filter out if not in our code? diff --git a/extensions/vscode/src/commands.ts b/extensions/vscode/src/commands.ts index 76045f196..1ef13d5f7 100644 --- a/extensions/vscode/src/commands.ts +++ b/extensions/vscode/src/commands.ts @@ -4,7 +4,6 @@ import * as os from "node:os"; import { ContextMenuConfig, RangeInFileWithContents } from "core"; import { CompletionProvider } from "core/autocomplete/CompletionProvider"; import { ConfigHandler } from "core/config/ConfigHandler"; -import { getModelByRole } from "core/config/util"; import { ContinueServerClient } from "core/continueServer/stubs/client"; import { EXTENSION_NAME } from "core/control-plane/env"; import { Core } from "core/core"; @@ -30,11 +29,12 @@ import { VerticalDiffManager } from "./diff/vertical/manager"; import EditDecorationManager from "./quickEdit/EditDecorationManager"; import { QuickEdit, QuickEditShowParams } from "./quickEdit/QuickEditQuickPick"; import { Battery } from "./util/battery"; -import { VsCodeIde } from "./VsCodeIde"; import { getMetaKeyLabel } from "./util/util"; +import { VsCodeIde } from "./VsCodeIde"; -import type { VsCodeWebviewProtocol } from "./webviewProtocol"; +import { LOCAL_DEV_DATA_VERSION } from "core/data/log"; import { startLocalOllama } from "core/util/ollamaHelper"; +import type { VsCodeWebviewProtocol } from "./webviewProtocol"; let fullScreenPanel: vscode.WebviewPanel | undefined; @@ -348,7 +348,7 @@ const getCommandsMap: ( ); const modelTitle = - getModelByRole(config, "inlineEdit")?.title ?? defaultModelTitle; + config.selectedModelByRole.edit?.title ?? defaultModelTitle; void sidebar.webviewProtocol.request("incrementFtc", undefined); @@ -710,7 +710,7 @@ const getCommandsMap: ( sidebar.webviewProtocol?.request("newSession", undefined); }, "continue.viewHistory": () => { - sidebar.webviewProtocol?.request("viewHistory", undefined); + vscode.commands.executeCommand("continue.navigateTo", "/history", true); }, "continue.focusContinueSessionId": async ( sessionId: string | undefined, @@ -872,16 +872,12 @@ const getCommandsMap: ( const config = vscode.workspace.getConfiguration(EXTENSION_NAME); const quickPick = vscode.window.createQuickPick(); - const autocompleteModels = - (await configHandler.loadConfig()).config?.tabAutocompleteModels ?? []; - let selected = new GlobalContext().get("selectedTabAutocompleteModel"); - if ( - !selected || - !autocompleteModels.some((model) => model.title === selected) - ) { - selected = autocompleteModels[0]?.title; - } + const { config: continueConfig } = await configHandler.loadConfig(); + const autocompleteModels = + continueConfig?.modelsByRole.autocomplete ?? []; + const selected = + continueConfig?.selectedModelByRole?.autocomplete?.title ?? undefined; // Toggle between Disabled, Paused, and Enabled const pauseOnBattery = @@ -916,7 +912,8 @@ const getCommandsMap: ( }, { label: "$(screen-full) Open full screen chat", - description: getMetaKeyLabel() + " + K, " + getMetaKeyLabel() + " + M", + description: + getMetaKeyLabel() + " + K, " + getMetaKeyLabel() + " + M", }, { label: quickPickStatusText(targetStatus), @@ -955,11 +952,14 @@ const getCommandsMap: ( } else if ( autocompleteModels.some((model) => model.title === selectedOption) ) { - new GlobalContext().update( - "selectedTabAutocompleteModel", - selectedOption, - ); - configHandler.reloadConfig(); + if (core.configHandler.currentProfile?.profileDescription.id) { + core.invoke("config/updateSelectedModel", { + profileId: + core.configHandler.currentProfile?.profileDescription.id, + role: "autocomplete", + title: selectedOption, + }); + } } else if (selectedOption === "$(feedback) Give feedback") { vscode.commands.executeCommand("continue.giveAutocompleteFeedback"); } else if (selectedOption === "$(comment) Open chat (Cmd+L)") { @@ -985,7 +985,10 @@ const getCommandsMap: ( }); if (feedback) { const client = await continueServerClientPromise; - const completionsPath = getDevDataFilePath("autocomplete"); + const completionsPath = getDevDataFilePath( + "autocomplete", + LOCAL_DEV_DATA_VERSION, + ); const lastLines = await readLastLines.read(completionsPath, 2); client.sendFeedback(feedback, lastLines); @@ -998,12 +1001,6 @@ const getCommandsMap: ( sidebar.webviewProtocol?.request("navigateTo", { path, toggle }); focusGUI(); }, - "continue.signInToControlPlane": () => { - sidebar.webviewProtocol?.request("signInToControlPlane", undefined); - }, - "continue.openAccountDialog": () => { - sidebar.webviewProtocol?.request("openDialogMessage", "account"); - }, "continue.startLocalOllama": () => { startLocalOllama(ide); }, diff --git a/extensions/vscode/src/diff/vertical/manager.ts b/extensions/vscode/src/diff/vertical/manager.ts index 1e1b41a17..a62406b00 100644 --- a/extensions/vscode/src/diff/vertical/manager.ts +++ b/extensions/vscode/src/diff/vertical/manager.ts @@ -1,4 +1,4 @@ -import { DiffLine } from "core"; +import { ChatMessage, DiffLine } from "core"; import { ConfigHandler } from "core/config/ConfigHandler"; import { streamDiffLines } from "core/edit/streamDiffLines"; import { pruneLinesFromBottom, pruneLinesFromTop } from "core/llm/countTokens"; @@ -272,6 +272,7 @@ export class VerticalDiffManager { onlyOneInsertion?: boolean, quickEdit?: string, range?: vscode.Range, + newCode?: string, ): Promise { vscode.commands.executeCommand("setContext", "continue.diffVisible", true); @@ -386,6 +387,18 @@ export class VerticalDiffManager { llm.model, ); + let overridePrompt: ChatMessage[] | undefined; + if (llm.promptTemplates?.apply) { + const rendered = llm.renderPromptTemplate(llm.promptTemplates.apply, [], { + original_code: rangeContent, + new_code: newCode ?? "", + }); + overridePrompt = + typeof rendered === "string" + ? [{ role: "user", content: rendered }] + : rendered; + } + if (editor.selection) { // Unselect the range editor.selection = new vscode.Selection( @@ -413,7 +426,8 @@ export class VerticalDiffManager { llm, input, getMarkdownLanguageTagForFile(fileUri), - onlyOneInsertion, + !!onlyOneInsertion, + overridePrompt, ); for await (const line of stream) { diff --git a/extensions/vscode/src/extension/VsCodeExtension.ts b/extensions/vscode/src/extension/VsCodeExtension.ts index be58bb375..8953c91a0 100644 --- a/extensions/vscode/src/extension/VsCodeExtension.ts +++ b/extensions/vscode/src/extension/VsCodeExtension.ts @@ -34,7 +34,6 @@ import { } from "../stubs/WorkOsAuthProvider"; import { Battery } from "../util/battery"; import { FileSearch } from "../util/FileSearch"; -import { TabAutocompleteModel } from "../util/loadAutocompleteModel"; import { VsCodeIde } from "../VsCodeIde"; import { VsCodeMessenger } from "./VsCodeMessenger"; @@ -47,7 +46,6 @@ export class VsCodeExtension { private configHandler: ConfigHandler; private extensionContext: vscode.ExtensionContext; private ide: VsCodeIde; - private tabAutocompleteModel: TabAutocompleteModel; private sidebar: ContinueGUIWebviewViewProvider; private windowId: string; private editDecorationManager: EditDecorationManager; @@ -143,7 +141,6 @@ export class VsCodeExtension { this.editDecorationManager, ); resolveVerticalDiffManager?.(this.verticalDiffManager); - this.tabAutocompleteModel = new TabAutocompleteModel(this.configHandler); setupRemoteConfigSync( this.configHandler.reloadConfig.bind(this.configHandler), @@ -168,22 +165,12 @@ export class VsCodeExtension { } else if (newConfig) { setupStatusBar(undefined, undefined, false); - const result = await this.configHandler.getSerializedConfig(); - this.sidebar.webviewProtocol?.request("configUpdate", { - result, - profileId: this.configHandler.currentProfile.profileDescription.id, - }); - - this.tabAutocompleteModel.clearLlm(); - registerAllCodeLensProviders( context, this.verticalDiffManager.fileUriToCodeLens, newConfig, ); } - - this.sidebar.webviewProtocol?.request("configError", errors); }, ); @@ -201,7 +188,6 @@ export class VsCodeExtension { new ContinueCompletionProvider( this.configHandler, this.ide, - this.tabAutocompleteModel, this.sidebar.webviewProtocol, ), ), @@ -275,6 +261,7 @@ export class VsCodeExtension { }); vscode.workspace.onDidSaveTextDocument(async (event) => { + this.ide.updateLastFileSaveTimestamp(); this.core.invoke("files/changed", { uris: [event.uri.toString()], }); @@ -375,24 +362,13 @@ export class VsCodeExtension { void this.core.invoke("didChangeActiveTextEditor", { filepath }); }); - const enableContinueHub = vscode.workspace - .getConfiguration(EXTENSION_NAME) - .get("enableContinueHub"); vscode.workspace.onDidChangeConfiguration(async (event) => { if (event.affectsConfiguration(EXTENSION_NAME)) { - const settings = this.ide.getIdeSettingsSync(); + const settings = await this.ide.getIdeSettings(); const webviewProtocol = await this.webviewProtocolPromise; void webviewProtocol.request("didChangeIdeSettings", { settings, }); - - if ( - enableContinueHub - ? settings.continueTestEnvironment !== "production" - : settings.continueTestEnvironment === "production" - ) { - await vscode.commands.executeCommand("workbench.action.reloadWindow"); - } } }); } diff --git a/extensions/vscode/src/extension/VsCodeMessenger.ts b/extensions/vscode/src/extension/VsCodeMessenger.ts index 6bce4818a..23669305a 100644 --- a/extensions/vscode/src/extension/VsCodeMessenger.ts +++ b/extensions/vscode/src/extension/VsCodeMessenger.ts @@ -28,6 +28,7 @@ import { showTutorial } from "../util/tutorial"; import { getExtensionUri } from "../util/vscode"; import { VsCodeIde } from "../VsCodeIde"; import { VsCodeWebviewProtocol } from "../webviewProtocol"; +import { ILLM } from "core"; /** * A shared messenger class between Core and Webview @@ -177,7 +178,7 @@ export class VsCodeMessenger { return; } - let llm = getModelByRole(config, "applyCodeBlock"); + let llm: ILLM | null | undefined = config.selectedModelByRole.apply; if (!llm) { llm = config.models.find( @@ -230,6 +231,7 @@ export class VsCodeMessenger { undefined, undefined, rangeToApplyTo, + data.text, ); } }); @@ -285,13 +287,10 @@ export class VsCodeMessenger { const prompt = msg.data.prompt; const { start, end } = msg.data.range.range; const verticalDiffManager = await verticalDiffManagerPromise; - const modelTitle = await this.webviewProtocol.request( - "getDefaultModelTitle", - undefined, - ); + const fileAfterEdit = await verticalDiffManager.streamEdit( stripImages(prompt), - modelTitle, + msg.data.selectedModelTitle, "edit", undefined, undefined, @@ -306,30 +305,6 @@ export class VsCodeMessenger { fileAfterEdit, }); }); - this.onWebview("edit/acceptReject", async (msg) => { - const { onlyFirst, accept, filepath } = msg.data; - if (accept && onlyFirst) { - // Accept first - vscode.commands.executeCommand( - "continue.acceptVerticalDiffBlock", - filepath, - 0, - ); - } else if (accept) { - vscode.commands.executeCommand("continue.acceptDiff", filepath); - // Accept all - } else if (onlyFirst) { - // Reject first - vscode.commands.executeCommand( - "continue.rejectVerticalDiffBlock", - filepath, - 0, - ); - } else { - // Reject all - vscode.commands.executeCommand("continue.rejectDiff", filepath); - } - }); this.onWebview("edit/exit", async (msg) => { if (msg.data.shouldFocusEditor) { const activeEditor = vscode.window.activeTextEditor; diff --git a/extensions/vscode/src/quickEdit/ContextProvidersQuickPick.ts b/extensions/vscode/src/quickEdit/ContextProvidersQuickPick.ts index 1296a3466..074ec4d86 100644 --- a/extensions/vscode/src/quickEdit/ContextProvidersQuickPick.ts +++ b/extensions/vscode/src/quickEdit/ContextProvidersQuickPick.ts @@ -41,8 +41,8 @@ export async function getContextProvidersString( return provider.getContextItems("", { config, ide, - embeddingsProvider: config.embeddingsProvider, - reranker: config.reranker, + embeddingsProvider: config.selectedModelByRole.embed, + reranker: config.selectedModelByRole.rerank, llm: config.models[0], fullInput: "", selectedCode: [], diff --git a/extensions/vscode/src/quickEdit/QuickEditQuickPick.ts b/extensions/vscode/src/quickEdit/QuickEditQuickPick.ts index 09cf8e2cd..ec84eb81b 100644 --- a/extensions/vscode/src/quickEdit/QuickEditQuickPick.ts +++ b/extensions/vscode/src/quickEdit/QuickEditQuickPick.ts @@ -1,8 +1,6 @@ /* eslint-disable @typescript-eslint/naming-convention */ import { IDE } from "core"; import { ConfigHandler } from "core/config/ConfigHandler"; -import { getModelByRole } from "core/config/util"; -import { logDevData } from "core/util/devdata"; import { Telemetry } from "core/util/posthog"; import * as vscode from "vscode"; @@ -10,6 +8,7 @@ import { VerticalDiffManager } from "../diff/vertical/manager"; import { FileSearch } from "../util/FileSearch"; import { VsCodeWebviewProtocol } from "../webviewProtocol"; +import { DataLogger } from "core/data/log"; import { getContextProviderQuickPickVal } from "./ContextProvidersQuickPick"; import { appendToHistory, getHistoryQuickPickVal } from "./HistoryQuickPick"; import { getModelQuickPickVal } from "./ModelSelectionQuickPick"; @@ -226,13 +225,18 @@ export class QuickEdit { break; } let model = await this.getCurModelTitle(); - logDevData("quickEdit", { - prompt, - path, - label, - diffs: this.verticalDiffManager.logDiffs, - model, + + void DataLogger.getInstance().logDevData({ + name: "quickEdit", + data: { + prompt, + path, + label, + diffs: this.verticalDiffManager.logDiffs, + model, + }, }); + quickPick.dispose(); }); } @@ -273,7 +277,7 @@ export class QuickEdit { } return ( - getModelByRole(config, "inlineEdit")?.title ?? + config.selectedModelByRole.edit?.title ?? (await this.webviewProtocol.request( "getDefaultModelTitle", undefined, diff --git a/extensions/vscode/src/stubs/WorkOsAuthProvider.ts b/extensions/vscode/src/stubs/WorkOsAuthProvider.ts index de10f9c7d..8f0e00c8c 100644 --- a/extensions/vscode/src/stubs/WorkOsAuthProvider.ts +++ b/extensions/vscode/src/stubs/WorkOsAuthProvider.ts @@ -25,10 +25,12 @@ import { SecretStorage } from "./SecretStorage"; const AUTH_NAME = "Continue"; +const enableControlServerBeta = workspace + .getConfiguration(EXTENSION_NAME) + .get("enableContinueForTeams", false); const controlPlaneEnv = getControlPlaneEnvSync( - workspace.getConfiguration(EXTENSION_NAME).get("enableContinueHub") - ? "production" - : "none", + true ? "production" : "none", + enableControlServerBeta, ); const SESSIONS_SECRET_KEY = `${controlPlaneEnv.AUTH_TYPE}.sessions`; diff --git a/extensions/vscode/src/stubs/remoteConfig.ts b/extensions/vscode/src/stubs/remoteConfig.ts index ffe1fe89b..e0ff9bb76 100644 --- a/extensions/vscode/src/stubs/remoteConfig.ts +++ b/extensions/vscode/src/stubs/remoteConfig.ts @@ -5,6 +5,7 @@ import { EXTENSION_NAME } from "core/control-plane/env"; import { getConfigJsonPathForRemote } from "core/util/paths"; import * as vscode from "vscode"; +import { canParseUrl } from "core/util/url"; import { CONTINUE_WORKSPACE_KEY } from "../util/workspaceConfig"; export class RemoteConfigSync { @@ -66,18 +67,6 @@ export class RemoteConfigSync { }; } - private canParse(url: string): boolean { - if ((URL as any).canParse) { - return (URL as any).canParse(url); - } - try { - new URL(url); - return true; - } catch (e) { - return false; - } - } - async setup() { if ( this.userToken === null || @@ -86,7 +75,7 @@ export class RemoteConfigSync { ) { return; } - if (!this.canParse(this.remoteConfigServerUrl)) { + if (!canParseUrl(this.remoteConfigServerUrl)) { vscode.window.showErrorMessage( "The value set for 'remoteConfigServerUrl' is not valid: ", this.remoteConfigServerUrl, diff --git a/extensions/vscode/src/util/ideUtils.ts b/extensions/vscode/src/util/ideUtils.ts index f576d6d1e..9642af68e 100644 --- a/extensions/vscode/src/util/ideUtils.ts +++ b/extensions/vscode/src/util/ideUtils.ts @@ -394,6 +394,27 @@ export class VsCodeIdeUtils { } } + private _getRepositories(): Repository[] | undefined { + const extension = + vscode.extensions.getExtension("vscode.git"); + if ( + typeof extension === "undefined" || + !extension.isActive || + typeof vscode.workspace.workspaceFolders === "undefined" + ) { + return undefined; + } + + try { + const git = extension.exports.getAPI(1); + return git.repositories; + } catch (e) { + this._repoWasNone = true; + console.warn("Git not found: ", e); + return undefined; + } + } + private _repoWasNone: boolean = false; private repoCache: Map = new Map(); private static secondsToWaitForGitToLoad = @@ -475,20 +496,28 @@ export class VsCodeIdeUtils { async getDiff(includeUnstaged: boolean): Promise { const diffs: string[] = []; - for (const dir of this.getWorkspaceDirectories()) { - const repo = await this.getRepo(dir); - if (!repo) { - continue; + const repos = this._getRepositories(); + + try { + if (repos) { + for (const repo of repos) { + + const staged = await repo.diff(true); + + diffs.push(staged); + if (includeUnstaged) { + const unstaged = await repo.diff(false); + diffs.push(unstaged); + } + } } - const staged = await repo.diff(true); - diffs.push(staged); - if (includeUnstaged) { - const unstaged = await repo.diff(false); - diffs.push(unstaged); - } + return diffs.flatMap((diff) => this.splitDiff(diff)); + + } catch (e) { + console.error(e); + return []; } - return diffs.flatMap((diff) => this.splitDiff(diff)); } } diff --git a/extensions/vscode/src/util/loadAutocompleteModel.ts b/extensions/vscode/src/util/loadAutocompleteModel.ts deleted file mode 100644 index fda69f023..000000000 --- a/extensions/vscode/src/util/loadAutocompleteModel.ts +++ /dev/null @@ -1,65 +0,0 @@ -import { ConfigHandler } from "core/config/ConfigHandler"; -import Ollama from "core/llm/llms/Ollama"; -import { GlobalContext } from "core/util/GlobalContext"; - -import type { ILLM } from "core"; - -export class TabAutocompleteModel { - private _llm: ILLM | undefined; - private defaultTag = "qwen2.5-coder:1.5b"; - private globalContext: GlobalContext = new GlobalContext(); - - constructor(private configHandler: ConfigHandler) {} - - clearLlm() { - this._llm = undefined; - } - - async getDefaultTabAutocompleteModel() { - const llm = new Ollama({ - model: this.defaultTag, - }); - - try { - const models = await llm.listModels(); - if (!models.includes(this.defaultTag)) { - return undefined; - } - } catch (e) { - return undefined; - } - - return llm; - } - - async get() { - if (!this._llm) { - const { config } = await this.configHandler.loadConfig(); - if (!config) { - return undefined; - } - - if (config.tabAutocompleteModels?.length) { - const selected = this.globalContext.get("selectedTabAutocompleteModel"); - if (selected) { - this._llm = - config.tabAutocompleteModels?.find( - (model) => model.title === selected, - ) ?? config.tabAutocompleteModels?.[0]; - } else { - if (config.tabAutocompleteModels[0].title) { - this.globalContext.update( - "selectedTabAutocompleteModel", - config.tabAutocompleteModels[0].title, - ); - } - this._llm = config.tabAutocompleteModels[0]; - } - } else { - this._llm = await this.getDefaultTabAutocompleteModel(); - } - } - - return this._llm; - } -} diff --git a/gui/package-lock.json b/gui/package-lock.json index 0984ae74d..74273c5aa 100644 --- a/gui/package-lock.json +++ b/gui/package-lock.json @@ -7,7 +7,7 @@ "name": "gui", "license": "Apache-2.0", "dependencies": { - "@continuedev/config-yaml": "^1.0.23", + "@continuedev/config-yaml": "^1.0.52", "@headlessui/react": "^1.7.17", "@heroicons/react": "^2.0.18", "@reduxjs/toolkit": "^2.3.0", @@ -32,7 +32,6 @@ "lodash": "^4.17.21", "minisearch": "^7.0.2", "mustache": "^4.2.0", - "onigasm": "^2.2.5", "posthog-js": "^1.130.1", "prismjs": "^1.29.0", "react": "^18.2.0", @@ -51,7 +50,7 @@ "redux-persist-transform-filter": "^0.0.22", "redux-thunk": "^3.1.0", "rehype-highlight": "^7.0.0", - "rehype-katex": "^7.0.0", + "rehype-katex": "^7.0.1", "rehype-wrap-all": "^1.1.0", "remark-math": "^6.0.0", "reselect": "^5.1.1", @@ -108,13 +107,13 @@ "@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.23", + "@continuedev/config-yaml": "^1.0.52", "@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", + "@octokit/rest": "^20.1.1", "@typescript-eslint/eslint-plugin": "^7.8.0", "@xenova/transformers": "2.14.0", "adf-to-md": "^1.1.0", @@ -167,7 +166,7 @@ "wink-nlp-utils": "^2.1.0", "workerpool": "^9.1.3", "yaml": "^2.4.2", - "zod": "^3.23.8" + "zod": "^3.24.2" }, "devDependencies": { "@babel/preset-env": "^7.24.7", @@ -556,13 +555,13 @@ } }, "node_modules/@continuedev/config-yaml": { - "version": "1.0.23", - "resolved": "https://registry.npmjs.org/@continuedev/config-yaml/-/config-yaml-1.0.23.tgz", - "integrity": "sha512-F2Hwc85iCwAHJuwJALOsmZIBeHdF+87mS0YT7dlC6QiE+zAhZKUHcLQ/nTt9bJuhyVyufpb9LApkp40UdGsaWw==", + "version": "1.0.52", + "resolved": "https://registry.npmjs.org/@continuedev/config-yaml/-/config-yaml-1.0.52.tgz", + "integrity": "sha512-x0m4bcQpjHrrv95cq5tsen4Hb6yKCVGn+NeojyzNQYnRD0If/On+ATgX78uXtQtZxsdO4ip73HHCyQlA0O3ZyQ==", "dependencies": { "@continuedev/config-types": "^1.0.14", "yaml": "^2.6.1", - "zod": "^3.23.8" + "zod": "^3.24.2" } }, "node_modules/@emotion/is-prop-valid": { @@ -3871,10 +3870,11 @@ } }, "node_modules/bin-version/node_modules/cross-spawn": { - "version": "7.0.3", - "resolved": "https://registry.npmjs.org/cross-spawn/-/cross-spawn-7.0.3.tgz", - "integrity": "sha512-iRDPJKUPVEND7dHPO8rkbOnPpyDygcDFtWjpeWNCgy8WP2rXcxXL8TskReQl6OrB2G7+UJrags1q15Fudc7G6w==", + "version": "7.0.6", + "resolved": "https://registry.npmjs.org/cross-spawn/-/cross-spawn-7.0.6.tgz", + "integrity": "sha512-uV2QOWP2nWzsy2aMp8aRibhi9dlzF5Hgh5SHaB9OiTGEyDTiJJyx0uy51QXdyWbtAHNua4XJzUKca3OzKUd3vA==", "dev": true, + "license": "MIT", "dependencies": { "path-key": "^3.1.0", "shebang-command": "^2.0.0", @@ -5756,10 +5756,11 @@ } }, "node_modules/foreground-child/node_modules/cross-spawn": { - "version": "7.0.3", - "resolved": "https://registry.npmjs.org/cross-spawn/-/cross-spawn-7.0.3.tgz", - "integrity": "sha512-iRDPJKUPVEND7dHPO8rkbOnPpyDygcDFtWjpeWNCgy8WP2rXcxXL8TskReQl6OrB2G7+UJrags1q15Fudc7G6w==", + "version": "7.0.6", + "resolved": "https://registry.npmjs.org/cross-spawn/-/cross-spawn-7.0.6.tgz", + "integrity": "sha512-uV2QOWP2nWzsy2aMp8aRibhi9dlzF5Hgh5SHaB9OiTGEyDTiJJyx0uy51QXdyWbtAHNua4XJzUKca3OzKUd3vA==", "dev": true, + "license": "MIT", "dependencies": { "path-key": "^3.1.0", "shebang-command": "^2.0.0", @@ -7595,13 +7596,14 @@ } }, "node_modules/katex": { - "version": "0.16.11", - "resolved": "https://registry.npmjs.org/katex/-/katex-0.16.11.tgz", - "integrity": "sha512-RQrI8rlHY92OLf3rho/Ts8i/XvjgguEjOkO1BEXcU3N8BqPpSzBNwV/G0Ukr+P/l3ivvJUE/Fa/CwbS6HesGNQ==", + "version": "0.16.21", + "resolved": "https://registry.npmjs.org/katex/-/katex-0.16.21.tgz", + "integrity": "sha512-XvqR7FgOHtWupfMiigNzmh+MgUVmDGU2kXZm899ZkPfcuoPuFxyHmXsgATDpFZDAXCI8tvinaVcDo8PIIJSo4A==", "funding": [ "https://opencollective.com/katex", "https://github.com/sponsors/katex" ], + "license": "MIT", "dependencies": { "commander": "^8.3.0" }, @@ -8610,9 +8612,9 @@ } }, "node_modules/nanoid": { - "version": "3.3.7", - "resolved": "https://registry.npmjs.org/nanoid/-/nanoid-3.3.7.tgz", - "integrity": "sha512-eSRppjcPIatRIMC1U6UngP8XFcz8MQWGQdt1MTBQ7NaAmvXDfvNxbvWV3x2y6CdEUciCSsDHDQZbhYaB8QEo2g==", + "version": "3.3.8", + "resolved": "https://registry.npmjs.org/nanoid/-/nanoid-3.3.8.tgz", + "integrity": "sha512-WNLf5Sd8oZxOm+TzppcYk8gVOgP+l58xNy58D0nbUnOxOWRWvlcCV4kUF7ltmI6PsrLl/BgKEyS4mqsGChFN0w==", "dev": true, "funding": [ { @@ -8620,6 +8622,7 @@ "url": "https://github.com/sponsors/ai" } ], + "license": "MIT", "bin": { "nanoid": "bin/nanoid.cjs" }, @@ -8831,27 +8834,6 @@ "url": "https://github.com/sponsors/sindresorhus" } }, - "node_modules/onigasm": { - "version": "2.2.5", - "resolved": "https://registry.npmjs.org/onigasm/-/onigasm-2.2.5.tgz", - "integrity": "sha512-F+th54mPc0l1lp1ZcFMyL/jTs2Tlq4SqIHKIXGZOR/VkHkF9A7Fr5rRr5+ZG/lWeRsyrClLYRq7s/yFQ/XhWCA==", - "dependencies": { - "lru-cache": "^5.1.1" - } - }, - "node_modules/onigasm/node_modules/lru-cache": { - "version": "5.1.1", - "resolved": "https://registry.npmjs.org/lru-cache/-/lru-cache-5.1.1.tgz", - "integrity": "sha512-KpNARQA3Iwv+jTA0utUVVbrh+Jlrr1Fv0e56GGzAFOXN7dk/FviaDW8LHmK52DlcH4WP2n6gI8vN1aesBFgo9w==", - "dependencies": { - "yallist": "^3.0.2" - } - }, - "node_modules/onigasm/node_modules/yallist": { - "version": "3.1.1", - "resolved": "https://registry.npmjs.org/yallist/-/yallist-3.1.1.tgz", - "integrity": "sha512-a4UGQaWPH59mOXUYnAG2ewncQS4i4F43Tv3JoAM+s2VDAmS9NsK8GpDMLrCHPksFT7h3K6TOoUNn2pb7RoXx4g==" - }, "node_modules/optionator": { "version": "0.9.4", "resolved": "https://registry.npmjs.org/optionator/-/optionator-0.9.4.tgz", @@ -12198,10 +12180,11 @@ } }, "node_modules/vite": { - "version": "4.5.5", - "resolved": "https://registry.npmjs.org/vite/-/vite-4.5.5.tgz", - "integrity": "sha512-ifW3Lb2sMdX+WU91s3R0FyQlAyLxOzCSCP37ujw0+r5POeHPwe6udWVIElKQq8gk3t7b8rkmvqC6IHBpCff4GQ==", + "version": "4.5.9", + "resolved": "https://registry.npmjs.org/vite/-/vite-4.5.9.tgz", + "integrity": "sha512-qK9W4xjgD3gXbC0NmdNFFnVFLMWSNiR3swj957yutwzzN16xF/E7nmtAyp1rT9hviDroQANjE4HK3H4WqWdFtw==", "dev": true, + "license": "MIT", "dependencies": { "esbuild": "^0.18.10", "postcss": "^8.4.27", @@ -12699,10 +12682,11 @@ } }, "node_modules/vite-node/node_modules/vite": { - "version": "5.4.9", - "resolved": "https://registry.npmjs.org/vite/-/vite-5.4.9.tgz", - "integrity": "sha512-20OVpJHh0PAM0oSOELa5GaZNWeDjcAvQjGXy2Uyr+Tp+/D2/Hdz6NLgpJLsarPTA2QJ6v8mX2P1ZfbsSKvdMkg==", + "version": "5.4.14", + "resolved": "https://registry.npmjs.org/vite/-/vite-5.4.14.tgz", + "integrity": "sha512-EK5cY7Q1D8JNhSaPKVK4pwBFvaTmZxEnoKXLG/U9gmdDcihQGNzFlgIvaxezFR4glP1LsuiedwMBqCXH3wZccA==", "dev": true, + "license": "MIT", "dependencies": { "esbuild": "^0.21.3", "postcss": "^8.4.43", @@ -13274,10 +13258,11 @@ } }, "node_modules/vitest/node_modules/vite": { - "version": "5.4.9", - "resolved": "https://registry.npmjs.org/vite/-/vite-5.4.9.tgz", - "integrity": "sha512-20OVpJHh0PAM0oSOELa5GaZNWeDjcAvQjGXy2Uyr+Tp+/D2/Hdz6NLgpJLsarPTA2QJ6v8mX2P1ZfbsSKvdMkg==", + "version": "5.4.14", + "resolved": "https://registry.npmjs.org/vite/-/vite-5.4.14.tgz", + "integrity": "sha512-EK5cY7Q1D8JNhSaPKVK4pwBFvaTmZxEnoKXLG/U9gmdDcihQGNzFlgIvaxezFR4glP1LsuiedwMBqCXH3wZccA==", "dev": true, + "license": "MIT", "dependencies": { "esbuild": "^0.21.3", "postcss": "^8.4.43", @@ -13748,9 +13733,9 @@ } }, "node_modules/zod": { - "version": "3.24.1", - "resolved": "https://registry.npmjs.org/zod/-/zod-3.24.1.tgz", - "integrity": "sha512-muH7gBL9sI1nciMZV67X5fTKKBLtwpZ5VBp1vsOQzj1MhrBZ4wlVCm3gedKZWLp0Oyel8sIGfeiz54Su+OVT+A==", + "version": "3.24.2", + "resolved": "https://registry.npmjs.org/zod/-/zod-3.24.2.tgz", + "integrity": "sha512-lY7CDW43ECgW9u1TcT3IoXHflywfVqDYze4waEz812jR/bZ8FHDsl7pFQoSZTz5N+2NqRXs8GBwnAwo3ZNxqhQ==", "funding": { "url": "https://github.com/sponsors/colinhacks" } diff --git a/gui/package.json b/gui/package.json index 4500287fa..9a9b8d737 100644 --- a/gui/package.json +++ b/gui/package.json @@ -15,7 +15,7 @@ "test:watch": "vitest" }, "dependencies": { - "@continuedev/config-yaml": "^1.0.23", + "@continuedev/config-yaml": "^1.0.52", "@headlessui/react": "^1.7.17", "@heroicons/react": "^2.0.18", "@reduxjs/toolkit": "^2.3.0", @@ -40,7 +40,6 @@ "lodash": "^4.17.21", "minisearch": "^7.0.2", "mustache": "^4.2.0", - "onigasm": "^2.2.5", "posthog-js": "^1.130.1", "prismjs": "^1.29.0", "react": "^18.2.0", @@ -59,7 +58,7 @@ "redux-persist-transform-filter": "^0.0.22", "redux-thunk": "^3.1.0", "rehype-highlight": "^7.0.0", - "rehype-katex": "^7.0.0", + "rehype-katex": "^7.0.1", "rehype-wrap-all": "^1.1.0", "remark-math": "^6.0.0", "reselect": "^5.1.1", diff --git a/gui/public/logos/ncompass.png b/gui/public/logos/ncompass.png new file mode 100644 index 000000000..09c306695 Binary files /dev/null and b/gui/public/logos/ncompass.png differ diff --git a/gui/src/components/AccountDialog.tsx b/gui/src/components/AccountDialog.tsx deleted file mode 100644 index 2b8e17ae4..000000000 --- a/gui/src/components/AccountDialog.tsx +++ /dev/null @@ -1,156 +0,0 @@ -import { Listbox, Transition } from "@headlessui/react"; -import { ChevronUpDownIcon } from "@heroicons/react/24/outline"; -import { Fragment, useContext } from "react"; -import { useDispatch } from "react-redux"; -import styled from "styled-components"; -import { - Button, - SecondaryButton, - vscInputBackground, - vscListActiveBackground, - vscListActiveForeground, -} from "."; -import { useAuth } from "../context/Auth"; -import { IdeMessengerContext } from "../context/IdeMessenger"; -import { setSelectedProfileId } from "../redux/slices/sessionSlice"; -import { setDialogMessage, setShowDialog } from "../redux/slices/uiSlice"; - -const StyledListboxOption = styled(Listbox.Option)<{ selected: boolean }>` - background-color: ${({ selected }) => - selected ? vscListActiveBackground : vscInputBackground}; - cursor: pointer; - padding: 6px 8px; - - &:hover { - background-color: ${vscListActiveBackground}; - color: ${vscListActiveForeground}; - } -`; - -export default function AccountDialog() { - const ideMessenger = useContext(IdeMessengerContext); - const { - session, - logout, - login, - profiles, - selectedProfile, - controlServerBetaEnabled, - } = useAuth(); - - // These shouldn't usually show but just to be safe - if (!session?.account?.id) { - return ( -
-

Account

- - Signed out - - -
- ); - } - - if (!controlServerBetaEnabled) { - return ( -
-

Account

-

- Continue For Teams is not enabled. You can enable it in your IDE - settings. -

-

Using local config.

-
- ); - } - - const dispatch = useDispatch(); - - const changeProfileId = (id: string) => { - ideMessenger.post("didChangeSelectedProfile", { id }); - dispatch(setSelectedProfileId(id)); - }; - - return ( -
-
-

Account

- - {session.account.label === "" ? ( - "Signed in" - ) : ( - <> - Signed in as{" "} - {session.account.label} - - )} - -
- -
- Current workspace - - - {({ open }) => ( -
- - {selectedProfile?.title} -
-
-
- - - - {profiles.map((option, idx) => ( - - - {option.title} - - - ))} - {profiles.length === 0 && ( -
- No workspaces found -
- )} -
-
-
- )} -
-
- -
- - Sign out - - -
-
- ); -} diff --git a/gui/src/components/CodeToEditCard/AddFileCombobox.tsx b/gui/src/components/CodeToEditCard/AddFileCombobox.tsx index abd7da72f..07ab68a2c 100644 --- a/gui/src/components/CodeToEditCard/AddFileCombobox.tsx +++ b/gui/src/components/CodeToEditCard/AddFileCombobox.tsx @@ -84,7 +84,7 @@ export default function AddFileCombobox({ className={({ active }) => `relative flex w-full cursor-pointer px-2 py-1 text-left text-xs ${ active - ? "bg-vsc-list-active-background text-vsc-list-active-foreground" + ? "bg-list-active text-list-active-foreground" : "" }` } @@ -112,7 +112,7 @@ export default function AddFileCombobox({ )) ) : ( -
+
No results
)} diff --git a/gui/src/components/Layout.tsx b/gui/src/components/Layout.tsx index 94a9fb616..a10fc7b6e 100644 --- a/gui/src/components/Layout.tsx +++ b/gui/src/components/Layout.tsx @@ -2,28 +2,29 @@ import { useEffect, useMemo } from "react"; import { Outlet, useLocation, useNavigate } from "react-router-dom"; import styled from "styled-components"; import { CustomScrollbarDiv, defaultBorderRadius } from "."; +import { AuthProvider } from "../context/Auth"; import { useWebviewListener } from "../hooks/useWebviewListener"; import { useAppDispatch, useAppSelector } from "../redux/hooks"; -import { setEditStatus, focusEdit } from "../redux/slices/editModeState"; -import { setDialogMessage, setShowDialog } from "../redux/slices/uiSlice"; +import { selectUseHub } from "../redux/selectors"; +import { focusEdit, setEditStatus } from "../redux/slices/editModeState"; import { addCodeToEdit, - updateApplyState, - setMode, newSession, + selectIsInEditMode, + setMode, + updateApplyState, } from "../redux/slices/sessionSlice"; +import { setShowDialog } from "../redux/slices/uiSlice"; +import { exitEditMode } from "../redux/thunks"; +import { loadLastSession, saveCurrentSession } from "../redux/thunks/session"; import { getFontSize, isMetaEquivalentKeyPressed } from "../util"; +import { incrementFreeTrialCount } from "../util/freeTrial"; import { ROUTES } from "../util/navigation"; import TextDialog from "./dialogs"; import Footer from "./Footer"; import { isNewUserOnboarding, useOnboardingCard } from "./OnboardingCard"; -import PostHogPageView from "./PosthogPageView"; -import AccountDialog from "./AccountDialog"; -import { AuthProvider } from "../context/Auth"; -import { exitEditMode } from "../redux/thunks"; -import { loadLastSession, saveCurrentSession } from "../redux/thunks/session"; -import { incrementFreeTrialCount } from "../util/freeTrial"; import OSRContextMenu from "./OSRContextMenu"; +import PostHogPageView from "./PosthogPageView"; const LayoutTopDiv = styled(CustomScrollbarDiv)` height: 100%; @@ -63,6 +64,7 @@ const Layout = () => { await dispatch( saveCurrentSession({ openNewSession: true, + generateTitle: true, }), ); dispatch(exitEditMode()); @@ -86,6 +88,7 @@ const Layout = () => { await dispatch( saveCurrentSession({ openNewSession: true, + generateTitle: true, }), ); dispatch(exitEditMode()); @@ -94,17 +97,6 @@ const Layout = () => { location.pathname === ROUTES.HOME, ); - useWebviewListener( - "openDialogMessage", - async (message) => { - if (message === "account") { - dispatch(setShowDialog(true)); - dispatch(setDialogMessage()); - } - }, - [], - ); - useWebviewListener( "addModel", async () => { @@ -113,19 +105,6 @@ const Layout = () => { [navigate], ); - useWebviewListener( - "viewHistory", - async () => { - // Toggle the history page / main page - if (location.pathname === "/history") { - navigate("/"); - } else { - navigate("/history"); - } - }, - [location, navigate], - ); - useWebviewListener( "navigateTo", async (data) => { @@ -182,6 +161,8 @@ const Layout = () => { await dispatch( saveCurrentSession({ openNewSession: false, + // Because this causes a lag before Edit mode is focused. TODO just have that happen in background + generateTitle: false, }), ); dispatch(newSession()); @@ -197,6 +178,7 @@ const Layout = () => { await dispatch( saveCurrentSession({ openNewSession: true, + generateTitle: true, }), ); dispatch(focusEdit()); @@ -221,7 +203,11 @@ const Layout = () => { [], ); + const isInEditMode = useAppSelector(selectIsInEditMode); useWebviewListener("exitEditMode", async () => { + if (!isInEditMode) { + return; + } dispatch( loadLastSession({ saveCurrentSession: false, @@ -259,6 +245,21 @@ const Layout = () => { } }, [location]); + const useHub = useAppSelector(selectUseHub); + + // Existing users that have already seen the onboarding card + // should be shown an intro card for hub.continue.dev + // useEffect(() => { + // if (useHub !== true) { + // return; + // } + // const seenHubIntro = getLocalStorage("seenHubIntro"); + // if (!onboardingCard.show && !seenHubIntro) { + // onboardingCard.setActiveTab("ExistingUserHubIntro"); + // } + // setLocalStorage("seenHubIntro", true); + // }, [onboardingCard.show, useHub]); + return ( @@ -293,9 +294,7 @@ const Layout = () => { onClick={() => navigate(ROUTES.CONFIG_ERROR)} > Error!{" "} - - Could not load config.json - + Could not load config
Learn More
)} diff --git a/gui/src/components/OnboardingCard/components/BestExperienceConfigForm.tsx b/gui/src/components/OnboardingCard/components/BestExperienceConfigForm.tsx index 98f71cce2..389ed72dd 100644 --- a/gui/src/components/OnboardingCard/components/BestExperienceConfigForm.tsx +++ b/gui/src/components/OnboardingCard/components/BestExperienceConfigForm.tsx @@ -5,8 +5,8 @@ import { Button, Input, InputSubtext, lightGray } from "../.."; import { IdeMessengerContext } from "../../../context/IdeMessenger"; import { models } from "../../../pages/AddNewModel/configs/models"; import { providers } from "../../../pages/AddNewModel/configs/providers"; -import AddModelButtonSubtext from "../../AddModelButtonSubtext"; import { setDefaultModel } from "../../../redux/slices/configSlice"; +import AddModelButtonSubtext from "../../AddModelButtonSubtext"; const { anthropic, mistral } = providers; const chatProvider = anthropic!; @@ -14,7 +14,7 @@ const autocompleteProvider = mistral!; const { claude35Sonnet: chatModel, - claude3Haiku: repoMapModel, + claude35Haiku: repoMapModel, codestral: autocompleteModel, } = models; diff --git a/gui/src/components/OnboardingCard/components/OllamaCompletedStep.tsx b/gui/src/components/OnboardingCard/components/OllamaCompletedStep.tsx index 1b2cbea0a..d7a396804 100644 --- a/gui/src/components/OnboardingCard/components/OllamaCompletedStep.tsx +++ b/gui/src/components/OnboardingCard/components/OllamaCompletedStep.tsx @@ -7,7 +7,7 @@ interface OllamaCompletedStepProps { function OllamaCompletedStep({ text }: OllamaCompletedStepProps) { return (
-

{text}

+

{text}

); diff --git a/gui/src/components/OnboardingCard/components/OllamaModelDownload.tsx b/gui/src/components/OnboardingCard/components/OllamaModelDownload.tsx index 7a4eede07..6a7075fac 100644 --- a/gui/src/components/OnboardingCard/components/OllamaModelDownload.tsx +++ b/gui/src/components/OnboardingCard/components/OllamaModelDownload.tsx @@ -27,13 +27,13 @@ function OllamaModelDownload({ return (
-

{title}

+

{title}

{hasDownloaded ? ( ) : ( <> -

{command}

+

{command}

diff --git a/gui/src/components/OnboardingCard/components/OllamaStatus.tsx b/gui/src/components/OnboardingCard/components/OllamaStatus.tsx index 15132518e..515958503 100644 --- a/gui/src/components/OnboardingCard/components/OllamaStatus.tsx +++ b/gui/src/components/OnboardingCard/components/OllamaStatus.tsx @@ -2,7 +2,7 @@ import { ArrowPathIcon, ArrowTopRightOnSquareIcon, } from "@heroicons/react/24/outline"; -import { useState, useContext } from "react"; +import { useState, useContext, useEffect } from "react"; import { IdeMessengerContext } from "../../../context/IdeMessenger"; import { providers } from "../../../pages/AddNewModel/configs/providers"; import { StyledActionButton } from "../.."; @@ -19,10 +19,15 @@ export function OllamaStatus({ isOllamaConnected }: OllamaStatusProps) { const ideMessenger = useContext(IdeMessengerContext); const [status, setStatus] = useState( - isOllamaConnected - ? OllamaConnectionStatuses.Connected - : OllamaConnectionStatuses.WaitingToDownload, + OllamaConnectionStatuses.WaitingToDownload, ); + useEffect(() => { + if (isOllamaConnected) { + setStatus(OllamaConnectionStatuses.Connected); + } else if (status !== OllamaConnectionStatuses.Downloading) { + setStatus(OllamaConnectionStatuses.WaitingToDownload); + } + }, [status, isOllamaConnected]); function onClickDownload() { ideMessenger.post("openUrl", downloadUrl); @@ -33,14 +38,14 @@ export function OllamaStatus({ isOllamaConnected }: OllamaStatusProps) { case OllamaConnectionStatuses.WaitingToDownload: return ( -

{downloadUrl}

+

{downloadUrl}

); case OllamaConnectionStatuses.Downloading: return (
-

+

Checking for connection to Ollama at http://localhost:11434

diff --git a/gui/src/components/OnboardingCard/components/OnboardingCardTabs.tsx b/gui/src/components/OnboardingCard/components/OnboardingCardTabs.tsx index e14d7aa2c..b1543ea58 100644 --- a/gui/src/components/OnboardingCard/components/OnboardingCardTabs.tsx +++ b/gui/src/components/OnboardingCard/components/OnboardingCardTabs.tsx @@ -7,7 +7,7 @@ interface OnboardingCardTabsProps { onTabClick: (tabName: TabTitle) => void; } -export type TabTitle = "Quickstart" | "Best" | "Local"; +export type TabTitle = "Quickstart" | "Best" | "Local" | "ExistingUserHubIntro"; export const TabTitles: { [k in TabTitle]: { md: string; default: string } } = { Quickstart: { @@ -22,6 +22,10 @@ export const TabTitles: { [k in TabTitle]: { md: string; default: string } } = { md: "Local", default: "Local with Ollama", }, + ExistingUserHubIntro: { + md: "Try out hub.continue.dev", + default: "Try out hub.continue.dev", + }, }; const StyledSelect = styled.select` diff --git a/gui/src/components/OnboardingCard/platform/PlatformOnboardingCard.tsx b/gui/src/components/OnboardingCard/platform/PlatformOnboardingCard.tsx index 51e951497..a48845c44 100644 --- a/gui/src/components/OnboardingCard/platform/PlatformOnboardingCard.tsx +++ b/gui/src/components/OnboardingCard/platform/PlatformOnboardingCard.tsx @@ -53,7 +53,7 @@ export function PlatformOnboardingCard({ isDialog }: OnboardingCardProps) { isDialog={isDialog} /> ) : ( -
+
By choosing this option, Continue will be configured by a local{" "} config.yaml file. If you're just looking to use diff --git a/gui/src/components/OnboardingCard/platform/tabs/main.tsx b/gui/src/components/OnboardingCard/platform/tabs/main.tsx index 94e3c0de0..8ca75b1e3 100644 --- a/gui/src/components/OnboardingCard/platform/tabs/main.tsx +++ b/gui/src/components/OnboardingCard/platform/tabs/main.tsx @@ -1,11 +1,11 @@ import { ChevronRightIcon } from "@heroicons/react/24/outline"; +import { useContext } from "react"; import { Button, ButtonSubtext } from "../../.."; import { useAuth } from "../../../../context/Auth"; +import { IdeMessengerContext } from "../../../../context/IdeMessenger"; +import { hasPassedFTL } from "../../../../util/freeTrial"; import ContinueLogo from "../../../gui/ContinueLogo"; import { useOnboardingCard } from "../../hooks"; -import { hasPassedFTL } from "../../../../util/freeTrial"; -import { useContext } from "react"; -import { IdeMessengerContext } from "../../../../context/IdeMessenger"; export default function MainTab({ onRemainLocal, @@ -29,6 +29,7 @@ export default function MainTab({ function openPastFreeTrialOnboarding() { ideMessenger.post("controlPlane/openUrl", { path: "setup-models", + orgSlug: auth.selectedOrganization?.slug, }); onboardingCard.close(isDialog); } @@ -54,6 +55,20 @@ export default function MainTab({ Go to Continue Platform + ) : onboardingCard.activeTab === "ExistingUserHubIntro" ? ( + <> +

+ You can now browse and create custom AI code assistants at{" "} + hub.continue.dev +

+ + + ) : ( <>

@@ -69,12 +84,21 @@ export default function MainTab({ )} - -

- Or, remain local - -
- + {onboardingCard.activeTab === "ExistingUserHubIntro" ? ( + onboardingCard.close(isDialog)}> +
+ Or, use Continue as usual + +
+
+ ) : ( + +
+ Or, remain local + +
+
+ )}
); } diff --git a/gui/src/components/OnboardingCard/tabs/OnboardingLocalTab.tsx b/gui/src/components/OnboardingCard/tabs/OnboardingLocalTab.tsx index 76ba5bf5c..81b0a7a6b 100644 --- a/gui/src/components/OnboardingCard/tabs/OnboardingLocalTab.tsx +++ b/gui/src/components/OnboardingCard/tabs/OnboardingLocalTab.tsx @@ -1,14 +1,14 @@ import { LOCAL_ONBOARDING_CHAT_MODEL, LOCAL_ONBOARDING_CHAT_TITLE, + LOCAL_ONBOARDING_EMBEDDINGS_MODEL, LOCAL_ONBOARDING_FIM_MODEL, - ONBOARDING_LOCAL_MODEL_TITLE, + LOCAL_ONBOARDING_PROVIDER_TITLE, } from "core/config/onboarding"; import { useContext, useEffect, useState } from "react"; import { useDispatch } from "react-redux"; import { Button } from "../.."; import { IdeMessengerContext } from "../../../context/IdeMessenger"; -import { hasPassedFTL } from "../../../util/freeTrial"; import AddModelButtonSubtext from "../../AddModelButtonSubtext"; import OllamaModelDownload from "../components/OllamaModelDownload"; import { OllamaStatus } from "../components/OllamaStatus"; @@ -25,10 +25,7 @@ interface OnboardingLocalTabProps { function OnboardingLocalTab({ isDialog }: OnboardingLocalTabProps) { const dispatch = useDispatch(); const ideMessenger = useContext(IdeMessengerContext); - const { submitOnboarding } = useSubmitOnboarding( - hasPassedFTL() ? "LocalAfterFreeTrial" : "Local", - isDialog, - ); + const { submitOnboarding } = useSubmitOnboarding("Local", isDialog); const [hasLoadedChatModel, setHasLoadedChatModel] = useState(false); const [downloadedOllamaModels, setDownloadedOllamaModels] = useState< string[] @@ -37,17 +34,28 @@ function OnboardingLocalTab({ isDialog }: OnboardingLocalTabProps) { const [isOllamaConnected, setIsOllamaConnected] = useState(false); const hasDownloadedChatModel = Array.isArray(downloadedOllamaModels) - ? downloadedOllamaModels.some((ollamaModel) => - ollamaModel.startsWith(LOCAL_ONBOARDING_CHAT_MODEL), + ? downloadedOllamaModels.some( + (ollamaModel) => ollamaModel === LOCAL_ONBOARDING_CHAT_MODEL, ) : false; const hasDownloadedAutocompleteModel = Array.isArray(downloadedOllamaModels) - ? downloadedOllamaModels.some((ollamaModel) => - ollamaModel.startsWith(LOCAL_ONBOARDING_CHAT_MODEL), + ? downloadedOllamaModels.some( + (ollamaModel) => ollamaModel === LOCAL_ONBOARDING_FIM_MODEL, ) : false; + const hasDownloadedEmbeddingsModel = Array.isArray(downloadedOllamaModels) + ? downloadedOllamaModels.some( + (ollamaModel) => ollamaModel === LOCAL_ONBOARDING_EMBEDDINGS_MODEL, + ) + : false; + + const allDownloaded = + hasDownloadedAutocompleteModel && + hasDownloadedChatModel && + hasDownloadedEmbeddingsModel; + /** * The first time we detect that a chat model has been loaded, * we send an empty request to load it @@ -57,7 +65,7 @@ function OnboardingLocalTab({ isDialog }: OnboardingLocalTabProps) { ideMessenger.post("llm/complete", { completionOptions: {}, prompt: "", - title: ONBOARDING_LOCAL_MODEL_TITLE, + title: LOCAL_ONBOARDING_PROVIDER_TITLE, }); setHasLoadedChatModel(true); @@ -68,18 +76,11 @@ function OnboardingLocalTab({ isDialog }: OnboardingLocalTabProps) { const fetchDownloadedModels = async () => { try { const result = await ideMessenger.request("llm/listModels", { - title: ONBOARDING_LOCAL_MODEL_TITLE, + title: LOCAL_ONBOARDING_PROVIDER_TITLE, }); if (result.status === "success") { - // TODO - temporary fix, see notes - // https://github.com/continuedev/continue/pull/3059 - if (Array.isArray(result.content)) { - setDownloadedOllamaModels(result.content); - setIsOllamaConnected(true); - } else { - setDownloadedOllamaModels([]); - setIsOllamaConnected(false); - } + setDownloadedOllamaModels(result.content ?? []); + setIsOllamaConnected(!!result.content); } else { throw new Error("Failed to fetch models"); } @@ -100,9 +101,9 @@ function OnboardingLocalTab({ isDialog }: OnboardingLocalTabProps) { }, []); return ( -
+
-

Install Ollama

+

Install Ollama

@@ -118,6 +119,12 @@ function OnboardingLocalTab({ isDialog }: OnboardingLocalTabProps) { hasDownloaded={hasDownloadedAutocompleteModel} /> + +
diff --git a/gui/src/components/PageHeader.tsx b/gui/src/components/PageHeader.tsx index 04317c947..22755926e 100644 --- a/gui/src/components/PageHeader.tsx +++ b/gui/src/components/PageHeader.tsx @@ -12,7 +12,7 @@ export default function PageHeader({ rightContent, }: PageHeaderProps) { return ( -
+
{title && (
` - background-color: ${({ selected }) => - selected ? vscListActiveBackground : vscInputBackground}; - cursor: pointer; - padding: 6px 8px; - - &:hover { - background-color: ${vscListActiveBackground}; - color: ${vscListActiveForeground}; - } -`; - -function ListBoxOption({ - option, - idx, - showDelete, - selected, -}: { - option: ProfileDescription; - idx: number; - showDelete?: boolean; - selected: boolean; -}) { - const [hovered, setHovered] = useState(false); - - return ( - { - setHovered(true); - }} - onMouseLeave={() => { - setHovered(false); - }} - > -
- {option.title} -
-
- ); -} - -function ProfileSwitcher() { - const ideMessenger = useContext(IdeMessengerContext); - const { session, logout, login } = useAuth(); - const [profiles, setProfiles] = useState([]); - - const dispatch = useDispatch(); - const lastControlServerBetaEnabledStatus = useAppSelector( - (state) => state.misc.lastControlServerBetaEnabledStatus, - ); - - const selectedProfileId = useAppSelector( - (store) => store.session.selectedProfileId, - ); - - const [controlServerBetaEnabled, setControlServerBetaEnabled] = - useState(false); - - useEffect(() => { - ideMessenger.ide.getIdeSettings().then(({ enableControlServerBeta }) => { - setControlServerBetaEnabled(enableControlServerBeta); - dispatch(setLastControlServerBetaEnabledStatus(enableControlServerBeta)); - - const shouldShowPopup = - !lastControlServerBetaEnabledStatus && enableControlServerBeta; - }); - }, []); - - useWebviewListener( - "didChangeIdeSettings", - async (msg) => { - const { settings } = msg; - setControlServerBetaEnabled(settings.enableControlServerBeta); - dispatch( - setLastControlServerBetaEnabledStatus(settings.enableControlServerBeta), - ); - }, - [], - ); - - useEffect(() => { - ideMessenger - .request("config/listProfiles", undefined) - .then( - (result) => result.status === "success" && setProfiles(result.content), - ); - }, []); - - useWebviewListener( - "didChangeAvailableProfiles", - async (data) => { - setProfiles(data.profiles); - }, - [], - ); - - const topDiv = document.getElementById("profile-select-top-div"); - - function selectedProfile() { - return profiles.find((p) => p.id === selectedProfileId); - } - - return ( - <> - {controlServerBetaEnabled && session?.account?.id && ( - { - ideMessenger.post("didChangeSelectedProfile", { id }); - }} - > -
- - {selectedProfile()?.title} -
-
-
- {topDiv && - ReactDOM.createPortal( - - - {profiles.map((option, idx) => ( - 1} - /> - ))} -
- {profiles.length === 0 ? ( - No workspaces found - ) : ( - "Select workspace" - )} -
-
-
, - topDiv, - )} -
-
- )} - - {controlServerBetaEnabled && - (session?.account ? ( - - - - ) : ( - - - - ))} - - ); -} - -export default ProfileSwitcher; diff --git a/gui/src/components/StepContainer/FeedbackButtons.tsx b/gui/src/components/StepContainer/FeedbackButtons.tsx index e621fda33..4ef09a833 100644 --- a/gui/src/components/StepContainer/FeedbackButtons.tsx +++ b/gui/src/components/StepContainer/FeedbackButtons.tsx @@ -22,8 +22,12 @@ export default function FeedbackButtons({ item }: FeedbackButtonsProps) { if (item.promptLogs?.length) { for (const promptLog of item.promptLogs) { ideMessenger.post("devdata/log", { - tableName: "chat", - data: { ...promptLog, feedback, sessionId }, + name: "chatFeedback", + data: { + ...promptLog, + feedback, + sessionId, + }, }); } } diff --git a/gui/src/components/TabBar/TabBar.tsx b/gui/src/components/TabBar/TabBar.tsx new file mode 100644 index 000000000..859f6e90c --- /dev/null +++ b/gui/src/components/TabBar/TabBar.tsx @@ -0,0 +1,279 @@ +import { XMarkIcon } from "@heroicons/react/24/outline"; +import { useCallback, useEffect } from "react"; +import { useDispatch, useSelector } from "react-redux"; +import styled from "styled-components"; +import { defaultBorderRadius } from ".."; +import { newSession } from "../../redux/slices/sessionSlice"; +import { + addTab, + handleSessionChange, + removeTab, + setActiveTab, + setTabs, +} from "../../redux/slices/tabsSlice"; +import { AppDispatch, RootState } from "../../redux/store"; +import { loadSession, saveCurrentSession } from "../../redux/thunks/session"; + +const TabBarContainer = styled.div` + display: flex; + flex-wrap: wrap; + flex-shrink: 0; + flex-grow: 0; + background-color: var(--vscode-tab-inactiveBackground); + border-bottom: none; + position: relative; + margin-top: 2px; + + /* Hide scrollbar but keep functionality */ + scrollbar-width: none; + &::-webkit-scrollbar { + display: none; + } +`; + +const Tab = styled.div<{ isActive: boolean }>` + display: flex; + align-items: center; + box-sizing: border-box; + padding: 0 5px 0 12px; + flex-grow: 1; + width: 100px; + max-width: 150px; + height: 25px; + background-color: ${(props) => + props.isActive + ? "var(--vscode-tab-activeBackground)" + : "var(--vscode-tab-inactiveBackground)"}; + color: ${(props) => + props.isActive + ? "var(--vscode-tab-activeForeground)" + : "var(--vscode-tab-inactiveForeground)"}; + cursor: pointer; + border: 1px solid var(--vscode-tab-border); + border-bottom: ${(props) => + props.isActive ? "none" : `1px solid var(--vscode-tab-border)`}; + user-select: none; + position: relative; + transition: background-color 0.2s; + border-top: ${(props) => + props.isActive + ? `1px solid var(--vscode-tab-activeBorderTop, --vscode-tab-border)` + : `1px solid var(--vscode-tab-border)`}; + &:first-child { + border-left: none; + } + & + & { + border-left: none; + } + + &:hover { + background-color: ${(props) => + props.isActive + ? "var(--vscode-tab-activeBackground)" + : "var(--vscode-tab-hoverBackground)"}; + color: ${(props) => + props.isActive + ? "var(--vscode-tab-activeForeground)" + : "var(--vscode-tab-hoverForeground)"}; + } +`; + +const TabTitle = styled.span` + flex: 1; + white-space: nowrap; + overflow: hidden; + text-overflow: ellipsis; + font-size: 13px; +`; + +const CloseButton = styled.button` + display: flex; + align-items: center; + justify-content: center; + width: 16px; + height: 16px; + margin-left: 4px; + border: none; + background: transparent; + color: inherit; + opacity: 0.7; + cursor: pointer; + border-radius: ${defaultBorderRadius}; + padding: 2px; + visibility: hidden; + + &:hover { + opacity: 1; + background-color: var(--vscode-tab-hoverBackground); + } + + ${Tab}:hover & { + visibility: visible; + } + + &[disabled] { + display: none !important; + } +`; + +const TabBarSpace = styled.div` + flex: 1; + display: flex; + border-bottom: 1px solid var(--vscode-tab-border); + background-color: var(--vscode-tab-inactiveBackground); +`; + +const NewTabButton = styled.button` + display: flex; + align-items: center; + justify-content: center; + width: 35px; + height: 100%; + border: none; + background: transparent; + color: var(--vscode-tab-inactiveForeground); + cursor: pointer; + opacity: 0.7; + transition: opacity 0.2s; + + &:hover { + opacity: 1; + background-color: var(--vscode-tab-hoverBackground); + color: var(--vscode-tab-hoverForeground); + } +`; + +export function TabBar() { + const dispatch = useDispatch(); + const currentSession = useSelector((state: RootState) => state.session); + const currentSessionId = useSelector((state: RootState) => state.session.id); + const currentSessionTitle = useSelector( + (state: RootState) => state.session.title, + ); + const hasHistory = useSelector( + (state: RootState) => state.session.history.length > 0, + ); + const tabs = useSelector((state: RootState) => state.tabs.tabs); + + useEffect(() => { + console.log("session", currentSession); + }, [currentSession.id]); + + // Simple UUID generator for our needs + const generateId = useCallback(() => { + return Date.now().toString(36) + Math.random().toString(36).substring(2); + }, []); + + // Handle session changes + useEffect(() => { + if (!currentSessionId) return; + + dispatch( + handleSessionChange({ + currentSessionId, + currentSessionTitle, + newTabId: generateId(), // Pass the ID generator result + }), + ); + }, [currentSessionId, currentSessionTitle]); + + const handleNewTab = async () => { + // Save current session before creating new one + if (hasHistory) { + await dispatch( + saveCurrentSession({ openNewSession: false, generateTitle: true }), + ); + } + + dispatch(newSession()); + + dispatch( + addTab({ + id: generateId(), + title: `Chat ${tabs.length + 1}`, + isActive: true, + sessionId: undefined, + }), + ); + }; + + useEffect(() => { + if (!tabs.length) { + handleNewTab(); + } + }, [tabs.map((t) => t.id).join(",")]); + + const handleTabClick = async (id: string) => { + const targetTab = tabs.find((tab) => tab.id === id); + if (!targetTab) return; + + if (targetTab.sessionId) { + // Switch to existing session + await dispatch( + loadSession({ + sessionId: targetTab.sessionId, + saveCurrentSession: hasHistory, + }), + ); + } + + dispatch(setActiveTab(id)); + }; + + const handleTabClose = async (id: string) => { + //if (tabs.length <= 1) return; + + const isClosingActive = tabs.find((t) => t.id === id)?.isActive; + const filtered = tabs.filter((t) => t.id !== id); + + if (isClosingActive) { + const lastTab = filtered[filtered.length - 1]; + if (filtered.length) { + await handleTabClick(lastTab.id); + dispatch( + setTabs( + filtered.map((tab, i) => ({ + ...tab, + isActive: i === filtered.length - 1, + })), + ), + ); + } else { + dispatch(setTabs([])); + dispatch(newSession()); + } + } else { + dispatch(removeTab(id)); + } + }; + + return tabs.length === 1 ? ( + <> + ) : ( + + {tabs.map((tab) => ( + handleTabClick(tab.id)} + > + {tab.title} + { + e.stopPropagation(); + handleTabClose(tab.id); + }} + > + + + + ))} + + {/* + + */} + + + ); +} diff --git a/gui/src/components/dialogs/AboutAssistantDialog.tsx b/gui/src/components/dialogs/AboutAssistantDialog.tsx deleted file mode 100644 index 6f1734a92..000000000 --- a/gui/src/components/dialogs/AboutAssistantDialog.tsx +++ /dev/null @@ -1,80 +0,0 @@ -import { useAppSelector } from "../../redux/hooks"; -import { RootState } from "../../redux/store"; - -export default function AboutAssistantDialog() { - const configJson = useAppSelector((store: RootState) => store.config.config); - - const selectedProfileId = useAppSelector( - (store) => store.session.selectedProfileId, - ); - - return ( -
-

About {selectedProfileId} assistant

- {configJson.models?.length > 0 && ( -
- Chat models -
    - {configJson.models.map((model, index) => ( -
  • {model.title}
  • - ))} -
-
- )} - - {configJson.embeddingsProvider && ( -
- Embedding model -

{configJson.embeddingsProvider}

-
- )} - - {configJson.reranker?.name && ( -
- Rerank model -

{configJson.reranker.name}

-
- )} - - {configJson.systemMessage && ( -
- Rules -

{configJson.systemMessage}

-
- )} - - {configJson.contextProviders?.length ? ( -
- Context -
    - {configJson.contextProviders.map((provider, index) => ( -
  • {provider.title}
  • - ))} -
-
- ) : null} - - {configJson.tools.length > 0 && ( -
- Tools -
    - {configJson.tools.map((tool, index) => ( -
  • {tool.displayTitle}
  • - ))} -
-
- )} - - {configJson.docs?.length ? ( -
- Docs -
    - {configJson.docs.map((doc, index) => ( -
  • {doc.title}
  • - ))} -
-
- ) : null} -
- ); -} diff --git a/gui/src/components/dialogs/AddDocsDialog.tsx b/gui/src/components/dialogs/AddDocsDialog.tsx index 8439a70fa..eb3d3bcbb 100644 --- a/gui/src/components/dialogs/AddDocsDialog.tsx +++ b/gui/src/components/dialogs/AddDocsDialog.tsx @@ -110,7 +110,6 @@ function AddDocsDialog() { type: "docs", description: "Initializing", id: startUrl, - embeddingsProviderId: "mock-embeddings-provider-id", progress: 0, status: "indexing", title, @@ -164,7 +163,6 @@ function AddDocsDialog() { type: "docs", description: "Initializing", id: docsResult.details.docsLink, - embeddingsProviderId: "mock-embeddings-provider-id", progress: 0, status: "indexing", title: docsResult.details.title ?? docsResult.packageInfo.name, @@ -184,7 +182,7 @@ function AddDocsDialog() { {!!sortedDocsSuggestions.length && (

Suggestions

)} -
+
{sortedDocsSuggestions.map((docsResult) => { const { error, details } = docsResult; const { language, name, version } = docsResult.packageInfo; @@ -202,14 +200,14 @@ function AddDocsDialog() {
This may not be a docs page
) : ( - + )}
@@ -224,7 +222,7 @@ function AddDocsDialog() {
{error || !details?.docsLink ? ( - + No docs link found ) : ( @@ -251,7 +249,7 @@ function AddDocsDialog() { >

{`Version: ${version}`}

@@ -271,7 +269,7 @@ function AddDocsDialog() {
The title that will be displayed to users in the `@docs` @@ -297,7 +295,7 @@ function AddDocsDialog() {
The starting location to begin crawling the documentation diff --git a/gui/src/components/dialogs/FreeTrialOverDialog.tsx b/gui/src/components/dialogs/FreeTrialOverDialog.tsx index d8666b1b2..107e351ce 100644 --- a/gui/src/components/dialogs/FreeTrialOverDialog.tsx +++ b/gui/src/components/dialogs/FreeTrialOverDialog.tsx @@ -1,15 +1,15 @@ -import { useDispatch } from "react-redux"; -import { setDialogMessage, setShowDialog } from "../../redux/slices/uiSlice"; -import { useAppSelector } from "../../redux/hooks"; import { useEffect } from "react"; -import { selectUsePlatform } from "../../redux/selectors"; -import { PlatformOnboardingCard } from "../OnboardingCard/platform/PlatformOnboardingCard"; +import { useDispatch } from "react-redux"; +import { useAppSelector } from "../../redux/hooks"; +import { selectUseHub } from "../../redux/selectors"; +import { setDialogMessage, setShowDialog } from "../../redux/slices/uiSlice"; import { OnboardingCard } from "../OnboardingCard"; +import { PlatformOnboardingCard } from "../OnboardingCard/platform/PlatformOnboardingCard"; function FreeTrialOverDialog() { const dispatch = useDispatch(); const history = useAppSelector((store) => store.session.history); - const usePlatform = useAppSelector(selectUsePlatform); + const usePlatform = useAppSelector(selectUseHub); useEffect(() => { if (history.length === 0) { diff --git a/gui/src/components/find/FindWidget.tsx b/gui/src/components/find/FindWidget.tsx index 9bf965d0f..7f6874aeb 100644 --- a/gui/src/components/find/FindWidget.tsx +++ b/gui/src/components/find/FindWidget.tsx @@ -43,7 +43,7 @@ const HighlightOverlay = (props: HighlightOverlayProps) => { const { isCurrent, top, left, width, height } = props; return (
= ({ }) => { return (
- {text} + {text}
diff --git a/gui/src/components/gui/Tooltip.tsx b/gui/src/components/gui/Tooltip.tsx index 6822dc06b..b1477ba73 100644 --- a/gui/src/components/gui/Tooltip.tsx +++ b/gui/src/components/gui/Tooltip.tsx @@ -1,17 +1,17 @@ import ReactDOM from "react-dom"; import { Tooltip } from "react-tooltip"; -import { vscForeground, vscInputBackground } from ".."; +import { vscBackground, vscForeground, vscInputBorder } from ".."; import { getFontSize } from "../../util"; const TooltipStyles = { fontSize: `${getFontSize() - 2}px`, - backgroundColor: vscInputBackground, + backgroundColor: vscBackground, + outline: `0.5px solid ${vscInputBorder}`, color: vscForeground, padding: "4px 8px", zIndex: 1000, maxWidth: "80vw", textAlign: "center", - overflow: "hidden", }; export function ToolTip(props: any) { diff --git a/gui/src/components/index.ts b/gui/src/components/index.ts index 8f1455c67..04460f3b1 100644 --- a/gui/src/components/index.ts +++ b/gui/src/components/index.ts @@ -4,50 +4,42 @@ import { getFontSize, isJetBrains } from "../util"; export const VSC_INPUT_BACKGROUND_VAR = "--vscode-input-background"; export const VSC_BACKGROUND_VAR = "--vscode-sideBar-background"; export const VSC_FOREGROUND_VAR = "--vscode-editor-foreground"; -export const VSC_FOREGROUND_MUTED_VAR = "--vscode-foreground-muted"; -export const VSC_DESCRIPTION_FOREGROUND = "--vscode-descriptionForeground"; -export const VSC_INPUT_PLACEHOLDER_FOREGROUND = - "--vscode-input-placeholderForeground"; export const VSC_BUTTON_BACKGROUND_VAR = "--vscode-button-background"; export const VSC_BUTTON_FOREGROUND_VAR = "--vscode-button-foreground"; export const VSC_EDITOR_BACKGROUND_VAR = "--vscode-editor-background"; export const VSC_LIST_SELECTION_BACKGROUND_VAR = "--vscode-list-activeSelectionBackground"; -export const VSC_FOCUS_BORDER = "--vscode-focus-border"; +export const VSC_FOCUS_BORDER_VAR = "--vscode-focusBorder"; export const VSC_LIST_ACTIVE_FOREGROUND_VAR = "--vscode-quickInputList-focusForeground"; export const VSC_QUICK_INPUT_BACKGROUND_VAR = "--vscode-quickInput-background"; export const VSC_INPUT_BORDER_VAR = "--vscode-input-border"; -export const VSC_INPUT_BORDER_FOCUS_VAR = "--vscode-focusBorder"; export const VSC_BADGE_BACKGROUND_VAR = "--vscode-badge-background"; export const VSC_BADGE_FOREGROUND_VAR = "--vscode-badge-foreground"; -export const VSC_SIDEBAR_BORDER_VAR = "--vscode-sideBar-border"; -export const VSC_DIFF_REMOVED_LINE_BACKGROUND_VAR = - "--vscode-diffEditor-removedLineBackground"; -export const VSC_DIFF_INSERTED_LINE_BACKGROUND_VAR = - "--vscode-diffEditor-insertedLineBackground"; +export const VSC_COMMAND_CENTER_ACTIVE_BORDER_VAR = + "--vscode-commandCenter-activeBorder"; +export const VSC_COMMAND_CENTER_INACTIVE_BORDER_VAR = + "--vscode-commandCenter-inactiveBorder"; +export const VSC_FIND_MATCH_SELECTED_VAR = + "--vscode-editor-findMatchHighlightBackground"; export const VSC_THEME_COLOR_VARS = [ VSC_INPUT_BACKGROUND_VAR, VSC_BACKGROUND_VAR, VSC_FOREGROUND_VAR, - VSC_FOREGROUND_MUTED_VAR, - VSC_DESCRIPTION_FOREGROUND, - VSC_INPUT_PLACEHOLDER_FOREGROUND, VSC_BUTTON_BACKGROUND_VAR, VSC_BUTTON_FOREGROUND_VAR, VSC_EDITOR_BACKGROUND_VAR, VSC_LIST_SELECTION_BACKGROUND_VAR, - VSC_FOCUS_BORDER, + VSC_FOCUS_BORDER_VAR, VSC_LIST_ACTIVE_FOREGROUND_VAR, VSC_QUICK_INPUT_BACKGROUND_VAR, VSC_INPUT_BORDER_VAR, - VSC_INPUT_BORDER_FOCUS_VAR, VSC_BADGE_BACKGROUND_VAR, - VSC_SIDEBAR_BORDER_VAR, VSC_BADGE_FOREGROUND_VAR, - VSC_DIFF_REMOVED_LINE_BACKGROUND_VAR, - VSC_DIFF_INSERTED_LINE_BACKGROUND_VAR, + VSC_COMMAND_CENTER_ACTIVE_BORDER_VAR, + VSC_COMMAND_CENTER_INACTIVE_BORDER_VAR, + VSC_FIND_MATCH_SELECTED_VAR, ]; export const defaultBorderRadius = "5px"; @@ -62,30 +54,14 @@ export const vscButtonBackground = `var(${VSC_BUTTON_BACKGROUND_VAR}, #1bbe84)`; export const vscButtonForeground = `var(${VSC_BUTTON_FOREGROUND_VAR}, #ffffff)`; export const vscEditorBackground = `var(${VSC_EDITOR_BACKGROUND_VAR}, ${VSC_BACKGROUND_VAR}, rgb(30 30 30))`; export const vscListActiveBackground = `var(${VSC_LIST_SELECTION_BACKGROUND_VAR}, #1bbe84)`; -export const vscFocusBorder = `var(${VSC_FOCUS_BORDER}, #1bbe84)`; +export const vscFocusBorder = `var(${VSC_FOCUS_BORDER_VAR}, #1bbe84)`; export const vscListActiveForeground = `var(${VSC_LIST_ACTIVE_FOREGROUND_VAR}, ${VSC_FOREGROUND_VAR})`; export const vscInputBorder = `var(${VSC_INPUT_BORDER_VAR}, ${lightGray})`; -export const vscInputBorderFocus = `var(${VSC_INPUT_BORDER_FOCUS_VAR}, ${lightGray})`; +export const vscInputBorderFocus = `var(${VSC_FOCUS_BORDER_VAR}, ${lightGray})`; export const vscBadgeBackground = `var(${VSC_BADGE_BACKGROUND_VAR}, #1bbe84)`; - -if (typeof document !== "undefined") { - for (const colorVar of VSC_THEME_COLOR_VARS) { - if (isJetBrains()) { - const cached = localStorage.getItem(colorVar); - if (cached) { - document.body.style.setProperty(colorVar, cached); - } - } - - // Remove alpha channel from colors - const value = getComputedStyle(document.documentElement).getPropertyValue( - colorVar, - ); - if (colorVar.startsWith("#") && value.length > 7) { - document.body.style.setProperty(colorVar, value.slice(0, 7)); - } - } -} +export const vscCommandCenterActiveBorder = `var(${VSC_COMMAND_CENTER_ACTIVE_BORDER_VAR}, #1bbe84)`; +export const vscCommandCenterInactiveBorder = `var(${VSC_COMMAND_CENTER_INACTIVE_BORDER_VAR}, #1bbe84)`; +export const vscFindMatchSelected = `var(${VSC_FIND_MATCH_SELECTED_VAR}, rgba(255, 223, 0))`; export function parseHexColor(hexColor: string): { r: number; @@ -134,7 +110,7 @@ export function parseColorForHex(colorVar: string): string { } export const Button = styled.button` - padding: 10px 12px; + padding: 6px 12px; margin: 8px 0; border-radius: ${defaultBorderRadius}; @@ -154,21 +130,14 @@ export const Button = styled.button` } `; -type NumberInputProps = { - value: number; - onChange: (value: number) => void; - max?: number; - min?: number; -}; - export const SecondaryButton = styled.button` - padding: 10px 12px; + padding: 6px 12px; margin: 8px 0; border-radius: ${defaultBorderRadius}; - border: 1px solid ${vscForeground}; + border: 1px solid ${vscInputBorder}; color: ${vscForeground}; - background-color: inherit; + background-color: ${vscInputBackground}; &:disabled { color: gray; diff --git a/gui/src/components/indexing/DocsDetailsDialog.tsx b/gui/src/components/indexing/DocsDetailsDialog.tsx index 7b824291a..f8d0a54e9 100644 --- a/gui/src/components/indexing/DocsDetailsDialog.tsx +++ b/gui/src/components/indexing/DocsDetailsDialog.tsx @@ -127,25 +127,36 @@ function DocsDetailsDialog({ startUrl }: DocsDetailsDialogProps) { - - {chunk.filepath} - - - {chunk.content} - ); })} + {/* Rending tooltips here because div can't be child of tbody apparently */} + {data.chunks.map((chunk, i) => { + const contentToolTipId = `docs-content-peek-${i}`; + const urlToolTipId = `docs-url-peek-${i}`; + return ( + <> + + {chunk.filepath} + + + {chunk.content} + + + ); + })}
)}
diff --git a/gui/src/components/indexing/DocsIndexingStatus.tsx b/gui/src/components/indexing/DocsIndexingStatus.tsx index fe64ae2dc..224d96265 100644 --- a/gui/src/components/indexing/DocsIndexingStatus.tsx +++ b/gui/src/components/indexing/DocsIndexingStatus.tsx @@ -91,7 +91,6 @@ function DocsIndexingStatus({ docConfig }: IndexingStatusViewerProps) { return (
- {/* {`${status.type} - ${status.id} - ${status.status} - ${status.progress} - ${status.description} - ${status.icon}`} */}
diff --git a/gui/src/components/indexing/DocsIndexingStatuses.tsx b/gui/src/components/indexing/DocsIndexingStatuses.tsx index db312aef9..f1e261dfb 100644 --- a/gui/src/components/indexing/DocsIndexingStatuses.tsx +++ b/gui/src/components/indexing/DocsIndexingStatuses.tsx @@ -7,11 +7,15 @@ import { useAppSelector } from "../../redux/hooks"; import { useContext, useMemo } from "react"; import { ExclamationTriangleIcon } from "@heroicons/react/24/outline"; import { IdeMessengerContext } from "../../context/IdeMessenger"; +import { IndexingStatus } from "core"; function DocsIndexingStatuses() { const dispatch = useDispatch(); const config = useAppSelector((store) => store.config.config); const ideMessenger = useContext(IdeMessengerContext); + const indexingStatuses = useAppSelector( + (store) => store.indexing.indexing.statuses, + ); const hasDocsProvider = useMemo(() => { return !!config.contextProviders?.some( @@ -19,15 +23,31 @@ function DocsIndexingStatuses() { ); }, [config]); - const configDocs = useMemo(() => { - return config.docs ?? []; - }, [config]); + // TODO - this might significantly impact performance during indexing + const sortedConfigDocs = useMemo(() => { + const sorter = (status: IndexingStatus["status"]) => { + // TODO - further sorting? + if (status === "indexing" || status === "paused") return 0; + if (status === "failed") return 1; + if (status === "aborted" || status === "pending") return 2; + return 3; + }; + + const docs = [...(config.docs ?? [])]; + docs.sort((a, b) => + sorter(indexingStatuses[b.startUrl]?.status ?? "pending") > + sorter(indexingStatuses[a.startUrl]?.status ?? "pending") + ? -1 + : 1, + ); + return docs; + }, [config, indexingStatuses]); return (

@docs indexes

- {configDocs.length ? ( + {sortedConfigDocs.length ? ( { @@ -41,7 +61,7 @@ function DocsIndexingStatuses() {
{hasDocsProvider ? ( - configDocs.length ? ( + sortedConfigDocs.length ? ( "Manage your documentation sources" ) : ( "No docs yet" @@ -72,7 +92,7 @@ function DocsIndexingStatuses() {
- {configDocs.length === 0 && ( + {sortedConfigDocs.length === 0 && ( { @@ -84,7 +104,7 @@ function DocsIndexingStatuses() { )}
- {configDocs.map((doc) => { + {sortedConfigDocs.map((doc) => { return ; })}
diff --git a/gui/src/components/mainInput/ContinueInputBox.tsx b/gui/src/components/mainInput/ContinueInputBox.tsx index bdfe15ba6..69264eb35 100644 --- a/gui/src/components/mainInput/ContinueInputBox.tsx +++ b/gui/src/components/mainInput/ContinueInputBox.tsx @@ -109,7 +109,6 @@ function ContinueInputBox(props: ContinueInputBoxProps) { hideImageUpload: false, hideUseCodebase: true, hideSelectModel: false, - hideTools: true, enterText: editModeState.editStatus === "accepting" ? "Retry" : "Edit", } : {}; diff --git a/gui/src/components/mainInput/InputToolbar.tsx b/gui/src/components/mainInput/InputToolbar.tsx index 93b437fdc..ace2ae991 100644 --- a/gui/src/components/mainInput/InputToolbar.tsx +++ b/gui/src/components/mainInput/InputToolbar.tsx @@ -67,7 +67,6 @@ export interface ToolbarOptions { hideAddContext?: boolean; enterText?: string; hideSelectModel?: boolean; - hideTools?: boolean; } interface InputToolbarProps { @@ -91,10 +90,7 @@ function InputToolbar(props: InputToolbarProps) { const hasCodeToEdit = useAppSelector(selectHasCodeToEdit); const isEditModeAndNoCodeToEdit = isInEditMode && !hasCodeToEdit; const isEnterDisabled = props.disabled || isEditModeAndNoCodeToEdit; - const shouldRenderToolsButton = - defaultModel && - modelSupportsTools(defaultModel.model, defaultModel.provider) && - !props.toolbarOptions?.hideTools; + const toolsSupported = defaultModel && modelSupportsTools(defaultModel); const supportsImages = defaultModel && @@ -110,7 +106,6 @@ function InputToolbar(props: InputToolbarProps) {
@@ -131,7 +126,7 @@ function InputToolbar(props: InputToolbarProps) { } }} /> - + )} - {shouldRenderToolsButton && } +
{!props.toolbarOptions?.hideUseCodebase && !isInEditMode && ( -
- {availableTools.map((tool) => ( +
+ {availableTools.map((tool: any) => ( + {props.tool.faviconUrl && ( + {props.tool.displayTitle} + )} {props.tool.displayTitle}{" "} {/* { if (queryInputRef.current) { queryInputRef.current.focus(); } - }, [querySubmenuItem]); + }, [querySubmenuItem, queryInputRef]); const selectItem = (index: number) => { const item = allItems[index]; @@ -378,6 +378,9 @@ const MentionList = forwardRef((props: MentionListProps, ref) => { {querySubmenuItem ? ( { + e.stopPropagation(); + }} rows={1} ref={queryInputRef} placeholder={querySubmenuItem.description} @@ -436,7 +439,10 @@ const MentionList = forwardRef((props: MentionListProps, ref) => { ref={(el) => (itemRefs.current[index] = el)} className={`item cursor-pointer ${isSelected ? "is-selected" : ""}`} key={index} - onClick={() => selectItem(index)} + onClick={(e) => { + e.stopPropagation(); + selectItem(index); + }} onMouseEnter={() => setSelectedIndex(index)} data-testid="context-provider-dropdown-item" > diff --git a/gui/src/components/mainInput/TipTapEditor.tsx b/gui/src/components/mainInput/TipTapEditor.tsx index f78b58720..35e993a54 100644 --- a/gui/src/components/mainInput/TipTapEditor.tsx +++ b/gui/src/components/mainInput/TipTapEditor.tsx @@ -5,13 +5,7 @@ import Paragraph from "@tiptap/extension-paragraph"; import Placeholder from "@tiptap/extension-placeholder"; import Text from "@tiptap/extension-text"; import { Plugin } from "@tiptap/pm/state"; -import { - AnyExtension, - Editor, - EditorContent, - JSONContent, - useEditor, -} from "@tiptap/react"; +import { Editor, EditorContent, JSONContent, useEditor } from "@tiptap/react"; import { ContextProviderDescription, InputModifiers } from "core"; import { rifWithContentsToContextItem } from "core/commands/util"; import { modelSupportsImages } from "core/llm/autodetect"; @@ -30,9 +24,10 @@ import { defaultBorderRadius, lightGray, vscBadgeBackground, + vscCommandCenterActiveBorder, + vscCommandCenterInactiveBorder, vscForeground, vscInputBackground, - vscInputBorder, vscInputBorderFocus, } from ".."; import { IdeMessengerContext } from "../../context/IdeMessenger"; @@ -66,6 +61,7 @@ import { import { AddCodeToEdit } from "./AddCodeToEditExtension"; import { CodeBlockExtension } from "./CodeBlockExtension"; import { SlashCommand } from "./CommandsExtension"; +import { MockExtension } from "./FillerExtension"; import InputToolbar, { ToolbarOptions } from "./InputToolbar"; import { Mention } from "./MentionExtension"; import "./TipTapEditor.css"; @@ -78,9 +74,8 @@ import { handleVSCMetaKeyIssues, } from "./handleMetaKeyIssues"; import { ComboBoxItem } from "./types"; -import { MockExtension } from "./FillerExtension"; -const InputBoxDiv = styled.div<{ border?: string }>` +const InputBoxDiv = styled.div<{}>` resize: none; padding-bottom: 4px; font-family: inherit; @@ -90,8 +85,13 @@ const InputBoxDiv = styled.div<{ border?: string }>` width: 100%; background-color: ${vscInputBackground}; color: ${vscForeground}; - border: ${(props) => - props.border ? props.border : `0.5px solid ${vscInputBorder}`}; + + border: 1px solid ${vscCommandCenterInactiveBorder}; + transition: border-color 0.15s ease-in-out; + &:focus-within { + border: 1px solid ${vscCommandCenterActiveBorder}; + } + outline: none; font-size: ${getFontSize()}px; @@ -173,7 +173,6 @@ interface TipTapEditorProps { ) => void; editorState?: JSONContent; toolbarOptions?: ToolbarOptions; - border?: string; placeholder?: string; historyKey: string; inputId: string; @@ -592,11 +591,12 @@ function TipTapEditor(props: TipTapEditorProps) { useEffect(() => { if (editor) { const handleFocus = () => { - debouncedShouldHideToolbar(false); + setShouldHideToolbar(false); }; const handleBlur = () => { - debouncedShouldHideToolbar(true); + // TODO - make toolbar auto-hiding work without breaking tool dropdown focus + // debouncedShouldHideToolbar(true); }; editor.on("focus", handleFocus); @@ -730,6 +730,7 @@ function TipTapEditor(props: TipTapEditorProps) { await dispatch( saveCurrentSession({ openNewSession: false, + generateTitle: true, }), ); } @@ -763,6 +764,7 @@ function TipTapEditor(props: TipTapEditorProps) { await dispatch( saveCurrentSession({ openNewSession: true, + generateTitle: true, }), ); setTimeout(() => { @@ -925,7 +927,6 @@ function TipTapEditor(props: TipTapEditorProps) { return ( void; } -const TutorialCardDiv = styled.div` - border: 1px solid ${lightGray}; - border-radius: ${defaultBorderRadius}; - background-color: ${vscBackground}; - padding: 1rem 2.5rem 1rem 2rem; - margin: 1rem; - max-width: 28rem; - position: relative; -`; - -const CloseButton = styled.button` - border: none; - background-color: ${vscBackground}; - color: ${lightGray}; - position: absolute; - top: 0.4rem; - right: 0.5rem; - padding: 0.25rem; - display: flex; - align-items: center; - justify-content: center; - cursor: pointer; -`; - export function TutorialCard({ onClose }: TutorialCardProps) { const ideMessenger = useContext(IdeMessengerContext); + const jetbrains = isJetBrains(); return ( - - - - +
+
+

+
+ +
+
    - {!isJetBrains() && ( + {!jetbrains && (
  • @@ -67,27 +52,36 @@ export function TutorialCard({ onClose }: TutorialCardProps) {
  • )}
  • - +
    + +
    - Highlight code and press {getMetaKeyLabel()} + I to - quickly make natural language edits + Highlight code and press {getMetaKeyLabel()} +{" "} + I to quickly make natural language edits
  • - +
    + +
    - Highlight code and press {getMetaKeyLabel()} + L to - add it to the chat window + Highlight code and press {getMetaKeyLabel()} +{" "} + {jetbrains ? "J" : "L"} to add it to the chat window
  • - +
    + +
    - Click the gear icon in the bottom right to configure Continue + Click the gear icon at the top of the chat window to configure + Continue
  • - +
    + +
- +
); } diff --git a/gui/src/components/markdown/StepContainerPreToolbar/StepContainerPreToolbar.tsx b/gui/src/components/markdown/StepContainerPreToolbar/StepContainerPreToolbar.tsx index 45faf550a..99e449cc7 100644 --- a/gui/src/components/markdown/StepContainerPreToolbar/StepContainerPreToolbar.tsx +++ b/gui/src/components/markdown/StepContainerPreToolbar/StepContainerPreToolbar.tsx @@ -99,16 +99,6 @@ export default function StepContainerPreToolbar( ideMessenger.ide, ); - // Sometimes the model will decide to only output the base name - // in which case we shouldn't create a new file if it matches the current file - const exists = await ideMessenger.ide.fileExists(fileUri); - if (!exists) { - const activeFile = await ideMessenger.ide.getCurrentFile(); - if (activeFile && activeFile.path.endsWith(props.relativeFilepath)) { - fileUri = activeFile.path; - } - } - ideMessenger.post("applyToFile", { streamId: streamIdRef.current, filepath: fileUri, diff --git a/gui/src/components/modelSelection/ModelSelect.tsx b/gui/src/components/modelSelection/ModelSelect.tsx index 68f5ea996..92a37928f 100644 --- a/gui/src/components/modelSelection/ModelSelect.tsx +++ b/gui/src/components/modelSelection/ModelSelect.tsx @@ -10,6 +10,7 @@ import { useContext, useEffect, useRef, useState } from "react"; import { useDispatch } from "react-redux"; import styled from "styled-components"; import { defaultBorderRadius, lightGray, vscInputBackground } from ".."; +import { useAuth } from "../../context/Auth"; import { IdeMessengerContext } from "../../context/IdeMessenger"; import AddModelForm from "../../forms/AddModelForm"; import { useAppSelector } from "../../redux/hooks"; @@ -219,9 +220,7 @@ function ModelSelect() { const buttonRef = useRef(null); const [options, setOptions] = useState([]); const [sortedOptions, setSortedOptions] = useState([]); - const selectedProfileId = useAppSelector( - (store) => store.session.selectedProfileId, - ); + const { selectedProfile } = useAuth(); // Sort so that options without an API key are at the end useEffect(() => { @@ -235,13 +234,15 @@ function ModelSelect() { useEffect(() => { setOptions( - allModels.map((model) => { - return { - value: model.title, - title: modelSelectTitle(model), - apiKey: model.apiKey, - }; - }), + allModels + .filter((m) => !m.roles || m.roles.includes("chat")) + .map((model) => { + return { + value: model.title, + title: modelSelectTitle(model), + apiKey: model.apiKey, + }; + }), ); }, [allModels]); @@ -349,7 +350,7 @@ function ModelSelect() {
- {selectedProfileId === "local" && ( + {selectedProfile?.id === "local" && ( <> ; } else if (assistant.iconUrl) { - return ; + return ; } else { return ; } diff --git a/gui/src/components/modelSelection/platform/AssistantSelect.tsx b/gui/src/components/modelSelection/platform/AssistantSelect.tsx index f1216ac3f..629f0fe14 100644 --- a/gui/src/components/modelSelection/platform/AssistantSelect.tsx +++ b/gui/src/components/modelSelection/platform/AssistantSelect.tsx @@ -1,26 +1,36 @@ import { Popover } from "@headlessui/react"; -import { ChevronDownIcon } from "@heroicons/react/24/outline"; -import { useEffect, useRef } from "react"; +import { ChevronDownIcon, PlusIcon } from "@heroicons/react/24/outline"; +import { ProfileDescription } from "core/config/ConfigHandler"; +import { useContext, useEffect, useRef } from "react"; import { useAuth } from "../../../context/Auth"; +import { IdeMessengerContext } from "../../../context/IdeMessenger"; import { useAppDispatch } from "../../../redux/hooks"; -import { cycleProfile } from "../../../redux/thunks/cycleProfile"; -import { - getFontSize, - isLocalProfile, - isMetaEquivalentKeyPressed, -} from "../../../util"; +import { cycleProfile } from "../../../redux/thunks/profileAndOrg"; +import { getFontSize, isMetaEquivalentKeyPressed } from "../../../util"; import PopoverTransition from "../../mainInput/InputToolbar/PopoverTransition"; -import { AssistantSelectOptions } from "./AssistantSelectOptions"; import AssistantIcon from "./AssistantIcon"; +import { AssistantSelectOptions } from "./AssistantSelectOptions"; import { getProfileDisplayText } from "./utils"; +function AssistantSelectButton(props: { selectedProfile: ProfileDescription }) { + return ( +
+
+ +
+ + {getProfileDisplayText(props.selectedProfile)} + +
+ ); +} + export default function AssistantSelect() { const dispatch = useAppDispatch(); const buttonRef = useRef(null); - const { selectedProfile } = useAuth(); - - const isLocalProfileSelected = - selectedProfile && isLocalProfile(selectedProfile); + const { selectedProfile, selectedOrganization, profiles } = useAuth(); + const ideMessenger = useContext(IdeMessengerContext); useEffect(() => { let lastToggleTime = 0; @@ -48,7 +58,20 @@ export default function AssistantSelect() { }, []); if (!selectedProfile) { - return null; + return ( +
{ + ideMessenger.request("controlPlane/openUrl", { + path: "/new?type=assistant", + orgSlug: selectedOrganization?.slug, + }); + }} + className="text-lightgray hover:bg mb-1 mr-3 flex cursor-pointer items-center gap-1" + style={{ fontSize: `${getFontSize() - 2}px` }} + > + Create your first assistant +
+ ); } return ( @@ -57,21 +80,10 @@ export default function AssistantSelect() { -
-
- -
- - {getProfileDisplayText(selectedProfile)} - -
+
diff --git a/gui/src/components/modelSelection/platform/AssistantSelectOptions.tsx b/gui/src/components/modelSelection/platform/AssistantSelectOptions.tsx index 436005f23..c0b7e6071 100644 --- a/gui/src/components/modelSelection/platform/AssistantSelectOptions.tsx +++ b/gui/src/components/modelSelection/platform/AssistantSelectOptions.tsx @@ -1,15 +1,14 @@ import { BuildingOfficeIcon, PlusIcon } from "@heroicons/react/24/outline"; +import { ProfileDescription } from "core/config/ConfigHandler"; import { useContext } from "react"; import { useNavigate } from "react-router-dom"; import { lightGray } from "../.."; import { useAuth } from "../../../context/Auth"; import { IdeMessengerContext } from "../../../context/IdeMessenger"; import { useAppDispatch } from "../../../redux/hooks"; -import { setDialogMessage, setShowDialog } from "../../../redux/slices/uiSlice"; -import { setProfileId } from "../../../redux/thunks/setProfileId"; +import { selectProfileThunk } from "../../../redux/thunks/profileAndOrg"; import { getFontSize, getMetaKeyLabel, isLocalProfile } from "../../../util"; import { ROUTES } from "../../../util/navigation"; -import AboutAssistantDialog from "../../dialogs/AboutAssistantDialog"; import AssistantIcon from "./AssistantIcon"; import { Divider, Option, OptionDiv } from "./shared"; import { getProfileDisplayText } from "./utils"; @@ -18,80 +17,79 @@ interface AssistantSelectOptionsProps { onClose: () => void; } -export function AssistantSelectOptions(props: AssistantSelectOptionsProps) { +export function AssistantSelectOptions({ + onClose, +}: AssistantSelectOptionsProps) { const ideMessenger = useContext(IdeMessengerContext); - const { profiles, selectedProfile, selectedOrganization } = useAuth(); + const { profiles, selectedProfile, selectedOrganization, session, login } = + useAuth(); const dispatch = useAppDispatch(); const navigate = useNavigate(); function onNewAssistant() { ideMessenger.post("controlPlane/openUrl", { path: "new", + orgSlug: selectedOrganization?.slug, }); + onClose(); } - function handleOptionLink(e: React.MouseEvent, profileId: string) { - e.stopPropagation(); - e.preventDefault(); - ideMessenger.post("config/openProfile", { profileId }); - } - - function handleConfigure(e: React.MouseEvent, option: any) { - e.stopPropagation(); - e.preventDefault(); - - if (option.id === "local") { - ideMessenger.post("config/openProfile", { profileId: option.id }); - } else { - props.onClose(); - dispatch(setDialogMessage()); - dispatch(setShowDialog(true)); - } + function handleConfigure(profile: ProfileDescription) { + ideMessenger.post("config/openProfile", { profileId: profile.id }); + onClose(); } function handleClickError(profileId: string) { ideMessenger.post("config/openProfile", { profileId }); + onClose(); + } + + if (!profiles) { + return null; } return (
- {profiles.map((profile, idx) => ( -
- + login(false)} + >
navigate(ROUTES.CONFIG)} > {selectedOrganization?.iconUrl ? ( - + ) : ( )} diff --git a/gui/src/components/modelSelection/platform/shared.tsx b/gui/src/components/modelSelection/platform/shared.tsx index bb94188a9..627d39133 100644 --- a/gui/src/components/modelSelection/platform/shared.tsx +++ b/gui/src/components/modelSelection/platform/shared.tsx @@ -54,8 +54,7 @@ interface ModelOptionProps { disabled: boolean; selected: boolean; showConfigure: boolean; - onLink?: (e: any) => void; - onConfigure: (e: any) => void; + onOpenConfig: () => void; onClick: () => void; errors?: ConfigValidationError[]; onClickError?: (e: any) => void; @@ -85,16 +84,15 @@ const StyledExclamationTriangleIcon = styled(IconBase).attrs({ })``; export function Option({ - onConfigure, children, idx, disabled, onClick, showConfigure, - onLink, selected, errors, onClickError, + onOpenConfig, }: ModelOptionProps) { const [hovered, setHovered] = useState(false); @@ -119,16 +117,27 @@ export function Option({
{children}
- {!errors?.length && showConfigure && ( - - )} - {!errors?.length && onLink && ( - - )} - {errors?.length ? ( + {!errors?.length ? ( + showConfigure ? ( + { + e.stopPropagation(); + e.preventDefault(); + onOpenConfig(); + }} + /> + ) : ( + { + e.stopPropagation(); + e.preventDefault(); + onOpenConfig(); + }} + /> + ) + ) : ( <> - ) : null} + )}
diff --git a/gui/src/context/Auth.tsx b/gui/src/context/Auth.tsx index 5154c67ae..807065019 100644 --- a/gui/src/context/Auth.tsx +++ b/gui/src/context/Auth.tsx @@ -10,29 +10,27 @@ import React, { useMemo, useState, } from "react"; -import { useDispatch } from "react-redux"; -import AccountDialog from "../components/AccountDialog"; import ConfirmationDialog from "../components/dialogs/ConfirmationDialog"; import { useWebviewListener } from "../hooks/useWebviewListener"; -import { useAppSelector } from "../redux/hooks"; +import { useAppDispatch, useAppSelector } from "../redux/hooks"; import { setLastControlServerBetaEnabledStatus } from "../redux/slices/miscSlice"; -import { - selectAvailableProfiles, - setAvailableProfiles, -} from "../redux/slices/sessionSlice"; import { setDialogMessage, setShowDialog } from "../redux/slices/uiSlice"; -import { getLocalStorage, setLocalStorage } from "../util/localStorage"; +import { + updateOrgsThunk, + updateProfilesThunk, +} from "../redux/thunks/profileAndOrg"; import { IdeMessengerContext } from "./IdeMessenger"; interface AuthContextType { session: ControlPlaneSessionInfo | undefined; logout: () => void; login: (useOnboarding: boolean) => Promise; - selectedProfile: ProfileDescription | undefined; - profiles: ProfileDescription[]; + selectedProfile: ProfileDescription | null; + profiles: ProfileDescription[] | null; + refreshProfiles: () => void; controlServerBetaEnabled: boolean; organizations: OrganizationDescription[]; - selectedOrganization: OrganizationDescription | undefined; + selectedOrganization: OrganizationDescription | null; } const AuthContext = createContext(undefined); @@ -40,34 +38,31 @@ const AuthContext = createContext(undefined); export const AuthProvider: React.FC<{ children: React.ReactNode }> = ({ children, }) => { + const dispatch = useAppDispatch(); + const ideMessenger = useContext(IdeMessengerContext); + + // Session const [session, setSession] = useState( undefined, ); - const [organizations, setOrganizations] = useState( - [], - ); - - const ideMessenger = useContext(IdeMessengerContext); - - const selectedOrganizationId = useAppSelector( + // Orgs + const orgs = useAppSelector((store) => store.session.organizations); + const selectedOrgId = useAppSelector( (store) => store.session.selectedOrganizationId, ); - const selectedOrganization = useMemo(() => { - return organizations.find((p) => p.id === selectedOrganizationId); - }, [organizations, selectedOrganizationId]); + if (!selectedOrgId) { + return null; + } + return orgs.find((p) => p.id === selectedOrgId) ?? null; + }, [orgs, selectedOrgId]); - const profiles = useAppSelector(selectAvailableProfiles); - - const selectedProfileId = useAppSelector( - (store) => store.session.selectedProfileId, + // Profiles + const profiles = useAppSelector((store) => store.session.availableProfiles); + const selectedProfile = useAppSelector( + (store) => store.session.selectedProfile, ); - const selectedProfile = useMemo(() => { - return profiles.find((p) => p.id === selectedProfileId); - }, [profiles, selectedProfileId]); - - const dispatch = useDispatch(); const login: AuthContextType["login"] = (useOnboarding: boolean) => { return new Promise((resolve) => { @@ -85,23 +80,6 @@ export const AuthProvider: React.FC<{ children: React.ReactNode }> = ({ const session = result.content; setSession(session); - // If this is the first time the user has logged in, explain how profiles work - if (!getLocalStorage("shownProfilesIntroduction")) { - dispatch(setShowDialog(true)); - dispatch( - setDialogMessage( - {}} - />, - ), - ); - setLocalStorage("shownProfilesIntroduction", true); - } - resolve(true); }); }); @@ -118,8 +96,8 @@ export const AuthProvider: React.FC<{ children: React.ReactNode }> = ({ ideMessenger.post("logoutOfControlPlane", undefined); }} onCancel={() => { - dispatch(setDialogMessage()); - dispatch(setShowDialog(true)); + dispatch(setDialogMessage(undefined)); + dispatch(setShowDialog(false)); }} />, ), @@ -128,10 +106,10 @@ export const AuthProvider: React.FC<{ children: React.ReactNode }> = ({ useWebviewListener("didChangeControlPlaneSessionInfo", async (data) => { setSession(data.sessionInfo); - }); - - useWebviewListener("signInToControlPlane", async () => { - login(false); + // On logout, clear the list of orgs + if (!data.sessionInfo) { + dispatch(updateOrgsThunk([])); + } }); useEffect(() => { @@ -152,10 +130,10 @@ export const AuthProvider: React.FC<{ children: React.ReactNode }> = ({ ideMessenger.ide .getIdeSettings() .then(({ enableControlServerBeta, continueTestEnvironment }) => { - const enabled = - enableControlServerBeta || continueTestEnvironment !== "none"; - setControlServerBetaEnabled(enabled); - dispatch(setLastControlServerBetaEnabledStatus(enabled)); + setControlServerBetaEnabled(enableControlServerBeta); + dispatch( + setLastControlServerBetaEnabledStatus(enableControlServerBeta), + ); }); }, []); @@ -165,11 +143,11 @@ export const AuthProvider: React.FC<{ children: React.ReactNode }> = ({ .request("controlPlane/listOrganizations", undefined) .then((result) => { if (result.status === "success") { - setOrganizations(result.content); + dispatch(updateOrgsThunk(result.content)); + } else { + dispatch(updateOrgsThunk([])); } }); - } else { - setOrganizations([]); } }, [session]); @@ -186,19 +164,37 @@ export const AuthProvider: React.FC<{ children: React.ReactNode }> = ({ ); useEffect(() => { - ideMessenger - .request("config/listProfiles", undefined) - .then( - (result) => - result.status === "success" && - dispatch(setAvailableProfiles(result.content)), - ); + ideMessenger.request("config/listProfiles", undefined).then((result) => { + if (result.status === "success") { + dispatch( + updateProfilesThunk({ + profiles: result.content, + selectedProfileId: null, + }), + ); + } + }); }, []); + const refreshProfiles = async () => { + try { + await ideMessenger.request("config/refreshProfiles", undefined); + ideMessenger.post("showToast", ["info", "Config refreshed"]); + } catch (e) { + console.error("Failed to refresh profiles", e); + ideMessenger.post("showToast", ["error", "Failed to refresh config"]); + } + }; + useWebviewListener( "didChangeAvailableProfiles", async (data) => { - dispatch(setAvailableProfiles(data.profiles)); + dispatch( + updateProfilesThunk({ + profiles: data.profiles, + selectedProfileId: data.selectedProfileId, + }), + ); }, [], ); @@ -211,8 +207,9 @@ export const AuthProvider: React.FC<{ children: React.ReactNode }> = ({ login, selectedProfile, profiles, + refreshProfiles, selectedOrganization, - organizations, + organizations: orgs, controlServerBetaEnabled, }} > diff --git a/gui/src/context/SubmenuContextProviders.tsx b/gui/src/context/SubmenuContextProviders.tsx index 5b6e58fa4..732213f5b 100644 --- a/gui/src/context/SubmenuContextProviders.tsx +++ b/gui/src/context/SubmenuContextProviders.tsx @@ -3,18 +3,24 @@ import { ContextProviderName, ContextSubmenuItemWithProvider, } from "core"; -import { createContext } from "react"; import { deduplicateArray } from "core/util"; -import MiniSearch, { SearchResult } from "minisearch"; -import { useCallback, useContext, useEffect, useRef, useState } from "react"; -import { IdeMessengerContext } from "./IdeMessenger"; -import { selectSubmenuContextProviders } from "../redux/selectors"; -import { useWebviewListener } from "../hooks/useWebviewListener"; -import { useAppSelector } from "../redux/hooks"; import { getShortestUniqueRelativeUriPaths, getUriPathBasename, } from "core/util/uri"; +import MiniSearch, { SearchResult } from "minisearch"; +import { + createContext, + useCallback, + useContext, + useEffect, + useRef, + useState, +} from "react"; +import { useWebviewListener } from "../hooks/useWebviewListener"; +import { useAppSelector } from "../redux/hooks"; +import { selectSubmenuContextProviders } from "../redux/selectors"; +import { IdeMessengerContext } from "./IdeMessenger"; const MINISEARCH_OPTIONS = { prefix: true, @@ -246,9 +252,7 @@ export const SubmenuContextProvidersProvider = ({ abortControllers.get(description.title)?.abort(); abortControllers.set(description.title, controller); providersLoading.add(description.title); - console.log( - `Refreshing items for ${description.title} submenu provider`, - ); + const result = await ideMessenger.request( "context/loadSubmenuItems", { @@ -270,10 +274,12 @@ export const SubmenuContextProvidersProvider = ({ } const submenuItems = result.content; const providerTitle = description.title; + const renderInlineAs = description.renderInlineAs; const itemsWithProvider = submenuItems.map((item) => ({ ...item, providerTitle, + renderInlineAs })); const minisearch = new MiniSearch( @@ -296,7 +302,7 @@ export const SubmenuContextProvidersProvider = ({ setFallbackResults((prev) => ({ ...prev, file: deduplicateArray( - [...lastOpenFilesRef.current, ...(prev.file ?? [])], + [...lastOpenFilesRef.current, ...itemsWithProvider], (a, b) => a.id === b.id, ), })); diff --git a/gui/src/hooks/useSetup.ts b/gui/src/hooks/useSetup.ts index 5ea5c2975..b86757cbf 100644 --- a/gui/src/hooks/useSetup.ts +++ b/gui/src/hooks/useSetup.ts @@ -11,9 +11,9 @@ import { updateDocsSuggestions } from "../redux/slices/miscSlice"; import { addContextItemsAtIndex, setInactive, - setSelectedProfileId, } from "../redux/slices/sessionSlice"; import { setTTSActive } from "../redux/slices/uiSlice"; +import { selectProfileThunk } from "../redux/thunks/profileAndOrg"; import { refreshSessionMetadata } from "../redux/thunks/session"; import { streamResponseThunk } from "../redux/thunks/streamResponse"; import { updateFileSymbolsFromHistory } from "../redux/thunks/updateFileSymbols"; @@ -36,7 +36,7 @@ function useSetup() { initial: boolean, result: { result: ConfigResult; - profileId: string; + profileId: string | null; }, ) => { const { result: configResult, profileId } = result; @@ -44,17 +44,8 @@ function useSetup() { return; } hasLoadedConfig.current = true; - // window.postMessage( - // { - // messageType: "refreshSubmenuItems", - // data: { - // providers: "all", - // }, - // }, - // "*", - // ); dispatch(setConfigResult(configResult)); - dispatch(setSelectedProfileId(profileId)); + dispatch(selectProfileThunk(profileId)); // Perform any actions needed with the config if (configResult.config?.ui?.fontSize) { @@ -124,7 +115,25 @@ function useSetup() { // Override persisted state dispatch(setInactive()); - if (isJetBrains()) { + const jetbrains = isJetBrains(); + for (const colorVar of VSC_THEME_COLOR_VARS) { + if (jetbrains) { + const cached = localStorage.getItem(colorVar); + if (cached) { + document.body.style.setProperty(colorVar, cached); + } + } + + // Remove alpha channel from colors + const value = getComputedStyle(document.documentElement).getPropertyValue( + colorVar, + ); + if (colorVar.startsWith("#") && value.length > 7) { + document.body.style.setProperty(colorVar, value.slice(0, 7)); + } + } + + if (jetbrains) { // Save theme colors to local storage for immediate loading in JetBrains ideMessenger.request("jetbrains/getColors", undefined).then((result) => { if (result.status === "success") { @@ -160,6 +169,17 @@ function useSetup() { } }, []); + useWebviewListener( + "jetbrains/setColors", + async (data) => { + Object.entries(data).forEach(([key, value]) => { + document.body.style.setProperty(key, value); + document.documentElement.style.setProperty(key, value); + }); + }, + [], + ); + useWebviewListener("docs/suggestions", async (data) => { dispatch(updateDocsSuggestions(data)); }); diff --git a/gui/src/index.css b/gui/src/index.css index d51fbf004..b151f3743 100644 --- a/gui/src/index.css +++ b/gui/src/index.css @@ -3,14 +3,7 @@ @tailwind utilities; :root { - --secondary-dark: rgb(37, 37, 38); - --vsc-background: rgb(30, 30, 30); - --button-color: rgb(113, 28, 59); - --button-color-hover: rgba(113, 28, 59, 0.667); - --def-border-radius: 5px; - --vscode-editor-background: rgb(30, 30, 30); - --vscode-editor-foreground: rgb(197, 200, 198); - --vscode-textBlockQuote-background: rgba(255, 255, 255, 1); + --example-var: rgb(30, 30, 30); } html, diff --git a/gui/src/pages/AddNewModel/AddNewModel.tsx b/gui/src/pages/AddNewModel/AddNewModel.tsx index d74cbf25c..f5caa2419 100644 --- a/gui/src/pages/AddNewModel/AddNewModel.tsx +++ b/gui/src/pages/AddNewModel/AddNewModel.tsx @@ -13,10 +13,10 @@ import ModelCard from "../../components/modelSelection/ModelCard"; import Toggle from "../../components/modelSelection/Toggle"; import { IdeMessengerContext } from "../../context/IdeMessenger"; import { useNavigationListener } from "../../hooks/useNavigationListener"; +import { setDefaultModel } from "../../redux/slices/configSlice"; import { ModelPackage, models } from "./configs/models"; import { providers } from "./configs/providers"; import { CustomModelButton } from "./ConfigureProvider"; -import { setDefaultModel } from "../../redux/slices/configSlice"; const IntroDiv = styled.div` padding: 8px 12px; @@ -39,7 +39,7 @@ const GridDiv = styled.div` */ const modelsByProvider: Record = { "Open AI": [models.gpt4turbo, models.gpt4o, models.gpt35turbo], - Anthropic: [models.claude3Opus, models.claude3Sonnet, models.claude3Haiku], + Anthropic: [models.claude3Opus, models.claude3Sonnet, models.claude35Haiku], Mistral: [ models.codestral, models.mistral7b, @@ -49,7 +49,11 @@ const modelsByProvider: Record = { models.mistralLarge, ], Cohere: [models.commandR, models.commandRPlus], - DeepSeek: [models.deepseekCoderApi, models.deepseekChatApi, models.deepseekReasonerApi], + DeepSeek: [ + models.deepseekCoderApi, + models.deepseekChatApi, + models.deepseekReasonerApi, + ], Gemini: [models.geminiPro, models.gemini15Pro, models.gemini15Flash], "Open Source": [models.llama3Chat, models.mistralOs, models.deepseek], }; diff --git a/gui/src/pages/AddNewModel/configs/models.ts b/gui/src/pages/AddNewModel/configs/models.ts index 607e466d9..73aaa428c 100644 --- a/gui/src/pages/AddNewModel/configs/models.ts +++ b/gui/src/pages/AddNewModel/configs/models.ts @@ -52,16 +52,14 @@ export const models: { [key: string]: ModelPackage } = { name: "Parameter Count", description: "The number of parameters in the model", options: { - "r1": { + r1: { model: "deepseek/deepseek_v3", title: "deepseek_v3", - } + }, }, }, ], - providerOptions: [ - "novita" - ], + providerOptions: ["novita", "nebius"], isOpenSource: true, }, deepseekR1Chat: { @@ -79,16 +77,14 @@ export const models: { [key: string]: ModelPackage } = { name: "Parameter Count", description: "The number of parameters in the model", options: { - "r1": { + r1: { model: "deepseek/deepseek-r1", title: "deepseek-r1", - } + }, }, }, ], - providerOptions: [ - "novita" - ], + providerOptions: ["novita", "nebius"], isOpenSource: true, }, llama318BChat: { @@ -109,13 +105,11 @@ export const models: { [key: string]: ModelPackage } = { "8b": { model: "meta-llama/llama-3.1-8b-instruct", title: "Llama3.1-8b", - } + }, }, }, ], - providerOptions: [ - "novita" - ], + providerOptions: ["novita"], isOpenSource: true, }, mistralChat: { @@ -140,9 +134,7 @@ export const models: { [key: string]: ModelPackage } = { }, ], icon: "mistral.png", - providerOptions: [ - "novita", - ], + providerOptions: ["novita"], isOpenSource: true, }, llama31Chat: { @@ -507,7 +499,20 @@ export const models: { [key: string]: ModelPackage } = { contextLength: 8192, }, icon: "meta.png", - providerOptions: ["groq", "scaleway"], + providerOptions: ["groq", "scaleway", "nebius"], + isOpenSource: false, + }, + llama3370bChat: { + title: "Llama3.3 70b Chat", + description: "A model from Meta, fine-tuned for chat", + refUrl: "", + params: { + title: "Llama3.3-70b", + model: "llama3.3-70b", + contextLength: 65536, + }, + icon: "meta.png", + providerOptions: [], isOpenSource: false, }, llama3170bChat: { @@ -520,7 +525,7 @@ export const models: { [key: string]: ModelPackage } = { contextLength: 8192, }, icon: "meta.png", - providerOptions: ["groq", "scaleway"], + providerOptions: ["groq", "scaleway", "nebius"], isOpenSource: false, }, llama31405bChat: { @@ -533,7 +538,7 @@ export const models: { [key: string]: ModelPackage } = { contextLength: 8192, }, icon: "meta.png", - providerOptions: ["groq"], + providerOptions: ["groq", "nebius"], isOpenSource: false, }, llama3170bNemotron: { @@ -559,7 +564,7 @@ export const models: { [key: string]: ModelPackage } = { contextLength: 8192, }, icon: "meta.png", - providerOptions: ["ollama", "groq", "llama.cpp", "sambanova"], + providerOptions: ["ollama", "groq", "llama.cpp", "sambanova", "nebius"], isOpenSource: false, }, llama323bChat: { @@ -995,14 +1000,14 @@ export const models: { [key: string]: ModelPackage } = { icon: "anthropic.png", isOpenSource: false, }, - claude3Haiku: { - title: "Claude 3 Haiku", + claude35Haiku: { + title: "Claude 3.5 Haiku", description: - "The third most capable model in the Claude 3 series: fastest and most compact model for near-instant responsiveness", + "The fastest model in the Claude 3.5 series: a compact model for near-instant responsiveness", params: { - model: "claude-3-haiku-20240307", + model: "claude-3-5-haiku-latest", contextLength: 200_000, - title: "Claude 3 Haiku", + title: "Claude 3.5 Haiku", apiKey: "", }, providerOptions: ["anthropic", "free-trial"], @@ -1369,7 +1374,7 @@ export const models: { [key: string]: ModelPackage } = { }, }, ], - providerOptions: ["nebius"], + providerOptions: ["nebius", "ncompass"], isOpenSource: true, }, Qwen25Coder32b: { @@ -1379,10 +1384,10 @@ export const models: { [key: string]: ModelPackage } = { params: { title: "Qwen 2.5 Coder 32b", model: "qwen2.5-coder-32b", - contextLength: 128_000, + contextLength: 32_000, }, icon: "qwen.png", - providerOptions: ["scaleway"], + providerOptions: ["scaleway", "nebius", "ncompass"], isOpenSource: true, }, grokBeta: { diff --git a/gui/src/pages/AddNewModel/configs/providers.ts b/gui/src/pages/AddNewModel/configs/providers.ts index 7e0560942..38ed33400 100644 --- a/gui/src/pages/AddNewModel/configs/providers.ts +++ b/gui/src/pages/AddNewModel/configs/providers.ts @@ -111,7 +111,7 @@ export const providers: Partial> = { models.claude35Sonnet, models.claude3Opus, models.claude3Sonnet, - models.claude3Haiku, + models.claude35Haiku, ], apiKeyUrl: "https://console.anthropic.com/account/keys", }, @@ -370,7 +370,11 @@ Select the \`GPT-4o\` model below to complete your provider configuration, but n required: true, }, ], - packages: [models.deepseekCoderApi, models.deepseekChatApi, models.deepseekReasonerApi], + packages: [ + models.deepseekCoderApi, + models.deepseekChatApi, + models.deepseekReasonerApi, + ], apiKeyUrl: "https://platform.deepseek.com/api_keys", }, together: { @@ -405,6 +409,38 @@ Select the \`GPT-4o\` model below to complete your provider configuration, but n }), apiKeyUrl: "https://api.together.xyz/settings/api-keys", }, + ncompass: { + title: "nCompass", + provider: "ncompass", + refPage: "ncompass", + description: + "Use the nCompass API for extremely fast streaming of open-source models", + icon: "ncompass.png", + longDescription: `nCompass is an extremely fast inference engine for open-source language models. To get started, obtain an API key from [their console](https://app.ncompass.tech/api-settings).`, + tags: [ModelProviderTags.RequiresApiKey, ModelProviderTags.OpenSource], + params: { + apiKey: "", + }, + collectInputFor: [ + { + inputType: "text", + key: "apiKey", + label: "API Key", + placeholder: "Enter your nCompass API key", + required: true, + }, + ...completionParamsInputsConfigs, + ], + packages: [ + models.llama318bChat, + models.llama3370bChat, + models.Qwen25Coder32b, + ].map((p) => { + p.params.contextLength = 4096; + return p; + }), + apiKeyUrl: "https://app.ncompass.tech/api-settings", + }, novita: { title: "NovitaAI", provider: "novita", @@ -427,8 +463,12 @@ Select the \`GPT-4o\` model below to complete your provider configuration, but n }, ...completionParamsInputsConfigs, ], - packages: [models.llama318BChat, models.mistralChat, - models.deepseekR1Chat, models.deepseekV3Chat].map((p) => { + packages: [ + models.llama318BChat, + models.mistralChat, + models.deepseekR1Chat, + models.deepseekV3Chat, + ].map((p) => { p.params.contextLength = 4096; return p; }), @@ -681,7 +721,7 @@ To get started, [register](https://dataplatform.cloud.ibm.com/registration/stepo { ...models.claude35Sonnet, title: "Claude 3.5 Sonnet (trial)" }, { ...models.gpt4o, title: "GPT-4o (trial)" }, { ...models.gpt35turbo, title: "GPT-3.5-Turbo (trial)" }, - { ...models.claude3Haiku, title: "Claude 3 Haiku (trial)" }, + { ...models.claude35Haiku, title: "Claude 3.5 Haiku (trial)" }, models.mixtralTrial, { ...models.gemini15Pro, title: "Gemini 1.5 Pro (trial)" }, { @@ -859,6 +899,10 @@ To get started, [register](https://dataplatform.cloud.ibm.com/registration/stepo icon: "nebius.png", tags: [ModelProviderTags.RequiresApiKey, ModelProviderTags.OpenSource], packages: [ + models.deepseekR1Chat, + models.deepseekV3Chat, + models.QwenQwQ_32b_preview, + models.Qwen25Coder_32b, models.llama318bChat, models.llama3170bChat, models.llama31405bChat, diff --git a/gui/src/pages/More/IndexingProgress/IndexingProgressErrorText.tsx b/gui/src/pages/More/IndexingProgress/IndexingProgressErrorText.tsx index 4cfea672c..e7a19f612 100644 --- a/gui/src/pages/More/IndexingProgress/IndexingProgressErrorText.tsx +++ b/gui/src/pages/More/IndexingProgress/IndexingProgressErrorText.tsx @@ -1,7 +1,6 @@ import { XCircleIcon } from "@heroicons/react/24/outline"; import { IndexingProgressUpdate } from "core"; import { useAppSelector } from "../../../redux/hooks"; -import { isJetBrains } from "../../../util"; export interface IndexingProgressErrorTextProps { update: IndexingProgressUpdate; @@ -9,20 +8,16 @@ export interface IndexingProgressErrorTextProps { function IndexingProgressErrorText({ update }: IndexingProgressErrorTextProps) { const embeddingsProvider = useAppSelector( - (state) => state.config.config.embeddingsProvider, + (state) => state.config.config.selectedModelByRole.embed, ); - const showJbError = - (isJetBrains() && embeddingsProvider === "all-MiniLM-L6-v2") || true; - - if (showJbError) { + if (!embeddingsProvider) { return (
- The transformers.js embeddingsProvider is currently - unsupported in JetBrains. To enable codebase indexing, you can use any - of the other providers described in the docs:{" "} + Add an Embeddings model to enable codebase indexing. See the docs for + examples: void; + displayName: string; + description: string; +} + +const ModelRoleSelector = ({ + models, + selectedModel, + onSelect, + displayName, + description, +}: ModelRoleSelectorProps) => { + function handleSelect(title: string | null) { + onSelect(models.find((m) => m.title === title) ?? null); + } + + return ( + <> +
+ {displayName} + + + {description} + +
+ + {({ open }) => ( +
+ + {models.length === 0 ? ( + {`No ${displayName} models${["Chat", "Apply", "Edit"].includes(displayName) ? ". Using chat model" : ""}`} + ) : ( + + {selectedModel?.title ?? `Select ${displayName} model`} + + )} + {models.length ? ( +
+
+ ) : null} +
+ + + + {models.map((option, idx) => ( + + + {option.title} + + + ))} + + +
+ )} +
+ + ); +}; + +export default ModelRoleSelector; diff --git a/gui/src/pages/config/ScopeSelect.tsx b/gui/src/pages/config/ScopeSelect.tsx index 9ee287e8b..c67f68241 100644 --- a/gui/src/pages/config/ScopeSelect.tsx +++ b/gui/src/pages/config/ScopeSelect.tsx @@ -1,54 +1,53 @@ import { Listbox } from "@headlessui/react"; import { - ChevronDownIcon, - UserCircleIcon, BuildingOfficeIcon, + ChevronUpDownIcon, + UserCircleIcon, } from "@heroicons/react/24/outline"; -import { useState } from "react"; import { useAuth } from "../../context/Auth"; -import { setOrgId } from "../../redux/thunks/setOrgId"; -import { useAppDispatch } from "../../redux/hooks"; - -const USER_PROFILE_VAL = "personal"; +import { useAppDispatch, useAppSelector } from "../../redux/hooks"; +import { selectOrgThunk } from "../../redux/thunks/profileAndOrg"; export function ScopeSelect() { const { organizations, selectedOrganization } = useAuth(); - const [value, setValue] = useState( - selectedOrganization?.id || USER_PROFILE_VAL, + const selectedOrgId = useAppSelector( + (state) => state.session.selectedOrganizationId, ); const dispatch = useAppDispatch(); - const handleChange = (newValue: string) => { - setValue(newValue); - - const orgId = newValue === USER_PROFILE_VAL ? null : newValue; - dispatch(setOrgId(orgId)); + const handleChange = (newValue: string | null) => { + dispatch(selectOrgThunk(newValue)); + }; + + const CurScopeEntityFallBackIcon = selectedOrgId + ? BuildingOfficeIcon + : UserCircleIcon; + + const selectedDisplay = selectedOrganization ?? { + name: "Personal", + iconUrl: null, }; - const selectedDisplay = - value === USER_PROFILE_VAL - ? { name: "Personal", iconUrl: null } - : organizations.find((org) => org.id === value); return ( - +
- +
{selectedDisplay?.iconUrl ? ( ) : ( - + )} {selectedDisplay?.name || "Select Organization"}
-
- + {organizations.length > 0 && ( <>
@@ -58,7 +57,7 @@ export function ScopeSelect() {
{org.iconUrl ? ( @@ -76,8 +75,8 @@ export function ScopeSelect() { )}
diff --git a/gui/src/pages/config/index.tsx b/gui/src/pages/config/index.tsx index 3f9cc611b..79c81a221 100644 --- a/gui/src/pages/config/index.tsx +++ b/gui/src/pages/config/index.tsx @@ -1,22 +1,31 @@ -import { useContext, useEffect, useState } from "react"; -import { useNavigate } from "react-router-dom"; -import PageHeader from "../../components/PageHeader"; -import { IdeMessengerContext } from "../../context/IdeMessenger"; -import { useNavigationListener } from "../../hooks/useNavigationListener"; -import { useAppDispatch, useAppSelector } from "../../redux/hooks"; - -import { CheckIcon, XMarkIcon } from "@heroicons/react/24/outline"; +import { ModelRole } from "@continuedev/config-yaml"; +import { Listbox, Transition } from "@headlessui/react"; +import { + CheckIcon, + ChevronUpDownIcon, + PlusCircleIcon, + XMarkIcon, +} from "@heroicons/react/24/outline"; +import { ModelDescription } from "core"; import { SharedConfigSchema, - modifyContinueConfigWithSharedConfig, + modifyAnyConfigWithSharedConfig, } from "core/config/sharedConfig"; +import { Fragment, useContext, useEffect, useState } from "react"; +import { useNavigate } from "react-router-dom"; import { Input, SecondaryButton } from "../../components"; import NumberInput from "../../components/gui/NumberInput"; import { Select } from "../../components/gui/Select"; import ToggleSwitch from "../../components/gui/Switch"; +import PageHeader from "../../components/PageHeader"; import { useAuth } from "../../context/Auth"; -import { updateConfig } from "../../redux/slices/configSlice"; -import { getFontSize } from "../../util"; +import { IdeMessengerContext } from "../../context/IdeMessenger"; +import { useNavigationListener } from "../../hooks/useNavigationListener"; +import { useAppDispatch, useAppSelector } from "../../redux/hooks"; +import { setDefaultModel, updateConfig } from "../../redux/slices/configSlice"; +import { selectProfileThunk } from "../../redux/thunks/profileAndOrg"; +import { getFontSize, isJetBrains } from "../../util"; +import ModelRoleSelector from "./ModelRoleSelector"; import { ScopeSelect } from "./ScopeSelect"; function ConfigPage() { @@ -25,16 +34,87 @@ function ConfigPage() { const navigate = useNavigate(); const ideMessenger = useContext(IdeMessengerContext); - const { selectedProfile, selectedOrganization, session } = useAuth(); - const config = useAppSelector((state) => state.config.config); + const { + session, + logout, + login, + profiles, + selectedProfile, + controlServerBetaEnabled, + selectedOrganization, + } = useAuth(); - function handleUpdate(sharedConfig: Partial) { - dispatch( - updateConfig(modifyContinueConfigWithSharedConfig(config, sharedConfig)), - ); + const changeProfileId = (id: string) => { + dispatch(selectProfileThunk(id)); + }; + + const [hubEnabled, setHubEnabled] = useState(false); + useEffect(() => { + ideMessenger.ide.getIdeSettings().then(({ continueTestEnvironment }) => { + setHubEnabled(continueTestEnvironment === "production"); + }); + }, [ideMessenger]); + + function handleOpenConfig() { + if (!selectedProfile) { + return; + } + ideMessenger.post("config/openProfile", { + profileId: selectedProfile.id, + }); + } + + // NOTE Hub takes priority over Continue for Teams + // Since teams will be moving to hub, not vice versa + + /////// User settings section ////// + const config = useAppSelector((state) => state.config.config); + const selectedChatModel = useAppSelector( + (store) => store.config.defaultModelTitle, + ); + + function handleUpdate(sharedConfig: SharedConfigSchema) { + // Optimistic update + const updatedConfig = modifyAnyConfigWithSharedConfig(config, sharedConfig); + dispatch(updateConfig(updatedConfig)); + // IMPORTANT no need for model role updates (separate logic for selected model roles) + // simply because this function won't be used to update model roles + + // Actual update to core which propagates back with config update event ideMessenger.post("config/updateSharedConfig", sharedConfig); } + function handleRoleUpdate(role: ModelRole, model: ModelDescription | null) { + if (!selectedProfile) { + return; + } + // Optimistic update + dispatch( + updateConfig({ + ...config, + selectedModelByRole: { + ...config.selectedModelByRole, + [role]: model, + }, + }), + ); + ideMessenger.post("config/updateSelectedModel", { + profileId: selectedProfile.id, + role, + title: model?.title ?? null, + }); + } + + // TODO use handleRoleUpdate for chat + function handleChatModelSelection(model: ModelDescription | null) { + if (!model) { + return; + } + dispatch(setDefaultModel({ title: model.title })); + } + + // TODO defaults are in multiple places, should be consolidated and probably not explicit here + const showSessionTabs = config.ui?.showSessionTabs ?? false; const codeWrap = config.ui?.codeWrap ?? false; const showChatScrollbar = config.ui?.showChatScrollbar ?? false; const displayRawMarkdown = config.ui?.displayRawMarkdown ?? false; @@ -52,14 +132,6 @@ function ConfigPage() { config.tabAutocompleteOptions?.multilineCompletions ?? "auto"; const fontSize = getFontSize(); - const [hubEnabled, setHubEnabled] = useState(false); - - useEffect(() => { - ideMessenger.ide.getIdeSettings().then(({ continueTestEnvironment }) => { - setHubEnabled(continueTestEnvironment === "production"); - }); - }, [ideMessenger]); - // Disable autocomplete const disableAutocompleteInFiles = ( config.tabAutocompleteOptions?.disableInFiles ?? [] @@ -101,307 +173,454 @@ function ConfigPage() { setFormPromptPath(promptPath); }, [promptPath]); - function handleOpenConfig() { - if (!selectedProfile) { - return; - } - ideMessenger.post("config/openProfile", { - profileId: selectedProfile.id, - }); - } - - if (!selectedProfile) { - return ( -
- navigate("/")} title="Chat" /> -
-
-

Continue Config

-
-

No config profile selected

-
-
- ); - } + const jetbrains = isJetBrains(); return (
navigate("/")} title="Chat" />
- {hubEnabled && !!session && ( -
-
+ {(session || hubEnabled || controlServerBetaEnabled) && ( +
+

Account

- {selectedOrganization?.name && ( - - You are currently signed in to{" "} - - {selectedOrganization?.name} - - + {!session ? ( +
+ You are not signed in. + login(false)}> + Sign in + +
+ ) : ( +
+ {hubEnabled ? ( + // Hub: show org selector +
+ {`Organization`} + +
+ ) : ( + // Continue for teams: show org text +
You are using Continue for Teams
+ )} +
+ + {session.account.label === "" + ? "Signed in" + : `Signed in as ${session.account.label}`} + + {`Sign out`} +
+
)}
- -
)} -
-

Configuration

+
+
+

Configuration

+ {profiles ? ( + <> +
+ {`${hubEnabled ? "Assistant" : "Profile"}`} + + {({ open }) => ( +
+ + + {selectedProfile?.title ?? "No Assistant Selected"} + +
+
+
- - Open configuration file - -
- -
-
-

User settings

-
- -
- - handleUpdate({ - codeWrap: !codeWrap, - }) - } - text="Wrap Codeblocks" - /> - - handleUpdate({ - displayRawMarkdown: !displayRawMarkdown, - }) - } - text="Display Raw Markdown" - /> - - handleUpdate({ - allowAnonymousTelemetry: !allowAnonymousTelemetry, - }) - } - text="Allow Anonymous Telemetry" - /> - - handleUpdate({ - disableIndexing: !disableIndexing, - }) - } - text="Disable Indexing" - /> - - - handleUpdate({ - disableSessionTitles: !disableSessionTitles, - }) - } - text="Disable Session Titles" - /> - - handleUpdate({ - readResponseTTS: !readResponseTTS, - }) - } - text="Response Text to Speech" - /> - - - handleUpdate({ - showChatScrollbar: !showChatScrollbar, - }) - } - text="Show Chat Scrollbar" - /> - - - handleUpdate({ - useAutocompleteCache: !useAutocompleteCache, - }) - } - text="Use Autocomplete Cache" - /> - - - handleUpdate({ - useChromiumForDocsCrawling: !useChromiumForDocsCrawling, - }) - } - text="Use Chromium for Docs Crawling" - /> - - - - - - - - -
{ - e.preventDefault(); - handleSubmitPromptPath(); - }} - > -
- Workspace prompts path -
- { - setFormPromptPath(e.target.value); - }} - /> -
- {formPromptPath !== promptPath ? ( - <> -
- -
-
- -
- - ) : ( -
- + + {profiles.map((option, idx) => ( + + + {option.title} + + + ))} + {hubEnabled && ( + { + if (session) { + ideMessenger.post("controlPlane/openUrl", { + path: "new", + orgSlug: selectedOrganization?.slug, + }); + } else { + login(false); + } + }} + > + + + Create new Assistant + + + )} + +
)} -
+
-
-
-
{ - e.preventDefault(); - handleDisableAutocompleteSubmit(); - }} - > -
- Disable autocomplete in files -
- { - setFormDisableAutocomplete(e.target.value); - }} + {selectedProfile && ( + + {selectedProfile.id === "local" + ? "Open Config File" + : hubEnabled + ? "Open Assistant" + : "Open Workspace"} + + )} + {/* {hubEnabled && session && ( +
+ {`If your hub secret values may have changed, refresh your assistants`} + + Refresh assistants + +
+ )} */} + + ) : ( +
Loading...
+ )} +
+

Model Roles

+
+ handleChatModelSelection(model)} + /> + handleRoleUpdate("autocomplete", model)} + /> + {/* Jetbrains has a model selector inline */} + {!jetbrains && ( + handleRoleUpdate("edit", model)} /> -
- {formDisableAutocomplete !== disableAutocompleteInFiles ? ( - <> -
- -
-
- -
- - ) : ( -
- -
- )} -
-
+ )} + handleRoleUpdate("apply", model)} + /> + handleRoleUpdate("embed", model)} + /> + handleRoleUpdate("rerank", model)} + />
- - Comma-separated list of path matchers - - +
+ {!controlServerBetaEnabled || hubEnabled ? ( +
+
+
+
+

User settings

+
+ +
+ + handleUpdate({ + showSessionTabs: !showSessionTabs, + }) + } + text="Show Session Tabs" + /> + + handleUpdate({ + codeWrap: !codeWrap, + }) + } + text="Wrap Codeblocks" + /> + + handleUpdate({ + displayRawMarkdown: !displayRawMarkdown, + }) + } + text="Display Raw Markdown" + /> + + handleUpdate({ + allowAnonymousTelemetry: !allowAnonymousTelemetry, + }) + } + text="Allow Anonymous Telemetry" + /> + + handleUpdate({ + disableIndexing: !disableIndexing, + }) + } + text="Disable Indexing" + /> + + + handleUpdate({ + disableSessionTitles: !disableSessionTitles, + }) + } + text="Disable Session Titles" + /> + + handleUpdate({ + readResponseTTS: !readResponseTTS, + }) + } + text="Response Text to Speech" + /> + + + handleUpdate({ + showChatScrollbar: !showChatScrollbar, + }) + } + text="Show Chat Scrollbar" + /> + + + handleUpdate({ + useAutocompleteCache: !useAutocompleteCache, + }) + } + text="Use Autocomplete Cache" + /> + + + handleUpdate({ + useChromiumForDocsCrawling: !useChromiumForDocsCrawling, + }) + } + text="Use Chromium for Docs Crawling" + /> + + + + + + + +
{ + e.preventDefault(); + handleSubmitPromptPath(); + }} + > +
+ Workspace prompts path +
+ { + setFormPromptPath(e.target.value); + }} + /> +
+ {formPromptPath !== promptPath ? ( + <> +
+ +
+
+ +
+ + ) : ( +
+ +
+ )} +
+
+
+
+
{ + e.preventDefault(); + handleDisableAutocompleteSubmit(); + }} + > +
+ Disable autocomplete in files +
+ { + setFormDisableAutocomplete(e.target.value); + }} + /> +
+ {formDisableAutocomplete !== + disableAutocompleteInFiles ? ( + <> +
+ +
+
+ +
+ + ) : ( +
+ +
+ )} +
+
+
+ + Comma-separated list of path matchers + +
+
+
+
+
+ ) : null}
); diff --git a/gui/src/pages/gui/Chat.tsx b/gui/src/pages/gui/Chat.tsx index c91781417..51c164799 100644 --- a/gui/src/pages/gui/Chat.tsx +++ b/gui/src/pages/gui/Chat.tsx @@ -21,6 +21,7 @@ import { } from "../../components"; import CodeToEditCard from "../../components/CodeToEditCard"; import FeedbackDialog from "../../components/dialogs/FeedbackDialog"; +import FreeTrialOverDialog from "../../components/dialogs/FreeTrialOverDialog"; import { useFindWidget } from "../../components/find/FindWidget"; import TimelineItem from "../../components/gui/TimelineItem"; import ChatIndexingPeeks from "../../components/indexing/ChatIndexingPeeks"; @@ -28,6 +29,7 @@ import ContinueInputBox from "../../components/mainInput/ContinueInputBox"; import { NewSessionButton } from "../../components/mainInput/NewSessionButton"; import resolveEditorContent from "../../components/mainInput/resolveInput"; import { TutorialCard } from "../../components/mainInput/TutorialCard"; +import AssistantSelect from "../../components/modelSelection/platform/AssistantSelect"; import { OnboardingCard, useOnboardingCard, @@ -36,11 +38,12 @@ import { PlatformOnboardingCard } from "../../components/OnboardingCard/platform import PageHeader from "../../components/PageHeader"; import StepContainer from "../../components/StepContainer"; import AcceptRejectAllButtons from "../../components/StepContainer/AcceptRejectAllButtons"; +import { TabBar } from "../../components/TabBar/TabBar"; import { IdeMessengerContext } from "../../context/IdeMessenger"; import { useTutorialCard } from "../../hooks/useTutorialCard"; import { useWebviewListener } from "../../hooks/useWebviewListener"; import { useAppDispatch, useAppSelector } from "../../redux/hooks"; -import { selectUsePlatform } from "../../redux/selectors"; +import { selectUseHub } from "../../redux/selectors"; import { selectCurrentToolCall } from "../../redux/selectors/selectCurrentToolCall"; import { selectDefaultModel } from "../../redux/slices/configSlice"; import { submitEdit } from "../../redux/slices/editModeState"; @@ -76,8 +79,6 @@ import ConfigErrorIndicator from "./ConfigError"; import { ToolCallDiv } from "./ToolCallDiv"; import { ToolCallButtons } from "./ToolCallDiv/ToolCallButtonsDiv"; import ToolOutput from "./ToolCallDiv/ToolOutput"; -import FreeTrialOverDialog from "../../components/dialogs/FreeTrialOverDialog"; -import AssistantSelect from "../../components/modelSelection/platform/AssistantSelect"; const StopButton = styled.div` background-color: ${vscBackground}; @@ -111,7 +112,7 @@ const StepsDiv = styled.div` } .thread-message { - margin: 0px 4px 0 4px; + margin: 0px 0px 0px 1px; } `; @@ -196,6 +197,9 @@ export function Chat() { const selectedModelTitle = useAppSelector( (store) => store.config.defaultModelTitle, ); + const showSessionTabs = useAppSelector( + (store) => store.config.config.ui?.showSessionTabs, + ); const defaultModel = useAppSelector(selectDefaultModel); const ttsActive = useAppSelector((state) => state.ui.ttsActive); const isStreaming = useAppSelector((state) => state.session.isStreaming); @@ -222,7 +226,7 @@ export function Chat() { selectIsSingleRangeEditOrInsertion, ); const lastSessionId = useAppSelector((state) => state.session.lastSessionId); - const usePlatform = useAppSelector(selectUsePlatform); + const useHub = useAppSelector(selectUseHub); useEffect(() => { // Cmd + Backspace to delete current step @@ -338,6 +342,7 @@ export function Chat() { ideMessenger.post("edit/sendPrompt", { prompt, range: codeToEdit[0] as RangeInFileWithContents, + selectedModelTitle, }); dispatch(submitEdit(prompt)); @@ -365,9 +370,11 @@ export function Chat() { useAutoScroll(stepsDivRef, history); + const showPageHeader = isInEditMode || useHub; + return ( <> - {(isInEditMode || usePlatform) && ( + {showPageHeader && ( } + rightContent={useHub && } /> )} {widget} + {!!showSessionTabs && } + 0 ? "flex-1" : ""}`} + className={`overflow-y-scroll ${showPageHeader ? "" : "pt-[8px]"} ${showScrollbar ? "thin-scrollbar" : "no-scrollbar"} ${history.length > 0 ? "flex-1" : ""}`} > {highlights} {history.map((item, index: number) => ( @@ -565,7 +574,7 @@ export function Chat() { <> {onboardingCard.show && (
- {usePlatform ? ( + {useHub ? ( ) : ( diff --git a/gui/src/pages/gui/StreamError.tsx b/gui/src/pages/gui/StreamError.tsx index 2a8465c30..36d3853b1 100644 --- a/gui/src/pages/gui/StreamError.tsx +++ b/gui/src/pages/gui/StreamError.tsx @@ -1,14 +1,17 @@ -import { Cog8ToothIcon, ListBulletIcon } from "@heroicons/react/24/outline"; -import { useAppDispatch, useAppSelector } from "../../redux/hooks"; -import { useContext } from "react"; -import { GithubIcon } from "../../components/svg/GithubIcon"; -import { DiscordIcon } from "../../components/svg/DiscordIcon"; -import { IdeMessengerContext } from "../../context/IdeMessenger"; +import { Cog8ToothIcon } from "@heroicons/react/24/outline"; import { DISCORD_LINK, GITHUB_LINK } from "core/util/constants"; -import { selectDefaultModel } from "../../redux/slices/configSlice"; -import { providers } from "../AddNewModel/configs/providers"; +import { useContext } from "react"; import { Button, SecondaryButton } from "../../components"; +import { DiscordIcon } from "../../components/svg/DiscordIcon"; +import { GithubIcon } from "../../components/svg/GithubIcon"; +import { useAuth } from "../../context/Auth"; +import { IdeMessengerContext } from "../../context/IdeMessenger"; +import { useAppDispatch, useAppSelector } from "../../redux/hooks"; +import { selectUseHub } from "../../redux/selectors"; +import { selectDefaultModel } from "../../redux/slices/configSlice"; import { setDialogMessage, setShowDialog } from "../../redux/slices/uiSlice"; +import { isLocalProfile } from "../../util"; +import { providers } from "../AddNewModel/configs/providers"; interface StreamErrorProps { error: unknown; @@ -17,6 +20,17 @@ const StreamErrorDialog = ({ error }: StreamErrorProps) => { const dispatch = useAppDispatch(); const ideMessenger = useContext(IdeMessengerContext); const selectedModel = useAppSelector(selectDefaultModel); + const hubEnabled = useAppSelector(selectUseHub); + const selectedProfile = useAppSelector( + (store) => store.session.selectedProfile, + ); + const { session, refreshProfiles } = useAuth(); + + const handleRefreshProfiles = () => { + refreshProfiles(); + dispatch(setShowDialog(false)); + dispatch(setDialogMessage(undefined)); + }; // Collect model information to display useful error info let modelTitle = "Chat model"; @@ -139,7 +153,18 @@ const StreamErrorDialog = ({ error }: StreamErrorProps) => { if (statusCode === 401) { errorContent = (
- {`Likely cause: your API key is invalid.`} + {hubEnabled && + session && + selectedProfile && + !isLocalProfile(selectedProfile) && ( +
+ {`If your hub secret values may have changed, refresh your assistants`} + + Refresh assistant secrets + +
+ )} + {`It's possible that your API key is invalid.`}
{checkKeysButton} {configButton} diff --git a/gui/src/pages/gui/ToolCallDiv/ThreadDiv.tsx b/gui/src/pages/gui/ToolCallDiv/ThreadDiv.tsx index 41ce2498e..503f54cb4 100644 --- a/gui/src/pages/gui/ToolCallDiv/ThreadDiv.tsx +++ b/gui/src/pages/gui/ToolCallDiv/ThreadDiv.tsx @@ -46,6 +46,10 @@ export function ThreadDiv(props: ThreadDivProps) { return rendered; } + const tool = availableTools.find( + (tool) => props.toolCall.function?.name === tool.function.name, + ); + return ( @@ -60,13 +64,10 @@ export function ThreadDiv(props: ThreadDivProps) { > {props.icon}
- Continue wants to{" "} - {renderWouldLikeToMessage( - availableTools.find( - (tool) => props.toolCall.function?.name === tool.function.name, - ), - props.toolCallState, + {tool?.faviconUrl && ( + )} + Continue wants to {renderWouldLikeToMessage(tool, props.toolCallState)} {props.children} diff --git a/gui/src/redux/selectors/index.ts b/gui/src/redux/selectors/index.ts index 737e865d3..2097dbce8 100644 --- a/gui/src/redux/selectors/index.ts +++ b/gui/src/redux/selectors/index.ts @@ -43,7 +43,7 @@ export const selectUseActiveFile = createSelector( (defaultContext) => defaultContext?.includes("activeFile" as any), ); -export const selectUsePlatform = createSelector( +export const selectUseHub = createSelector( [(state: RootState) => state.config.config.usePlatform], (usePlatform) => usePlatform, ); diff --git a/gui/src/redux/slices/configSlice.ts b/gui/src/redux/slices/configSlice.ts index e8939e81d..3b5c55137 100644 --- a/gui/src/redux/slices/configSlice.ts +++ b/gui/src/redux/slices/configSlice.ts @@ -26,7 +26,25 @@ const initialState: ConfigState = { contextProviders: [], models: [], tools: [], - usePlatform: false, + usePlatform: true, + modelsByRole: { + chat: [], + apply: [], + edit: [], + summarize: [], + autocomplete: [], + rerank: [], + embed: [], + }, + selectedModelByRole: { + chat: null, + apply: null, + edit: null, + summarize: null, + autocomplete: null, + rerank: null, + embed: null, + }, }, }; diff --git a/gui/src/redux/slices/sessionSlice.ts b/gui/src/redux/slices/sessionSlice.ts index fa6cfb03c..be4d3aa77 100644 --- a/gui/src/redux/slices/sessionSlice.ts +++ b/gui/src/redux/slices/sessionSlice.ts @@ -22,6 +22,7 @@ import { ToolCallState, } from "core"; import { ProfileDescription } from "core/config/ConfigHandler"; +import { OrganizationDescription } from "core/config/ProfileLifecycleManager"; import { NEW_SESSION_TITLE } from "core/util/constants"; import { incrementalParseJson } from "core/util/incrementalParseJson"; import { renderChatMessage } from "core/util/messageContent"; @@ -30,7 +31,6 @@ import { v4 as uuidv4 } from "uuid"; import { RootState } from "../store"; import { streamResponseThunk } from "../thunks/streamResponse"; import { findCurrentToolCall } from "../util"; -import { OrganizationDescription } from "core/config/ProfileLifecycleManager"; // We need this to handle reorderings (e.g. a mid-array deletion) of the messages array. // The proper fix is adding a UUID to all chat messages, but this is the temp workaround. @@ -45,14 +45,14 @@ type SessionState = { isStreaming: boolean; title: string; id: string; - selectedProfileId: string; - availableProfiles: ProfileDescription[]; + /** null indicates loading state */ + availableProfiles: ProfileDescription[] | null; + selectedProfile: ProfileDescription | null; + organizations: OrganizationDescription[]; selectedOrganizationId: string | null; - availableOrganizations: OrganizationDescription[]; streamAborter: AbortController; codeToEdit: CodeToEdit[]; curCheckpointIndex: number; - currentMainEditorContent?: JSONContent; mainEditorContentTrigger?: JSONContent | undefined; symbols: FileSymbolMap; mode: MessageModes; @@ -88,23 +88,10 @@ const initialState: SessionState = { isStreaming: false, title: NEW_SESSION_TITLE, id: uuidv4(), - selectedProfileId: "local", - availableProfiles: [ - { - id: "local", - title: "Local", - errors: undefined, - profileType: "local", - fullSlug: { - ownerSlug: "", - packageSlug: "", - versionSlug: "", - }, - iconUrl: "", - }, - ], + selectedProfile: null, + availableProfiles: null, + organizations: [], selectedOrganizationId: "", - availableOrganizations: [], curCheckpointIndex: 0, streamAborter: new AbortController(), codeToEdit: [], @@ -191,13 +178,13 @@ export const sessionSlice = createSlice({ { payload, }: PayloadAction<{ - index?: number; + index: number; editorState: JSONContent; }>, ) => { const { index, editorState } = payload; - if (typeof index === "number" && index < state.history.length) { + if (state.history.length && index < state.history.length) { // Resubmission - update input message, truncate history after resubmit with new empty response message if (index % 2 === 1) { console.warn( @@ -208,6 +195,7 @@ export const sessionSlice = createSlice({ historyItem.message.content = ""; // IMPORTANT - this is quickly updated by resolveEditorContent based on editor state prior to streaming historyItem.editorState = payload.editorState; + historyItem.contextItems = []; state.history = state.history.slice(0, index + 1).concat({ message: { @@ -260,7 +248,7 @@ export const sessionSlice = createSlice({ }>, ) => { const { index, updates } = payload; - if (!state.history[index]) { + if (index !== 0 && !state.history[index]) { console.error( `attempting to update history item at nonexistent index ${index}`, updates, @@ -340,7 +328,7 @@ export const sessionSlice = createSlice({ !(!lastMessage.toolCalls?.length && !lastMessage.content) && // And there's a difference in tool call presence (lastMessage.toolCalls?.length ?? 0) !== - (message.toolCalls?.length ?? 0)) + (message.toolCalls?.length ?? 0)) ) { // Create a new message const historyItem: ChatHistoryItemWithMessageId = { @@ -485,9 +473,9 @@ export const sessionSlice = createSlice({ state.allSessionMetadata = state.allSessionMetadata.map((session) => session.sessionId === payload.sessionId ? { - ...session, - ...payload, - } + ...session, + ...payload, + } : session, ); if (payload.title && payload.sessionId === state.id) { @@ -522,9 +510,8 @@ export const sessionSlice = createSlice({ payload.rangeInFileWithContents.filepath, ); - const lineNums = `(${ - payload.rangeInFileWithContents.range.start.line + 1 - }-${payload.rangeInFileWithContents.range.end.line + 1})`; + const lineNums = `(${payload.rangeInFileWithContents.range.start.line + 1 + }-${payload.rangeInFileWithContents.range.end.line + 1})`; contextItems.push({ name: `${fileName} ${lineNums}`, @@ -544,49 +531,34 @@ export const sessionSlice = createSlice({ state.history[state.history.length - 1].contextItems = contextItems; }, - setSelectedProfileId: (state, { payload }: PayloadAction) => { - return { - ...state, - selectedProfileId: payload, - }; + // Important: these reducers don't handle selected profile/organization fallback logic + // That is done in thunks + setSelectedProfile: ( + state, + { payload }: PayloadAction, + ) => { + state.selectedProfile = payload; }, setAvailableProfiles: ( state, - { payload }: PayloadAction, + { payload }: PayloadAction, ) => { - return { - ...state, - availableProfiles: payload, - selectedProfileId: payload.find( - (profile) => profile.id === state.selectedProfileId, - ) - ? state.selectedProfileId - : payload[0]?.id, - }; + state.availableProfiles = payload; + }, + setOrganizations: ( + state, + { payload }: PayloadAction, + ) => { + state.organizations = payload; }, setSelectedOrganizationId: ( state, { payload }: PayloadAction, ) => { - return { - ...state, - selectedOrganizationId: payload, - }; - }, - setAvailableOrganizations: ( - state, - { payload }: PayloadAction, - ) => { - return { - ...state, - availableOrganizations: payload, - selectedOrganizationId: payload.find( - (org) => org.id === state.selectedOrganizationId, - ) - ? state.selectedOrganizationId - : payload[0]?.id, - }; + state.selectedOrganizationId = payload; }, + /////////////// + updateCurCheckpoint: ( state, { payload }: PayloadAction<{ filepath: string; content: string }>, @@ -712,12 +684,6 @@ export const sessionSlice = createSlice({ selectHasCodeToEdit: (state) => { return state.codeToEdit.length > 0; }, - selectAvailableProfiles: (state) => { - return state.availableProfiles; - }, - selectAvailableOrganizations: (state) => { - return state.availableOrganizations; - }, }, extraReducers: (builder) => { addPassthroughCases(builder, [streamResponseThunk]); @@ -730,9 +696,9 @@ function addPassthroughCases( ) { thunks.forEach((thunk) => { builder - .addCase(thunk.fulfilled, (state, action) => {}) - .addCase(thunk.rejected, (state, action) => {}) - .addCase(thunk.pending, (state, action) => {}); + .addCase(thunk.fulfilled, (state, action) => { }) + .addCase(thunk.rejected, (state, action) => { }) + .addCase(thunk.pending, (state, action) => { }); }); } @@ -768,8 +734,6 @@ export const { updateHistoryItemAtIndex, clearLastEmptyResponse, setMainEditorContentTrigger, - setSelectedProfileId, - setSelectedOrganizationId, deleteMessage, setIsGatheringContext, updateCurCheckpoint, @@ -782,8 +746,6 @@ export const { removeCodeToEdit, setCalling, cancelToolCall, - setAvailableProfiles, - setAvailableOrganizations, acceptToolCall, setToolGenerated, setToolCallOutput, @@ -793,6 +755,11 @@ export const { updateSessionMetadata, deleteSessionMetadata, setNewestCodeblocksForInput, + + setAvailableProfiles, + setSelectedProfile, + setOrganizations, + setSelectedOrganizationId, } = sessionSlice.actions; export const { @@ -800,8 +767,6 @@ export const { selectIsInEditMode, selectIsSingleRangeEditOrInsertion, selectHasCodeToEdit, - selectAvailableProfiles, - selectAvailableOrganizations, } = sessionSlice.selectors; export default sessionSlice.reducer; diff --git a/gui/src/redux/slices/tabsSlice.ts b/gui/src/redux/slices/tabsSlice.ts new file mode 100644 index 000000000..5c68c0b06 --- /dev/null +++ b/gui/src/redux/slices/tabsSlice.ts @@ -0,0 +1,116 @@ +import { PayloadAction, createSlice } from "@reduxjs/toolkit"; + +export interface Tab { + id: string; + title: string; + isActive: boolean; + sessionId?: string; +} + +interface TabsState { + tabs: Tab[]; +} + +const initialState: TabsState = { + tabs: [{ + id: Date.now().toString(36) + Math.random().toString(36).substring(2), + title: "Chat 1", + isActive: true + }] +}; + +export const tabsSlice = createSlice({ + name: "tabs", + initialState, + reducers: { + setTabs: (state, action: PayloadAction) => { + state.tabs = action.payload; + }, + updateTab: (state, action: PayloadAction<{ id: string; updates: Partial }>) => { + const { id, updates } = action.payload; + state.tabs = state.tabs.map(tab => + tab.id === id ? { ...tab, ...updates } : tab + ); + }, + addTab: (state, action: PayloadAction) => { + state.tabs = state.tabs.map(tab => ({ ...tab, isActive: action.payload.isActive ? false : tab.isActive })) + .concat(action.payload); + }, + removeTab: (state, action: PayloadAction) => { + state.tabs = state.tabs.filter(tab => tab.id !== action.payload); + }, + setActiveTab: (state, action: PayloadAction) => { + state.tabs = state.tabs.map(tab => ({ + ...tab, + isActive: tab.id === action.payload + })); + }, + handleSessionChange: ( + state, + action: PayloadAction<{ + currentSessionId: string; + currentSessionTitle: string; + newTabId?: string; + }> + ) => { + const { currentSessionId, currentSessionTitle, newTabId } = action.payload; + + const activeTab = state.tabs.find(tab => tab.isActive); + if (!activeTab) return; + + // Current session matches active tab's session + if (activeTab.sessionId === currentSessionId) { + state.tabs = state.tabs.map(tab => + tab.id === activeTab.id + ? { ...tab, title: currentSessionTitle } + : tab + ); + return; + } + + // Check if there's another tab with the same session ID + const existingTabWithSession = state.tabs.find( + tab => tab.sessionId === currentSessionId + ); + if (existingTabWithSession) { + // Activate the existing tab and update its title + // Remove any unassigned tabs + state.tabs = state.tabs + .filter(tab => tab.sessionId || tab.id === existingTabWithSession.id) + .map(tab => ({ + ...tab, + isActive: tab.id === existingTabWithSession.id, + title: tab.sessionId === currentSessionId + ? currentSessionTitle + : tab.title, + })); + return; + } + + // Active tab has no session ID + if (!activeTab.sessionId) { + state.tabs = state.tabs.map(tab => + tab.id === activeTab.id + ? { + ...tab, + sessionId: currentSessionId, + title: currentSessionTitle, + } + : tab + ); + } else { + // Active tab has a session ID, create new tab + state.tabs = state.tabs.map(tab => ({ ...tab, isActive: false })).concat({ + id: newTabId || Date.now().toString(36) + Math.random().toString(36).substring(2), + title: currentSessionTitle, + isActive: true, + sessionId: currentSessionId, + }); + } + } + } +}); + +export const { setTabs, updateTab, addTab, removeTab, setActiveTab, handleSessionChange } = tabsSlice.actions; + +export default tabsSlice.reducer; \ No newline at end of file diff --git a/gui/src/redux/store.ts b/gui/src/redux/store.ts index d716a6446..e77ca3ef9 100644 --- a/gui/src/redux/store.ts +++ b/gui/src/redux/store.ts @@ -1,5 +1,4 @@ import { combineReducers, configureStore } from "@reduxjs/toolkit"; -import miscReducer from "./slices/miscSlice"; import { createMigrate, MigrationManifest, @@ -10,11 +9,13 @@ import { createFilter } from "redux-persist-transform-filter"; import autoMergeLevel2 from "redux-persist/lib/stateReconciler/autoMergeLevel2"; import storage from "redux-persist/lib/storage"; import { IdeMessenger, IIdeMessenger } from "../context/IdeMessenger"; -import editModeStateReducer from "./slices/editModeState"; import configReducer from "./slices/configSlice"; +import editModeStateReducer from "./slices/editModeState"; import indexingReducer from "./slices/indexingSlice"; +import miscReducer from "./slices/miscSlice"; import sessionReducer from "./slices/sessionSlice"; import uiReducer from "./slices/uiSlice"; +import tabsReducer from "./slices/tabsSlice"; export interface ChatMessage { role: "system" | "user" | "assistant"; @@ -28,20 +29,37 @@ const rootReducer = combineReducers({ editModeState: editModeStateReducer, config: configReducer, indexing: indexingReducer, + tabs: tabsReducer, }); const saveSubsetFilters = [ createFilter("session", [ "history", - "sessionId", "selectedOrganizationId", - "selectedProfileId", + "selectedProfile", + "id", + "lastSessionId", + "title", + + // Persist edit mode in case closes in middle + "mode", + "codeToEdit", + + // TODO consider removing persisted profiles/orgs + "availableProfiles", + "organizations", + + // higher risk to persist + // codeBlockApplyStates + // symbols + // curCheckpointIndex ]), // Don't persist any of the edit state for now createFilter("editModeState", []), createFilter("config", ["defaultModelTitle"]), createFilter("ui", ["toolSettings", "useTools"]), createFilter("indexing", []), + createFilter("tabs", ["tabs"]), ]; const migrations: MigrationManifest = { @@ -56,6 +74,13 @@ const migrations: MigrationManifest = { history: oldState?.state?.history ?? [], id: oldState?.state?.sessionId ?? "", }, + tabs: { + tabs: [{ + id: Date.now().toString(36) + Math.random().toString(36).substring(2), + title: "Chat 1", + isActive: true + }] + }, _persist: oldState?._persist, }; }, diff --git a/gui/src/redux/thunks/callTool.ts b/gui/src/redux/thunks/callTool.ts index a59a1d119..0bd367587 100644 --- a/gui/src/redux/thunks/callTool.ts +++ b/gui/src/redux/thunks/callTool.ts @@ -1,4 +1,4 @@ -import { createAsyncThunk } from "@reduxjs/toolkit"; +import { createAsyncThunk, unwrapResult } from "@reduxjs/toolkit"; import { selectCurrentToolCall } from "../selectors/selectCurrentToolCall"; import { acceptToolCall, @@ -23,8 +23,7 @@ export const callTool = createAsyncThunk( } if (!state.config.defaultModelTitle) { - console.error("Cannot call tools, no model selected"); - return; + throw new Error("No model selected"); } dispatch(setCalling()); @@ -40,12 +39,17 @@ export const callTool = createAsyncThunk( dispatch(acceptToolCall()); // Send to the LLM to continue the conversation - dispatch( + const response = await dispatch( streamResponseAfterToolCall({ toolCallId: toolCallState.toolCall.id, toolOutput: contextItems, }), ); + unwrapResult(response); + } else { + throw new Error( + `Failed to call tool ${toolCallState.toolCall.function.name}: ${result.error}`, + ); } }, ); diff --git a/gui/src/redux/thunks/cycleProfile.ts b/gui/src/redux/thunks/cycleProfile.ts deleted file mode 100644 index 0ee548c31..000000000 --- a/gui/src/redux/thunks/cycleProfile.ts +++ /dev/null @@ -1,21 +0,0 @@ -import { createAsyncThunk } from "@reduxjs/toolkit"; -import { ThunkApiType } from "../store"; -import { setProfileId } from "./setProfileId"; - -export const cycleProfile = createAsyncThunk( - "profile/cycle", - async (_, { dispatch, getState, extra }) => { - const state = getState(); - const profileIds = state.session.availableProfiles.map( - (profile) => profile.id, - ); - const curIndex = profileIds.indexOf(state.session.selectedProfileId); - const nextIndex = (curIndex + 1) % profileIds.length; - const nextId = profileIds[nextIndex]; - dispatch(setProfileId(nextId)); - - extra.ideMessenger.post("didChangeSelectedProfile", { - id: nextId, - }); - }, -); diff --git a/gui/src/redux/thunks/gatherContext.ts b/gui/src/redux/thunks/gatherContext.ts index 8bae5227e..6b1f11db4 100644 --- a/gui/src/redux/thunks/gatherContext.ts +++ b/gui/src/redux/thunks/gatherContext.ts @@ -6,12 +6,10 @@ import { MessageContent, RangeInFile, } from "core"; -import resolveEditorContent from "../../components/mainInput/resolveInput"; -import { ThunkApiType } from "../store"; -import { selectDefaultModel } from "../slices/configSlice"; -import { findUriInDirs, getUriPathBasename } from "core/util/uri"; import * as URI from "uri-js"; -import { v4 as uuidv4 } from "uuid"; +import resolveEditorContent from "../../components/mainInput/resolveInput"; +import { selectDefaultModel } from "../slices/configSlice"; +import { ThunkApiType } from "../store"; export const gatherContext = createAsyncThunk< { diff --git a/gui/src/redux/thunks/profileAndOrg.ts b/gui/src/redux/thunks/profileAndOrg.ts new file mode 100644 index 000000000..82a9602c0 --- /dev/null +++ b/gui/src/redux/thunks/profileAndOrg.ts @@ -0,0 +1,137 @@ +import { createAsyncThunk } from "@reduxjs/toolkit"; +import { ProfileDescription } from "core/config/ConfigHandler"; +import { OrganizationDescription } from "core/config/ProfileLifecycleManager"; +import { + setAvailableProfiles, + setOrganizations, + setSelectedOrganizationId, + setSelectedProfile, +} from "../slices/sessionSlice"; +import { ThunkApiType } from "../store"; + +export const selectProfileThunk = createAsyncThunk< + void, + string | null, + ThunkApiType +>("profiles/select", async (id, { dispatch, extra, getState }) => { + const state = getState(); + + if (state.session.availableProfiles === null) { + // Currently in loading state + return; + } + + const initialId = state.session.selectedProfile?.id; + + let newId = id; + + // If no profiles, force clear + if (state.session.availableProfiles.length === 0) { + newId = null; + } else { + // If new id doesn't match an existing profile, clear it + if (newId) { + if (!state.session.availableProfiles.find((p) => p.id === newId)) { + newId = null; + } + } + if (!newId) { + // At this point if null ID and there ARE profiles, + // Fallback to a profile, prioritizing the first in the list + newId = state.session.availableProfiles[0].id; + } + } + + // Only update if there's a change + if ((newId ?? null) !== (initialId ?? null)) { + dispatch( + setSelectedProfile( + state.session.availableProfiles.find((p) => p.id === newId) ?? null, + ), + ); + extra.ideMessenger.post("didChangeSelectedProfile", { + id: newId, + }); + } +}); + +export const cycleProfile = createAsyncThunk( + "profiles/cycle", + async (_, { dispatch, getState }) => { + const state = getState(); + + if (state.session.availableProfiles === null) { + return; + } + + const profileIds = state.session.availableProfiles.map( + (profile) => profile.id, + ); + // In case of no profiles just does nothing + if (profileIds.length === 0) { + return; + } + let nextId = profileIds[0]; + if (state.session.selectedProfile) { + const curIndex = profileIds.indexOf(state.session.selectedProfile?.id); + const nextIndex = (curIndex + 1) % profileIds.length; + nextId = profileIds[nextIndex]; + } + await dispatch(selectProfileThunk(nextId)); + }, +); + +export const updateProfilesThunk = createAsyncThunk< + void, + { profiles: ProfileDescription[] | null; selectedProfileId: string | null }, + ThunkApiType +>("profiles/update", async (data, { dispatch, extra, getState }) => { + const { profiles, selectedProfileId } = data; + + dispatch(setAvailableProfiles(profiles)); + + // This will trigger reselection if needed + dispatch(selectProfileThunk(selectedProfileId)); +}); + +export const selectOrgThunk = createAsyncThunk< + void, + string | null, + ThunkApiType +>("session/selectOrg", async (id, { dispatch, extra, getState }) => { + const state = getState(); + const initialId = state.session.selectedOrganizationId; + let newId = id; + + // If no orgs, force clear + if (state.session.organizations.length === 0) { + newId = null; + } else if (newId) { + // If new id doesn't match an existing org, clear it + if (!state.session.organizations.find((o) => o.id === newId)) { + newId = null; + } + } + // Unlike profiles, don't fallback to the first org, + // Fallback to Personal (org = null) + + if (initialId !== newId) { + dispatch(setAvailableProfiles(null)); + dispatch(setSelectedOrganizationId(newId)); + extra.ideMessenger.post("didChangeSelectedOrg", { + id: newId, + }); + } +}); + +export const updateOrgsThunk = createAsyncThunk< + void, + OrganizationDescription[], + ThunkApiType +>("session/updateOrgs", async (orgs, { dispatch, getState }) => { + const state = getState(); + dispatch(setOrganizations(orgs)); + + // This will trigger reselection if needed + dispatch(selectOrgThunk(state.session.selectedOrganizationId)); +}); diff --git a/gui/src/redux/thunks/session.ts b/gui/src/redux/thunks/session.ts index c311df194..be43f725e 100644 --- a/gui/src/redux/thunks/session.ts +++ b/gui/src/redux/thunks/session.ts @@ -1,15 +1,15 @@ -import { createAsyncThunk, Dispatch, unwrapResult } from "@reduxjs/toolkit"; +import { createAsyncThunk, unwrapResult } from "@reduxjs/toolkit"; import { ChatMessage, Session, SessionMetadata } from "core"; import { NEW_SESSION_TITLE } from "core/util/constants"; import { renderChatMessage } from "core/util/messageContent"; -import { ThunkApiType } from "../store"; +import { IIdeMessenger } from "../../context/IdeMessenger"; import { deleteSessionMetadata, newSession, setAllSessionMetadata, updateSessionMetadata, } from "../slices/sessionSlice"; -import { IIdeMessenger } from "../../context/IdeMessenger"; +import { ThunkApiType } from "../store"; const MAX_TITLE_LENGTH = 100; @@ -97,6 +97,7 @@ export const loadSession = createAsyncThunk< const result = await dispatch( saveCurrentSession({ openNewSession: false, + generateTitle: true, }), ); unwrapResult(result); @@ -147,11 +148,11 @@ function getChatTitleFromMessage(message: ChatMessage) { export const saveCurrentSession = createAsyncThunk< void, - { openNewSession: boolean }, + { openNewSession: boolean; generateTitle: boolean }, ThunkApiType >( "session/saveCurrent", - async ({ openNewSession }, { dispatch, extra, getState }) => { + async ({ openNewSession, generateTitle }, { dispatch, extra, getState }) => { const state = getState(); if (state.session.history.length === 0) { return; @@ -173,7 +174,7 @@ export const saveCurrentSession = createAsyncThunk< ?.filter((h) => h.message.role === "assistant")[0] ?.message?.content?.toString(); - if (assistantResponse) { + if (assistantResponse && generateTitle) { try { const result = await extra.ideMessenger.request( "chatDescriber/describe", diff --git a/gui/src/redux/thunks/setOrgId.ts b/gui/src/redux/thunks/setOrgId.ts deleted file mode 100644 index 9db496365..000000000 --- a/gui/src/redux/thunks/setOrgId.ts +++ /dev/null @@ -1,13 +0,0 @@ -import { createAsyncThunk } from "@reduxjs/toolkit"; -import { setSelectedOrganizationId } from "../slices/sessionSlice"; -import { ThunkApiType } from "../store"; - -export const setOrgId = createAsyncThunk( - "profile/setOrgId", - async (id, { dispatch, extra }) => { - dispatch(setSelectedOrganizationId(id)); - extra.ideMessenger.post("didChangeSelectedOrg", { - id, - }); - }, -); diff --git a/gui/src/redux/thunks/setProfileId.ts b/gui/src/redux/thunks/setProfileId.ts deleted file mode 100644 index 6ec1020ce..000000000 --- a/gui/src/redux/thunks/setProfileId.ts +++ /dev/null @@ -1,13 +0,0 @@ -import { createAsyncThunk } from "@reduxjs/toolkit"; -import { setSelectedProfileId } from "../slices/sessionSlice"; -import { ThunkApiType } from "../store"; - -export const setProfileId = createAsyncThunk( - "profile/setId", - async (id, { dispatch, extra }) => { - dispatch(setSelectedProfileId(id)); - extra.ideMessenger.post("didChangeSelectedProfile", { - id, - }); - }, -); diff --git a/gui/src/redux/thunks/streamNormalInput.ts b/gui/src/redux/thunks/streamNormalInput.ts index 9a19a471c..036ef4431 100644 --- a/gui/src/redux/thunks/streamNormalInput.ts +++ b/gui/src/redux/thunks/streamNormalInput.ts @@ -1,4 +1,4 @@ -import { createAsyncThunk } from "@reduxjs/toolkit"; +import { createAsyncThunk, unwrapResult } from "@reduxjs/toolkit"; import { ChatMessage, PromptLog } from "core"; import { selectCurrentToolCall } from "../selectors/selectCurrentToolCall"; import { selectDefaultModel } from "../slices/configSlice"; @@ -28,7 +28,9 @@ export const streamNormalInput = createAsyncThunk< } const includeTools = - useTools && modelSupportsTools(defaultModel.model, defaultModel.provider); + useTools && + modelSupportsTools(defaultModel) && + state.session.mode === "chat"; // Send request const gen = extra.ideMessenger.llmStreamChat( @@ -59,6 +61,34 @@ export const streamNormalInput = createAsyncThunk< // Attach prompt log if (next.done && next.value) { dispatch(addPromptCompletionPair([next.value])); + + try { + if (state.session.mode === "chat") { + extra.ideMessenger.post("devdata/log", { + name: "chatInteraction", + data: { + prompt: next.value.prompt, + completion: next.value.completion, + modelProvider: defaultModel.provider, + modelTitle: defaultModel.title, + sessionId: state.session.id, + }, + }); + } + // else if (state.session.mode === "edit") { + // extra.ideMessenger.post("devdata/log", { + // name: "editInteraction", + // data: { + // prompt: next.value.prompt, + // completion: next.value.completion, + // modelProvider: defaultModel.provider, + // modelTitle: defaultModel.title, + // }, + // }); + // } + } catch (e) { + console.error("Failed to send dev data interaction log", e); + } } // If it's a tool call that is automatically accepted, we should call it @@ -70,7 +100,8 @@ export const streamNormalInput = createAsyncThunk< toolSettings[toolCallState.toolCall.function.name] === "allowedWithoutPermission" ) { - await dispatch(callTool()); + const response = await dispatch(callTool()); + unwrapResult(response); } } }); diff --git a/gui/src/redux/thunks/streamResponse.ts b/gui/src/redux/thunks/streamResponse.ts index 1c191b662..9c0cb4b9a 100644 --- a/gui/src/redux/thunks/streamResponse.ts +++ b/gui/src/redux/thunks/streamResponse.ts @@ -41,8 +41,8 @@ const getSlashCommandForInput = ( if (lastText.startsWith("/")) { slashCommandName = lastText.split(" ")[0].substring(1); - slashCommand = slashCommands.find( - (command) => command.name === slashCommandName, + slashCommand = slashCommands.find((command) => + lastText.startsWith(`/${command.name} `), ); } if (!slashCommand || !slashCommandName) { @@ -74,13 +74,15 @@ export const streamResponseThunk = createAsyncThunk< const useTools = state.ui.useTools; const defaultModel = selectDefaultModel(state); const slashCommands = state.config.config.slashCommands || []; - const inputIndex = index ?? state.session.history.length; + const inputIndex = index ?? state.session.history.length; // Either given index or concat to end if (!defaultModel) { throw new Error("No chat model selected"); } - dispatch(submitEditorAndInitAtIndex({ index, editorState })); + dispatch( + submitEditorAndInitAtIndex({ index: inputIndex, editorState }), + ); resetStateForNewMessage(); const result = await dispatch( @@ -120,8 +122,7 @@ export const streamResponseThunk = createAsyncThunk< const updatedHistory = getState().session.history; const messages = constructMessages( [...updatedHistory], - defaultModel.model, - defaultModel.provider, + defaultModel, useTools, ); diff --git a/gui/src/redux/thunks/streamResponseAfterToolCall.ts b/gui/src/redux/thunks/streamResponseAfterToolCall.ts index 396ab6075..3eb11b249 100644 --- a/gui/src/redux/thunks/streamResponseAfterToolCall.ts +++ b/gui/src/redux/thunks/streamResponseAfterToolCall.ts @@ -31,8 +31,7 @@ export const streamResponseAfterToolCall = createAsyncThunk< const defaultModel = selectDefaultModel(state); if (!defaultModel) { - console.error("No default model found"); - return; + throw new Error("No model selected"); } resetStateForNewMessage(); @@ -44,7 +43,6 @@ export const streamResponseAfterToolCall = createAsyncThunk< content: renderContextItems(toolOutput), toolCallId, }; - dispatch(streamUpdate([newMessage])); dispatch( addContextItemsAtIndex({ @@ -64,11 +62,11 @@ export const streamResponseAfterToolCall = createAsyncThunk< const updatedHistory = getState().session.history; const messages = constructMessages( [...updatedHistory], - defaultModel.model, - defaultModel.provider, + defaultModel, useTools, ); - unwrapResult(await dispatch(streamNormalInput(messages))); + const output = await dispatch(streamNormalInput(messages)); + unwrapResult(output); }), ); }, diff --git a/gui/src/redux/thunks/streamSlashCommand.ts b/gui/src/redux/thunks/streamSlashCommand.ts index 79336bb3d..c18afd52c 100644 --- a/gui/src/redux/thunks/streamSlashCommand.ts +++ b/gui/src/redux/thunks/streamSlashCommand.ts @@ -5,6 +5,7 @@ import { RangeInFile, SlashCommandDescription, } from "core"; +import { modelSupportsTools } from "core/llm/autodetect"; import { selectDefaultModel } from "../slices/configSlice"; import { abortStream, streamUpdate } from "../slices/sessionSlice"; import { ThunkApiType } from "../store"; @@ -30,11 +31,18 @@ export const streamSlashCommand = createAsyncThunk< const defaultModel = selectDefaultModel(state); const isStreaming = state.session.isStreaming; const streamAborter = state.session.streamAborter; + const toolSettings = state.ui.toolSettings; if (!defaultModel) { throw new Error("Default model not defined"); } + const useTools = state.ui.useTools; + const includeTools = + useTools && + modelSupportsTools(defaultModel) && + state.session.mode === "chat"; + const modelTitle = defaultModel.title; const checkActiveInterval = setInterval(() => { @@ -55,6 +63,14 @@ export const streamSlashCommand = createAsyncThunk< params: slashCommand.params, historyIndex, selectedCode, + completionOptions: includeTools + ? { + // Temporarily commented out until slash commands are hooked up to the tool use feedback loop + // tools: state.config.config.tools.filter( + // (tool) => toolSettings[tool.function.name] !== "disabled", + // ), + } + : {}, }, streamAborter.signal, )) { diff --git a/gui/src/redux/thunks/streamThunkWrapper.tsx b/gui/src/redux/thunks/streamThunkWrapper.tsx index cd9f10f6d..7bd5a82f9 100644 --- a/gui/src/redux/thunks/streamThunkWrapper.tsx +++ b/gui/src/redux/thunks/streamThunkWrapper.tsx @@ -1,9 +1,9 @@ import { createAsyncThunk } from "@reduxjs/toolkit"; +import StreamErrorDialog from "../../pages/gui/StreamError"; import { clearLastEmptyResponse, setInactive } from "../slices/sessionSlice"; +import { setDialogMessage, setShowDialog } from "../slices/uiSlice"; import { ThunkApiType } from "../store"; import { saveCurrentSession } from "./session"; -import { setDialogMessage, setShowDialog } from "../slices/uiSlice"; -import StreamErrorDialog from "../../pages/gui/StreamError"; export const streamThunkWrapper = createAsyncThunk< void, @@ -23,6 +23,7 @@ export const streamThunkWrapper = createAsyncThunk< await dispatch( saveCurrentSession({ openNewSession: false, + generateTitle: true, }), ); } diff --git a/gui/src/util/localStorage.ts b/gui/src/util/localStorage.ts index f457e3544..e80e4ceea 100644 --- a/gui/src/util/localStorage.ts +++ b/gui/src/util/localStorage.ts @@ -13,6 +13,8 @@ type LocalStorageTypes = { showTutorialCard: boolean; shownProfilesIntroduction: boolean; disableIndexing: boolean; + /** Indicates whether the user has seen any kind of onboarding card since hub.continue.dev */ + seenHubIntro: boolean; }; export function getLocalStorage( diff --git a/gui/tailwind.config.cjs b/gui/tailwind.config.cjs index c837eea75..67677e103 100644 --- a/gui/tailwind.config.cjs +++ b/gui/tailwind.config.cjs @@ -13,6 +13,7 @@ module.exports = { "2xs": "170px", // Smallest width for Primary Sidebar in VS Code xs: "250px", // Avg default sidebar width in VS Code sm: "330px", + int: "380px", md: "460px", lg: "590px", xl: "720px", @@ -26,36 +27,20 @@ module.exports = { }, colors: { lightgray: "#999998", - "vsc-background": "rgb(var(--vsc-background) / )", - "secondary-dark": "rgb(var(--secondary-dark) / )", "vsc-input-background": "var(--vscode-input-background, rgb(45 45 45))", - "vsc-quick-input-background": - "var(--vscode-quickInput-background, var(--vscode-input-background, rgb(45 45 45)))", "vsc-background": "var(--vscode-sideBar-background, rgb(30 30 30))", "vsc-foreground": "var(--vscode-editor-foreground, #fff)", - "vsc-button-background": "var(--vscode-button-background, #1bbe84)", - "vsc-button-foreground": "var(--vscode-button-foreground, #ffffff)", "vsc-editor-background": "var(--vscode-editor-background, var(--vscode-sideBar-background, rgb(30 30 30)))", - "vsc-list-active-background": - "var(--vscode-list-activeSelectionBackground, #1bbe84)", - "vsc-focus-border": "var(--vscode-focus-border, #1bbe84)", - "vsc-list-active-foreground": - "var(--vscode-quickInputList-focusForeground, var(--vscode-editor-foreground))", "vsc-input-border": "var(--vscode-input-border, #999998)", - "vsc-input-border-focus": "var(--vscode-focusBorder, #999998)", - "vsc-badge-background": "var(--vscode-badge-background, #1bbe84)", - "vsc-badge-foreground": "var(--vscode-badge-foreground, #fff)", - "vsc-sidebar-border": "var(--vscode-sideBar-border, transparent)", - "vsc-find-match": - "var(--vscode-editor-findMatchBackground, rgba(255, 255, 0, 0.6))", - "vsc-find-match-selected": - "var(--vscode-editor-findMatchHighlightBackground, rgba(255, 223, 0, 0.8))", - "vsc-foreground-muted": "var(--vscode-foreground-muted, #999)", - "vsc-description-foreground": - "var(--vscode-descriptionForeground, #999)", - "vsc-input-placeholder-foreground": - "var(--vscode-input-placeholderForeground, #999)", + + // Starting to make things less vsc-specific + // TODO make it all non-IDE-specific naming + "find-match-selected": + "var(--vscode-editor-findMatchHighlightBackground, rgba(255, 223, 0))", + "list-active": "var(--vscode-list-activeSelectionBackground, #1bbe84)", + "list-active-foreground": + "var(--vscode-quickInputList-focusForeground, var(--vscode-editor-foreground))", }, }, }, diff --git a/gui/vite.config.ts b/gui/vite.config.ts index d4c4ba7d7..6c5cd6d75 100644 --- a/gui/vite.config.ts +++ b/gui/vite.config.ts @@ -16,6 +16,14 @@ export default defineConfig({ }, }, }, + server: { + cors: { + origin: "*", + methods: ["GET", "POST", "PUT", "DELETE", "PATCH", "OPTIONS"], + allowedHeaders: ["*", "Content-Type", "Authorization"], + credentials: true, + }, + }, test: { globals: true, environment: "jsdom", diff --git a/manual-testing-sandbox/AdvancedPage.tsx b/manual-testing-sandbox/AdvancedPage.tsx index 5b5ccbde6..9f7d321ec 100644 --- a/manual-testing-sandbox/AdvancedPage.tsx +++ b/manual-testing-sandbox/AdvancedPage.tsx @@ -30,6 +30,7 @@ const AdvancedPage = () => {

Counter: {counter}

+