Merge branch 'main' into dallin/gemini-tools
This commit is contained in:
commit
414bc04e26
127 changed files with 4388 additions and 2612 deletions
18
.github/workflows/pr_checks.yaml
vendored
18
.github/workflows/pr_checks.yaml
vendored
|
|
@ -5,6 +5,7 @@ on:
|
|||
branches:
|
||||
- main
|
||||
paths:
|
||||
- "extensions/intellij/**"
|
||||
- "extensions/vscode/**"
|
||||
- "core/**"
|
||||
- "gui/**"
|
||||
|
|
@ -274,6 +275,11 @@ jobs:
|
|||
run: |
|
||||
cd core
|
||||
npm test
|
||||
env:
|
||||
OPENAI_API_KEY: ${{ secrets.OPENAI_API_KEY }}
|
||||
ANTHROPIC_API_KEY: ${{ secrets.ANTHROPIC_API_KEY }}
|
||||
GEMINI_API_KEY: ${{ secrets.GEMINI_API_KEY }}
|
||||
MISTRAL_API_KEY: ${{ secrets.MISTRAL_API_KEY }}
|
||||
|
||||
vscode-get-test-file-matrix:
|
||||
runs-on: ubuntu-latest
|
||||
|
|
@ -370,7 +376,7 @@ jobs:
|
|||
path: extensions/vscode/e2e/storage
|
||||
|
||||
vscode-e2e-tests:
|
||||
name: ${{ matrix.test_file }}"
|
||||
name: ${{ matrix.test_file }} (${{ matrix.command }})
|
||||
needs:
|
||||
[
|
||||
vscode-download-e2e-dependencies,
|
||||
|
|
@ -384,6 +390,7 @@ jobs:
|
|||
fail-fast: false
|
||||
matrix:
|
||||
test_file: ${{ fromJson(needs.vscode-get-test-file-matrix.outputs.test_file_matrix) }}
|
||||
command: [ "e2e:ci:run", "e2e:ci:run-yaml" ]
|
||||
steps:
|
||||
- uses: actions/checkout@v4
|
||||
- uses: actions/setup-node@v4
|
||||
|
|
@ -432,8 +439,7 @@ jobs:
|
|||
- name: Run e2e tests
|
||||
run: |
|
||||
cd extensions/vscode
|
||||
TEST_FILE="${{ matrix.test_file }}" npm run e2e:ci:run
|
||||
|
||||
TEST_FILE="${{ matrix.test_file }}" npm run ${{ matrix.command }}
|
||||
env:
|
||||
DISPLAY: :99
|
||||
|
||||
|
|
@ -546,7 +552,7 @@ jobs:
|
|||
with:
|
||||
url: http://127.0.0.1:8082
|
||||
max-attempts: 15
|
||||
retry-delay: 5s
|
||||
retry-delay: 30s
|
||||
|
||||
- name: Run tests
|
||||
run: |
|
||||
|
|
@ -572,6 +578,4 @@ jobs:
|
|||
with:
|
||||
name: jb-failure-report
|
||||
path: |
|
||||
${{ github.workspace }}/extensions/intellij/build/reports
|
||||
|
||||
|
||||
${{ github.workspace }}/extensions/intellij/build/reports
|
||||
2
.vscode/launch.json
vendored
2
.vscode/launch.json
vendored
|
|
@ -20,10 +20,10 @@
|
|||
"outFiles": ["${workspaceFolder}/extensions/vscode/out/extension.js"],
|
||||
"preLaunchTask": "vscode-extension:build",
|
||||
"env": {
|
||||
// "CONTROL_PLANE_ENV": "local",
|
||||
"CONTINUE_GLOBAL_DIR": "${workspaceFolder}/extensions/.continue-debug"
|
||||
// "staging" for the preview deployment "CONTINUE_GLOBAL_DIR": "${workspaceFolder}/extensions/.continue-debug"
|
||||
// "local" for entirely local development of control plane/proxy
|
||||
// "CONTROL_PLANE_ENV": "staging"
|
||||
}
|
||||
},
|
||||
{
|
||||
|
|
|
|||
|
|
@ -118,6 +118,22 @@ async function installNodeModuleInTempDirAndCopyToCurrent(packageName, toCopy) {
|
|||
}
|
||||
|
||||
(async () => {
|
||||
// Informs of where to look for node_sqlite3.node https://www.npmjs.com/package/bindings#:~:text=The%20searching%20for,file%20is%20found
|
||||
// This is only needed for our `pkg` command at build time
|
||||
fs.writeFileSync(
|
||||
"out/package.json",
|
||||
JSON.stringify(
|
||||
{
|
||||
name: "binary",
|
||||
version: "1.0.0",
|
||||
author: "Continue Dev, Inc",
|
||||
license: "Apache-2.0",
|
||||
},
|
||||
undefined,
|
||||
2,
|
||||
),
|
||||
);
|
||||
|
||||
console.log("[info] Downloading prebuilt lancedb...");
|
||||
for (const target of targets) {
|
||||
if (targetToLanceDb[target]) {
|
||||
|
|
@ -263,9 +279,12 @@ 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
|
||||
fs.rmSync("out/package.json");
|
||||
|
||||
const pathsToVerify = [];
|
||||
for (const target of targets) {
|
||||
const exe = target.startsWith("win") ? ".exe" : "";
|
||||
|
|
|
|||
3
binary/package-lock.json
generated
3
binary/package-lock.json
generated
|
|
@ -48,7 +48,7 @@
|
|||
"@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.0",
|
||||
"@continuedev/config-yaml": "^1.0.10",
|
||||
"@continuedev/fetch": "^1.0.4",
|
||||
"@continuedev/llm-info": "^1.0.2",
|
||||
"@continuedev/openai-adapters": "^1.0.10",
|
||||
|
|
@ -118,6 +118,7 @@
|
|||
"@types/jest": "^29.5.12",
|
||||
"@types/jquery": "^3.5.29",
|
||||
"@types/jsdom": "^21.1.6",
|
||||
"@types/json-schema": "^7.0.15",
|
||||
"@types/mozilla-readability": "^0.2.1",
|
||||
"@types/mustache": "^4.2.5",
|
||||
"@types/node-fetch": "^2.6.11",
|
||||
|
|
|
|||
|
|
@ -1,158 +0,0 @@
|
|||
# Tab Autocomplete (beta)
|
||||
|
||||
Continue now provides support for tab autocomplete in [VS Code](https://marketplace.visualstudio.com/items?itemName=Continue.continue) and [JetBrains IDEs](https://plugins.jetbrains.com/plugin/22707-continue/edit). We will be greatly improving the experience over the next few releases, and it is always helpful to hear feedback. If you have any problems or suggestions, please let us know in our [Discord](https://discord.gg/vapESyrFmJ).
|
||||
|
||||
## Setting up with Ollama (default)
|
||||
|
||||
We recommend setting up tab-autocomplete with a local Ollama instance. 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
|
||||
```
|
||||
|
||||
Once it has been downloaded, you should begin to see completions in VS Code.
|
||||
|
||||
## Setting up with LM Studio
|
||||
|
||||
You can also set up tab-autocomplete with a local LM Studio instance by following these steps:
|
||||
|
||||
1. Download the latest version of LM Studio from [here](https://lmstudio.ai/)
|
||||
2. Download a model (e.g. search for `Qwen/Qwen2.5-Coder-1.5B-Instruct-GGUF` and choose one of the options there)
|
||||
3. Go to the server section (button is on the left), select your model from the dropdown at the top, and click "Start Server"
|
||||
4. Go to the "My Models" section (button is on the left), find your selected model, and copy the name the path (example: `Qwen/Qwen2.5-Coder-1.5B-Instruct-GGUF/qwen2.5-coder-1.5b-instruct-q4_k_m.gguf`); this will be used as the "model" attribute in Continue
|
||||
5. Go to Continue and modify the configurations for a [custom model](#setting-up-a-custom-model)
|
||||
6. Set the "provider" to `lmstudio` and the "model" to the path copied earlier
|
||||
|
||||
Example:
|
||||
|
||||
```json title="config.json"
|
||||
{
|
||||
"tabAutocompleteModel": {
|
||||
"title": "Qwen2.5-Coder 1.5b",
|
||||
"model": "Qwen/Qwen2.5-Coder-1.5B-Instruct-GGUF",
|
||||
"provider": "lmstudio"
|
||||
}
|
||||
}
|
||||
```
|
||||
|
||||
## 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 vLLM instance you would edit your `config.json` like this (note that it is not inside the models array), filling in the correct model name and vLLM endpoint:
|
||||
|
||||
```json title="config.json"
|
||||
{
|
||||
"tabAutocompleteModel": {
|
||||
"title": "Tab Autocomplete Model",
|
||||
"provider": "openai",
|
||||
"model": "<MODEL_NAME>",
|
||||
"apiBase": "<VLLM_ENDPOINT_URL>"
|
||||
},
|
||||
...
|
||||
}
|
||||
```
|
||||
|
||||
As another example, say you want to use a different model, `deepseek-coder:6.7b-base`, with Ollama:
|
||||
|
||||
```json title="config.json"
|
||||
{
|
||||
"tabAutocompleteModel": {
|
||||
"title": "Tab Autocomplete Model",
|
||||
"provider": "ollama",
|
||||
"model": "deepseek-coder:6.7b-base"
|
||||
},
|
||||
...
|
||||
}
|
||||
```
|
||||
|
||||
If you aren't yet familiar with the available options, you can learn more in our [overview](../setup/overview.md).
|
||||
|
||||
### What model should I use?
|
||||
|
||||
If you are running the model locally, we recommend `qwen2.5-coder:1.5b`.
|
||||
|
||||
If you have a bit more compute, or are running a model in the cloud, you can upgrade to `qwen2.5-coder:7b`.
|
||||
|
||||
Regardless of what you are willing to spend, we do not recommend using GPT or Claude for autocomplete. Learn why [below](#i-want-better-completions-should-i-use-gpt-4).
|
||||
|
||||
## Configuration Options
|
||||
|
||||
The following can be configured in `config.json`:
|
||||
|
||||
### `tabAutocompleteModel`
|
||||
|
||||
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 `starcoder-3b`.
|
||||
|
||||
### `tabAutocompleteOptions`
|
||||
|
||||
This object allows you to customize the behavior of tab-autocomplete. The available options are:
|
||||
|
||||
- `useFileSuffix`: Determines whether to use the file suffix in the prompt. (Boolean)
|
||||
- `maxPromptTokens`: The maximum number of prompt tokens to use. A smaller number will yield faster completions, but less context. (Number)
|
||||
- `debounceDelay`: The delay in milliseconds before triggering autocomplete after a keystroke. (Number)
|
||||
- `maxSuffixPercentage`: The maximum percentage of the prompt that can be dedicated to the suffix. (Number)
|
||||
- `prefixPercentage`: The percentage of the input that should be dedicated to the prefix. (Number)
|
||||
- `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)
|
||||
- `multilineCompletions`: Whether to enable multiline completions ("always", "never", or "auto"). Defaults to "auto".
|
||||
|
||||
### Full example
|
||||
|
||||
```json title="config.json"
|
||||
{
|
||||
"tabAutocompleteModel": {
|
||||
"title": "Tab Autocomplete Model",
|
||||
"provider": "ollama",
|
||||
"model": "qwen2.5-coder:1.5b-base",
|
||||
"apiBase": "https://<my endpoint>"
|
||||
},
|
||||
"tabAutocompleteOptions": {
|
||||
"maxPromptTokens": 400,
|
||||
"prefixPercentage": 0.5
|
||||
}
|
||||
}
|
||||
```
|
||||
|
||||
## Troubleshooting
|
||||
|
||||
### I want better completions, should I use GPT-4?
|
||||
|
||||
Perhaps surprisingly, the answer is no. The models that we suggest for autocomplete are trained with a highly specific prompt format, which allows them to respond to requests for completing code (see examples of these prompts [here](https://github.com/continuedev/continue/blob/main/core/autocomplete/templates.ts)). Some of the best commercial models like GPT-4 or Claude are not trained with this prompt format, which means that they won't generate useful completions. Luckily, a huge model is not required for great autocomplete. Most of the state-of-the-art autocomplete models are no more than 10b parameters, and increasing beyond this does not significantly improve performance.
|
||||
|
||||
### I'm not seeing any completions
|
||||
|
||||
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).
|
||||
2. Make sure you have downloaded Ollama.
|
||||
3. Run `ollama run qwen2.5-coder:1.5b-base` 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. If you are using another Ollama model for chat and your resources are limited, this will cause Ollama to constantly load and unload the models from memory, resulting in slow responses (or none at all) for both. A resolution for this could be using the same model for chat and autocomplete.
|
||||
6. 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).
|
||||
7. If you are still having issues, please let us know in our [Discord](https://discord.gg/vapESyrFmJ) and we'll help as soon as possible.
|
||||
|
||||
### Completions are slow
|
||||
|
||||
Depending on your hardware, you may want to try a smaller, faster model. If 3b isn't working for you we recommend trying `deepseek-coder:1.3b-base`.
|
||||
|
||||
### Completions don't know about my code
|
||||
|
||||
We are working on this! Right now Continue uses the Language Server Protocol to add definitions to the prompt, as well as using similarity search over recently edited files. We will be improving the accuracy of this system greatly over the next few weeks.
|
||||
|
||||
### Completions contain formatting errors
|
||||
|
||||
If you're seeing a common pattern of mistake that might be helpful to report, please share in Discord. We will do our best to fix it as soon as possible.
|
||||
|
||||
## How to turn off autocomplete
|
||||
|
||||
### VS Code
|
||||
|
||||
Click the "Continue" button in the status panel at the bottom right of the screen. The checkmark will become a "cancel" symbol and you will no longer see completions. You can click again to turn it back on.
|
||||
|
||||
Alternatively, open VS Code settings, search for "Continue" and uncheck the box for "Enable Tab Autocomplete".
|
||||
|
||||
### JetBrains
|
||||
|
||||
Open Settings -> Tools -> Continue and uncheck the box for "Enable Tab Autocomplete".
|
||||
|
||||
### Feedback
|
||||
|
||||
If you're turning off autocomplete, we'd love to hear how we can improve! Please let us know in our [Discord](https://discord.gg/vapESyrFmJ) or file an issue on GitHub.
|
||||
|
|
@ -14,7 +14,7 @@ describe.skip("Test the ConfigHandler and E2E config loading", () => {
|
|||
expect(profiles[0].id).toBe("local");
|
||||
|
||||
const currentProfile = testConfigHandler.currentProfile;
|
||||
expect(currentProfile.profileId).toBe("local");
|
||||
expect(currentProfile.profileDescription.id).toBe("local");
|
||||
});
|
||||
|
||||
test("should load the default config successfully", async () => {
|
||||
|
|
|
|||
|
|
@ -14,18 +14,21 @@ import Ollama from "../llm/llms/Ollama.js";
|
|||
import { GlobalContext } from "../util/GlobalContext.js";
|
||||
import { getConfigJsonPath } from "../util/paths.js";
|
||||
|
||||
import { ConfigResult } from "./load.js";
|
||||
import { ConfigResult } from "@continuedev/config-yaml";
|
||||
import { controlPlaneEnv } from "../control-plane/env.js";
|
||||
import { usePlatform } from "../control-plane/flags.js";
|
||||
import {
|
||||
LOCAL_ONBOARDING_CHAT_MODEL,
|
||||
ONBOARDING_LOCAL_MODEL_TITLE,
|
||||
} from "./onboarding.js";
|
||||
import ControlPlaneProfileLoader from "./profile/ControlPlaneProfileLoader.js";
|
||||
import LocalProfileLoader from "./profile/LocalProfileLoader.js";
|
||||
import PlatformProfileLoader from "./profile/PlatformProfileLoader.js";
|
||||
import {
|
||||
ProfileDescription,
|
||||
ProfileLifecycleManager,
|
||||
} from "./ProfileLifecycleManager.js";
|
||||
import { pathToFileURL } from "url";
|
||||
import { localPathToUri } from "../util/pathToUri.js";
|
||||
|
||||
export type { ProfileDescription };
|
||||
|
||||
|
|
@ -57,7 +60,7 @@ export class ConfigHandler {
|
|||
writeLog,
|
||||
);
|
||||
this.profiles = [new ProfileLifecycleManager(localProfileLoader)];
|
||||
this.selectedProfileId = localProfileLoader.profileId;
|
||||
this.selectedProfileId = localProfileLoader.description.id;
|
||||
|
||||
// Always load local profile immediately in case control plane doesn't load
|
||||
try {
|
||||
|
|
@ -77,39 +80,40 @@ export class ConfigHandler {
|
|||
|
||||
get currentProfile() {
|
||||
return (
|
||||
this.profiles.find((p) => p.profileId === this.selectedProfileId) ??
|
||||
this.fallbackProfile
|
||||
this.profiles.find(
|
||||
(p) => p.profileDescription.id === this.selectedProfileId,
|
||||
) ?? this.fallbackProfile
|
||||
);
|
||||
}
|
||||
|
||||
get inactiveProfiles() {
|
||||
return this.profiles.filter((p) => p.profileId !== this.selectedProfileId);
|
||||
return this.profiles.filter(
|
||||
(p) => p.profileDescription.id !== this.selectedProfileId,
|
||||
);
|
||||
}
|
||||
|
||||
async openConfigProfile(profileId?: string) {
|
||||
let openProfileId = profileId || this.selectedProfileId;
|
||||
if (openProfileId === "local") {
|
||||
await this.ide.openFile(pathToFileURL(getConfigJsonPath()).toString());
|
||||
await this.ide.openFile(localPathToUri(getConfigJsonPath()));
|
||||
} else {
|
||||
await this.ide.openUrl(
|
||||
"https://app.continue.dev/",
|
||||
// `https://app.continue.dev/workspaces/${openProfileId}/chat`,
|
||||
);
|
||||
await this.ide.openUrl(`${controlPlaneEnv.APP_URL}${openProfileId}`);
|
||||
}
|
||||
}
|
||||
|
||||
private async fetchControlPlaneProfiles() {
|
||||
private async loadPlatformProfiles() {
|
||||
// Get the profiles and create their lifecycle managers
|
||||
this.controlPlaneClient
|
||||
.listWorkspaces()
|
||||
.then(async (workspaces) => {
|
||||
.listAssistants()
|
||||
.then(async (assistants) => {
|
||||
this.profiles = this.profiles.filter(
|
||||
(profile) => profile.profileId === "local",
|
||||
(profile) => profile.profileDescription.id === "local",
|
||||
);
|
||||
workspaces.forEach((workspace) => {
|
||||
const profileLoader = new ControlPlaneProfileLoader(
|
||||
workspace.id,
|
||||
workspace.name,
|
||||
assistants.forEach((assistant) => {
|
||||
const profileLoader = new PlatformProfileLoader(
|
||||
assistant.configResult,
|
||||
assistant.ownerSlug,
|
||||
assistant.packageSlug,
|
||||
this.controlPlaneClient,
|
||||
this.ide,
|
||||
this.ideSettingsPromise,
|
||||
|
|
@ -141,10 +145,67 @@ export class ConfigHandler {
|
|||
}
|
||||
})
|
||||
.catch((e) => {
|
||||
console.error(e);
|
||||
console.error("Failed to list assistants: ", e);
|
||||
});
|
||||
}
|
||||
|
||||
private platformProfilesRefreshInterval: NodeJS.Timeout | undefined;
|
||||
|
||||
private async fetchControlPlaneProfiles() {
|
||||
if (usePlatform()) {
|
||||
clearInterval(this.platformProfilesRefreshInterval);
|
||||
await this.loadPlatformProfiles();
|
||||
this.platformProfilesRefreshInterval = setInterval(
|
||||
this.loadPlatformProfiles.bind(this),
|
||||
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.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);
|
||||
});
|
||||
}
|
||||
}
|
||||
|
||||
async setSelectedProfile(profileId: string) {
|
||||
this.selectedProfileId = profileId;
|
||||
const result = await this.loadConfig();
|
||||
|
|
|
|||
|
|
@ -1,15 +1,17 @@
|
|||
import { ConfigResult, ConfigValidationError } from "@continuedev/config-yaml";
|
||||
import {
|
||||
BrowserSerializedContinueConfig,
|
||||
ContinueConfig,
|
||||
IContextProvider,
|
||||
} from "../index.js";
|
||||
|
||||
import { ConfigResult, finalToBrowserConfig } from "./load.js";
|
||||
import { finalToBrowserConfig } from "./load.js";
|
||||
import { IProfileLoader } from "./profile/IProfileLoader.js";
|
||||
|
||||
export interface ProfileDescription {
|
||||
title: string;
|
||||
id: string;
|
||||
errors: ConfigValidationError[] | undefined;
|
||||
}
|
||||
|
||||
export class ProfileLifecycleManager {
|
||||
|
|
@ -19,19 +21,8 @@ export class ProfileLifecycleManager {
|
|||
|
||||
constructor(private readonly profileLoader: IProfileLoader) {}
|
||||
|
||||
get profileId() {
|
||||
return this.profileLoader.profileId;
|
||||
}
|
||||
|
||||
get profileTitle() {
|
||||
return this.profileLoader.profileTitle;
|
||||
}
|
||||
|
||||
get profileDescription(): ProfileDescription {
|
||||
return {
|
||||
title: this.profileTitle,
|
||||
id: this.profileId,
|
||||
};
|
||||
return this.profileLoader.description;
|
||||
}
|
||||
|
||||
clearConfig() {
|
||||
|
|
@ -71,14 +62,10 @@ export class ProfileLifecycleManager {
|
|||
result.config.contextProviders = (
|
||||
result.config.contextProviders ?? []
|
||||
).concat(additionalContextProviders);
|
||||
|
||||
this.savedConfigResult = result;
|
||||
resolve(result);
|
||||
} else if (result.errors) {
|
||||
reject(
|
||||
`Error in config.json: ${result.errors.map((item) => item.message).join(" | ")}`,
|
||||
);
|
||||
}
|
||||
|
||||
this.savedConfigResult = result;
|
||||
resolve(result);
|
||||
});
|
||||
|
||||
// Wait for the config promise to resolve
|
||||
|
|
|
|||
|
|
@ -33,7 +33,6 @@ import {
|
|||
} from "../commands/index.js";
|
||||
import { AllRerankers } from "../context/allRerankers";
|
||||
import { MCPManagerSingleton } from "../context/mcp";
|
||||
import CodebaseContextProvider from "../context/providers/CodebaseContextProvider";
|
||||
import ContinueProxyContextProvider from "../context/providers/ContinueProxyContextProvider";
|
||||
import CustomContextProviderClass from "../context/providers/CustomContextProvider";
|
||||
import FileContextProvider from "../context/providers/FileContextProvider";
|
||||
|
|
@ -63,6 +62,8 @@ import {
|
|||
getEsbuildBinaryPath,
|
||||
} from "../util/paths";
|
||||
|
||||
import { ConfigResult, ConfigValidationError } from "@continuedev/config-yaml";
|
||||
import { usePlatform } from "../control-plane/flags";
|
||||
import {
|
||||
defaultContextProvidersJetBrains,
|
||||
defaultContextProvidersVsCode,
|
||||
|
|
@ -70,14 +71,9 @@ import {
|
|||
defaultSlashCommandsVscode,
|
||||
} from "./default";
|
||||
import { getSystemPromptDotFile } from "./getSystemPromptDotFile";
|
||||
import { isSupportedLanceDbCpuTarget } from "./util";
|
||||
import { ConfigValidationError, validateConfig } from "./validation.js";
|
||||
|
||||
export interface ConfigResult<T> {
|
||||
config: T | undefined;
|
||||
errors: ConfigValidationError[] | undefined;
|
||||
configLoadInterrupted: boolean;
|
||||
}
|
||||
// import { isSupportedLanceDbCpuTarget } from "./util";
|
||||
import { validateConfig } from "./validation.js";
|
||||
import { localPathToUri } from "../util/pathToUri";
|
||||
|
||||
function resolveSerializedConfig(filepath: string): SerializedContinueConfig {
|
||||
let content = fs.readFileSync(filepath, "utf8");
|
||||
|
|
@ -176,9 +172,10 @@ function loadSerializedConfig(
|
|||
? [...defaultSlashCommandsVscode]
|
||||
: [...defaultSlashCommandsJetBrains];
|
||||
|
||||
if (!isSupportedLanceDbCpuTarget(ide)) {
|
||||
config.disableIndexing = true;
|
||||
}
|
||||
// Temporarily disabling this check until we can verify the commands are accuarate
|
||||
// if (!isSupportedLanceDbCpuTarget(ide)) {
|
||||
// config.disableIndexing = true;
|
||||
// }
|
||||
|
||||
return { config, errors, configLoadInterrupted: false };
|
||||
}
|
||||
|
|
@ -229,12 +226,19 @@ function isModelDescription(
|
|||
return (llm as ModelDescription).title !== undefined;
|
||||
}
|
||||
|
||||
function isContextProviderWithParams(
|
||||
export function isContextProviderWithParams(
|
||||
contextProvider: CustomContextProvider | ContextProviderWithParams,
|
||||
): contextProvider is ContextProviderWithParams {
|
||||
return (contextProvider as ContextProviderWithParams).name !== undefined;
|
||||
}
|
||||
|
||||
const getCodebaseProvider = async (params: any) => {
|
||||
const { default: CodebaseContextProvider } = await import(
|
||||
"../context/providers/CodebaseContextProvider"
|
||||
);
|
||||
return new CodebaseContextProvider(params);
|
||||
};
|
||||
|
||||
/** Only difference between intermediate and final configs is the `models` array */
|
||||
async function intermediateToFinalConfig(
|
||||
config: Config,
|
||||
|
|
@ -394,9 +398,14 @@ async function intermediateToFinalConfig(
|
|||
| ContextProviderWithParams
|
||||
| undefined
|
||||
)?.params || {};
|
||||
|
||||
const DEFAULT_CONTEXT_PROVIDERS = [
|
||||
new FileContextProvider({}),
|
||||
new CodebaseContextProvider(codebaseContextParams),
|
||||
// Add codebase provider if indexing is enabled
|
||||
...(!config.disableIndexing
|
||||
? [await getCodebaseProvider(codebaseContextParams)]
|
||||
: []),
|
||||
// Add prompt files provider if enabled
|
||||
...(loadPromptFiles ? [new PromptFilesContextProvider({})] : []),
|
||||
];
|
||||
|
||||
|
|
@ -570,6 +579,7 @@ function finalToBrowserConfig(
|
|||
experimental: final.experimental,
|
||||
docs: final.docs,
|
||||
tools: final.tools,
|
||||
usePlatform: usePlatform(),
|
||||
};
|
||||
}
|
||||
|
||||
|
|
@ -804,7 +814,7 @@ async function loadFullConfigNode(
|
|||
"Could not load config.ts as absolute path, retrying as file url ...",
|
||||
);
|
||||
try {
|
||||
module = await import(`file://${configJsPath}`);
|
||||
module = await import(localPathToUri(configJsPath));
|
||||
} catch (e) {
|
||||
throw new Error("Could not load config.ts as file url either", {
|
||||
cause: e,
|
||||
|
|
|
|||
|
|
@ -7,16 +7,16 @@ import {
|
|||
IdeSettings,
|
||||
SerializedContinueConfig,
|
||||
} from "../../index.js";
|
||||
import { ConfigResult } from "../load.js";
|
||||
|
||||
import { ConfigResult } from "@continuedev/config-yaml";
|
||||
import { ProfileDescription } from "../ProfileLifecycleManager.js";
|
||||
import doLoadConfig from "./doLoadConfig.js";
|
||||
import { IProfileLoader } from "./IProfileLoader.js";
|
||||
|
||||
export default class ControlPlaneProfileLoader implements IProfileLoader {
|
||||
private static RELOAD_INTERVAL = 1000 * 60 * 15; // every 15 minutes
|
||||
|
||||
readonly profileId: string;
|
||||
profileTitle: string;
|
||||
description: ProfileDescription;
|
||||
|
||||
workspaceSettings: ConfigJson | undefined;
|
||||
|
||||
|
|
@ -29,12 +29,17 @@ export default class ControlPlaneProfileLoader implements IProfileLoader {
|
|||
private writeLog: (message: string) => Promise<void>,
|
||||
private readonly onReload: () => void,
|
||||
) {
|
||||
this.profileId = workspaceId;
|
||||
this.profileTitle = workspaceTitle;
|
||||
this.description = {
|
||||
id: workspaceId,
|
||||
title: workspaceTitle,
|
||||
errors: undefined,
|
||||
};
|
||||
|
||||
setInterval(async () => {
|
||||
this.workspaceSettings =
|
||||
await this.controlPlaneClient.getSettingsForWorkspace(this.profileId);
|
||||
await this.controlPlaneClient.getSettingsForWorkspace(
|
||||
this.description.id,
|
||||
);
|
||||
this.onReload();
|
||||
}, ControlPlaneProfileLoader.RELOAD_INTERVAL);
|
||||
}
|
||||
|
|
@ -43,7 +48,7 @@ export default class ControlPlaneProfileLoader implements IProfileLoader {
|
|||
const settings =
|
||||
this.workspaceSettings ??
|
||||
((await this.controlPlaneClient.getSettingsForWorkspace(
|
||||
this.profileId,
|
||||
this.description.id,
|
||||
)) as any);
|
||||
const serializedConfig: SerializedContinueConfig = settings;
|
||||
|
||||
|
|
@ -53,6 +58,8 @@ export default class ControlPlaneProfileLoader implements IProfileLoader {
|
|||
this.controlPlaneClient,
|
||||
this.writeLog,
|
||||
serializedConfig,
|
||||
undefined,
|
||||
undefined,
|
||||
this.workspaceId,
|
||||
);
|
||||
|
||||
|
|
|
|||
|
|
@ -1,12 +1,12 @@
|
|||
// ProfileHandlers manage the loading of a config, allowing us to abstract over different ways of getting to a ContinueConfig
|
||||
|
||||
import { ConfigResult } from "@continuedev/config-yaml";
|
||||
import { ContinueConfig } from "../../index.js";
|
||||
import { ConfigResult } from "../load.js";
|
||||
import { ProfileDescription } from "../ProfileLifecycleManager.js";
|
||||
|
||||
// After we have the ContinueConfig, the ConfigHandler takes care of everything else (loading models, lifecycle, etc.)
|
||||
export interface IProfileLoader {
|
||||
profileTitle: string;
|
||||
profileId: string;
|
||||
description: ProfileDescription;
|
||||
doLoadConfig(): Promise<ConfigResult<ContinueConfig>>;
|
||||
setIsActive(isActive: boolean): void;
|
||||
}
|
||||
|
|
|
|||
|
|
@ -1,14 +1,18 @@
|
|||
import { ConfigResult } from "@continuedev/config-yaml";
|
||||
import { ControlPlaneClient } from "../../control-plane/client.js";
|
||||
import { ContinueConfig, IDE, IdeSettings } from "../../index.js";
|
||||
import { ConfigResult } from "../load.js";
|
||||
|
||||
import { ProfileDescription } from "../ProfileLifecycleManager.js";
|
||||
import doLoadConfig from "./doLoadConfig.js";
|
||||
import { IProfileLoader } from "./IProfileLoader.js";
|
||||
|
||||
export default class LocalProfileLoader implements IProfileLoader {
|
||||
static ID = "local";
|
||||
profileId = LocalProfileLoader.ID;
|
||||
profileTitle = "Local Config";
|
||||
description: ProfileDescription = {
|
||||
id: LocalProfileLoader.ID,
|
||||
title: "Local Config",
|
||||
errors: undefined,
|
||||
};
|
||||
|
||||
constructor(
|
||||
private ide: IDE,
|
||||
|
|
@ -18,13 +22,19 @@ export default class LocalProfileLoader implements IProfileLoader {
|
|||
) {}
|
||||
|
||||
async doLoadConfig(): Promise<ConfigResult<ContinueConfig>> {
|
||||
return doLoadConfig(
|
||||
const result = await doLoadConfig(
|
||||
this.ide,
|
||||
this.ideSettingsPromise,
|
||||
this.controlPlaneClient,
|
||||
this.writeLog,
|
||||
undefined,
|
||||
undefined,
|
||||
undefined,
|
||||
);
|
||||
|
||||
this.description.errors = result.errors;
|
||||
|
||||
return result;
|
||||
}
|
||||
|
||||
setIsActive(isActive: boolean): void {}
|
||||
|
|
|
|||
90
core/config/profile/PlatformProfileLoader.ts
Normal file
90
core/config/profile/PlatformProfileLoader.ts
Normal file
|
|
@ -0,0 +1,90 @@
|
|||
import { ClientConfigYaml } from "@continuedev/config-yaml/dist/schemas/index.js";
|
||||
|
||||
import { ControlPlaneClient } from "../../control-plane/client.js";
|
||||
import { ContinueConfig, IDE, IdeSettings } from "../../index.js";
|
||||
|
||||
import { ConfigResult } from "@continuedev/config-yaml";
|
||||
import { ProfileDescription } from "../ProfileLifecycleManager.js";
|
||||
import doLoadConfig from "./doLoadConfig.js";
|
||||
import { IProfileLoader } from "./IProfileLoader.js";
|
||||
|
||||
/**
|
||||
* Metadata about the package that is currently being loaded
|
||||
* If this is `undefined`, it's not a config from the platform,
|
||||
* could be local for example.
|
||||
*/
|
||||
export interface PlatformConfigMetadata {
|
||||
ownerSlug: string;
|
||||
packageSlug: string;
|
||||
}
|
||||
|
||||
export default class PlatformProfileLoader implements IProfileLoader {
|
||||
static RELOAD_INTERVAL = 1000 * 60 * 15; // every 15 minutes
|
||||
|
||||
description: ProfileDescription;
|
||||
|
||||
constructor(
|
||||
private configResult: ConfigResult<ClientConfigYaml>,
|
||||
private readonly ownerSlug: string,
|
||||
private readonly packageSlug: string,
|
||||
private readonly controlPlaneClient: ControlPlaneClient,
|
||||
private readonly ide: IDE,
|
||||
private ideSettingsPromise: Promise<IdeSettings>,
|
||||
private writeLog: (message: string) => Promise<void>,
|
||||
private readonly onReload: () => void,
|
||||
) {
|
||||
this.description = {
|
||||
id: `${ownerSlug}/${packageSlug}`,
|
||||
title: `${ownerSlug}/${packageSlug}`,
|
||||
errors: configResult.errors,
|
||||
};
|
||||
|
||||
setInterval(async () => {
|
||||
const assistants = await this.controlPlaneClient.listAssistants();
|
||||
const newConfigResult = assistants.find(
|
||||
(assistant) =>
|
||||
assistant.packageSlug === this.packageSlug &&
|
||||
assistant.ownerSlug === this.ownerSlug,
|
||||
)?.configResult;
|
||||
if (!newConfigResult) {
|
||||
return;
|
||||
}
|
||||
this.configResult = {
|
||||
config: newConfigResult.config,
|
||||
errors: newConfigResult.errors,
|
||||
configLoadInterrupted: false,
|
||||
};
|
||||
this.onReload();
|
||||
}, PlatformProfileLoader.RELOAD_INTERVAL);
|
||||
}
|
||||
|
||||
async doLoadConfig(): Promise<ConfigResult<ContinueConfig>> {
|
||||
if (this.configResult.errors?.length) {
|
||||
return {
|
||||
config: undefined,
|
||||
errors: this.configResult.errors,
|
||||
configLoadInterrupted: false,
|
||||
};
|
||||
}
|
||||
|
||||
const results = await doLoadConfig(
|
||||
this.ide,
|
||||
this.ideSettingsPromise,
|
||||
this.controlPlaneClient,
|
||||
this.writeLog,
|
||||
undefined,
|
||||
this.configResult.config,
|
||||
{
|
||||
ownerSlug: this.ownerSlug,
|
||||
packageSlug: this.packageSlug,
|
||||
},
|
||||
);
|
||||
|
||||
return {
|
||||
...results,
|
||||
errors: [], // Don't do config validation here, it happens in admin panel
|
||||
};
|
||||
}
|
||||
|
||||
setIsActive(isActive: boolean): void {}
|
||||
}
|
||||
|
|
@ -1,5 +1,7 @@
|
|||
import fs from "fs";
|
||||
|
||||
import { ConfigResult, ConfigValidationError } from "@continuedev/config-yaml";
|
||||
import { ClientConfigYaml } from "@continuedev/config-yaml/dist/schemas";
|
||||
import {
|
||||
ContinueConfig,
|
||||
ContinueRcJson,
|
||||
|
|
@ -15,9 +17,9 @@ import ContinueProxy from "../../llm/llms/stubs/ContinueProxy";
|
|||
import { getConfigYamlPath } from "../../util/paths";
|
||||
import { Telemetry } from "../../util/posthog";
|
||||
import { TTS } from "../../util/tts";
|
||||
import { ConfigResult, loadFullConfigNode } from "../load";
|
||||
import { ConfigValidationError } from "../validation";
|
||||
import { loadFullConfigNode } from "../load";
|
||||
import { loadContinueConfigFromYaml } from "../yaml/loadYaml";
|
||||
import { PlatformConfigMetadata } from "./PlatformProfileLoader";
|
||||
|
||||
export default async function doLoadConfig(
|
||||
ide: IDE,
|
||||
|
|
@ -25,6 +27,8 @@ export default async function doLoadConfig(
|
|||
controlPlaneClient: ControlPlaneClient,
|
||||
writeLog: (message: string) => Promise<void>,
|
||||
overrideConfigJson: SerializedContinueConfig | undefined,
|
||||
overrideConfigYaml: ClientConfigYaml | undefined,
|
||||
platformConfigMetadata: PlatformConfigMetadata | undefined,
|
||||
workspaceId?: string,
|
||||
): Promise<ConfigResult<ContinueConfig>> {
|
||||
const workspaceConfigs = await getWorkspaceConfigs(ide);
|
||||
|
|
@ -39,7 +43,7 @@ export default async function doLoadConfig(
|
|||
let errors: ConfigValidationError[] | undefined;
|
||||
let configLoadInterrupted = false;
|
||||
|
||||
if (fs.existsSync(configYamlPath)) {
|
||||
if (fs.existsSync(configYamlPath) || overrideConfigYaml) {
|
||||
const result = await loadContinueConfigFromYaml(
|
||||
ide,
|
||||
workspaceConfigs.map((c) => JSON.stringify(c)),
|
||||
|
|
@ -48,8 +52,9 @@ export default async function doLoadConfig(
|
|||
uniqueId,
|
||||
writeLog,
|
||||
workOsAccessToken,
|
||||
undefined,
|
||||
// overrideConfigYaml, TODO
|
||||
overrideConfigYaml,
|
||||
platformConfigMetadata,
|
||||
controlPlaneClient,
|
||||
);
|
||||
newConfig = result.config;
|
||||
errors = result.errors;
|
||||
|
|
|
|||
|
|
@ -1,11 +1,7 @@
|
|||
import { ConfigValidationError } from "@continuedev/config-yaml";
|
||||
import { ModelDescription, SerializedContinueConfig } from "../";
|
||||
import { Telemetry } from "../util/posthog";
|
||||
|
||||
export interface ConfigValidationError {
|
||||
fatal: boolean;
|
||||
message: string;
|
||||
}
|
||||
|
||||
/**
|
||||
* Validates a SerializedContinueConfig object to ensure all properties are correctly formed.
|
||||
* @param config The configuration object to validate.
|
||||
|
|
|
|||
|
|
@ -8,6 +8,7 @@ export function convertConfigJsonToConfigYaml(
|
|||
): ConfigYaml {
|
||||
return {
|
||||
name: "Local Config",
|
||||
version: "1.0.0",
|
||||
models: [
|
||||
...configJson.models.map(
|
||||
(model): ModelConfig => ({
|
||||
|
|
|
|||
|
|
@ -5,10 +5,12 @@ export const defaultConfigYaml: ConfigYaml = {
|
|||
models: [],
|
||||
context: [],
|
||||
name: "Local Config",
|
||||
version: "1.0.0",
|
||||
};
|
||||
|
||||
export const defaultConfigYamlJetBrains: ConfigYaml = {
|
||||
models: [],
|
||||
context: [],
|
||||
name: "Local Config",
|
||||
version: "1.0.0",
|
||||
};
|
||||
|
|
|
|||
|
|
@ -1,13 +1,12 @@
|
|||
import fs from "node:fs";
|
||||
import path from "path";
|
||||
|
||||
import {
|
||||
extendConfig,
|
||||
ConfigResult,
|
||||
fillTemplateVariables,
|
||||
resolveSecretsOnClient,
|
||||
validateConfigYaml,
|
||||
} from "@continuedev/config-yaml";
|
||||
import { ConfigYaml } from "@continuedev/config-yaml/dist/schemas";
|
||||
import { ValidationLevel } from "@continuedev/config-yaml/dist/validation";
|
||||
import { ClientConfigYaml } from "@continuedev/config-yaml/dist/schemas";
|
||||
import { fetchwithRequestOptions } from "@continuedev/fetch";
|
||||
import * as YAML from "yaml";
|
||||
|
||||
|
|
@ -26,23 +25,17 @@ import { contextProviderClassFromName } from "../../context/providers/index";
|
|||
import { allEmbeddingsProviders } from "../../indexing/allEmbeddingsProviders";
|
||||
import FreeTrial from "../../llm/llms/FreeTrial";
|
||||
import TransformersJsEmbeddingsProvider from "../../llm/llms/TransformersJsEmbeddingsProvider";
|
||||
import {
|
||||
getConfigYamlPath,
|
||||
getContinueDotEnv,
|
||||
readAllGlobalPromptFiles,
|
||||
} from "../../util/paths";
|
||||
import { getSystemPromptDotFile } from "../getSystemPromptDotFile";
|
||||
import { ConfigValidationError } from "../validation.js";
|
||||
|
||||
import { llmsFromModelConfig } from "./models";
|
||||
import { getAllPromptFiles } from "../../promptFiles/v2/getPromptFiles";
|
||||
import { slashCommandFromPromptFileV1 } from "../../promptFiles/v1/slashCommandFromPromptFile";
|
||||
import { getAllPromptFiles } from "../../promptFiles/v2/getPromptFiles";
|
||||
import { getConfigYamlPath, getContinueDotEnv } from "../../util/paths";
|
||||
import { getSystemPromptDotFile } from "../getSystemPromptDotFile";
|
||||
import { PlatformConfigMetadata } from "../profile/PlatformProfileLoader";
|
||||
|
||||
export interface ConfigResult<T> {
|
||||
config: T | undefined;
|
||||
errors: ConfigValidationError[] | undefined;
|
||||
configLoadInterrupted: boolean;
|
||||
}
|
||||
import CodebaseContextProvider from "../../context/providers/CodebaseContextProvider";
|
||||
import FileContextProvider from "../../context/providers/FileContextProvider";
|
||||
import PromptFilesContextProvider from "../../context/providers/PromptFilesContextProvider";
|
||||
import { ControlPlaneClient } from "../../control-plane/client";
|
||||
import { llmsFromModelConfig } from "./models";
|
||||
|
||||
function renderTemplateVars(configYaml: string): string {
|
||||
const data: Record<string, string> = {};
|
||||
|
|
@ -60,36 +53,28 @@ function renderTemplateVars(configYaml: string): string {
|
|||
|
||||
function loadConfigYaml(
|
||||
workspaceConfigs: string[],
|
||||
ideSettings: IdeSettings,
|
||||
ideType: IdeType,
|
||||
rawYaml: string,
|
||||
): ConfigResult<ConfigYaml> {
|
||||
const renderedYaml = renderTemplateVars(rawYaml);
|
||||
let config = YAML.parse(renderedYaml) as ConfigYaml;
|
||||
overrideConfigYaml: ClientConfigYaml | undefined,
|
||||
): ConfigResult<ClientConfigYaml> {
|
||||
let config =
|
||||
overrideConfigYaml ??
|
||||
(YAML.parse(renderTemplateVars(rawYaml)) as ClientConfigYaml);
|
||||
const errors = validateConfigYaml(config);
|
||||
|
||||
if (errors?.some((error) => error.level === ValidationLevel.Error)) {
|
||||
if (errors?.some((error) => error.fatal)) {
|
||||
return {
|
||||
errors: errors.map((error) => ({
|
||||
message: error.message,
|
||||
fatal: error.level === ValidationLevel.Error,
|
||||
})),
|
||||
errors,
|
||||
config: undefined,
|
||||
configLoadInterrupted: true,
|
||||
};
|
||||
}
|
||||
|
||||
for (const workspaceConfig of workspaceConfigs) {
|
||||
const rendered = renderTemplateVars(workspaceConfig);
|
||||
config = extendConfig(config, YAML.parse(rendered) as ConfigYaml);
|
||||
}
|
||||
|
||||
// Set defaults if undefined (this lets us keep config.json uncluttered for new users)
|
||||
return {
|
||||
config,
|
||||
errors: errors.map((error) => ({
|
||||
message: error.message,
|
||||
fatal: error.level === ValidationLevel.Error,
|
||||
fatal: error.fatal,
|
||||
})),
|
||||
configLoadInterrupted: false,
|
||||
};
|
||||
|
|
@ -113,12 +98,13 @@ async function slashCommandsFromV1PromptFiles(
|
|||
}
|
||||
|
||||
async function configYamlToContinueConfig(
|
||||
config: ConfigYaml,
|
||||
config: ClientConfigYaml,
|
||||
ide: IDE,
|
||||
ideSettings: IdeSettings,
|
||||
uniqueId: string,
|
||||
writeLog: (log: string) => Promise<void>,
|
||||
workOsAccessToken: string | undefined,
|
||||
platformConfigMetadata: PlatformConfigMetadata | undefined,
|
||||
allowFreeTrial: boolean = true,
|
||||
): Promise<ContinueConfig> {
|
||||
const continueConfig: ContinueConfig = {
|
||||
|
|
@ -126,10 +112,24 @@ async function configYamlToContinueConfig(
|
|||
models: [],
|
||||
tabAutocompleteModels: [],
|
||||
tools: [],
|
||||
systemMessage: config.rules?.join("\n"),
|
||||
embeddingsProvider: new TransformersJsEmbeddingsProvider(),
|
||||
experimental: {
|
||||
modelContextProtocolServers: [],
|
||||
modelContextProtocolServers: config.mcpServers?.map((mcpServer) => ({
|
||||
transport: {
|
||||
type: "stdio",
|
||||
command: mcpServer.command,
|
||||
args: mcpServer.args ?? [],
|
||||
env: mcpServer.env,
|
||||
},
|
||||
})),
|
||||
},
|
||||
docs: config.docs?.map((doc) => ({
|
||||
title: doc.name,
|
||||
startUrl: doc.startUrl,
|
||||
rootUrl: doc.rootUrl,
|
||||
faviconUrl: doc.faviconUrl,
|
||||
})),
|
||||
};
|
||||
|
||||
// Models
|
||||
|
|
@ -146,9 +146,13 @@ async function configYamlToContinueConfig(
|
|||
uniqueId,
|
||||
ideSettings,
|
||||
writeLog,
|
||||
platformConfigMetadata,
|
||||
continueConfig.systemMessage,
|
||||
);
|
||||
continueConfig.models.push(...llms);
|
||||
} else if (model.roles?.includes("autocomplete")) {
|
||||
}
|
||||
|
||||
if (model.roles?.includes("autocomplete")) {
|
||||
// Autocomplete models array
|
||||
const llms = await llmsFromModelConfig(
|
||||
model,
|
||||
|
|
@ -156,6 +160,8 @@ async function configYamlToContinueConfig(
|
|||
uniqueId,
|
||||
ideSettings,
|
||||
writeLog,
|
||||
platformConfigMetadata,
|
||||
continueConfig.systemMessage,
|
||||
);
|
||||
continueConfig.tabAutocompleteModels?.push(...llms);
|
||||
}
|
||||
|
|
@ -181,18 +187,33 @@ async function configYamlToContinueConfig(
|
|||
|
||||
// TODO: Split into model roles.
|
||||
|
||||
// Context
|
||||
// Context providers
|
||||
const codebaseContextParams: IContextProvider[] =
|
||||
(config.context || []).find((cp) => cp.uses === "codebase")?.with || {};
|
||||
const DEFAULT_CONTEXT_PROVIDERS = [
|
||||
new FileContextProvider({}),
|
||||
new CodebaseContextProvider(codebaseContextParams),
|
||||
new PromptFilesContextProvider({}),
|
||||
];
|
||||
|
||||
const DEFAULT_CONTEXT_PROVIDERS_TITLES = DEFAULT_CONTEXT_PROVIDERS.map(
|
||||
({ description: { title } }) => title,
|
||||
);
|
||||
|
||||
continueConfig.contextProviders = config.context
|
||||
?.map((context) => {
|
||||
const cls = contextProviderClassFromName(context.uses) as any;
|
||||
if (!cls) {
|
||||
console.warn(`Unknown context provider ${context.uses}`);
|
||||
if (!DEFAULT_CONTEXT_PROVIDERS_TITLES.includes(context.uses)) {
|
||||
console.warn(`Unknown context provider ${context.uses}`);
|
||||
}
|
||||
return undefined;
|
||||
}
|
||||
const instance: IContextProvider = new cls(context.with ?? {});
|
||||
return instance;
|
||||
})
|
||||
.filter((p) => !!p) as IContextProvider[];
|
||||
continueConfig.contextProviders.push(...DEFAULT_CONTEXT_PROVIDERS);
|
||||
|
||||
// Embeddings Provider
|
||||
const embedConfig = config.models?.find((model) =>
|
||||
|
|
@ -283,16 +304,20 @@ export async function loadContinueConfigFromYaml(
|
|||
uniqueId: string,
|
||||
writeLog: (log: string) => Promise<void>,
|
||||
workOsAccessToken: string | undefined,
|
||||
overrideConfigYaml: string | undefined,
|
||||
overrideConfigYaml: ClientConfigYaml | undefined,
|
||||
platformConfigMetadata: PlatformConfigMetadata | undefined,
|
||||
controlPlaneClient: ControlPlaneClient,
|
||||
): Promise<ConfigResult<ContinueConfig>> {
|
||||
const configYamlPath = getConfigYamlPath(ideType);
|
||||
const rawYaml = fs.readFileSync(configYamlPath, "utf-8");
|
||||
const rawYaml =
|
||||
overrideConfigYaml === undefined
|
||||
? fs.readFileSync(configYamlPath, "utf-8")
|
||||
: "";
|
||||
|
||||
const configYamlResult = await loadConfigYaml(
|
||||
const configYamlResult = loadConfigYaml(
|
||||
workspaceConfigs,
|
||||
ideSettings,
|
||||
ideType,
|
||||
overrideConfigYaml ?? rawYaml,
|
||||
rawYaml,
|
||||
overrideConfigYaml,
|
||||
);
|
||||
|
||||
if (!configYamlResult.config || configYamlResult.configLoadInterrupted) {
|
||||
|
|
@ -303,13 +328,24 @@ export async function loadContinueConfigFromYaml(
|
|||
};
|
||||
}
|
||||
|
||||
const continueConfig = await configYamlToContinueConfig(
|
||||
const configYaml = await resolveSecretsOnClient(
|
||||
configYamlResult.config,
|
||||
ide.readSecrets.bind(ide),
|
||||
async (secretNames: string[]) => {
|
||||
const secretValues = await controlPlaneClient.syncSecrets(secretNames);
|
||||
await ide.writeSecrets(secretValues);
|
||||
return secretValues;
|
||||
},
|
||||
);
|
||||
|
||||
const continueConfig = await configYamlToContinueConfig(
|
||||
configYaml,
|
||||
ide,
|
||||
ideSettings,
|
||||
uniqueId,
|
||||
writeLog,
|
||||
workOsAccessToken,
|
||||
platformConfigMetadata,
|
||||
);
|
||||
|
||||
const systemPromptDotFile = await getSystemPromptDotFile(ide);
|
||||
|
|
|
|||
|
|
@ -3,21 +3,59 @@ import { ModelConfig } from "@continuedev/config-yaml";
|
|||
import { IDE, IdeSettings, LLMOptions } from "../..";
|
||||
import { BaseLLM } from "../../llm";
|
||||
import { LLMClasses } from "../../llm/llms";
|
||||
import ContinueProxy from "../../llm/llms/stubs/ContinueProxy";
|
||||
import { PlatformConfigMetadata } from "../profile/PlatformProfileLoader";
|
||||
|
||||
const AUTODETECT = "AUTODETECT";
|
||||
|
||||
function useContinueProxy(
|
||||
model: ModelConfig,
|
||||
platformConfigMetadata: PlatformConfigMetadata | undefined,
|
||||
): boolean {
|
||||
return !!platformConfigMetadata && model.apiKeySecret !== undefined;
|
||||
}
|
||||
|
||||
function getModelClass(
|
||||
model: ModelConfig,
|
||||
platformConfigMetadata: PlatformConfigMetadata | undefined,
|
||||
): (typeof LLMClasses)[number] | undefined {
|
||||
if (useContinueProxy(model, platformConfigMetadata)) {
|
||||
return ContinueProxy;
|
||||
}
|
||||
return LLMClasses.find((llm) => llm.providerName === model.provider);
|
||||
}
|
||||
|
||||
function getContinueProxyModelName(
|
||||
ownerSlug: string,
|
||||
packageSlug: string,
|
||||
model: ModelConfig,
|
||||
): string {
|
||||
return `${ownerSlug}/${packageSlug}/${model.provider}/${model.model}`;
|
||||
}
|
||||
|
||||
async function modelConfigToBaseLLM(
|
||||
model: ModelConfig,
|
||||
uniqueId: string,
|
||||
ideSettings: IdeSettings,
|
||||
writeLog: (log: string) => Promise<void>,
|
||||
platformConfigMetadata: PlatformConfigMetadata | undefined,
|
||||
systemMessage: string | undefined,
|
||||
): Promise<BaseLLM | undefined> {
|
||||
const cls = LLMClasses.find((llm) => llm.providerName === model.provider);
|
||||
const cls = getModelClass(model, platformConfigMetadata);
|
||||
|
||||
if (!cls) {
|
||||
return undefined;
|
||||
}
|
||||
|
||||
const usingContinueProxy = useContinueProxy(model, platformConfigMetadata);
|
||||
const modelName = usingContinueProxy
|
||||
? getContinueProxyModelName(
|
||||
platformConfigMetadata!.ownerSlug,
|
||||
platformConfigMetadata!.packageSlug,
|
||||
model,
|
||||
)
|
||||
: model.model;
|
||||
|
||||
let options: LLMOptions = {
|
||||
...model,
|
||||
completionOptions: {
|
||||
|
|
@ -30,6 +68,8 @@ async function modelConfigToBaseLLM(
|
|||
writeLog,
|
||||
uniqueId,
|
||||
title: model.name,
|
||||
model: modelName,
|
||||
systemMessage,
|
||||
};
|
||||
|
||||
const llm = new cls(options);
|
||||
|
|
@ -43,6 +83,8 @@ async function autodetectModels(
|
|||
uniqueId: string,
|
||||
ideSettings: IdeSettings,
|
||||
writeLog: (log: string) => Promise<void>,
|
||||
platformConfigMetadata: PlatformConfigMetadata | undefined,
|
||||
systemMessage: string | undefined,
|
||||
): Promise<BaseLLM[]> {
|
||||
try {
|
||||
const modelNames = await llm.listModels();
|
||||
|
|
@ -62,6 +104,8 @@ async function autodetectModels(
|
|||
uniqueId,
|
||||
ideSettings,
|
||||
writeLog,
|
||||
platformConfigMetadata,
|
||||
systemMessage,
|
||||
);
|
||||
}),
|
||||
);
|
||||
|
|
@ -78,12 +122,16 @@ export async function llmsFromModelConfig(
|
|||
uniqueId: string,
|
||||
ideSettings: IdeSettings,
|
||||
writeLog: (log: string) => Promise<void>,
|
||||
platformConfigMetadata: PlatformConfigMetadata | undefined,
|
||||
systemMessage: string | undefined,
|
||||
): Promise<BaseLLM[]> {
|
||||
const baseLlm = await modelConfigToBaseLLM(
|
||||
model,
|
||||
uniqueId,
|
||||
ideSettings,
|
||||
writeLog,
|
||||
platformConfigMetadata,
|
||||
systemMessage,
|
||||
);
|
||||
if (!baseLlm) {
|
||||
return [];
|
||||
|
|
@ -97,6 +145,8 @@ export async function llmsFromModelConfig(
|
|||
uniqueId,
|
||||
ideSettings,
|
||||
writeLog,
|
||||
platformConfigMetadata,
|
||||
systemMessage,
|
||||
);
|
||||
return models;
|
||||
} else {
|
||||
|
|
|
|||
|
|
@ -4,9 +4,9 @@ import { StdioClientTransport } from "@modelcontextprotocol/sdk/client/stdio.js"
|
|||
import { WebSocketClientTransport } from "@modelcontextprotocol/sdk/client/websocket.js";
|
||||
import { Transport } from "@modelcontextprotocol/sdk/shared/transport.js";
|
||||
|
||||
import { ConfigValidationError } from "@continuedev/config-yaml";
|
||||
import { ContinueConfig, MCPOptions, SlashCommand, Tool } from "../..";
|
||||
import { constructMcpSlashCommand } from "../../commands/slash/mcp";
|
||||
import { ConfigValidationError } from "../../config/validation";
|
||||
import { encodeMCPToolUri } from "../../tools/callTool";
|
||||
import MCPContextProvider from "../providers/MCPContextProvider";
|
||||
|
||||
|
|
|
|||
|
|
@ -41,7 +41,7 @@ class RepoMapContextProvider extends BaseContextProvider {
|
|||
// Doesn't ALWAYS depend on indexing, so not setting dependsOnIndexing = true, just checking for it
|
||||
includeSignatures: extras.config.disableIndexing
|
||||
? false
|
||||
: (this.options?.includeSignatures ?? false),
|
||||
: (this.options?.includeSignatures ?? true),
|
||||
}),
|
||||
},
|
||||
];
|
||||
|
|
|
|||
|
|
@ -1,5 +1,7 @@
|
|||
import { v4 as uuidv4 } from "uuid";
|
||||
|
||||
import { controlPlaneEnv } from "../env";
|
||||
|
||||
const CLIENT_ID = "client_01J0FW6XN8N2XJAECF7NE0Y65J";
|
||||
// const CLIENT_ID = "client_01J0FW6XCPMJMQ3CG51RB4HBZQ"; // Staging
|
||||
|
||||
|
|
@ -8,7 +10,7 @@ export async function getAuthUrlForTokenPage(): Promise<string> {
|
|||
const params = {
|
||||
response_type: "code",
|
||||
client_id: CLIENT_ID,
|
||||
redirect_uri: "https://app.continue.dev/tokens/callback",
|
||||
redirect_uri: `${controlPlaneEnv.APP_URL}tokens/callback`,
|
||||
// redirect_uri: "http://localhost:3000/tokens/callback",
|
||||
state: uuidv4(),
|
||||
provider: "authkit",
|
||||
|
|
|
|||
|
|
@ -1,8 +1,10 @@
|
|||
import { ConfigJson } from "@continuedev/config-types";
|
||||
import { ClientConfigYaml } from "@continuedev/config-yaml/dist/schemas/index.js";
|
||||
import fetch, { RequestInit, Response } from "node-fetch";
|
||||
|
||||
import { ModelDescription } from "../index.js";
|
||||
|
||||
import { ConfigResult } from "@continuedev/config-yaml";
|
||||
import { controlPlaneEnv } from "./env.js";
|
||||
|
||||
export interface ControlPlaneSessionInfo {
|
||||
|
|
@ -85,6 +87,29 @@ export class ControlPlaneClient {
|
|||
}
|
||||
}
|
||||
|
||||
public async listAssistants(): Promise<
|
||||
{
|
||||
configResult: ConfigResult<ClientConfigYaml>;
|
||||
ownerSlug: string;
|
||||
packageSlug: string;
|
||||
iconUrl: string;
|
||||
}[]
|
||||
> {
|
||||
const userId = await this.userId;
|
||||
if (!userId) {
|
||||
return [];
|
||||
}
|
||||
|
||||
try {
|
||||
const resp = await this.request("ide/list-assistants", {
|
||||
method: "GET",
|
||||
});
|
||||
return (await resp.json()) as any;
|
||||
} catch (e) {
|
||||
return [];
|
||||
}
|
||||
}
|
||||
|
||||
async getSettingsForWorkspace(workspaceId: string): Promise<ConfigJson> {
|
||||
const userId = await this.userId;
|
||||
if (!userId) {
|
||||
|
|
@ -96,4 +121,21 @@ export class ControlPlaneClient {
|
|||
});
|
||||
return ((await resp.json()) as any).settings;
|
||||
}
|
||||
|
||||
async syncSecrets(secretNames: string[]): Promise<Record<string, string>> {
|
||||
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 {};
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -1,3 +1,6 @@
|
|||
import { readUsePlatform } from "../util/paths";
|
||||
import { usePlatform } from "./flags";
|
||||
|
||||
interface ControlPlaneEnv {
|
||||
DEFAULT_CONTROL_PLANE_PROXY_URL: string;
|
||||
CONTROL_PLANE_URL: string;
|
||||
|
|
@ -21,7 +24,7 @@ const PRODUCTION_ENV: ControlPlaneEnv = {
|
|||
"https://control-plane-api-service-i3dqylpbqa-uc.a.run.app/",
|
||||
AUTH_TYPE: WORKOS_ENV_ID_PRODUCTION,
|
||||
WORKOS_CLIENT_ID: WORKOS_CLIENT_ID_PRODUCTION,
|
||||
APP_URL: "https://app.continue.dev",
|
||||
APP_URL: "https://app.continue.dev/",
|
||||
};
|
||||
|
||||
const STAGING_ENV: ControlPlaneEnv = {
|
||||
|
|
@ -31,7 +34,15 @@ const STAGING_ENV: ControlPlaneEnv = {
|
|||
"https://control-plane-api-service-537175798139.us-central1.run.app/",
|
||||
AUTH_TYPE: WORKOS_CLIENT_ID_STAGING,
|
||||
WORKOS_CLIENT_ID: WORKOS_CLIENT_ID_STAGING,
|
||||
APP_URL: "https://app-preview.continue.dev",
|
||||
APP_URL: "https://app-preview.continue.dev/",
|
||||
};
|
||||
|
||||
const TEST_ENV: ControlPlaneEnv = {
|
||||
DEFAULT_CONTROL_PLANE_PROXY_URL: "https://api-test.continue.dev/",
|
||||
CONTROL_PLANE_URL: "https://api-test.continue.dev/",
|
||||
AUTH_TYPE: WORKOS_ENV_ID_STAGING,
|
||||
WORKOS_CLIENT_ID: WORKOS_CLIENT_ID_STAGING,
|
||||
APP_URL: "https://app-test.continue.dev/",
|
||||
};
|
||||
|
||||
const LOCAL_ENV: ControlPlaneEnv = {
|
||||
|
|
@ -39,12 +50,20 @@ const LOCAL_ENV: ControlPlaneEnv = {
|
|||
CONTROL_PLANE_URL: "http://localhost:3001/",
|
||||
AUTH_TYPE: WORKOS_ENV_ID_STAGING,
|
||||
WORKOS_CLIENT_ID: WORKOS_CLIENT_ID_STAGING,
|
||||
APP_URL: "http://localhost:3000",
|
||||
APP_URL: "http://localhost:3000/",
|
||||
};
|
||||
|
||||
export const controlPlaneEnv =
|
||||
process.env.CONTROL_PLANE_ENV === "local"
|
||||
function getControlPlaneEnv(): ControlPlaneEnv {
|
||||
const usePlatformFileEnv = readUsePlatform();
|
||||
const env = usePlatformFileEnv || process.env.CONTROL_PLANE_ENV;
|
||||
|
||||
return env === "local"
|
||||
? LOCAL_ENV
|
||||
: process.env.CONTROL_PLANE_ENV === "staging"
|
||||
: env === "staging"
|
||||
? STAGING_ENV
|
||||
: PRODUCTION_ENV;
|
||||
: env === "test" || usePlatform()
|
||||
? TEST_ENV
|
||||
: PRODUCTION_ENV;
|
||||
}
|
||||
|
||||
export const controlPlaneEnv = getControlPlaneEnv();
|
||||
|
|
|
|||
13
core/control-plane/flags.ts
Normal file
13
core/control-plane/flags.ts
Normal file
|
|
@ -0,0 +1,13 @@
|
|||
import { readUsePlatform, usePlatformPathExists } from "../util/paths";
|
||||
|
||||
export function usePlatform(): boolean {
|
||||
return usePlatformPathExists();
|
||||
}
|
||||
|
||||
export function getEnvFromUsePlatformFile(): string | undefined {
|
||||
const contents = readUsePlatform();
|
||||
if (contents && contents.trim().length > 0) {
|
||||
return contents.trim();
|
||||
}
|
||||
return undefined;
|
||||
}
|
||||
47
core/core.ts
47
core/core.ts
|
|
@ -43,8 +43,16 @@ import { Telemetry } from "./util/posthog";
|
|||
import { getSymbolsForManyFiles } from "./util/treeSitter";
|
||||
import { TTS } from "./util/tts";
|
||||
|
||||
import { type ContextItemId, type IDE, type IndexingProgressUpdate } from ".";
|
||||
import {
|
||||
ChatMessage,
|
||||
DiffLine,
|
||||
PromptLog,
|
||||
type ContextItemId,
|
||||
type IDE,
|
||||
type IndexingProgressUpdate,
|
||||
} from ".";
|
||||
|
||||
import { usePlatform } from "./control-plane/flags";
|
||||
import type { FromCoreProtocol, ToCoreProtocol } from "./protocol";
|
||||
import type { IMessenger, Message } from "./protocol/messenger";
|
||||
|
||||
|
|
@ -103,6 +111,7 @@ export class Core {
|
|||
const ideSettingsPromise = messenger.request("getIdeSettings", undefined);
|
||||
const sessionInfoPromise = messenger.request("getControlPlaneSessionInfo", {
|
||||
silent: true,
|
||||
useOnboarding: usePlatform(),
|
||||
});
|
||||
|
||||
this.controlPlaneClient = new ControlPlaneClient(sessionInfoPromise);
|
||||
|
|
@ -124,7 +133,7 @@ export class Core {
|
|||
const serializedResult = await this.configHandler.getSerializedConfig();
|
||||
this.messenger.send("configUpdate", {
|
||||
result: serializedResult,
|
||||
profileId: this.configHandler.currentProfile.profileId,
|
||||
profileId: this.configHandler.currentProfile.profileDescription.id,
|
||||
});
|
||||
});
|
||||
|
||||
|
|
@ -378,7 +387,7 @@ export class Core {
|
|||
on("config/getSerializedProfileInfo", async (msg) => {
|
||||
return {
|
||||
result: await this.configHandler.getSerializedConfig(),
|
||||
profileId: this.configHandler.currentProfile.profileId,
|
||||
profileId: this.configHandler.currentProfile.profileDescription.id,
|
||||
};
|
||||
});
|
||||
|
||||
|
|
@ -395,7 +404,7 @@ export class Core {
|
|||
configHandler: ConfigHandler,
|
||||
abortedMessageIds: Set<string>,
|
||||
msg: Message<ToCoreProtocol["llm/streamChat"][0]>,
|
||||
) {
|
||||
): AsyncGenerator<ChatMessage, PromptLog> {
|
||||
const { config } = await configHandler.loadConfig();
|
||||
if (!config) {
|
||||
throw new Error("Config not loaded");
|
||||
|
|
@ -431,7 +440,7 @@ export class Core {
|
|||
|
||||
const chunk = next.value;
|
||||
|
||||
yield { content: chunk };
|
||||
yield chunk;
|
||||
next = await gen.next();
|
||||
}
|
||||
|
||||
|
|
@ -448,7 +457,11 @@ export class Core {
|
|||
true,
|
||||
);
|
||||
|
||||
return { done: true, content: next.value };
|
||||
if (!next.done) {
|
||||
throw new Error("Will never happen");
|
||||
}
|
||||
|
||||
return next.value;
|
||||
}
|
||||
|
||||
on("llm/streamChat", (msg) =>
|
||||
|
|
@ -458,9 +471,8 @@ export class Core {
|
|||
async function* llmStreamComplete(
|
||||
configHandler: ConfigHandler,
|
||||
abortedMessageIds: Set<string>,
|
||||
|
||||
msg: Message<ToCoreProtocol["llm/streamComplete"][0]>,
|
||||
) {
|
||||
): AsyncGenerator<string, PromptLog> {
|
||||
const model = await configHandler.llmFromTitle(msg.data.title);
|
||||
const gen = model.streamComplete(
|
||||
msg.data.prompt,
|
||||
|
|
@ -482,11 +494,13 @@ export class Core {
|
|||
});
|
||||
break;
|
||||
}
|
||||
yield { content: next.value };
|
||||
yield next.value;
|
||||
next = await gen.next();
|
||||
}
|
||||
|
||||
return { done: true, content: next.value };
|
||||
if (!next.done) {
|
||||
throw new Error("This will never happen");
|
||||
}
|
||||
return next.value;
|
||||
}
|
||||
|
||||
on("llm/streamComplete", (msg) =>
|
||||
|
|
@ -548,7 +562,7 @@ export class Core {
|
|||
abortedMessageIds: Set<string>,
|
||||
msg: Message<ToCoreProtocol["command/run"][0]>,
|
||||
messenger: IMessenger<ToCoreProtocol, FromCoreProtocol>,
|
||||
) {
|
||||
): AsyncGenerator<string> {
|
||||
const {
|
||||
input,
|
||||
history,
|
||||
|
|
@ -613,7 +627,7 @@ export class Core {
|
|||
break;
|
||||
}
|
||||
if (content) {
|
||||
yield { content };
|
||||
yield content;
|
||||
}
|
||||
}
|
||||
} catch (e) {
|
||||
|
|
@ -621,7 +635,6 @@ export class Core {
|
|||
} finally {
|
||||
clearInterval(checkActiveInterval);
|
||||
}
|
||||
yield { done: true, content: "" };
|
||||
}
|
||||
on("command/run", (msg) =>
|
||||
runNodeJsSlashCommand(
|
||||
|
|
@ -652,7 +665,7 @@ export class Core {
|
|||
configHandler: ConfigHandler,
|
||||
abortedMessageIds: Set<string>,
|
||||
msg: Message<ToCoreProtocol["streamDiffLines"][0]>,
|
||||
) {
|
||||
): AsyncGenerator<DiffLine> {
|
||||
const data = msg.data;
|
||||
const llm = await configHandler.llmFromTitle(msg.data.modelTitle);
|
||||
for await (const diffLine of streamDiffLines(
|
||||
|
|
@ -667,10 +680,8 @@ export class Core {
|
|||
abortedMessageIds.delete(msg.messageId);
|
||||
break;
|
||||
}
|
||||
yield { content: diffLine };
|
||||
yield diffLine;
|
||||
}
|
||||
|
||||
return { done: true };
|
||||
}
|
||||
|
||||
on("streamDiffLines", (msg) =>
|
||||
|
|
|
|||
16
core/index.d.ts
vendored
16
core/index.d.ts
vendored
|
|
@ -466,6 +466,7 @@ export interface LLMOptions {
|
|||
writeLog?: (str: string) => Promise<void>;
|
||||
llmRequestHook?: (model: string, prompt: string) => any;
|
||||
apiKey?: string;
|
||||
apiKeySecret?: string;
|
||||
aiGatewaySlug?: string;
|
||||
apiBase?: string;
|
||||
cacheBehavior?: CacheBehavior;
|
||||
|
|
@ -689,6 +690,11 @@ export interface IDE {
|
|||
|
||||
getGitHubAuthToken(args: GetGhTokenArgs): Promise<string | undefined>;
|
||||
|
||||
// Secret Storage
|
||||
readSecrets(keys: string[]): Promise<Record<string, string>>;
|
||||
|
||||
writeSecrets(secrets: { [key: string]: string }): Promise<void>;
|
||||
|
||||
// LSP
|
||||
gotoDefinition(location: Location): Promise<RangeInFile[]>;
|
||||
|
||||
|
|
@ -860,6 +866,13 @@ export interface Tool {
|
|||
uri?: string;
|
||||
}
|
||||
|
||||
interface ToolChoice {
|
||||
type: "function";
|
||||
function: {
|
||||
name: string;
|
||||
};
|
||||
}
|
||||
|
||||
export interface BaseCompletionOptions {
|
||||
temperature?: number;
|
||||
topP?: number;
|
||||
|
|
@ -877,6 +890,7 @@ export interface BaseCompletionOptions {
|
|||
stream?: boolean;
|
||||
prediction?: Prediction;
|
||||
tools?: Tool[];
|
||||
toolChoice?: ToolChoice;
|
||||
}
|
||||
|
||||
export interface ModelCapability {
|
||||
|
|
@ -888,6 +902,7 @@ export interface ModelDescription {
|
|||
provider: string;
|
||||
model: string;
|
||||
apiKey?: string;
|
||||
apiKeySecret?: string;
|
||||
apiBase?: string;
|
||||
contextLength?: number;
|
||||
maxStopWords?: number;
|
||||
|
|
@ -1204,6 +1219,7 @@ export interface BrowserSerializedContinueConfig {
|
|||
analytics?: AnalyticsConfig;
|
||||
docs?: SiteIndexingConfig[];
|
||||
tools: Tool[];
|
||||
usePlatform: boolean;
|
||||
}
|
||||
|
||||
// DOCS SUGGESTIONS AND PACKAGE INFO
|
||||
|
|
|
|||
|
|
@ -14,12 +14,12 @@ import {
|
|||
} from "../test/testDir.js";
|
||||
import { getIndexSqlitePath } from "../util/paths.js";
|
||||
|
||||
import { pathToFileURL } from "node:url";
|
||||
import { CodebaseIndexer, PauseToken } from "./CodebaseIndexer.js";
|
||||
import { getComputeDeleteAddRemove } from "./refreshIndex.js";
|
||||
import { TestCodebaseIndex } from "./TestCodebaseIndex.js";
|
||||
import { CodebaseIndex } from "./types.js";
|
||||
import { walkDir } from "./walkDir.js";
|
||||
import { localPathToUri } from "../util/pathToUri.js";
|
||||
|
||||
jest.useFakeTimers();
|
||||
|
||||
|
|
@ -159,7 +159,7 @@ describe("CodebaseIndexer", () => {
|
|||
|
||||
test("should have created index folder with all necessary files", async () => {
|
||||
const exists = await testIde.fileExists(
|
||||
pathToFileURL(getIndexSqlitePath()).toString(),
|
||||
localPathToUri(getIndexSqlitePath()),
|
||||
);
|
||||
expect(exists).toBe(true);
|
||||
});
|
||||
|
|
|
|||
|
|
@ -25,7 +25,7 @@ import {
|
|||
} from "../../util/paths";
|
||||
import { Telemetry } from "../../util/posthog";
|
||||
|
||||
import { ConfigResult } from "../../config/load";
|
||||
import { ConfigResult } from "@continuedev/config-yaml";
|
||||
import { Article, chunkArticle, pageToArticle } from "./article";
|
||||
import DocsCrawler from "./DocsCrawler";
|
||||
import { runLanceMigrations, runSqliteMigrations } from "./migrations";
|
||||
|
|
|
|||
|
|
@ -25,6 +25,7 @@ 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";
|
||||
import { Telemetry } from "../util/posthog.js";
|
||||
import { withExponentialBackoff } from "../util/withExponentialBackoff.js";
|
||||
|
||||
|
|
@ -55,7 +56,6 @@ import {
|
|||
toCompleteBody,
|
||||
toFimBody,
|
||||
} from "./openaiTypeConverters.js";
|
||||
import { isOllamaInstalled } from "../util/ollamaHelper.js";
|
||||
|
||||
export abstract class BaseLLM implements ILLM {
|
||||
static providerName: string;
|
||||
|
|
@ -117,6 +117,7 @@ export abstract class BaseLLM implements ILLM {
|
|||
writeLog?: (str: string) => Promise<void>;
|
||||
llmRequestHook?: (model: string, prompt: string) => any;
|
||||
apiKey?: string;
|
||||
apiKeySecret?: string;
|
||||
apiBase?: string;
|
||||
cacheBehavior?: CacheBehavior;
|
||||
capabilities?: ModelCapability;
|
||||
|
|
@ -194,6 +195,7 @@ export abstract class BaseLLM implements ILLM {
|
|||
this.writeLog = options.writeLog;
|
||||
this.llmRequestHook = options.llmRequestHook;
|
||||
this.apiKey = options.apiKey;
|
||||
this.apiKeySecret = options.apiKeySecret;
|
||||
this.aiGatewaySlug = options.aiGatewaySlug;
|
||||
this.apiBase = options.apiBase;
|
||||
this.cacheBehavior = options.cacheBehavior;
|
||||
|
|
@ -415,10 +417,9 @@ export abstract class BaseLLM implements ILLM {
|
|||
e.code === "ECONNREFUSED" &&
|
||||
e.message.includes("http://127.0.0.1:11434")
|
||||
) {
|
||||
const message = (await isOllamaInstalled()) ?
|
||||
"Unable to connect to local Ollama instance. Ollama may not be running." :
|
||||
"Unable to connect to local Ollama instance. Ollama may not be installed or may not running."
|
||||
;
|
||||
const message = (await isOllamaInstalled())
|
||||
? "Unable to connect to local Ollama instance. Ollama may not be running."
|
||||
: "Unable to connect to local Ollama instance. Ollama may not be installed or may not running.";
|
||||
throw new Error(message);
|
||||
}
|
||||
}
|
||||
|
|
@ -693,13 +694,28 @@ export abstract class BaseLLM implements ILLM {
|
|||
return body;
|
||||
}
|
||||
|
||||
private _modifyCompletionOptions(
|
||||
completionOptions: CompletionOptions,
|
||||
): CompletionOptions {
|
||||
// As of 01/14/25 streaming is currently not available with o1
|
||||
// See these threads:
|
||||
// - https://github.com/continuedev/continue/issues/3698
|
||||
// - https://community.openai.com/t/streaming-support-for-o1-o1-2024-12-17-resulting-in-400-unsupported-value/1085043
|
||||
if (completionOptions.model === "o1") {
|
||||
completionOptions.stream = false;
|
||||
}
|
||||
|
||||
return completionOptions;
|
||||
}
|
||||
|
||||
async *streamChat(
|
||||
_messages: ChatMessage[],
|
||||
signal: AbortSignal,
|
||||
options: LLMFullCompletionOptions = {},
|
||||
): AsyncGenerator<ChatMessage, PromptLog> {
|
||||
const { completionOptions, log, raw } =
|
||||
this._parseCompletionOptions(options);
|
||||
let { completionOptions, log } = this._parseCompletionOptions(options);
|
||||
|
||||
completionOptions = this._modifyCompletionOptions(completionOptions);
|
||||
|
||||
const messages = this._compileChatMessages(completionOptions, _messages);
|
||||
|
||||
|
|
|
|||
|
|
@ -1,13 +1,17 @@
|
|||
import * as dotenv from "dotenv";
|
||||
|
||||
import { CompletionOptions } from "..";
|
||||
import { AssistantChatMessage, CompletionOptions } from "..";
|
||||
|
||||
import { BaseLLM } from ".";
|
||||
import Anthropic from "./llms/Anthropic";
|
||||
import Gemini from "./llms/Gemini";
|
||||
import Mistral from "./llms/Mistral";
|
||||
import OpenAI from "./llms/OpenAI";
|
||||
|
||||
dotenv.config();
|
||||
|
||||
const COMPLETION_OPTIONS: Partial<CompletionOptions> = {
|
||||
temperature: 0.5,
|
||||
// temperature: 0.5,
|
||||
topP: 1,
|
||||
topK: 40,
|
||||
presencePenalty: 0,
|
||||
|
|
@ -16,12 +20,23 @@ const COMPLETION_OPTIONS: Partial<CompletionOptions> = {
|
|||
// maxTokens: 5,
|
||||
};
|
||||
|
||||
function testLLM(llm: BaseLLM) {
|
||||
function testLLM(
|
||||
llm: BaseLLM,
|
||||
{
|
||||
skip,
|
||||
testFim,
|
||||
testToolCall,
|
||||
}: { skip?: boolean; testFim?: boolean; testToolCall?: boolean },
|
||||
) {
|
||||
if (skip) {
|
||||
return;
|
||||
}
|
||||
|
||||
beforeAll(() => {
|
||||
llm.completionOptions = { ...llm.completionOptions, ...COMPLETION_OPTIONS };
|
||||
});
|
||||
|
||||
describe(llm.providerName, () => {
|
||||
describe(llm.providerName + "/" + llm.model, () => {
|
||||
test("Stream Chat works", async () => {
|
||||
let total = "";
|
||||
for await (const chunk of llm.streamChat(
|
||||
|
|
@ -54,62 +69,119 @@ function testLLM(llm: BaseLLM) {
|
|||
expect(completion.length).toBeGreaterThan(0);
|
||||
return;
|
||||
});
|
||||
|
||||
if (testFim) {
|
||||
test("FIM works", async () => {
|
||||
let total = "";
|
||||
for await (const chunk of llm.streamFim(
|
||||
"Hi",
|
||||
"name is ChatGPT.",
|
||||
new AbortController().signal,
|
||||
)) {
|
||||
total += chunk;
|
||||
}
|
||||
|
||||
expect(total.length).toBeGreaterThan(0);
|
||||
return;
|
||||
});
|
||||
}
|
||||
|
||||
if (testToolCall) {
|
||||
test("Tool Call works", async () => {
|
||||
let args = "";
|
||||
let isFirstChunk = true;
|
||||
for await (const chunk of llm.streamChat(
|
||||
[{ role: "user", content: "Hi, my name is Nate." }],
|
||||
new AbortController().signal,
|
||||
{
|
||||
tools: [
|
||||
{
|
||||
displayTitle: "Say Hello",
|
||||
function: {
|
||||
name: "say_hello",
|
||||
description: "Say Hello",
|
||||
parameters: {
|
||||
type: "object",
|
||||
properties: {
|
||||
name: {
|
||||
type: "string",
|
||||
description: "The name of the person to greet",
|
||||
},
|
||||
},
|
||||
},
|
||||
},
|
||||
type: "function",
|
||||
wouldLikeTo: "Say hello",
|
||||
readonly: true,
|
||||
},
|
||||
],
|
||||
toolChoice: {
|
||||
type: "function",
|
||||
function: {
|
||||
name: "say_hello",
|
||||
},
|
||||
},
|
||||
},
|
||||
)) {
|
||||
const typedChunk = chunk as AssistantChatMessage;
|
||||
if (!typedChunk.toolCalls) {
|
||||
continue;
|
||||
}
|
||||
const toolCall = typedChunk.toolCalls[0];
|
||||
args += toolCall.function?.arguments ?? "";
|
||||
|
||||
expect(chunk.role).toBe("assistant");
|
||||
expect(chunk.content).toBe("");
|
||||
expect(typedChunk.toolCalls).toHaveLength(1);
|
||||
|
||||
if (isFirstChunk) {
|
||||
isFirstChunk = false;
|
||||
expect(toolCall.id).toBeDefined();
|
||||
expect(toolCall.function!.name).toBe("say_hello");
|
||||
}
|
||||
}
|
||||
|
||||
const parsedArgs = JSON.parse(args);
|
||||
expect(parsedArgs.name).toBe("Nate");
|
||||
});
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
describe.skip("LLM", () => {
|
||||
// testLLM(
|
||||
// new FreeTrial({
|
||||
// model: "gpt-3.5-turbo",
|
||||
// }),
|
||||
// );
|
||||
// testLLM(
|
||||
// new Anthropic({
|
||||
// model: "claude-2",
|
||||
// apiKey: process.env.ANTHROPIC_API_KEY,
|
||||
// }),
|
||||
// );
|
||||
describe("LLM", () => {
|
||||
testLLM(
|
||||
new OpenAI({ apiKey: process.env.OPENAI_API_KEY, model: "gpt-3.5-turbo" }),
|
||||
new Anthropic({
|
||||
model: "claude-3-5-sonnet-latest",
|
||||
apiKey: process.env.ANTHROPIC_API_KEY,
|
||||
}),
|
||||
{
|
||||
skip: false,
|
||||
testToolCall: true,
|
||||
},
|
||||
);
|
||||
testLLM(new OpenAI({ apiKey: process.env.OPENAI_API_KEY, model: "gpt-4o" }), {
|
||||
skip: false,
|
||||
testToolCall: true,
|
||||
});
|
||||
testLLM(
|
||||
new OpenAI({ apiKey: process.env.OPENAI_API_KEY, model: "o1-preview" }),
|
||||
{ skip: false },
|
||||
);
|
||||
testLLM(new OpenAI({ apiKey: process.env.OPENAI_API_KEY, model: "o1" }), {
|
||||
skip: false,
|
||||
});
|
||||
testLLM(
|
||||
new Gemini({
|
||||
model: "gemini-2.0-flash-exp",
|
||||
apiKey: process.env.GEMINI_API_KEY,
|
||||
}),
|
||||
{ skip: false },
|
||||
);
|
||||
testLLM(
|
||||
new Mistral({
|
||||
apiKey: process.env.MISTRAL_API_KEY,
|
||||
model: "codestral-latest",
|
||||
}),
|
||||
{ testFim: true, skip: false },
|
||||
);
|
||||
// TODO: Fix Replicate
|
||||
// testLLM(
|
||||
// new Replicate({
|
||||
// apiKey: process.env.REPLICATE_API_KEY,
|
||||
// model: "codellama-7b",
|
||||
// })
|
||||
// );
|
||||
// testLLM(new LMStudio({ model: "codellama-7b" }));
|
||||
// testLLM(new Ollama({ model: "codellama-7b" }));
|
||||
// testLLM(
|
||||
// new Together({
|
||||
// apiKey: process.env.TOGETHER_API_KEY,
|
||||
// model: "codellama-7b",
|
||||
// })
|
||||
// );
|
||||
// testLLM(new LlamaCpp({ model: "deepseek-7b" }));
|
||||
// testLLM(new Llamafile({ model: "mistral-7b" }));
|
||||
// TODO: Test these
|
||||
// testLLM(new TextGenWebUI({ model: "codellama-7b" }));
|
||||
// testLLM(new HuggingFaceTGI({ model: "codellama-7b" }));
|
||||
// testLLM(new HuggingFaceInferenceAPI({ model: "codellama-7b" }));
|
||||
// testLLM(
|
||||
// new Gemini({
|
||||
// model: "gemini-pro",
|
||||
// // model: "chat-bison-001",
|
||||
// apiKey: process.env.GOOGLE_PALM_API_KEY,
|
||||
// })
|
||||
// );
|
||||
// testLLM(
|
||||
// new Gemini({ model: "gemini-pro", apiKey: process.env.GOOGLE_PALM_API_KEY })
|
||||
// );
|
||||
// testLLM(
|
||||
// new Mistral({ apiKey: process.env.MISTRAL_API_KEY, model: "mistral-small" })
|
||||
// );
|
||||
// testLLM(
|
||||
// new Flowise({ apiKey: process.env.FLOWISE_API_KEY, model: "gpt-3.5-turbo" })
|
||||
// );
|
||||
// testLLM(
|
||||
// new Nebius({ apiKey: process.env.NEBIUS_API_KEY, model: "llama3.1-8b" })
|
||||
// );
|
||||
});
|
||||
|
|
|
|||
|
|
@ -30,6 +30,12 @@ class Anthropic extends BaseLLM {
|
|||
description: tool.function.description,
|
||||
input_schema: tool.function.parameters,
|
||||
})),
|
||||
tool_choice: options.toolChoice
|
||||
? {
|
||||
type: "tool",
|
||||
name: options.toolChoice.function.name,
|
||||
}
|
||||
: undefined,
|
||||
};
|
||||
|
||||
return finalOptions;
|
||||
|
|
|
|||
|
|
@ -1,7 +1,7 @@
|
|||
import { ChatMessage, CompletionOptions, LLMOptions } from "../../index.js";
|
||||
import { BaseLLM } from "../index.js";
|
||||
|
||||
type MockMessage = ChatMessage | "REPEAT_LAST_MSG";
|
||||
type MockMessage = ChatMessage | "REPEAT_LAST_MSG" | "REPEAT_SYSTEM_MSG";
|
||||
|
||||
class MockLLM extends BaseLLM {
|
||||
public completion: string = "Test Completion";
|
||||
|
|
@ -42,6 +42,13 @@ class MockLLM extends BaseLLM {
|
|||
content: messages[messages.length - 1].content,
|
||||
};
|
||||
break;
|
||||
case "REPEAT_SYSTEM_MSG":
|
||||
yield {
|
||||
role: "assistant",
|
||||
content:
|
||||
messages.find((m) => m.role === "system")?.content || "",
|
||||
};
|
||||
break;
|
||||
default:
|
||||
yield message;
|
||||
}
|
||||
|
|
|
|||
|
|
@ -273,10 +273,8 @@ class Ollama extends BaseLLM {
|
|||
content: "",
|
||||
};
|
||||
|
||||
if (typeof message.content === "string") {
|
||||
ollamaMessage.content = message.content;
|
||||
} else {
|
||||
ollamaMessage.content = renderChatMessage(message);
|
||||
ollamaMessage.content = renderChatMessage(message);
|
||||
if (Array.isArray(message.content)) {
|
||||
const images: string[] = [];
|
||||
message.content.forEach((part) => {
|
||||
if (part.type === "imageUrl" && part.imageUrl) {
|
||||
|
|
|
|||
|
|
@ -113,6 +113,10 @@ class OpenAI extends BaseLLM {
|
|||
};
|
||||
}
|
||||
|
||||
protected extraBodyProperties(): Record<string, any> {
|
||||
return {};
|
||||
}
|
||||
|
||||
protected getMaxStopWords(): number {
|
||||
const url = new URL(this.apiBase!);
|
||||
|
||||
|
|
@ -150,6 +154,10 @@ class OpenAI extends BaseLLM {
|
|||
finalOptions.messages = formatMessageForO1(finalOptions.messages);
|
||||
}
|
||||
|
||||
if (options.model === "o1") {
|
||||
finalOptions.stream = false;
|
||||
}
|
||||
|
||||
if (options.prediction && this.supportsPrediction(options.model)) {
|
||||
if (finalOptions.presence_penalty) {
|
||||
// prediction doesn't support > 0
|
||||
|
|
@ -241,6 +249,11 @@ class OpenAI extends BaseLLM {
|
|||
body.messages = formatMessageForO1(body.messages);
|
||||
}
|
||||
|
||||
if (body.model === "o1") {
|
||||
// o1 doesn't support streaming
|
||||
body.stream = false;
|
||||
}
|
||||
|
||||
if (body.prediction && this.supportsPrediction(body.model)) {
|
||||
if (body.presence_penalty) {
|
||||
// prediction doesn't support > 0
|
||||
|
|
@ -278,6 +291,7 @@ class OpenAI extends BaseLLM {
|
|||
body: JSON.stringify({
|
||||
...args,
|
||||
stream: true,
|
||||
...this.extraBodyProperties(),
|
||||
}),
|
||||
signal,
|
||||
});
|
||||
|
|
@ -319,7 +333,10 @@ class OpenAI extends BaseLLM {
|
|||
const response = await this.fetch(this._getEndpoint("chat/completions"), {
|
||||
method: "POST",
|
||||
headers: this._getHeaders(),
|
||||
body: JSON.stringify(body),
|
||||
body: JSON.stringify({
|
||||
...body,
|
||||
...this.extraBodyProperties(),
|
||||
}),
|
||||
signal,
|
||||
});
|
||||
|
||||
|
|
@ -358,6 +375,7 @@ class OpenAI extends BaseLLM {
|
|||
presence_penalty: options.presencePenalty,
|
||||
stop: options.stop,
|
||||
stream: true,
|
||||
...this.extraBodyProperties(),
|
||||
}),
|
||||
headers: {
|
||||
"Content-Type": "application/json",
|
||||
|
|
@ -404,6 +422,7 @@ class OpenAI extends BaseLLM {
|
|||
body: JSON.stringify({
|
||||
input: chunks,
|
||||
model: this.model,
|
||||
...this.extraBodyProperties(),
|
||||
}),
|
||||
headers: {
|
||||
Authorization: `Bearer ${this.apiKey}`,
|
||||
|
|
|
|||
|
|
@ -10,11 +10,33 @@ class ContinueProxy extends OpenAI {
|
|||
this.apiBase = new URL("openai/v1/", value.controlPlaneProxyUrl).toString();
|
||||
}
|
||||
|
||||
// The apiKey and apiBase are set to the values for the proxy,
|
||||
// but we need to keep track of the actual values that the proxy will use
|
||||
// to call whatever LLM API is chosen
|
||||
private actualApiBase?: string;
|
||||
private actualApiKey?: string;
|
||||
|
||||
constructor(options: LLMOptions) {
|
||||
super(options);
|
||||
this.actualApiBase = options.apiBase;
|
||||
this.actualApiKey = options.apiKey;
|
||||
}
|
||||
|
||||
static providerName = "continue-proxy";
|
||||
static defaultOptions: Partial<LLMOptions> = {
|
||||
useLegacyCompletionsEndpoint: false,
|
||||
};
|
||||
|
||||
protected extraBodyProperties(): Record<string, any> {
|
||||
return {
|
||||
continueProperties: {
|
||||
apiKey: this.actualApiKey,
|
||||
apiBase: this.actualApiBase,
|
||||
apiKeySecret: this.apiKeySecret,
|
||||
},
|
||||
};
|
||||
}
|
||||
|
||||
protected _getHeaders() {
|
||||
const headers: any = super._getHeaders();
|
||||
headers["x-continue-unique-id"] = Telemetry.uniqueId;
|
||||
|
|
|
|||
|
|
@ -100,6 +100,7 @@ export function toChatBody(
|
|||
stream: options.stream ?? true,
|
||||
stop: options.stop,
|
||||
prediction: options.prediction,
|
||||
tool_choice: options.toolChoice,
|
||||
};
|
||||
|
||||
if (options.tools?.length) {
|
||||
|
|
|
|||
15
core/package-lock.json
generated
15
core/package-lock.json
generated
|
|
@ -13,7 +13,7 @@
|
|||
"@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.0",
|
||||
"@continuedev/config-yaml": "^1.0.11",
|
||||
"@continuedev/fetch": "^1.0.4",
|
||||
"@continuedev/llm-info": "^1.0.2",
|
||||
"@continuedev/openai-adapters": "^1.0.10",
|
||||
|
|
@ -3030,18 +3030,19 @@
|
|||
}
|
||||
},
|
||||
"node_modules/@continuedev/config-types": {
|
||||
"version": "1.0.13",
|
||||
"resolved": "https://registry.npmjs.org/@continuedev/config-types/-/config-types-1.0.13.tgz",
|
||||
"integrity": "sha512-5Qmy2x58uhW1GYknypFT/7iwxEJSbt8gMgfQReV7d6xjbJ09ISOTki3hIfCilKrTCo0gIY6pzKEfCoQkUTEi6Q==",
|
||||
"version": "1.0.14",
|
||||
"resolved": "https://registry.npmjs.org/@continuedev/config-types/-/config-types-1.0.14.tgz",
|
||||
"integrity": "sha512-PVHyHPyRXd2QsaNgnCpiKYU3uHFTlyuQSkqE8OwrBmQqO6/TXUVIr/2EGtyIZGrml4Y+rGMSH40WU4/0t4SGpQ==",
|
||||
"dependencies": {
|
||||
"zod": "^3.23.8"
|
||||
}
|
||||
},
|
||||
"node_modules/@continuedev/config-yaml": {
|
||||
"version": "1.0.0",
|
||||
"resolved": "https://registry.npmjs.org/@continuedev/config-yaml/-/config-yaml-1.0.0.tgz",
|
||||
"integrity": "sha512-NwagzzpnPLbMC3delzFSjWiFv5fp8ReFjdMQF0ko0Xg+U0Myja90k/J7JWGegF/SZMABxc/OJchElJFr58TwGA==",
|
||||
"version": "1.0.11",
|
||||
"resolved": "https://registry.npmjs.org/@continuedev/config-yaml/-/config-yaml-1.0.11.tgz",
|
||||
"integrity": "sha512-E3RBQfNEPBGBmlnAbCXgeAasDzTjo4ON/HH0hr5g292i+WdAN3i/omjQ6Iusx00L1Fz7klZGJePZ3GVQKOGEUg==",
|
||||
"dependencies": {
|
||||
"@continuedev/config-types": "^1.0.14",
|
||||
"yaml": "^2.6.1",
|
||||
"zod": "^3.23.8"
|
||||
}
|
||||
|
|
|
|||
|
|
@ -46,7 +46,7 @@
|
|||
"@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.0",
|
||||
"@continuedev/config-yaml": "^1.0.11",
|
||||
"@continuedev/fetch": "^1.0.4",
|
||||
"@continuedev/llm-info": "^1.0.2",
|
||||
"@continuedev/openai-adapters": "^1.0.10",
|
||||
|
|
|
|||
|
|
@ -16,11 +16,11 @@ export async function getPromptFilesFromDir(
|
|||
return [];
|
||||
}
|
||||
|
||||
const paths = await walkDir(dir, ide, { ignoreFiles: [] });
|
||||
const promptFilePaths = paths.filter((p) => p.endsWith(".prompt"));
|
||||
const results = promptFilePaths.map(async (path) => {
|
||||
const content = await ide.readFile(path); // make a try catch
|
||||
return { path, content };
|
||||
const uris = await walkDir(dir, ide, { ignoreFiles: [] });
|
||||
const promptFilePaths = uris.filter((p) => p.endsWith(".prompt"));
|
||||
const results = promptFilePaths.map(async (uri) => {
|
||||
const content = await ide.readFile(uri); // make a try catch
|
||||
return { path: uri, content };
|
||||
});
|
||||
return Promise.all(results);
|
||||
} catch (e) {
|
||||
|
|
|
|||
|
|
@ -1,6 +1,4 @@
|
|||
import { AutocompleteInput } from "../autocomplete/util/types";
|
||||
import { ProfileDescription } from "../config/ConfigHandler";
|
||||
|
||||
import { ConfigResult } from "@continuedev/config-yaml";
|
||||
import type {
|
||||
BrowserSerializedContinueConfig,
|
||||
ChatMessage,
|
||||
|
|
@ -14,6 +12,7 @@ import type {
|
|||
LLMFullCompletionOptions,
|
||||
ModelDescription,
|
||||
ModelRoles,
|
||||
PromptLog,
|
||||
RangeInFile,
|
||||
SerializedContinueConfig,
|
||||
Session,
|
||||
|
|
@ -21,28 +20,8 @@ import type {
|
|||
SiteIndexingConfig,
|
||||
ToolCall,
|
||||
} from "../";
|
||||
import { ConfigResult } from "../config/load";
|
||||
|
||||
export type ProtocolGeneratorYield<T> = {
|
||||
done?: boolean;
|
||||
content: T;
|
||||
};
|
||||
export type ProtocolGeneratorType<Y> = AsyncGenerator<
|
||||
ProtocolGeneratorYield<Y>
|
||||
>;
|
||||
|
||||
export type AsyncGeneratorYieldType<T> =
|
||||
T extends AsyncGenerator<infer Y, any, any>
|
||||
? Y extends ProtocolGeneratorYield<infer PR>
|
||||
? PR
|
||||
: never
|
||||
: never;
|
||||
// export type AsyncGeneratorReturnType<T> =
|
||||
// T extends AsyncGenerator<any, infer R, any>
|
||||
// ? R extends ProtocolGeneratorYield<infer PR>
|
||||
// ? PR
|
||||
// : never
|
||||
// : never;
|
||||
import { AutocompleteInput } from "../autocomplete/util/types";
|
||||
import { ProfileDescription } from "../config/ConfigHandler";
|
||||
|
||||
export type OnboardingModes =
|
||||
| "Local"
|
||||
|
|
@ -120,7 +99,7 @@ export type ToCoreFromIdeOrWebviewProtocol = {
|
|||
historyIndex: number;
|
||||
selectedCode: RangeInFile[];
|
||||
},
|
||||
ProtocolGeneratorType<string>,
|
||||
AsyncGenerator<string>,
|
||||
];
|
||||
"llm/complete": [
|
||||
{
|
||||
|
|
@ -137,7 +116,7 @@ export type ToCoreFromIdeOrWebviewProtocol = {
|
|||
completionOptions: LLMFullCompletionOptions;
|
||||
title: string;
|
||||
},
|
||||
ProtocolGeneratorType<string>,
|
||||
AsyncGenerator<string>,
|
||||
];
|
||||
"llm/streamChat": [
|
||||
{
|
||||
|
|
@ -145,7 +124,7 @@ export type ToCoreFromIdeOrWebviewProtocol = {
|
|||
completionOptions: LLMFullCompletionOptions;
|
||||
title: string;
|
||||
},
|
||||
ProtocolGeneratorType<ChatMessage>,
|
||||
AsyncGenerator<ChatMessage, PromptLog>,
|
||||
];
|
||||
streamDiffLines: [
|
||||
{
|
||||
|
|
@ -156,7 +135,7 @@ export type ToCoreFromIdeOrWebviewProtocol = {
|
|||
language: string | undefined;
|
||||
modelTitle: string | undefined;
|
||||
},
|
||||
ProtocolGeneratorType<DiffLine>,
|
||||
AsyncGenerator<DiffLine>,
|
||||
];
|
||||
"chatDescriber/describe": [
|
||||
{
|
||||
|
|
|
|||
|
|
@ -13,8 +13,8 @@ import type {
|
|||
Problem,
|
||||
Range,
|
||||
RangeInFile,
|
||||
TerminalOptions,
|
||||
Thread,
|
||||
TerminalOptions
|
||||
} from "../";
|
||||
|
||||
export interface GetGhTokenArgs {
|
||||
|
|
@ -29,7 +29,7 @@ export type ToIdeFromWebviewOrCoreProtocol = {
|
|||
showVirtualFile: [{ name: string; content: string }, void];
|
||||
openFile: [{ path: string }, void];
|
||||
openUrl: [string, void];
|
||||
runCommand: [{ command: string, options?: TerminalOptions }, void];
|
||||
runCommand: [{ command: string; options?: TerminalOptions }, void];
|
||||
getSearchResults: [{ query: string }, string];
|
||||
subprocess: [{ command: string; cwd?: string }, [string, string]];
|
||||
saveFile: [{ filepath: string }, void];
|
||||
|
|
@ -72,6 +72,8 @@ export type ToIdeFromWebviewOrCoreProtocol = {
|
|||
isTelemetryEnabled: [undefined, boolean];
|
||||
getUniqueId: [undefined, string];
|
||||
getTags: [string, IndexTag[]];
|
||||
readSecrets: [{ keys: string[] }, Record<string, string>];
|
||||
writeSecrets: [{ secrets: Record<string, string> }, void];
|
||||
// end methods from IDE type
|
||||
|
||||
getIdeSettings: [undefined, IdeSettings];
|
||||
|
|
@ -92,7 +94,7 @@ export type ToIdeFromWebviewOrCoreProtocol = {
|
|||
|
||||
getGitHubAuthToken: [GetGhTokenArgs, string | undefined];
|
||||
getControlPlaneSessionInfo: [
|
||||
{ silent: boolean },
|
||||
{ silent: boolean; useOnboarding: boolean },
|
||||
ControlPlaneSessionInfo | undefined,
|
||||
];
|
||||
logoutOfControlPlane: [undefined, void];
|
||||
|
|
|
|||
|
|
@ -29,6 +29,14 @@ export class MessageIde implements IDE {
|
|||
) => void,
|
||||
) {}
|
||||
|
||||
async readSecrets(keys: string[]): Promise<Record<string, string>> {
|
||||
return this.request("readSecrets", { keys });
|
||||
}
|
||||
|
||||
async writeSecrets(secrets: { [key: string]: string }): Promise<void> {
|
||||
return this.request("writeSecrets", { secrets });
|
||||
}
|
||||
|
||||
fileExists(fileUri: string): Promise<boolean> {
|
||||
return this.request("fileExists", { filepath: fileUri });
|
||||
}
|
||||
|
|
@ -152,7 +160,7 @@ export class MessageIde implements IDE {
|
|||
await this.request("openUrl", url);
|
||||
}
|
||||
|
||||
async runCommand(command: string, options?: TerminalOptions): Promise<void> {
|
||||
async runCommand(command: string, options?: TerminalOptions): Promise<void> {
|
||||
await this.request("runCommand", { command, options });
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -1,17 +1,53 @@
|
|||
import { FromWebviewProtocol } from ".";
|
||||
|
||||
interface ErrorWebviewMessengerResult {
|
||||
done: boolean;
|
||||
export interface ErrorWebviewMessage {
|
||||
status: "error";
|
||||
error: string;
|
||||
done: true;
|
||||
}
|
||||
|
||||
interface SuccessWebviewMessengerResult<T extends keyof FromWebviewProtocol> {
|
||||
done: boolean;
|
||||
export interface SuccessWebviewSingleMessage<T> {
|
||||
done: true;
|
||||
status: "success";
|
||||
content: FromWebviewProtocol[T][1];
|
||||
content: T;
|
||||
}
|
||||
|
||||
export type WebviewMessengerResult<T extends keyof FromWebviewProtocol> =
|
||||
| ErrorWebviewMessengerResult
|
||||
| SuccessWebviewMessengerResult<T>;
|
||||
export type WebviewSingleMessage<T> =
|
||||
| ErrorWebviewMessage
|
||||
| SuccessWebviewSingleMessage<T>;
|
||||
|
||||
export type WebviewSingleProtocolMessage<T extends keyof FromWebviewProtocol> =
|
||||
WebviewSingleMessage<FromWebviewProtocol[T][1]>;
|
||||
|
||||
// Generators
|
||||
export type GeneratorYieldType<T> =
|
||||
T extends AsyncGenerator<infer Yield, any, any> ? Yield : never;
|
||||
export type GeneratorReturnType<T> =
|
||||
T extends AsyncGenerator<any, infer Return, any> ? Return : never;
|
||||
|
||||
type SuccessWebviewGeneratorMessage<T, R> =
|
||||
| {
|
||||
status: "success";
|
||||
done: false;
|
||||
content: T;
|
||||
}
|
||||
| {
|
||||
status: "success";
|
||||
done: true;
|
||||
content: R;
|
||||
};
|
||||
|
||||
export type WebviewGeneratorMessage<T, R> =
|
||||
| SuccessWebviewGeneratorMessage<T, R>
|
||||
| ErrorWebviewMessage;
|
||||
|
||||
export type WebviewProtocolGeneratorMessage<
|
||||
T extends keyof FromWebviewProtocol,
|
||||
> = WebviewGeneratorMessage<
|
||||
GeneratorYieldType<FromWebviewProtocol[T][1]>,
|
||||
GeneratorReturnType<FromWebviewProtocol[T][1]>
|
||||
>;
|
||||
|
||||
export type WebviewMessage<T = unknown, R = unknown> =
|
||||
| WebviewSingleMessage<T>
|
||||
| WebviewGeneratorMessage<T, R>;
|
||||
|
|
|
|||
|
|
@ -1,11 +1,8 @@
|
|||
import { ConfigResult } from "../config/load.js";
|
||||
import { ConfigValidationError } from "../config/validation.js";
|
||||
|
||||
import { ConfigResult, ConfigValidationError } from "@continuedev/config-yaml";
|
||||
import type {
|
||||
BrowserSerializedContinueConfig,
|
||||
ContextItemWithId,
|
||||
ContextProviderName,
|
||||
ContextSubmenuItem,
|
||||
IndexingProgressUpdate,
|
||||
IndexingStatus,
|
||||
PackageDocsResult,
|
||||
|
|
|
|||
|
|
@ -21,6 +21,13 @@ import { GetGhTokenArgs } from "../protocol/ide.js";
|
|||
|
||||
class FileSystemIde implements IDE {
|
||||
constructor(private readonly workspaceDir: string) {}
|
||||
|
||||
async readSecrets(keys: string[]): Promise<Record<string, string>> {
|
||||
return {};
|
||||
}
|
||||
|
||||
async writeSecrets(secrets: { [key: string]: string }): Promise<void> {}
|
||||
|
||||
showToast(
|
||||
type: ToastType,
|
||||
message: string,
|
||||
|
|
|
|||
|
|
@ -4,7 +4,7 @@ import * as URI from "uri-js";
|
|||
|
||||
// CAN ONLY BE USED IN CORE
|
||||
|
||||
// Converts a local path to a file:// URI
|
||||
// Converts a local path to a file:/// URI
|
||||
export function localPathToUri(path: string) {
|
||||
const url = pathToFileURL(path);
|
||||
return URI.normalize(url.toString());
|
||||
|
|
|
|||
|
|
@ -301,11 +301,18 @@ export function getPathToRemoteConfig(remoteConfigServerUrl: string): string {
|
|||
return dir;
|
||||
}
|
||||
|
||||
export function internalBetaPathExists(): boolean {
|
||||
const sPath = path.join(getContinueGlobalPath(), ".internal_beta");
|
||||
export function usePlatformPathExists(): boolean {
|
||||
const sPath = path.join(getContinueGlobalPath(), ".use_platform");
|
||||
return fs.existsSync(sPath);
|
||||
}
|
||||
|
||||
export function readUsePlatform(): string | undefined {
|
||||
const sPath = path.join(getContinueGlobalPath(), ".use_platform");
|
||||
if (fs.existsSync(sPath)) {
|
||||
return fs.readFileSync(sPath, "utf8");
|
||||
}
|
||||
}
|
||||
|
||||
export function getConfigJsonPathForRemote(
|
||||
remoteConfigServerUrl: string,
|
||||
): string {
|
||||
|
|
|
|||
|
|
@ -261,9 +261,9 @@ Uses the top _n_ levels (defaulting to 3) of the call stack for that thread.
|
|||
|
||||
### `@Repository Map`
|
||||
|
||||
Reference the outline of your codebase.
|
||||
Reference the outline of your codebase. By default, signatures are included along with file in the repo map.
|
||||
|
||||
`includeSignatures` params can be used to include signatures for all files in the repo. Use with caution as will increase context size significantly. `includeSignatures` will not work if indexing is disabled.
|
||||
`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"
|
||||
{
|
||||
|
|
@ -271,7 +271,7 @@ Reference the outline of your codebase.
|
|||
{
|
||||
"name": "repo-map",
|
||||
"params": {
|
||||
"includeSignatures": false
|
||||
"includeSignatures": false // default true
|
||||
}
|
||||
}
|
||||
]
|
||||
|
|
|
|||
|
|
@ -15,7 +15,7 @@ We recommend configuring **Llama3.1 8B** as your chat model.
|
|||
{
|
||||
"title": "Llama3.1 8B Instruct",
|
||||
"provider": "vllm",
|
||||
"model": "meta-llama/Meta-Llama-3.1-8B-Instruct"
|
||||
"model": "meta-llama/Meta-Llama-3.1-8B-Instruct",
|
||||
"apiBase": "http://<vllm chat endpoint>/v1"
|
||||
}
|
||||
]
|
||||
|
|
|
|||
|
|
@ -64,7 +64,7 @@ To configure a remote instance of Ollama, add the `"apiBase"` property to your m
|
|||
{
|
||||
"title": "Llama3.1 8B",
|
||||
"provider": "ollama",
|
||||
"model": "llama3.1:8b"
|
||||
"model": "llama3.1:8b",
|
||||
"apiBase": "http://<my endpoint>:11434"
|
||||
}
|
||||
]
|
||||
|
|
|
|||
|
|
@ -251,16 +251,6 @@ Example
|
|||
]
|
||||
```
|
||||
|
||||
### `analytics`
|
||||
|
||||
Configuration for analytics tracking.
|
||||
|
||||
**Properties:**
|
||||
|
||||
- `provider`: Analytics provider (`"posthog"` or `"logstash"`).
|
||||
- `url`: URL for analytics data.
|
||||
- `clientKey`: Client key for analytics.
|
||||
|
||||
### `slashCommands`
|
||||
|
||||
Custom commands initiated by typing "/" in the sidebar. Commands include predefined functionality or may be user-defined.
|
||||
|
|
@ -420,6 +410,7 @@ Several experimental config parameters are available, as described below:
|
|||
- `fix`: Prompt for fixing code.
|
||||
- `optimize`: Prompt for optimizing code.
|
||||
- `useChromiumForDocsCrawling`: Use Chromium to crawl docs locally. Useful if the default Cheerio crawler fails on sites that require JavaScript rendering. Downloads and installs Chromium to `~/.continue/.utils`..
|
||||
- `modelContextProtocolServers`: See [Model Context Protocol](/customize/context-providers#model-context-protocol)
|
||||
|
||||
Example
|
||||
|
||||
|
|
@ -441,7 +432,16 @@ Example
|
|||
"fixGrammar": "Fix grammar in the above but allow for typos."
|
||||
},
|
||||
"readResponseTTS": false,
|
||||
"useChromiumForDocsCrawling": true
|
||||
"useChromiumForDocsCrawling": true,
|
||||
"modelContextProtocolServers": [
|
||||
{
|
||||
"transport": {
|
||||
"type": "stdio",
|
||||
"command": "uvx",
|
||||
"args": ["mcp-server-sqlite", "--db-path", "/Users/NAME/test.db"]
|
||||
}
|
||||
}
|
||||
]
|
||||
}
|
||||
}
|
||||
```
|
||||
|
|
|
|||
347
docs/docs/yaml-migration.md
Normal file
347
docs/docs/yaml-migration.md
Normal file
|
|
@ -0,0 +1,347 @@
|
|||
---
|
||||
title: Config Migration to YAML
|
||||
description: Reference for migrating from JSON to YAML Continue configuration.
|
||||
keywords: [config, yaml, configuration, customize, customization, migration]
|
||||
---
|
||||
|
||||
# Migrating Config to YAML
|
||||
|
||||
Continue's YAML configuration format provides more readable, maintainable, consistent configuration files, as well as new configuration options and removal of some old configuration options. YAML is the preferred format and will be used to integrate with future Continue products. Below is a brief guide for migration from `config.json` to `config.yaml`.
|
||||
|
||||
See also
|
||||
|
||||
- [Intro to YAML](https://yaml.org/)
|
||||
- [JSON Continue Config Reference](/reference)
|
||||
- [YAML Continue Config Reference](/yaml-reference)
|
||||
|
||||
## Create YAML file
|
||||
|
||||
Create a `config.yaml` file in your Continue Global Directory (`~/.continue` on Mac, `%USERPROFILE%\.continue`) alongside your current `config.json` file. If a `config.yaml` file is present, it will be loaded instead of `config.json`.
|
||||
|
||||
Give your configuration a `name` and a `version`:
|
||||
|
||||
```yaml title="config.yaml"
|
||||
name: my-configuration
|
||||
version: 0.0.1
|
||||
```
|
||||
|
||||
### Models
|
||||
|
||||
Add all model configurations in `config.json`, including models in `models`, `tabAutocompleteModel`, `embeddingsProvider`, and `reranker`, to the `models` section of your new YAML config file. A new `roles` YAML field specifies which roles a model can be used for, with possible values `chat`, `autocomplete`, `embed`, `rerank`, `edit`, `apply`, `summarize`.
|
||||
|
||||
- `models` in config should have `roles: [chat]`
|
||||
- `tabAutocompleteModel`(s) in config should have `roles: [autocomplete]`
|
||||
- `embeddingsProvider` in config should have `roles: [embed]`
|
||||
- `reranker` in config should have `roles: [rerank]`
|
||||
- `experimental.modelRoles` is replaced by simply adding roles to the model
|
||||
- `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 `completionOptions` are replaced by `defaultCompletionOptions`, with minor changes. See [YAML Continue Config Reference](/yaml-reference#completionoptions)
|
||||
|
||||
<!-- TODO - API KEY -> apiKeySecret? -->
|
||||
<!-- TODO - ollama autodetect supported? -->
|
||||
|
||||
**Before**
|
||||
|
||||
```json title="config.json"
|
||||
{
|
||||
"models": [
|
||||
{
|
||||
"title": "GPT-4",
|
||||
"provider": "openai",
|
||||
"model": "gpt-4",
|
||||
"apiKey": "YOUR_API_KEY",
|
||||
"completionOptions": {
|
||||
"temperature": 0.5,
|
||||
"maxTokens": 2000
|
||||
}
|
||||
},
|
||||
{
|
||||
"title": "Ollama",
|
||||
"provider": "ollama",
|
||||
"model": "AUTODETECT"
|
||||
},
|
||||
{
|
||||
"title": "My Open AI Compatible Model",
|
||||
"provider": "openai",
|
||||
"apiBase": "http://3.3.3.3/v1",
|
||||
"model": "my-openai-compatible-model",
|
||||
"requestOptions": {
|
||||
"headers": { "X-Auth-Token": "<API_KEY>" }
|
||||
}
|
||||
}
|
||||
],
|
||||
"tabAutocompleteModel": {
|
||||
"title": "My Starcoder",
|
||||
"provider": "ollama",
|
||||
"model": "starcoder2:3b"
|
||||
},
|
||||
"embeddingsProvider": {
|
||||
"provider": "openai",
|
||||
"model": "text-embedding-ada-002",
|
||||
"apiKey": "<API_KEY>",
|
||||
"maxChunkSize": 256,
|
||||
"maxBatchSize": 5
|
||||
},
|
||||
"reranker": {
|
||||
"name": "voyage",
|
||||
"params": {
|
||||
"model": "rerank-2",
|
||||
"apiKey": "<VOYAGE_API_KEY>"
|
||||
}
|
||||
}
|
||||
}
|
||||
```
|
||||
|
||||
**After**
|
||||
|
||||
```yaml title="config.yaml"
|
||||
models:
|
||||
- name: GPT-4
|
||||
provider: openai
|
||||
model: gpt-4
|
||||
apiKey: <API_KEY>
|
||||
defaultCompletionOptions:
|
||||
temperature: 0.5
|
||||
maxTokens: 2000
|
||||
roles:
|
||||
- chat
|
||||
- edit
|
||||
|
||||
- name: My Voyage Reranker
|
||||
provider: voyage
|
||||
apiKey: <API_KEY>
|
||||
roles:
|
||||
- rerank
|
||||
|
||||
- name: My Starcoder
|
||||
provider: ollama
|
||||
model: starcoder2:3b
|
||||
roles:
|
||||
- autocomplete
|
||||
|
||||
- name: My Ada Embedder
|
||||
provider: openai
|
||||
apiKey: <API_KEY>
|
||||
roles:
|
||||
- embed
|
||||
|
||||
- name: Ollama Autodetect
|
||||
provider: ollama
|
||||
model: AUTODETECT
|
||||
|
||||
- name: My Open AI Compatible Model - Apply
|
||||
provider: openai
|
||||
model: my-openai-compatible-model
|
||||
apiBase: http://3.3.3.3/v1
|
||||
requestOptions:
|
||||
headers:
|
||||
X-Auth-Token: <API_KEY>
|
||||
roles:
|
||||
- chat
|
||||
- apply
|
||||
```
|
||||
|
||||
Note that the `repoMapFileSelection` experimental model role has been deprecated.
|
||||
|
||||
### Context Providers
|
||||
|
||||
The JSON `contextProviders` field is replaced by the YAML `context` array.
|
||||
|
||||
- JSON `name` maps to `uses`
|
||||
- JSON `params` map to `with`
|
||||
|
||||
**Before**
|
||||
|
||||
```json title="config.json"
|
||||
{
|
||||
"contextProviders": [
|
||||
{
|
||||
"name": "docs"
|
||||
},
|
||||
{
|
||||
"name": "codebase",
|
||||
"params": {
|
||||
"nRetrieve": 30,
|
||||
"nFinal": 3
|
||||
}
|
||||
},
|
||||
{
|
||||
"name": "diff",
|
||||
"params": {}
|
||||
}
|
||||
]
|
||||
}
|
||||
```
|
||||
|
||||
**After**
|
||||
|
||||
```yaml title="config.yaml"
|
||||
context:
|
||||
- uses: docs
|
||||
|
||||
- uses: codebase
|
||||
with:
|
||||
nRetrieve: 30
|
||||
nFinal: 3
|
||||
|
||||
- uses: diff
|
||||
```
|
||||
|
||||
### System Message
|
||||
|
||||
The `systemMessage` property has been replaced with a `rules` property that takes an array of strings.
|
||||
|
||||
**Before**
|
||||
|
||||
```json title="config.json"
|
||||
{
|
||||
"systemMessage": "Always give concise responses"
|
||||
}
|
||||
```
|
||||
|
||||
**After**
|
||||
|
||||
```yaml title="config.yaml"
|
||||
rules:
|
||||
- Always give concise responses
|
||||
```
|
||||
|
||||
### Prompts
|
||||
|
||||
Rather than with `customCommands`, you can now use the `prompts` field to define custom prompts.
|
||||
|
||||
**Before**
|
||||
|
||||
```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."
|
||||
}
|
||||
]
|
||||
}
|
||||
```
|
||||
|
||||
**After**
|
||||
|
||||
```yaml title="config.yaml"
|
||||
prompts:
|
||||
- name: check
|
||||
description: Check for mistakes in my code
|
||||
prompt: |
|
||||
Please read the highlighted code and check for any mistakes. You should look for the following, and be extremely vigilant:
|
||||
- Syntax errors
|
||||
- Logic errors
|
||||
- Security vulnerabilities
|
||||
- Performance issues
|
||||
- Anything else that looks wrong
|
||||
|
||||
Once 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.
|
||||
```
|
||||
|
||||
### Documentation
|
||||
|
||||
Documentation is largely the same, but the `title` property has been replaced with `name`. The `startUrl`, `rootUrl`, and `faviconUrl` properties remain.
|
||||
|
||||
**Before**
|
||||
|
||||
```json title="config.json"
|
||||
{
|
||||
"docs": [
|
||||
{
|
||||
"startUrl": "https://docs.nestjs.com/",
|
||||
"title": "nest.js"
|
||||
},
|
||||
{
|
||||
"startUrl": "https://mysite.com/docs/",
|
||||
"title": "My site"
|
||||
}
|
||||
]
|
||||
}
|
||||
```
|
||||
|
||||
**After**
|
||||
|
||||
```yaml title="config.yaml"
|
||||
docs:
|
||||
- name: nest.js
|
||||
startUrl: https://docs.nestjs.com/
|
||||
|
||||
- name: My site
|
||||
startUrl: https://mysite.com/docs/
|
||||
```
|
||||
|
||||
### MCP Servers
|
||||
|
||||
<!-- TODO this is definitely wrong -->
|
||||
|
||||
**Properties:**
|
||||
|
||||
- `name` (**required**): The name of the MCP server.
|
||||
- `command` (**required**): The command used to start the server.
|
||||
- `args`: An optional array of arguments for the command.
|
||||
- `env`: An optional map of environment variables for the server process.
|
||||
|
||||
**Before**
|
||||
|
||||
```json title="config.json"
|
||||
{
|
||||
"experimental": {
|
||||
"modelContextProtocolServers": [
|
||||
{
|
||||
"transport": {
|
||||
"type": "stdio",
|
||||
"command": "uvx",
|
||||
"args": ["mcp-server-sqlite", "--db-path", "/Users/NAME/test.db"],
|
||||
"env": {
|
||||
"KEY": "<VALUE>"
|
||||
}
|
||||
}
|
||||
}
|
||||
]
|
||||
}
|
||||
}
|
||||
```
|
||||
|
||||
**After**
|
||||
|
||||
```yaml title="config.yaml"
|
||||
mcpServers:
|
||||
- name: My MCP Server
|
||||
command: uvx
|
||||
args:
|
||||
- mcp-server-sqlite
|
||||
- --db-path
|
||||
- /Users/NAME/test.db
|
||||
env:
|
||||
KEY: <VALUE>
|
||||
```
|
||||
|
||||
---
|
||||
|
||||
## Deprecated configuration options
|
||||
|
||||
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
|
||||
|
||||
- Slash commands (JSON `slashCommands`)
|
||||
- top-level `requestOptions`
|
||||
- top-level `completionOptions`
|
||||
- `tabAutocompleteOptions`
|
||||
- `analytics`
|
||||
- `customCommands`
|
||||
- `disableSessionTitles`
|
||||
- `experimental`
|
||||
- `allowAnonymousTelemetry` (moved to user/IDE level)
|
||||
- `ui` (moved to user/IDE level)
|
||||
- `userToken`
|
||||
- `disableIndexing` (moved to user/IDE level)
|
||||
|
||||
## 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.
|
||||
321
docs/docs/yaml-reference.md
Normal file
321
docs/docs/yaml-reference.md
Normal file
|
|
@ -0,0 +1,321 @@
|
|||
---
|
||||
title: Config YAML Reference
|
||||
description: Reference for the Continue configuration YAML file
|
||||
keywords: [config, yaml, configuration, customize, customization]
|
||||
---
|
||||
|
||||
# Config YAML Reference
|
||||
|
||||
<!-- TODO - data and packages sections -->
|
||||
|
||||
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`)
|
||||
|
||||
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**)
|
||||
<!-- - [`packages`](#packages) -->
|
||||
- [`version`](#version) (**required**)
|
||||
- [`models`](#models)
|
||||
- [`context`](#context)
|
||||
- [`rules`](#rules)
|
||||
- [`prompts`](#prompts)
|
||||
- [`docs`](#docs)
|
||||
<!-- - [`data`](#data) -->
|
||||
<!-- - [`tools`](#tools) -->
|
||||
- [`mcpServers`](#mcpservers)
|
||||
|
||||
---
|
||||
|
||||
### `name`
|
||||
|
||||
The `name` property specifies the name of your project or configuration.
|
||||
|
||||
```yaml title="config.yaml"
|
||||
name: MyProject
|
||||
```
|
||||
|
||||
### `version`
|
||||
|
||||
The `version` property specifies the version of your project or configuration.
|
||||
|
||||
---
|
||||
|
||||
### `models`
|
||||
|
||||
The `models` section defines the language models used in your configuration. Models are used for functionalities such as chat, editing, and summarizing.
|
||||
|
||||
**Properties:**
|
||||
|
||||
- `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`.
|
||||
- `defaultCompletionOptions`: Default completion options for model settings.
|
||||
|
||||
**Properties:**
|
||||
|
||||
- `contextLength`: Maximum context length of the model, typically in tokens.
|
||||
- `maxTokens`: Maximum number of tokens to generate in a completion.
|
||||
- `temperature`: Controls the randomness of the completion. Values range from `0.0` (deterministic) to `1.0` (random).
|
||||
- `topP`: The cumulative probability for nucleus sampling.
|
||||
- `topK`: Maximum number of tokens considered at each step.
|
||||
- `stop`: An array of stop tokens that will terminate the completion.
|
||||
- `n`: Number of completions to generate.
|
||||
|
||||
- `requestOptions`: HTTP request options specific to the model.
|
||||
|
||||
**Properties:**
|
||||
|
||||
- `timeout`: Timeout for each request to the language model.
|
||||
- `verifySsl`: Whether to verify SSL certificates for requests.
|
||||
- `caBundlePath`: Path to a custom CA bundle for HTTP requests.
|
||||
- `proxy`: Proxy URL 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:
|
||||
|
||||
```yaml title="config.yaml"
|
||||
models:
|
||||
- name: GPT-4o
|
||||
provider: openai
|
||||
model: gpt-4o
|
||||
roles:
|
||||
- chat
|
||||
- edit
|
||||
- apply
|
||||
defaultCompletionOptions:
|
||||
temperature: 0.7
|
||||
maxTokens: 1500
|
||||
|
||||
- name: Codestral
|
||||
provider: mistral
|
||||
model: codestral-latest
|
||||
roles:
|
||||
- autocomplete
|
||||
```
|
||||
|
||||
---
|
||||
|
||||
### `context`
|
||||
|
||||
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)
|
||||
|
||||
**Properties:**
|
||||
|
||||
- `uses` (**required**): The identifier or name of the context provider (e.g., `code`, `docs`, `web`).
|
||||
- `with`: Optional parameters to configure the context provider's behavior.
|
||||
|
||||
**Example:**
|
||||
|
||||
```yaml title="config.yaml"
|
||||
context:
|
||||
- uses: files
|
||||
- uses: code
|
||||
- uses: codebase
|
||||
with:
|
||||
nFinal: 10
|
||||
- uses: docs
|
||||
- uses: diff
|
||||
- uses: folder
|
||||
- uses: terminal
|
||||
```
|
||||
|
||||
---
|
||||
|
||||
### `rules`
|
||||
|
||||
List of rules that the LLM should follow. These are inserted into the system message for all chat requests.
|
||||
|
||||
Example
|
||||
|
||||
```yaml title="config.yaml"
|
||||
rules:
|
||||
- Always annotate Python functions with their parameter and return types
|
||||
- Always write Google style docstrings for functions and classes
|
||||
```
|
||||
|
||||
---
|
||||
|
||||
### `prompts`
|
||||
|
||||
A list of custom prompts that can be invoked from the chat window. Each prompt has a name, description, and the actual prompt text.
|
||||
|
||||
```yaml title="config.yaml"
|
||||
prompts:
|
||||
- name: check
|
||||
description: Check for mistakes in my code
|
||||
prompt: |
|
||||
Please read the highlighted code and check for any mistakes. You should look for the following, and be extremely vigilant:
|
||||
- Syntax errors
|
||||
- Logic errors
|
||||
- Security vulnerabilities
|
||||
```
|
||||
|
||||
---
|
||||
|
||||
### `docs`
|
||||
|
||||
List of documentation sites to index.
|
||||
|
||||
**Properties:**
|
||||
|
||||
- `name` (**required**): Name 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
|
||||
- `favicon`: URL for site favicon (default is `/favicon.ico` from `startUrl`).
|
||||
|
||||
Example
|
||||
|
||||
```yaml title="config.yaml"
|
||||
docs:
|
||||
- name: Continue
|
||||
startUrl: https://docs.continue.dev/intro
|
||||
rootUrl: https://docs.continue.dev
|
||||
favicon: https://docs.continue.dev/favicon.ico
|
||||
```
|
||||
|
||||
---
|
||||
|
||||
<!-- ### `tools`
|
||||
|
||||
The `tools` section specifies external tools or APIs that can be used within your configuration.
|
||||
|
||||
**Properties:**
|
||||
|
||||
- `url` (**required**): The URL of the tool's API or endpoint.
|
||||
- `apiKey`: An optional API key required by the tool.
|
||||
|
||||
**Example:**
|
||||
|
||||
```yaml title="config.yaml"
|
||||
tools:
|
||||
- url: https://api.exampletool.com/tool1
|
||||
apiKey: YOUR_API_KEY
|
||||
```
|
||||
|
||||
--- -->
|
||||
|
||||
### `mcpServers`
|
||||
|
||||
<!-- TODO is this correct? -->
|
||||
|
||||
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.
|
||||
|
||||
**Properties:**
|
||||
|
||||
- `name` (**required**): The name of the MCP server.
|
||||
- `command` (**required**): The command used to start the server.
|
||||
- `args`: An optional array of arguments for the command.
|
||||
- `env`: An optional map of environment variables for the server process.
|
||||
|
||||
**Example:**
|
||||
|
||||
```yaml title="config.yaml"
|
||||
mcpServers:
|
||||
- name: My MCP Server
|
||||
command: uvx
|
||||
args:
|
||||
- mcp-server-sqlite
|
||||
- --db-path
|
||||
- /Users/NAME/test.db
|
||||
```
|
||||
|
||||
<!-- ### `data`
|
||||
|
||||
The `data` section specifies data providers used in your configuration. Data providers supply data or resources for use in various operations.
|
||||
|
||||
**Properties:**
|
||||
|
||||
- `provider` (**required**): The name of the data provider.
|
||||
|
||||
**Example:**
|
||||
|
||||
```yaml title="config.yaml"
|
||||
data:
|
||||
- provider: embeddings
|
||||
```
|
||||
|
||||
--- -->
|
||||
|
||||
---
|
||||
|
||||
## Complete YAML Config Example
|
||||
|
||||
Putting it all together, here's a complete example of a `config.yaml` configuration file:
|
||||
|
||||
```yaml title="config.yaml"
|
||||
name: MyProject
|
||||
version: 0.0.1
|
||||
|
||||
models:
|
||||
- name: GPT-4
|
||||
provider: openai
|
||||
model: gpt-4
|
||||
roles:
|
||||
- chat
|
||||
- edit
|
||||
defaultCompletionOptions:
|
||||
temperature: 0.5
|
||||
maxTokens: 2000
|
||||
requestOptions:
|
||||
headers:
|
||||
Authorization: Bearer YOUR_OPENAI_API_KEY
|
||||
|
||||
- name: Ollama Starcoder
|
||||
provider: ollama
|
||||
model: starcoder
|
||||
roles:
|
||||
- autocomplete
|
||||
defaultCompletionOptions:
|
||||
temperature: 0.3
|
||||
stop:
|
||||
- "\n"
|
||||
|
||||
rules:
|
||||
- Give concise responses
|
||||
- Always assume TypeScript rather than JavaScript
|
||||
|
||||
prompts:
|
||||
- name: test
|
||||
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.
|
||||
|
||||
context:
|
||||
- uses: diff
|
||||
- uses: file
|
||||
- uses: codebase
|
||||
- uses: code
|
||||
- uses: docs
|
||||
with:
|
||||
startUrl: https://docs.example.com/introduction
|
||||
rootUrl: https://docs.example.com
|
||||
maxDepth: 3
|
||||
|
||||
mcpServers:
|
||||
- name: DevServer
|
||||
command: npm
|
||||
args:
|
||||
- run
|
||||
- dev
|
||||
env:
|
||||
PORT: "3000"
|
||||
```
|
||||
|
|
@ -13,7 +13,6 @@ const config = {
|
|||
experimental_faster: true,
|
||||
},
|
||||
|
||||
|
||||
title: "Continue",
|
||||
tagline:
|
||||
"the open-source library for accelerating software development with language models",
|
||||
|
|
|
|||
2702
docs/package-lock.json
generated
2702
docs/package-lock.json
generated
File diff suppressed because it is too large
Load diff
|
|
@ -16,10 +16,10 @@
|
|||
"write-heading-ids": "docusaurus write-heading-ids"
|
||||
},
|
||||
"dependencies": {
|
||||
"@docusaurus/core": "^3.6.3",
|
||||
"@docusaurus/faster": "^3.6.3",
|
||||
"@docusaurus/plugin-client-redirects": "^3.6.3",
|
||||
"@docusaurus/preset-classic": "^3.6.3",
|
||||
"@docusaurus/core": "^3.7.0",
|
||||
"@docusaurus/faster": "^3.7.0",
|
||||
"@docusaurus/plugin-client-redirects": "^3.7.0",
|
||||
"@docusaurus/preset-classic": "^3.7.0",
|
||||
"@mdx-js/react": "^3.0.0",
|
||||
"clsx": "^2.1.0",
|
||||
"prism-react-renderer": "^2.3.1",
|
||||
|
|
@ -27,7 +27,7 @@
|
|||
"react-dom": "^18.2.0"
|
||||
},
|
||||
"devDependencies": {
|
||||
"@docusaurus/module-type-aliases": "^3.6.3",
|
||||
"@docusaurus/module-type-aliases": "^3.7.0",
|
||||
"nodemon": "^3.1.4"
|
||||
},
|
||||
"browserslist": {
|
||||
|
|
|
|||
|
|
@ -138,6 +138,16 @@ const sidebars = {
|
|||
label: "Reference",
|
||||
href: "/reference",
|
||||
},
|
||||
// {
|
||||
// type: "link",
|
||||
// label: "YAML Reference",
|
||||
// href: "/yaml-reference",
|
||||
// },
|
||||
// {
|
||||
// type: "link",
|
||||
// label: "YAML Migration",
|
||||
// href: "/yaml-migration",
|
||||
// },
|
||||
],
|
||||
};
|
||||
|
||||
|
|
|
|||
|
|
@ -1,31 +1,31 @@
|
|||
<component name="ProjectRunConfigurationManager">
|
||||
<configuration default="false" name="Run Extension" type="GradleRunConfiguration" factoryName="Gradle">
|
||||
<ExternalSystemSettings>
|
||||
<option name="env">
|
||||
<map>
|
||||
<entry key="GUI_URL" value="http://localhost:5173/jetbrains_index.html" />
|
||||
<entry key="ORG_GRADLE_PROJECT_platformVersion" value="2024.1" />
|
||||
<entry key="USE_TCP" value="true" />
|
||||
</map>
|
||||
</option>
|
||||
<option name="executionName" />
|
||||
<option name="externalProjectPath" value="$PROJECT_DIR$" />
|
||||
<option name="externalSystemIdString" value="GRADLE" />
|
||||
<option name="scriptParameters" value="" />
|
||||
<option name="taskDescriptions">
|
||||
<list />
|
||||
</option>
|
||||
<option name="taskNames">
|
||||
<list>
|
||||
<option value="runIde" />
|
||||
</list>
|
||||
</option>
|
||||
<option name="vmOptions" />
|
||||
</ExternalSystemSettings>
|
||||
<ExternalSystemDebugServerProcess>true</ExternalSystemDebugServerProcess>
|
||||
<ExternalSystemReattachDebugProcess>true</ExternalSystemReattachDebugProcess>
|
||||
<DebugAllEnabled>false</DebugAllEnabled>
|
||||
<RunAsTest>false</RunAsTest>
|
||||
<method v="2" />
|
||||
</configuration>
|
||||
<configuration default="false" name="Run Extension" type="GradleRunConfiguration" factoryName="Gradle">
|
||||
<ExternalSystemSettings>
|
||||
<option name="env">
|
||||
<map>
|
||||
<entry key="GUI_URL" value="http://localhost:5173/jetbrains_index.html"/>
|
||||
<entry key="ORG_GRADLE_PROJECT_platformVersion" value="2024.1"/>
|
||||
<entry key="USE_TCP" value="true"/>
|
||||
</map>
|
||||
</option>
|
||||
<option name="executionName"/>
|
||||
<option name="externalProjectPath" value="$PROJECT_DIR$/extensions/intellij"/>
|
||||
<option name="externalSystemIdString" value="GRADLE"/>
|
||||
<option name="scriptParameters" value=""/>
|
||||
<option name="taskDescriptions">
|
||||
<list/>
|
||||
</option>
|
||||
<option name="taskNames">
|
||||
<list>
|
||||
<option value="runIde"/>
|
||||
</list>
|
||||
</option>
|
||||
<option name="vmOptions"/>
|
||||
</ExternalSystemSettings>
|
||||
<ExternalSystemDebugServerProcess>true</ExternalSystemDebugServerProcess>
|
||||
<ExternalSystemReattachDebugProcess>true</ExternalSystemReattachDebugProcess>
|
||||
<DebugAllEnabled>false</DebugAllEnabled>
|
||||
<RunAsTest>false</RunAsTest>
|
||||
<method v="2"/>
|
||||
</configuration>
|
||||
</component>
|
||||
|
|
@ -5,7 +5,7 @@
|
|||
<option name="SCRIPT_PATH" value="" />
|
||||
<option name="SCRIPT_OPTIONS" value="" />
|
||||
<option name="INDEPENDENT_SCRIPT_WORKING_DIRECTORY" value="true" />
|
||||
<option name="SCRIPT_WORKING_DIRECTORY" value="$PROJECT_DIR$/../../binary" />
|
||||
<option name="SCRIPT_WORKING_DIRECTORY" value="$PROJECT_DIR$/binary" />
|
||||
<option name="INDEPENDENT_INTERPRETER_PATH" value="true" />
|
||||
<option name="INTERPRETER_PATH" value="" />
|
||||
<option name="INTERPRETER_OPTIONS" value="" />
|
||||
|
|
|
|||
|
|
@ -5,7 +5,7 @@
|
|||
<option name="SCRIPT_PATH" value="" />
|
||||
<option name="SCRIPT_OPTIONS" value="" />
|
||||
<option name="INDEPENDENT_SCRIPT_WORKING_DIRECTORY" value="true" />
|
||||
<option name="SCRIPT_WORKING_DIRECTORY" value="$PROJECT_DIR$/../../gui" />
|
||||
<option name="SCRIPT_WORKING_DIRECTORY" value="$PROJECT_DIR$/gui" />
|
||||
<option name="INDEPENDENT_INTERPRETER_PATH" value="true" />
|
||||
<option name="INTERPRETER_PATH" value="/bin/zsh" />
|
||||
<option name="INTERPRETER_OPTIONS" value="" />
|
||||
|
|
|
|||
|
|
@ -152,6 +152,8 @@ This will generate a .zip file in `./build/distributions` with the version defin
|
|||
The e2e tests are written using [intellij-ui-test-robot](`https://github.com/JetBrains/intellij-ui-test-robot`). The
|
||||
README for this project has a lot of helpful info on how to use the library.
|
||||
|
||||
Note that these tests fully take control of your mouse while executing.
|
||||
|
||||
#### Setup
|
||||
|
||||
If you are on macOS, you'll need to give IntelliJ permission to control your computer in order to run the e2e tests.
|
||||
|
|
@ -174,7 +176,18 @@ to run.
|
|||
|
||||
#### Identifying selectors
|
||||
|
||||
While the `runIdeForUiTests` task is runnung, you can visit the following URL
|
||||
While the `runIdeForUiTests` task is running, you can visit the following URL
|
||||
to view the UI hierarchy of the running IDE:
|
||||
|
||||
http://127.0.0.1:8082/
|
||||
http://127.0.0.1:8082/
|
||||
|
||||
#### Rebuilding the extension
|
||||
|
||||
To rebuild the extension with the latest source code, run the following:
|
||||
|
||||
```sh
|
||||
./gradlew buildPlugin
|
||||
```
|
||||
|
||||
This will update the contents of the extension that is loaded into the test IDE from
|
||||
`build/idea-sandbox/plugins-uiTest/continue-intellij-extension`
|
||||
|
|
|
|||
|
|
@ -47,6 +47,22 @@ dependencies {
|
|||
testRuntimeOnly("org.junit.jupiter:junit-jupiter-engine:5.9.2")
|
||||
testImplementation("com.squareup.okhttp3:logging-interceptor:4.12.0")
|
||||
implementation("com.automation-remarks:video-recorder-junit5:2.0")
|
||||
|
||||
|
||||
// Exclude vulnerable Log4j from all dependencies
|
||||
configurations.all {
|
||||
resolutionStrategy {
|
||||
eachDependency {
|
||||
if (requested.group == "log4j" && requested.name == "log4j") {
|
||||
useTarget("org.slf4j:log4j-over-slf4j:1.7.36")
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// Add Log4j 2.x explicitly
|
||||
implementation("org.apache.logging.log4j:log4j-core:2.20.0")
|
||||
implementation("org.apache.logging.log4j:log4j-api:2.20.0")
|
||||
}
|
||||
|
||||
// Set the JVM language level used to build the project. Use Java 11 for 2020.3+, and Java 17 for
|
||||
|
|
@ -105,13 +121,10 @@ tasks {
|
|||
wrapper { gradleVersion = properties("gradleVersion").get() }
|
||||
|
||||
patchPluginXml {
|
||||
version = properties("pluginVersion")
|
||||
sinceBuild = properties("pluginSinceBuild")
|
||||
untilBuild = properties("pluginUntilBuild")
|
||||
|
||||
// Extract the <!-- Plugin description --> section from README.md and provide for the plugin's
|
||||
// manifest
|
||||
pluginDescription =
|
||||
version.set(properties("pluginVersion"))
|
||||
sinceBuild.set(properties("pluginSinceBuild"))
|
||||
untilBuild.set(properties("pluginUntilBuild"))
|
||||
pluginDescription.set(
|
||||
providers.fileContents(layout.projectDirectory.file("README.md")).asText.map {
|
||||
val start = "<!-- Plugin description -->"
|
||||
val end = "<!-- Plugin description end -->"
|
||||
|
|
@ -125,6 +138,7 @@ tasks {
|
|||
subList(indexOf(start) + 1, indexOf(end)).joinToString("\n").let(::markdownToHTML)
|
||||
}
|
||||
}
|
||||
)
|
||||
}
|
||||
|
||||
// Configure UI tests plugin
|
||||
|
|
@ -149,9 +163,9 @@ tasks {
|
|||
// This is to ensure we load the GUI with OSR enabled. We have logic that
|
||||
// renders with OSR disabled below a particular IDE version.
|
||||
// See ContinueExtensionSettingsService.kt for more info.
|
||||
intellij {
|
||||
version.set("2024.1")
|
||||
}
|
||||
// intellij {
|
||||
// version.set("2024.1")
|
||||
// }
|
||||
}
|
||||
|
||||
signPlugin {
|
||||
|
|
|
|||
|
|
@ -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.84
|
||||
pluginVersion=0.0.85
|
||||
# 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
|
||||
|
|
|
|||
|
|
@ -297,13 +297,12 @@ class AutocompleteService(private val project: Project) {
|
|||
}
|
||||
|
||||
private fun isInjectedFile(editor: Editor): Boolean {
|
||||
return ApplicationManager.getApplication().executeOnPooledThread<Boolean> {
|
||||
ApplicationManager.getApplication().runReadAction<Boolean> {
|
||||
val psiFile =
|
||||
PsiDocumentManager.getInstance(project).getPsiFile(editor.document) ?: return@runReadAction false
|
||||
return@runReadAction psiFile.isInjectedText()
|
||||
}
|
||||
}.get()
|
||||
val psiFile = runReadAction { PsiDocumentManager.getInstance(project).getPsiFile(editor.document) }
|
||||
if (psiFile == null) {
|
||||
return false
|
||||
}
|
||||
val response = runReadAction { psiFile.isInjectedText() }
|
||||
return response
|
||||
}
|
||||
|
||||
fun hideCompletions(editor: Editor) {
|
||||
|
|
|
|||
|
|
@ -58,10 +58,10 @@ class CoreMessengerManager(
|
|||
private fun setupCoreMessenger(continueCorePath: String) {
|
||||
coreMessenger = CoreMessenger(project, continueCorePath, ideProtocolClient, coroutineScope)
|
||||
|
||||
coreMessenger?.request("config/getSerializedProfileInfo", null, null) { resp ->
|
||||
val data = resp as? Map<String, Any>
|
||||
val profileInfo = data?.get("config") as? Map<String, Any>
|
||||
val allowAnonymousTelemetry = profileInfo?.get("allowAnonymousTelemetry") as? Boolean
|
||||
coreMessenger?.request("config/getSerializedProfileInfo", null, null) { response ->
|
||||
val result = (response as Map<String, Any>)["result"] as Map<String, Any>
|
||||
val config = result["config"] as Map<String, Any>
|
||||
val allowAnonymousTelemetry = config?.get("allowAnonymousTelemetry") as? Boolean
|
||||
val telemetryService = service<TelemetryService>()
|
||||
if (allowAnonymousTelemetry == true || allowAnonymousTelemetry == null) {
|
||||
telemetryService.setup(getMachineUniqueID())
|
||||
|
|
|
|||
|
|
@ -439,7 +439,8 @@ class IdeProtocolClient(
|
|||
null,
|
||||
null
|
||||
) { response ->
|
||||
val config = (response as Map<String, Any>)["config"] as Map<String, Any>
|
||||
val result = (response as Map<String, Any>)["result"] as Map<String, Any>
|
||||
val config = result["config"] as Map<String, Any>
|
||||
val applyCodeBlockModel = getModelByRole(config, "applyCodeBlock")
|
||||
|
||||
if (applyCodeBlockModel != null) {
|
||||
|
|
|
|||
|
|
@ -128,11 +128,14 @@ fun openInlineEdit(project: Project?, editor: Editor) {
|
|||
// Get list of model titles
|
||||
val continuePluginService = project.service<ContinuePluginService>()
|
||||
val modelTitles = mutableListOf<String>()
|
||||
|
||||
continuePluginService.coreMessenger?.request("config/getSerializedProfileInfo", null, null) { response ->
|
||||
val config = response as Map<String, Any>
|
||||
val models = (config["config"] as Map<String, Any>)["models"] as List<Map<String, Any>>
|
||||
val result = (response as Map<String, Any>)["result"] as Map<String, Any>
|
||||
val config = result["config"] as Map<String, Any>
|
||||
val models = config["models"] as List<Map<String, Any>>
|
||||
modelTitles.addAll(models.map { it["title"] as String })
|
||||
}
|
||||
|
||||
val maxWaitTime = 200
|
||||
val startTime = System.currentTimeMillis()
|
||||
while (modelTitles.isEmpty() && System.currentTimeMillis() - startTime < maxWaitTime) {
|
||||
|
|
@ -427,7 +430,7 @@ class CustomPanel(
|
|||
}
|
||||
|
||||
selectedIndex =
|
||||
if(itemCount == 0) -1 else continueSettingsService.continueState.lastSelectedInlineEditModel?.let {
|
||||
if (itemCount == 0) -1 else continueSettingsService.continueState.lastSelectedInlineEditModel?.let {
|
||||
if (modelTitles.isEmpty()) -1
|
||||
else {
|
||||
val index = modelTitles.indexOf(it)
|
||||
|
|
|
|||
|
|
@ -179,8 +179,8 @@ class ContinuePluginSelectionListener(
|
|||
val lineStartOffset = document.getLineStartOffset(lineNumber)
|
||||
val lineEndOffset = document.getLineEndOffset(lineNumber)
|
||||
val lineText = document.getText(TextRange(lineStartOffset, lineEndOffset)).trimEnd()
|
||||
val endOfLinePos = LogicalPosition(lineNumber, lineText.length)
|
||||
return editor.logicalPositionToXY(endOfLinePos).x
|
||||
val visualPosition = editor.offsetToVisualPosition(lineStartOffset + lineText.length)
|
||||
return editor.visualPositionToXY(visualPosition).x
|
||||
}
|
||||
|
||||
val offset = 40
|
||||
|
|
|
|||
|
|
@ -34,7 +34,7 @@ class Autocomplete {
|
|||
@AfterEach
|
||||
fun closeProject(remoteRobot: RemoteRobot) = CommonSteps(remoteRobot).closeProject()
|
||||
|
||||
// @Test
|
||||
@Test
|
||||
@Video
|
||||
fun displayCompletion(remoteRobot: RemoteRobot): Unit = with(remoteRobot) {
|
||||
welcomeFrame {
|
||||
|
|
@ -50,7 +50,7 @@ class Autocomplete {
|
|||
// Our "continue_tutorial.java.ft" tab loads first, but then "Main.java" takes focus.
|
||||
waitFor(ofSeconds(20)) {
|
||||
findAll<ComponentFixture>(
|
||||
byXpath("//div[@accessiblename='Main.java' and @class='EditorTabLabel']")
|
||||
byXpath("//div[@accessiblename='Main.java' and @class='SingleHeightLabel']")
|
||||
).isNotEmpty()
|
||||
}
|
||||
|
||||
|
|
@ -64,7 +64,7 @@ class Autocomplete {
|
|||
enterText(" ")
|
||||
}
|
||||
|
||||
waitFor(ofSeconds(10)) {
|
||||
waitFor(ofSeconds(20)) {
|
||||
editor.hasText("TEST_LLM_RESPONSE_0")
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -39,7 +39,7 @@ class GUI {
|
|||
@AfterEach
|
||||
fun closeProject(remoteRobot: RemoteRobot) = CommonSteps(remoteRobot).closeProject()
|
||||
|
||||
// @Test
|
||||
// @Test
|
||||
@Video
|
||||
fun highlightCode(remoteRobot: RemoteRobot): Unit = with(remoteRobot) {
|
||||
welcomeFrame {
|
||||
|
|
@ -57,7 +57,7 @@ class GUI {
|
|||
// while the `continue_tutorial.java` is loading.
|
||||
waitFor(ofSeconds(20)) {
|
||||
findAll<ComponentFixture>(
|
||||
byXpath("//div[@accessiblename='Main.java' and @class='EditorTabLabel']")
|
||||
byXpath("//div[@accessiblename='Main.java' and @class='SingleHeightLabel']")
|
||||
).isNotEmpty()
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -35,7 +35,7 @@ class Onboarding {
|
|||
fun closeProject(remoteRobot: RemoteRobot) = CommonSteps(remoteRobot).closeProject()
|
||||
|
||||
|
||||
// @Test
|
||||
// @Test
|
||||
@Video
|
||||
fun onboarding(remoteRobot: RemoteRobot): Unit = with(remoteRobot) {
|
||||
welcomeFrame {
|
||||
|
|
@ -53,7 +53,7 @@ class Onboarding {
|
|||
// So we need to wait for that to occur, and then focus on "continue_tutorial.java.ft"
|
||||
waitFor(ofSeconds(20)) {
|
||||
findAll<ComponentFixture>(
|
||||
byXpath("//div[@accessiblename='Main.java' and @class='EditorTabLabel']")
|
||||
byXpath("//div[@accessiblename='Main.java' and @class='SingleHeightLabel']")
|
||||
).isNotEmpty()
|
||||
}
|
||||
|
||||
|
|
|
|||
4
extensions/vscode/.gitignore
vendored
4
extensions/vscode/.gitignore
vendored
|
|
@ -23,4 +23,6 @@ e2e/.test-extensions
|
|||
e2e/storage
|
||||
e2e/vsix
|
||||
e2e/test-continue/*
|
||||
!e2e/test-continue/config.json
|
||||
!e2e/test-continue/config.json
|
||||
e2e/test-continue-yaml/*
|
||||
!e2e/test-continue-yaml/config.yaml
|
||||
|
|
@ -1,4 +1,5 @@
|
|||
import { By, WebDriver, WebView } from "vscode-extension-tester";
|
||||
|
||||
import { SelectorUtils } from "./SelectorUtils";
|
||||
|
||||
export class GUISelectors {
|
||||
|
|
@ -41,6 +42,24 @@ export class GUISelectors {
|
|||
return SelectorUtils.getElementByDataTestId(view, "model-select-button");
|
||||
}
|
||||
|
||||
public static getFirstContextProviderDropdownItem(view: WebView) {
|
||||
return SelectorUtils.getElementByDataTestId(
|
||||
view,
|
||||
"context-provider-dropdown-item",
|
||||
);
|
||||
}
|
||||
|
||||
public static getContextItemsPeek(view: WebView) {
|
||||
return SelectorUtils.getElementByDataTestId(view, "context-items-peek");
|
||||
}
|
||||
|
||||
public static getFirstContextItemsPeekItem(view: WebView) {
|
||||
return SelectorUtils.getElementByDataTestId(
|
||||
view,
|
||||
"context-items-peek-item",
|
||||
);
|
||||
}
|
||||
|
||||
public static getNthHistoryTableRow(view: WebView, index: number) {
|
||||
return SelectorUtils.getElementByDataTestId(view, `history-row-${index}`);
|
||||
}
|
||||
|
|
|
|||
76
extensions/vscode/e2e/test-continue-yaml/config.yaml
Normal file
76
extensions/vscode/e2e/test-continue-yaml/config.yaml
Normal file
|
|
@ -0,0 +1,76 @@
|
|||
name: Test Config
|
||||
version: 0.0.1
|
||||
|
||||
rules:
|
||||
- TEST_SYS_MSG
|
||||
|
||||
models:
|
||||
- name: TEST LLM
|
||||
provider: test
|
||||
model: this field is not used
|
||||
roles:
|
||||
- chat
|
||||
- edit
|
||||
- apply
|
||||
- autocomplete
|
||||
|
||||
- name: Mock
|
||||
provider: mock
|
||||
model: this field is not used
|
||||
roles:
|
||||
- chat
|
||||
- edit
|
||||
- apply
|
||||
|
||||
- name: TOOL MOCK LLM
|
||||
provider: mock
|
||||
model: claude-3-5-sonnet-latest
|
||||
requestOptions:
|
||||
extraBodyProperties:
|
||||
chatStream:
|
||||
- - role: assistant
|
||||
content: "I'm going to call a tool:"
|
||||
- role: assistant
|
||||
content: ""
|
||||
toolCalls:
|
||||
- id: test_id
|
||||
type: function
|
||||
function:
|
||||
name: builtin_exact_search
|
||||
arguments: '{"query": "test query"}'
|
||||
- REPEAT_LAST_MSG
|
||||
roles:
|
||||
- chat
|
||||
- edit
|
||||
- apply
|
||||
|
||||
- name: SYSTEM MESSAGE MOCK LLM
|
||||
provider: mock
|
||||
model: claude-3-5-sonnet-latest
|
||||
requestOptions:
|
||||
extraBodyProperties:
|
||||
chatStream:
|
||||
- - REPEAT_SYSTEM_MSG
|
||||
roles:
|
||||
- chat
|
||||
- edit
|
||||
- apply
|
||||
|
||||
- name: LAST MESSAGE MOCK LLM
|
||||
provider: mock
|
||||
model: claude-3-5-sonnet-latest
|
||||
requestOptions:
|
||||
extraBodyProperties:
|
||||
chatStream:
|
||||
- - REPEAT_LAST_MSG
|
||||
roles:
|
||||
- chat
|
||||
- edit
|
||||
- apply
|
||||
|
||||
context:
|
||||
- uses: docs
|
||||
- uses: diff
|
||||
- uses: url
|
||||
- uses: folder
|
||||
- uses: terminal
|
||||
|
|
@ -44,8 +44,29 @@
|
|||
]
|
||||
}
|
||||
}
|
||||
},
|
||||
{
|
||||
"provider": "mock",
|
||||
"title": "SYSTEM MESSAGE MOCK LLM",
|
||||
"model": "claude-3-5-sonnet-latest",
|
||||
"requestOptions": {
|
||||
"extraBodyProperties": {
|
||||
"chatStream": [["REPEAT_SYSTEM_MSG"]]
|
||||
}
|
||||
}
|
||||
},
|
||||
{
|
||||
"provider": "mock",
|
||||
"title": "LAST MESSAGE MOCK LLM",
|
||||
"model": "claude-3-5-sonnet-latest",
|
||||
"requestOptions": {
|
||||
"extraBodyProperties": {
|
||||
"chatStream": [["REPEAT_LAST_MSG"]]
|
||||
}
|
||||
}
|
||||
}
|
||||
],
|
||||
"systemMessage": "TEST_SYS_MSG",
|
||||
"analytics": {
|
||||
"provider": "continue-proxy"
|
||||
},
|
||||
|
|
@ -69,6 +90,9 @@
|
|||
},
|
||||
{
|
||||
"name": "folder"
|
||||
},
|
||||
{
|
||||
"name": "terminal"
|
||||
}
|
||||
],
|
||||
"docs": []
|
||||
|
|
|
|||
|
|
@ -207,6 +207,53 @@ describe("GUI Test", () => {
|
|||
});
|
||||
});
|
||||
|
||||
describe("Context providers", () => {
|
||||
it("should successfully use the terminal context provider", async () => {
|
||||
await GUIActions.selectModelFromDropdown(view, "LAST MESSAGE MOCK LLM");
|
||||
|
||||
// Enter just the context provider in the input and send
|
||||
const [messageInput] = await GUISelectors.getMessageInputFields(view);
|
||||
await messageInput.sendKeys("@");
|
||||
await messageInput.sendKeys("terminal");
|
||||
await messageInput.sendKeys(Key.ENTER);
|
||||
await messageInput.sendKeys(Key.ENTER);
|
||||
|
||||
// Open the context items peek
|
||||
const contextItemsPeek = await GUISelectors.getContextItemsPeek(view);
|
||||
await contextItemsPeek.click();
|
||||
|
||||
await TestUtils.waitForSuccess(async () => {
|
||||
const firstContextItemInPeek =
|
||||
await GUISelectors.getFirstContextItemsPeekItem(view);
|
||||
await firstContextItemInPeek.click();
|
||||
|
||||
// Check that item is there with correct name
|
||||
const description = await firstContextItemInPeek.getText();
|
||||
expect(description).to.include("Terminal");
|
||||
});
|
||||
|
||||
// Check that the contents match what we expect (repeated back by the mock LLM)
|
||||
await TestUtils.waitForSuccess(() => {
|
||||
return GUISelectors.getThreadMessageByText(
|
||||
view,
|
||||
"Current terminal contents:",
|
||||
);
|
||||
});
|
||||
}).timeout(DEFAULT_TIMEOUT.MD);
|
||||
});
|
||||
|
||||
describe("Repeat back the system message", () => {
|
||||
it("should repeat back the system message", async () => {
|
||||
await GUIActions.selectModelFromDropdown(view, "SYSTEM MESSAGE MOCK LLM");
|
||||
const [messageInput] = await GUISelectors.getMessageInputFields(view);
|
||||
await messageInput.sendKeys("Hello");
|
||||
await messageInput.sendKeys(Key.ENTER);
|
||||
await TestUtils.waitForSuccess(() =>
|
||||
GUISelectors.getThreadMessageByText(view, "TEST_SYS_MSG"),
|
||||
);
|
||||
});
|
||||
});
|
||||
|
||||
describe("Chat Paths", () => {
|
||||
it("Send many messages → chat auto scrolls → go to history → open previous chat → it is scrolled to the bottom", async () => {
|
||||
for (let i = 0; i <= 20; i++) {
|
||||
|
|
|
|||
6
extensions/vscode/package-lock.json
generated
6
extensions/vscode/package-lock.json
generated
|
|
@ -1,12 +1,12 @@
|
|||
{
|
||||
"name": "continue",
|
||||
"version": "0.9.251",
|
||||
"version": "0.9.252",
|
||||
"lockfileVersion": 3,
|
||||
"requires": true,
|
||||
"packages": {
|
||||
"": {
|
||||
"name": "continue",
|
||||
"version": "0.9.251",
|
||||
"version": "0.9.252",
|
||||
"license": "Apache-2.0",
|
||||
"dependencies": {
|
||||
"@continuedev/fetch": "^1.0.3",
|
||||
|
|
@ -106,7 +106,7 @@
|
|||
"@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.0",
|
||||
"@continuedev/config-yaml": "^1.0.11",
|
||||
"@continuedev/fetch": "^1.0.4",
|
||||
"@continuedev/llm-info": "^1.0.2",
|
||||
"@continuedev/openai-adapters": "^1.0.10",
|
||||
|
|
|
|||
|
|
@ -2,7 +2,7 @@
|
|||
"name": "continue",
|
||||
"icon": "media/icon.png",
|
||||
"author": "Continue Dev, Inc",
|
||||
"version": "0.9.251",
|
||||
"version": "0.9.252",
|
||||
"repository": {
|
||||
"type": "git",
|
||||
"url": "https://github.com/continuedev/continue"
|
||||
|
|
@ -628,7 +628,8 @@
|
|||
"e2e:all": "npm run e2e:build && npm run e2e:compile && npm run e2e:create-storage && npm run e2e:get-chromedriver && npm run e2e:get-vscode && npm run e2e:sign-vscode && npm run e2e:copy-vsix && npm run e2e:install-vsix && npm run e2e:install-extensions && CONTINUE_GLOBAL_DIR=e2e/test-continue npm run e2e:test && npm run e2e:clean",
|
||||
"e2e:quick": "npm run e2e:compile && CONTINUE_GLOBAL_DIR=e2e/test-continue npm run e2e:test && npm run e2e:clean",
|
||||
"e2e:ci:download": "npm run e2e:create-storage && npm run e2e:get-chromedriver && npm run e2e:get-vscode",
|
||||
"e2e:ci:run": "npm run e2e:compile && npm run e2e:copy-vsix && npm run e2e:install-vsix && npm run e2e:install-extensions && CONTINUE_GLOBAL_DIR=e2e/test-continue npm run e2e:test"
|
||||
"e2e:ci:run": "npm run e2e:compile && npm run e2e:copy-vsix && npm run e2e:install-vsix && npm run e2e:install-extensions && CONTINUE_GLOBAL_DIR=e2e/test-continue npm run e2e:test",
|
||||
"e2e:ci:run-yaml": "npm run e2e:compile && npm run e2e:copy-vsix && npm run e2e:install-vsix && npm run e2e:install-extensions && CONTINUE_GLOBAL_DIR=e2e/test-continue-yaml npm run e2e:test"
|
||||
},
|
||||
"devDependencies": {
|
||||
"@biomejs/biome": "1.6.4",
|
||||
|
|
|
|||
|
|
@ -28,15 +28,41 @@ import type {
|
|||
TerminalOptions,
|
||||
Thread,
|
||||
} from "core";
|
||||
import { SecretStorage } from "./stubs/SecretStorage";
|
||||
|
||||
class VsCodeIde implements IDE {
|
||||
ideUtils: VsCodeIdeUtils;
|
||||
secretStorage: SecretStorage;
|
||||
|
||||
constructor(
|
||||
private readonly vscodeWebviewProtocolPromise: Promise<VsCodeWebviewProtocol>,
|
||||
private readonly context: vscode.ExtensionContext,
|
||||
) {
|
||||
this.ideUtils = new VsCodeIdeUtils();
|
||||
this.secretStorage = new SecretStorage(context);
|
||||
}
|
||||
|
||||
async readSecrets(keys: string[]): Promise<Record<string, string>> {
|
||||
const secretValuePromises = keys.map((key) => this.secretStorage.get(key));
|
||||
const secretValues = await Promise.all(secretValuePromises);
|
||||
|
||||
return keys.reduce(
|
||||
(acc, key, index) => {
|
||||
if (secretValues[index] === undefined) {
|
||||
return acc;
|
||||
}
|
||||
|
||||
acc[key] = secretValues[index];
|
||||
return acc;
|
||||
},
|
||||
{} as Record<string, string>,
|
||||
);
|
||||
}
|
||||
|
||||
async writeSecrets(secrets: { [key: string]: string }): Promise<void> {
|
||||
for (const [key, value] of Object.entries(secrets)) {
|
||||
await this.secretStorage.store(key, value);
|
||||
}
|
||||
}
|
||||
|
||||
async fileExists(uri: string): Promise<boolean> {
|
||||
|
|
@ -399,17 +425,22 @@ class VsCodeIde implements IDE {
|
|||
);
|
||||
}
|
||||
|
||||
async runCommand(command: string, options: TerminalOptions = {reuseTerminal: true}): Promise<void> {
|
||||
async runCommand(
|
||||
command: string,
|
||||
options: TerminalOptions = { reuseTerminal: true },
|
||||
): Promise<void> {
|
||||
let terminal: vscode.Terminal | undefined;
|
||||
if (vscode.window.terminals.length && options.reuseTerminal) {
|
||||
if (options.terminalName) {
|
||||
terminal = vscode.window.terminals.find(t => t?.name === options.terminalName);
|
||||
terminal = vscode.window.terminals.find(
|
||||
(t) => t?.name === options.terminalName,
|
||||
);
|
||||
} else {
|
||||
terminal = vscode.window.activeTerminal ?? vscode.window.terminals[0];
|
||||
}
|
||||
}
|
||||
|
||||
if( !terminal) {
|
||||
if (!terminal) {
|
||||
terminal = vscode.window.createTerminal(options?.terminalName);
|
||||
}
|
||||
terminal.show();
|
||||
|
|
|
|||
|
|
@ -171,7 +171,7 @@ export class VsCodeExtension {
|
|||
const result = await this.configHandler.getSerializedConfig();
|
||||
this.sidebar.webviewProtocol?.request("configUpdate", {
|
||||
result,
|
||||
profileId: this.configHandler.currentProfile.profileId,
|
||||
profileId: this.configHandler.currentProfile.profileDescription.id,
|
||||
});
|
||||
|
||||
this.tabAutocompleteModel.clearLlm();
|
||||
|
|
@ -301,7 +301,7 @@ export class VsCodeExtension {
|
|||
true,
|
||||
);
|
||||
|
||||
const sessionInfo = await getControlPlaneSessionInfo(true);
|
||||
const sessionInfo = await getControlPlaneSessionInfo(true, false);
|
||||
this.webviewProtocolPromise.then(async (webviewProtocol) => {
|
||||
void webviewProtocol.request("didChangeControlPlaneSessionInfo", {
|
||||
sessionInfo,
|
||||
|
|
|
|||
|
|
@ -446,7 +446,10 @@ export class VsCodeMessenger {
|
|||
ide.getGitHubAuthToken(msg.data),
|
||||
);
|
||||
this.onWebviewOrCore("getControlPlaneSessionInfo", async (msg) => {
|
||||
return getControlPlaneSessionInfo(msg.data.silent);
|
||||
return getControlPlaneSessionInfo(
|
||||
msg.data.silent,
|
||||
msg.data.useOnboarding,
|
||||
);
|
||||
});
|
||||
this.onWebviewOrCore("logoutOfControlPlane", async (msg) => {
|
||||
const sessions = await this.workOsAuthProvider.getSessions();
|
||||
|
|
|
|||
|
|
@ -1,3 +1,7 @@
|
|||
import crypto from "crypto";
|
||||
|
||||
import { ControlPlaneSessionInfo } from "core/control-plane/client";
|
||||
import { controlPlaneEnv } from "core/control-plane/env";
|
||||
import fetch from "node-fetch";
|
||||
import { v4 as uuidv4 } from "uuid";
|
||||
import {
|
||||
|
|
@ -16,6 +20,7 @@ import {
|
|||
} from "vscode";
|
||||
|
||||
import { PromiseAdapter, promiseFromEvent } from "./promiseUtils";
|
||||
import { SecretStorage } from "./SecretStorage";
|
||||
|
||||
const AUTH_NAME = "Continue";
|
||||
|
||||
|
|
@ -26,14 +31,6 @@ class UriEventHandler extends EventEmitter<Uri> implements UriHandler {
|
|||
this.fire(uri);
|
||||
}
|
||||
}
|
||||
|
||||
import { ControlPlaneSessionInfo } from "core/control-plane/client";
|
||||
import { controlPlaneEnv } from "core/control-plane/env";
|
||||
|
||||
import crypto from "crypto";
|
||||
|
||||
import { SecretStorage } from "./SecretStorage";
|
||||
|
||||
// Function to generate a random string of specified length
|
||||
function generateRandomString(length: number): string {
|
||||
const possibleCharacters =
|
||||
|
|
@ -163,12 +160,6 @@ export class WorkOsAuthProvider implements AuthenticationProvider, Disposable {
|
|||
}
|
||||
|
||||
get ideRedirectUri() {
|
||||
const publisher = this.context.extension.packageJSON.publisher;
|
||||
const name = this.context.extension.packageJSON.name;
|
||||
return `${env.uriScheme}://${publisher}.${name}`;
|
||||
}
|
||||
|
||||
get redirectUri() {
|
||||
if (
|
||||
env.uriScheme === "vscode-insiders" ||
|
||||
env.uriScheme === "vscode" ||
|
||||
|
|
@ -179,6 +170,18 @@ export class WorkOsAuthProvider implements AuthenticationProvider, Disposable {
|
|||
url.pathname = `/auth/${env.uriScheme}-redirect`;
|
||||
return url.toString();
|
||||
}
|
||||
const publisher = this.context.extension.packageJSON.publisher;
|
||||
const name = this.context.extension.packageJSON.name;
|
||||
return `${env.uriScheme}://${publisher}.${name}`;
|
||||
}
|
||||
|
||||
public static useOnboardingUri: boolean = false;
|
||||
get redirectUri() {
|
||||
if (WorkOsAuthProvider.useOnboardingUri) {
|
||||
const url = new URL(controlPlaneEnv.APP_URL);
|
||||
url.pathname = `/onboarding/redirect/${env.uriScheme}`;
|
||||
return url.toString();
|
||||
}
|
||||
return this.ideRedirectUri;
|
||||
}
|
||||
|
||||
|
|
@ -407,8 +410,9 @@ export class WorkOsAuthProvider implements AuthenticationProvider, Disposable {
|
|||
try {
|
||||
return await Promise.race([
|
||||
codeExchangePromise.promise,
|
||||
new Promise<string>((_, reject) =>
|
||||
setTimeout(() => reject("Cancelled"), 15 * 60 * 1_000),
|
||||
new Promise<string>(
|
||||
(_, reject) =>
|
||||
setTimeout(() => reject("Cancelled"), 60 * 60 * 1_000), // 60min timeout
|
||||
),
|
||||
promiseFromEvent<any, any>(
|
||||
token.onCancellationRequested,
|
||||
|
|
@ -488,20 +492,29 @@ export class WorkOsAuthProvider implements AuthenticationProvider, Disposable {
|
|||
|
||||
export async function getControlPlaneSessionInfo(
|
||||
silent: boolean,
|
||||
useOnboarding: boolean,
|
||||
): Promise<ControlPlaneSessionInfo | undefined> {
|
||||
const session = await authentication.getSession(
|
||||
controlPlaneEnv.AUTH_TYPE,
|
||||
[],
|
||||
silent ? { silent: true } : { createIfNone: true },
|
||||
);
|
||||
if (!session) {
|
||||
return undefined;
|
||||
try {
|
||||
if (useOnboarding) {
|
||||
WorkOsAuthProvider.useOnboardingUri = true;
|
||||
}
|
||||
|
||||
const session = await authentication.getSession(
|
||||
controlPlaneEnv.AUTH_TYPE,
|
||||
[],
|
||||
silent ? { silent: true } : { createIfNone: true },
|
||||
);
|
||||
if (!session) {
|
||||
return undefined;
|
||||
}
|
||||
return {
|
||||
accessToken: session.accessToken,
|
||||
account: {
|
||||
id: session.account.id,
|
||||
label: session.account.label,
|
||||
},
|
||||
};
|
||||
} finally {
|
||||
WorkOsAuthProvider.useOnboardingUri = false;
|
||||
}
|
||||
return {
|
||||
accessToken: session.accessToken,
|
||||
account: {
|
||||
id: session.account.id,
|
||||
label: session.account.label,
|
||||
},
|
||||
};
|
||||
}
|
||||
|
|
|
|||
|
|
@ -1,6 +1,5 @@
|
|||
import { FromWebviewProtocol, ToWebviewProtocol } from "core/protocol";
|
||||
import { Message } from "core/protocol/messenger";
|
||||
import { WebviewMessengerResult } from "core/protocol/util";
|
||||
import { extractMinimalStackTraceInfo } from "core/util/extractMinimalStackTraceInfo";
|
||||
import { Telemetry } from "core/util/posthog";
|
||||
import { v4 as uuidv4 } from "uuid";
|
||||
|
|
@ -51,34 +50,40 @@ export class VsCodeWebviewProtocol
|
|||
this._webview = webView;
|
||||
this._webviewListener?.dispose();
|
||||
|
||||
this._webviewListener = this._webview.onDidReceiveMessage(async (msg) => {
|
||||
if (!msg.messageType || !msg.messageId) {
|
||||
const handleMessage = async (msg: Message): Promise<void> => {
|
||||
if (!("messageType" in msg) || !("messageId" in msg)) {
|
||||
throw new Error(`Invalid webview protocol msg: ${JSON.stringify(msg)}`);
|
||||
}
|
||||
|
||||
const respond = (message: WebviewMessengerResult<any>) =>
|
||||
const respond = (message: any) =>
|
||||
this.send(msg.messageType, message, msg.messageId);
|
||||
|
||||
const handlers = this.listeners.get(msg.messageType) || [];
|
||||
const handlers =
|
||||
this.listeners.get(msg.messageType as keyof FromWebviewProtocol) || [];
|
||||
for (const handler of handlers) {
|
||||
try {
|
||||
const response = await handler(msg);
|
||||
// For generator types e.g. llm/streamChat
|
||||
if (
|
||||
response &&
|
||||
typeof response[Symbol.asyncIterator] === "function"
|
||||
) {
|
||||
let next = await response.next();
|
||||
while (!next.done) {
|
||||
respond(next.value);
|
||||
respond({
|
||||
done: false,
|
||||
content: next.value,
|
||||
status: "success",
|
||||
});
|
||||
next = await response.next();
|
||||
}
|
||||
respond({
|
||||
done: true,
|
||||
content: next.value?.content,
|
||||
content: next.value,
|
||||
status: "success",
|
||||
});
|
||||
} else {
|
||||
respond({ done: true, content: response ?? {}, status: "success" });
|
||||
respond({ content: response, status: "success" });
|
||||
}
|
||||
} catch (e: any) {
|
||||
respond({ done: true, error: e.message, status: "error" });
|
||||
|
|
@ -92,7 +97,6 @@ export class VsCodeWebviewProtocol
|
|||
stringified.includes("llm/streamChat") ||
|
||||
stringified.includes("chatDescriber/describe")
|
||||
) {
|
||||
// handle these errors in the GUI
|
||||
return;
|
||||
}
|
||||
|
||||
|
|
@ -143,7 +147,9 @@ export class VsCodeWebviewProtocol
|
|||
}
|
||||
}
|
||||
}
|
||||
});
|
||||
};
|
||||
|
||||
this._webviewListener = this._webview.onDidReceiveMessage(handleMessage);
|
||||
}
|
||||
|
||||
constructor(private readonly reloadConfig: () => void) {}
|
||||
|
|
|
|||
21
gui/package-lock.json
generated
21
gui/package-lock.json
generated
|
|
@ -7,7 +7,7 @@
|
|||
"name": "gui",
|
||||
"license": "Apache-2.0",
|
||||
"dependencies": {
|
||||
"@continuedev/config-yaml": "^1.0.0",
|
||||
"@continuedev/config-yaml": "^1.0.11",
|
||||
"@headlessui/react": "^1.7.17",
|
||||
"@heroicons/react": "^2.0.18",
|
||||
"@reduxjs/toolkit": "^2.3.0",
|
||||
|
|
@ -108,7 +108,7 @@
|
|||
"@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.0",
|
||||
"@continuedev/config-yaml": "^1.0.11",
|
||||
"@continuedev/fetch": "^1.0.4",
|
||||
"@continuedev/llm-info": "^1.0.2",
|
||||
"@continuedev/openai-adapters": "^1.0.10",
|
||||
|
|
@ -547,11 +547,20 @@
|
|||
"integrity": "sha512-0hYQ8SB4Db5zvZB4axdMHGwEaQjkZzFjQiN9LVYvIFB2nSUHW9tYpxWriPrWDASIxiaXax83REcLxuSdnGPZtw==",
|
||||
"dev": true
|
||||
},
|
||||
"node_modules/@continuedev/config-yaml": {
|
||||
"version": "1.0.0",
|
||||
"resolved": "https://registry.npmjs.org/@continuedev/config-yaml/-/config-yaml-1.0.0.tgz",
|
||||
"integrity": "sha512-NwagzzpnPLbMC3delzFSjWiFv5fp8ReFjdMQF0ko0Xg+U0Myja90k/J7JWGegF/SZMABxc/OJchElJFr58TwGA==",
|
||||
"node_modules/@continuedev/config-types": {
|
||||
"version": "1.0.14",
|
||||
"resolved": "https://registry.npmjs.org/@continuedev/config-types/-/config-types-1.0.14.tgz",
|
||||
"integrity": "sha512-PVHyHPyRXd2QsaNgnCpiKYU3uHFTlyuQSkqE8OwrBmQqO6/TXUVIr/2EGtyIZGrml4Y+rGMSH40WU4/0t4SGpQ==",
|
||||
"dependencies": {
|
||||
"zod": "^3.23.8"
|
||||
}
|
||||
},
|
||||
"node_modules/@continuedev/config-yaml": {
|
||||
"version": "1.0.11",
|
||||
"resolved": "https://registry.npmjs.org/@continuedev/config-yaml/-/config-yaml-1.0.11.tgz",
|
||||
"integrity": "sha512-E3RBQfNEPBGBmlnAbCXgeAasDzTjo4ON/HH0hr5g292i+WdAN3i/omjQ6Iusx00L1Fz7klZGJePZ3GVQKOGEUg==",
|
||||
"dependencies": {
|
||||
"@continuedev/config-types": "^1.0.14",
|
||||
"yaml": "^2.6.1",
|
||||
"zod": "^3.23.8"
|
||||
}
|
||||
|
|
|
|||
|
|
@ -15,7 +15,7 @@
|
|||
"test:watch": "vitest"
|
||||
},
|
||||
"dependencies": {
|
||||
"@continuedev/config-yaml": "^1.0.0",
|
||||
"@continuedev/config-yaml": "^1.0.11",
|
||||
"@headlessui/react": "^1.7.17",
|
||||
"@heroicons/react": "^2.0.18",
|
||||
"@reduxjs/toolkit": "^2.3.0",
|
||||
|
|
|
|||
|
|
@ -1,6 +1,7 @@
|
|||
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,
|
||||
|
|
@ -9,10 +10,9 @@ import {
|
|||
vscListActiveBackground,
|
||||
vscListActiveForeground,
|
||||
} from ".";
|
||||
import { IdeMessengerContext } from "../context/IdeMessenger";
|
||||
import { useAuth } from "../context/Auth";
|
||||
import { IdeMessengerContext } from "../context/IdeMessenger";
|
||||
import { setSelectedProfileId } from "../redux/slices/sessionSlice";
|
||||
import { useDispatch } from "react-redux";
|
||||
import { setDialogMessage, setShowDialog } from "../redux/slices/uiSlice";
|
||||
|
||||
const StyledListboxOption = styled(Listbox.Option)<{ selected: boolean }>`
|
||||
|
|
@ -46,7 +46,7 @@ export default function AccountDialog() {
|
|||
<span className="text-lightgray mb-4 block text-center">
|
||||
Signed out
|
||||
</span>
|
||||
<Button className="w-full" onClick={login}>
|
||||
<Button className="w-full" onClick={() => login(false)}>
|
||||
Sign in
|
||||
</Button>
|
||||
</div>
|
||||
|
|
|
|||
|
|
@ -0,0 +1,63 @@
|
|||
import { XMarkIcon } from "@heroicons/react/24/outline";
|
||||
import { useState } from "react";
|
||||
import styled from "styled-components";
|
||||
import { CloseButton, defaultBorderRadius, vscInputBackground } from "../..";
|
||||
import { getLocalStorage, setLocalStorage } from "../../../util/localStorage";
|
||||
import Alert from "../../gui/Alert";
|
||||
import { TabTitle } from "../components/OnboardingCardTabs";
|
||||
import { useOnboardingCard } from "../hooks";
|
||||
import OnboardingLocalTab from "../tabs/OnboardingLocalTab";
|
||||
import MainTab from "./tabs/main";
|
||||
|
||||
const StyledCard = styled.div`
|
||||
margin: auto;
|
||||
border-radius: ${defaultBorderRadius};
|
||||
background-color: ${vscInputBackground};
|
||||
box-shadow:
|
||||
0 20px 25px -5px rgb(0 0 0 / 0.1),
|
||||
0 8px 10px -6px rgb(0 0 0 / 0.1);
|
||||
`;
|
||||
|
||||
export interface OnboardingCardState {
|
||||
show?: boolean;
|
||||
activeTab?: TabTitle;
|
||||
}
|
||||
|
||||
export function PlatformOnboardingCard() {
|
||||
const onboardingCard = useOnboardingCard();
|
||||
|
||||
if (getLocalStorage("onboardingStatus") === undefined) {
|
||||
setLocalStorage("onboardingStatus", "Started");
|
||||
}
|
||||
|
||||
const [currentTab, setCurrentTab] = useState<"main" | "local">("main");
|
||||
|
||||
return (
|
||||
<StyledCard className="xs:py-4 xs:px-4 relative px-2 py-3">
|
||||
<CloseButton onClick={onboardingCard.close}>
|
||||
<XMarkIcon className="mt-1.5 hidden h-5 w-5 hover:brightness-125 sm:flex" />
|
||||
</CloseButton>
|
||||
<div className="content py-4">
|
||||
<div className="flex h-full w-full items-center justify-center">
|
||||
{currentTab === "main" ? (
|
||||
<MainTab onRemainLocal={() => setCurrentTab("local")} />
|
||||
) : (
|
||||
<div className="mt-4">
|
||||
<Alert type="info">
|
||||
By choosing this option, Continue will be configured by a local{" "}
|
||||
<code>config.yaml</code> file. If you're just looking to use
|
||||
Ollama and still want to manage your configuration through
|
||||
Continue, click{" "}
|
||||
<a href="#" onClick={() => setCurrentTab("main")}>
|
||||
here
|
||||
</a>
|
||||
</Alert>
|
||||
|
||||
<OnboardingLocalTab />
|
||||
</div>
|
||||
)}
|
||||
</div>
|
||||
</div>
|
||||
</StyledCard>
|
||||
);
|
||||
}
|
||||
26
gui/src/components/OnboardingCard/platform/tabs/local.tsx
Normal file
26
gui/src/components/OnboardingCard/platform/tabs/local.tsx
Normal file
|
|
@ -0,0 +1,26 @@
|
|||
import { useAuth } from "../../../../context/Auth";
|
||||
import ContinueLogo from "../../../gui/ContinueLogo";
|
||||
import { useOnboardingCard } from "../../hooks";
|
||||
|
||||
export default function LocalTab() {
|
||||
const onboardingCard = useOnboardingCard();
|
||||
const auth = useAuth();
|
||||
|
||||
return (
|
||||
<div className="xs:px-0 flex w-full max-w-full flex-col items-center justify-center px-4 text-center">
|
||||
<div className="xs:flex hidden">
|
||||
<ContinueLogo height={75} />
|
||||
</div>
|
||||
|
||||
<p className="xs:w-3/4 w-full text-sm">
|
||||
Log in to quickly build your first custom AI code assistant
|
||||
</p>
|
||||
|
||||
{/* <p className="xs:w-3/4 w-full text-sm">
|
||||
To prevent abuse, we'll ask you to sign in to GitHub.
|
||||
</p> */}
|
||||
|
||||
<div className="mt-4 w-full"></div>
|
||||
</div>
|
||||
);
|
||||
}
|
||||
49
gui/src/components/OnboardingCard/platform/tabs/main.tsx
Normal file
49
gui/src/components/OnboardingCard/platform/tabs/main.tsx
Normal file
|
|
@ -0,0 +1,49 @@
|
|||
import { ChevronRightIcon } from "@heroicons/react/24/outline";
|
||||
import { Button, ButtonSubtext } from "../../..";
|
||||
import { useAuth } from "../../../../context/Auth";
|
||||
import ContinueLogo from "../../../gui/ContinueLogo";
|
||||
import { useOnboardingCard } from "../../hooks";
|
||||
|
||||
export default function MainTab({
|
||||
onRemainLocal,
|
||||
}: {
|
||||
onRemainLocal: () => void;
|
||||
}) {
|
||||
const onboardingCard = useOnboardingCard();
|
||||
const auth = useAuth();
|
||||
|
||||
function onGetStarted() {
|
||||
auth.login(true).then((success) => {
|
||||
if (success) {
|
||||
onboardingCard.close();
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
return (
|
||||
<div className="xs:px-0 flex w-full max-w-full flex-col items-center justify-center px-4 text-center">
|
||||
<div className="xs:flex hidden">
|
||||
<ContinueLogo height={75} />
|
||||
</div>
|
||||
|
||||
<p className="xs:w-3/4 w-full text-sm">
|
||||
Log in to quickly build your first custom AI code assistant
|
||||
</p>
|
||||
|
||||
<div className="mt-4 w-full">
|
||||
<Button
|
||||
onClick={onGetStarted}
|
||||
className="grid w-full grid-flow-col items-center gap-2"
|
||||
>
|
||||
Get started
|
||||
</Button>
|
||||
<ButtonSubtext onClick={onRemainLocal}>
|
||||
<div className="mt-4 flex cursor-pointer items-center justify-center gap-1">
|
||||
<span>Or, remain local</span>
|
||||
<ChevronRightIcon className="h-3 w-3" />
|
||||
</div>
|
||||
</ButtonSubtext>
|
||||
</div>
|
||||
</div>
|
||||
);
|
||||
}
|
||||
|
|
@ -7,7 +7,7 @@ import { UserCircleIcon as UserCircleIconSolid } from "@heroicons/react/24/solid
|
|||
import { ProfileDescription } from "core/config/ConfigHandler";
|
||||
import { Fragment, useContext, useEffect, useState } from "react";
|
||||
import ReactDOM from "react-dom";
|
||||
import { useDispatch, useSelector } from "react-redux";
|
||||
import { useDispatch } from "react-redux";
|
||||
import styled from "styled-components";
|
||||
import {
|
||||
defaultBorderRadius,
|
||||
|
|
@ -21,11 +21,10 @@ import {
|
|||
import { useAuth } from "../context/Auth";
|
||||
import { IdeMessengerContext } from "../context/IdeMessenger";
|
||||
import { useWebviewListener } from "../hooks/useWebviewListener";
|
||||
import { useAppSelector } from "../redux/hooks";
|
||||
import { setLastControlServerBetaEnabledStatus } from "../redux/slices/miscSlice";
|
||||
import { RootState } from "../redux/store";
|
||||
import { getFontSize } from "../util";
|
||||
import HeaderButtonWithToolTip from "./gui/HeaderButtonWithToolTip";
|
||||
import { useAppSelector } from "../redux/hooks";
|
||||
|
||||
const StyledListbox = styled(Listbox)`
|
||||
background-color: ${vscBackground};
|
||||
|
|
@ -148,9 +147,6 @@ function ProfileSwitcher() {
|
|||
|
||||
const shouldShowPopup =
|
||||
!lastControlServerBetaEnabledStatus && enableControlServerBeta;
|
||||
if (shouldShowPopup) {
|
||||
ideMessenger.ide.showToast("info", "Continue for Teams enabled");
|
||||
}
|
||||
});
|
||||
}, []);
|
||||
|
||||
|
|
|
|||
80
gui/src/components/dialogs/AboutAssistantDialog.tsx
Normal file
80
gui/src/components/dialogs/AboutAssistantDialog.tsx
Normal file
|
|
@ -0,0 +1,80 @@
|
|||
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 (
|
||||
<div className="h-[60vh] space-y-4 overflow-y-scroll px-4 pb-4">
|
||||
<h2>About {selectedProfileId} assistant</h2>
|
||||
{configJson.models?.length > 0 && (
|
||||
<details>
|
||||
<summary>Chat models</summary>
|
||||
<ul>
|
||||
{configJson.models.map((model, index) => (
|
||||
<li key={index}>{model.title}</li>
|
||||
))}
|
||||
</ul>
|
||||
</details>
|
||||
)}
|
||||
|
||||
{configJson.embeddingsProvider && (
|
||||
<details>
|
||||
<summary>Embedding model</summary>
|
||||
<p>{configJson.embeddingsProvider}</p>
|
||||
</details>
|
||||
)}
|
||||
|
||||
{configJson.reranker?.name && (
|
||||
<details>
|
||||
<summary>Rerank model</summary>
|
||||
<p>{configJson.reranker.name}</p>
|
||||
</details>
|
||||
)}
|
||||
|
||||
{configJson.systemMessage && (
|
||||
<details>
|
||||
<summary>Rules</summary>
|
||||
<p>{configJson.systemMessage}</p>
|
||||
</details>
|
||||
)}
|
||||
|
||||
{configJson.contextProviders?.length ? (
|
||||
<details>
|
||||
<summary>Context</summary>
|
||||
<ul>
|
||||
{configJson.contextProviders.map((provider, index) => (
|
||||
<li key={index}>{provider.title}</li>
|
||||
))}
|
||||
</ul>
|
||||
</details>
|
||||
) : null}
|
||||
|
||||
{configJson.tools.length > 0 && (
|
||||
<details>
|
||||
<summary>Tools</summary>
|
||||
<ul>
|
||||
{configJson.tools.map((tool, index) => (
|
||||
<li key={index}>{tool.displayTitle}</li>
|
||||
))}
|
||||
</ul>
|
||||
</details>
|
||||
)}
|
||||
|
||||
{configJson.docs?.length ? (
|
||||
<details>
|
||||
<summary>Docs</summary>
|
||||
<ul>
|
||||
{configJson.docs.map((doc, index) => (
|
||||
<li key={index}>{doc.title}</li>
|
||||
))}
|
||||
</ul>
|
||||
</details>
|
||||
) : null}
|
||||
</div>
|
||||
);
|
||||
}
|
||||
|
|
@ -1,4 +1,4 @@
|
|||
import styled, { keyframes } from "styled-components";
|
||||
import styled from "styled-components";
|
||||
import { getFontSize, isJetBrains } from "../util";
|
||||
|
||||
export const VSC_INPUT_BACKGROUND_VAR = "--vscode-input-background";
|
||||
|
|
@ -298,11 +298,6 @@ export const HeaderButton = styled.button<{
|
|||
padding: 2px;
|
||||
`;
|
||||
|
||||
export const Divider = styled.div`
|
||||
height: 1px;
|
||||
background-color: ${lightGray};
|
||||
`;
|
||||
|
||||
export const StyledActionButton = styled.div`
|
||||
display: flex;
|
||||
justify-content: space-between;
|
||||
|
|
|
|||
|
|
@ -107,6 +107,7 @@ function ContextItemsPeekItem({ contextItem }: ContextItemsPeekItemProps) {
|
|||
<div
|
||||
onClick={openContextItem}
|
||||
className="group mr-2 flex cursor-pointer items-center overflow-hidden text-ellipsis whitespace-nowrap rounded px-1.5 py-1 text-xs hover:bg-white/10"
|
||||
data-testid="context-items-peek-item"
|
||||
>
|
||||
<div className="flex w-full items-center">
|
||||
{getContextItemIcon()}
|
||||
|
|
@ -161,6 +162,7 @@ function ContextItemsPeek({
|
|||
<div
|
||||
className="flex cursor-pointer items-center justify-start text-xs text-gray-300"
|
||||
onClick={() => setOpen((prev) => !prev)}
|
||||
data-testid="context-items-peek"
|
||||
>
|
||||
<div className="relative mr-1 h-4 w-4">
|
||||
<ChevronRightIcon
|
||||
|
|
|
|||
|
|
@ -10,7 +10,7 @@ import {
|
|||
vscInputBackground,
|
||||
} from "..";
|
||||
import { useAppDispatch, useAppSelector } from "../../redux/hooks";
|
||||
import { selectUseActiveFile } from "../../redux/selectors";
|
||||
import { selectUseActiveFile, selectUsePlatform } from "../../redux/selectors";
|
||||
import { selectDefaultModel } from "../../redux/slices/configSlice";
|
||||
import {
|
||||
selectHasCodeToEdit,
|
||||
|
|
@ -26,6 +26,7 @@ import {
|
|||
} from "../../util";
|
||||
import { ToolTip } from "../gui/Tooltip";
|
||||
import ModelSelect from "../modelSelection/ModelSelect";
|
||||
import AssistantAndModelSelect from "../modelSelection/platform/AssistantAndModelSelect";
|
||||
import HoverItem from "./InputToolbar/HoverItem";
|
||||
import ToggleToolsButton from "./InputToolbar/ToggleToolsButton";
|
||||
|
||||
|
|
@ -96,6 +97,8 @@ function InputToolbar(props: InputToolbarProps) {
|
|||
modelSupportsTools(defaultModel.model, defaultModel.provider) &&
|
||||
!props.toolbarOptions?.hideTools;
|
||||
|
||||
const usePlatform = useAppSelector(selectUsePlatform);
|
||||
|
||||
const supportsImages =
|
||||
defaultModel &&
|
||||
modelSupportsImages(
|
||||
|
|
@ -114,7 +117,7 @@ function InputToolbar(props: InputToolbarProps) {
|
|||
className="find-widget-skip flex"
|
||||
>
|
||||
<div className="flex items-center justify-start gap-2 whitespace-nowrap">
|
||||
<ModelSelect />
|
||||
{usePlatform ? <AssistantAndModelSelect /> : <ModelSelect />}
|
||||
<div className="xs:flex -mb-1 hidden items-center text-gray-400 transition-colors duration-200">
|
||||
{props.toolbarOptions?.hideImageUpload ||
|
||||
(supportsImages && (
|
||||
|
|
|
|||
|
|
@ -0,0 +1,26 @@
|
|||
import { Transition } from "@headlessui/react";
|
||||
|
||||
export default function PopoverTransition({
|
||||
children,
|
||||
show,
|
||||
afterLeave,
|
||||
}: {
|
||||
children: React.ReactNode;
|
||||
show?: boolean;
|
||||
afterLeave?: () => void;
|
||||
}) {
|
||||
return (
|
||||
<Transition
|
||||
show={show}
|
||||
enter="transition duration-100 ease-out"
|
||||
enterFrom="transform scale-95 opacity-0"
|
||||
enterTo="transform scale-100 opacity-100"
|
||||
leave="transition duration-75 ease-out"
|
||||
leaveFrom="transform scale-100 opacity-100"
|
||||
leaveTo="transform scale-95 opacity-0"
|
||||
afterLeave={afterLeave}
|
||||
>
|
||||
{children}
|
||||
</Transition>
|
||||
);
|
||||
}
|
||||
|
|
@ -1,4 +1,4 @@
|
|||
import { Listbox, Transition } from "@headlessui/react";
|
||||
import { Listbox } from "@headlessui/react";
|
||||
import {
|
||||
EllipsisHorizontalCircleIcon as EllipsisHorizontalIcon,
|
||||
WrenchScrewdriverIcon as WrenchScrewdriverIconOutline,
|
||||
|
|
@ -7,12 +7,13 @@ import { WrenchScrewdriverIcon as WrenchScrewdriverIconSolid } from "@heroicons/
|
|||
import { useEffect, useRef, useState } from "react";
|
||||
import { useDispatch } from "react-redux";
|
||||
import { lightGray, vscForeground } from "../..";
|
||||
import { useAppSelector } from "../../../redux/hooks";
|
||||
import { toggleUseTools } from "../../../redux/slices/uiSlice";
|
||||
import { ToolTip } from "../../gui/Tooltip";
|
||||
import InfoHover from "../../InfoHover";
|
||||
import HoverItem from "./HoverItem";
|
||||
import PopoverTransition from "./PopoverTransition";
|
||||
import ToolDropdownItem from "./ToolDropdownItem";
|
||||
import { useAppSelector } from "../../../redux/hooks";
|
||||
import { ToolTip } from "../../gui/Tooltip";
|
||||
|
||||
export default function ToolDropdown() {
|
||||
const buttonRef = useRef<HTMLButtonElement>(null);
|
||||
|
|
@ -85,14 +86,8 @@ export default function ToolDropdown() {
|
|||
>
|
||||
<EllipsisHorizontalIcon className="h-3 w-3 cursor-pointer hover:brightness-125" />
|
||||
</Listbox.Button>
|
||||
<Transition
|
||||
<PopoverTransition
|
||||
show={open}
|
||||
enter="transition duration-100 ease-out"
|
||||
enterFrom="transform scale-95 opacity-0"
|
||||
enterTo="transform scale-100 opacity-100"
|
||||
leave="transition duration-75 ease-out"
|
||||
leaveFrom="transform scale-100 opacity-100"
|
||||
leaveTo="transform scale-95 opacity-0"
|
||||
afterLeave={() => setDropdownOpen(false)}
|
||||
>
|
||||
<Listbox.Options
|
||||
|
|
@ -151,7 +146,7 @@ export default function ToolDropdown() {
|
|||
))}
|
||||
</div>
|
||||
</Listbox.Options>
|
||||
</Transition>
|
||||
</PopoverTransition>
|
||||
</>
|
||||
)}
|
||||
</Listbox>
|
||||
|
|
|
|||
|
|
@ -46,11 +46,11 @@ import FileIcon from "../FileIcon";
|
|||
import SafeImg from "../SafeImg";
|
||||
import AddDocsDialog from "../dialogs/AddDocsDialog";
|
||||
import HeaderButtonWithToolTip from "../gui/HeaderButtonWithToolTip";
|
||||
import { ComboBoxItem, ComboBoxItemType } from "./types";
|
||||
import { DiscordIcon } from "../svg/DiscordIcon";
|
||||
import { GoogleIcon } from "../svg/GoogleIcon";
|
||||
import { GitlabIcon } from "../svg/GitlabIcon";
|
||||
import { GithubIcon } from "../svg/GithubIcon";
|
||||
import { GitlabIcon } from "../svg/GitlabIcon";
|
||||
import { GoogleIcon } from "../svg/GoogleIcon";
|
||||
import { ComboBoxItem, ComboBoxItemType } from "./types";
|
||||
|
||||
const ICONS_FOR_DROPDOWN: { [key: string]: any } = {
|
||||
file: FolderIcon,
|
||||
|
|
@ -81,6 +81,7 @@ const ICONS_FOR_DROPDOWN: { [key: string]: any } = {
|
|||
google: GoogleIcon,
|
||||
"gitlab-mr": GitlabIcon,
|
||||
http: GlobeAltIcon,
|
||||
trash: TrashIcon,
|
||||
};
|
||||
|
||||
export function getIconFromDropdownItem(
|
||||
|
|
@ -413,6 +414,7 @@ const MentionList = forwardRef((props: MentionListProps, ref) => {
|
|||
key={index}
|
||||
onClick={() => selectItem(index)}
|
||||
onMouseEnter={() => setSelectedIndex(index)}
|
||||
data-testid="context-provider-dropdown-item"
|
||||
>
|
||||
<span className="flex w-full items-center justify-between">
|
||||
<div className="flex items-center justify-center">
|
||||
|
|
@ -451,7 +453,10 @@ const MentionList = forwardRef((props: MentionListProps, ref) => {
|
|||
/>
|
||||
)}
|
||||
{item.subActions?.map((subAction) => {
|
||||
const Icon = ICONS_FOR_DROPDOWN[subAction.icon];
|
||||
const Icon = getIconFromDropdownItem(
|
||||
subAction.icon,
|
||||
"action",
|
||||
);
|
||||
return (
|
||||
<HeaderButtonWithToolTip
|
||||
onClick={(e) => {
|
||||
|
|
|
|||
|
|
@ -6,17 +6,17 @@ import {
|
|||
PlusIcon,
|
||||
TrashIcon,
|
||||
} from "@heroicons/react/24/outline";
|
||||
import { MouseEvent, useContext, useEffect, useRef, useState } from "react";
|
||||
import { useDispatch, useSelector } from "react-redux";
|
||||
import { useContext, useEffect, useRef, useState } from "react";
|
||||
import { useDispatch } from "react-redux";
|
||||
import styled from "styled-components";
|
||||
import {
|
||||
defaultBorderRadius,
|
||||
Divider,
|
||||
lightGray,
|
||||
vscInputBackground,
|
||||
} from "..";
|
||||
import { defaultBorderRadius, lightGray, vscInputBackground } from "..";
|
||||
import { IdeMessengerContext } from "../../context/IdeMessenger";
|
||||
import AddModelForm from "../../forms/AddModelForm";
|
||||
import { useAppSelector } from "../../redux/hooks";
|
||||
import {
|
||||
selectDefaultModel,
|
||||
setDefaultModel,
|
||||
} from "../../redux/slices/configSlice";
|
||||
import { setDialogMessage, setShowDialog } from "../../redux/slices/uiSlice";
|
||||
import {
|
||||
getFontSize,
|
||||
|
|
@ -24,11 +24,7 @@ import {
|
|||
isMetaEquivalentKeyPressed,
|
||||
} from "../../util";
|
||||
import ConfirmationDialog from "../dialogs/ConfirmationDialog";
|
||||
import { useAppSelector } from "../../redux/hooks";
|
||||
import {
|
||||
selectDefaultModel,
|
||||
setDefaultModel,
|
||||
} from "../../redux/slices/configSlice";
|
||||
import { Divider } from "./platform/shared";
|
||||
|
||||
interface ModelOptionProps {
|
||||
option: Option;
|
||||
|
|
@ -144,7 +140,7 @@ function ModelOption({
|
|||
const dispatch = useDispatch();
|
||||
const [hovered, setHovered] = useState(false);
|
||||
|
||||
function onClickDelete(e: MouseEvent) {
|
||||
function onClickDelete(e: any) {
|
||||
e.stopPropagation();
|
||||
e.preventDefault();
|
||||
|
||||
|
|
@ -164,7 +160,7 @@ function ModelOption({
|
|||
);
|
||||
}
|
||||
|
||||
function onClickGear(e: MouseEvent) {
|
||||
function onClickGear(e: any) {
|
||||
e.stopPropagation();
|
||||
e.preventDefault();
|
||||
|
||||
|
|
@ -173,7 +169,7 @@ function ModelOption({
|
|||
});
|
||||
}
|
||||
|
||||
function handleOptionClick(e: MouseEvent) {
|
||||
function handleOptionClick(e: any) {
|
||||
if (showMissingApiKeyMsg) {
|
||||
e.preventDefault();
|
||||
e.stopPropagation();
|
||||
|
|
|
|||
|
|
@ -0,0 +1,194 @@
|
|||
import { Popover } from "@headlessui/react";
|
||||
import {
|
||||
ChevronDownIcon,
|
||||
DocumentIcon,
|
||||
SparklesIcon,
|
||||
} from "@heroicons/react/24/outline";
|
||||
import { useEffect, useRef, useState } from "react";
|
||||
import styled from "styled-components";
|
||||
import { defaultBorderRadius, lightGray, vscInputBackground } from "../..";
|
||||
import { useAuth } from "../../../context/Auth";
|
||||
import AddModelForm from "../../../forms/AddModelForm";
|
||||
import { useAppDispatch, useAppSelector } from "../../../redux/hooks";
|
||||
import {
|
||||
cycleDefaultModel,
|
||||
selectDefaultModel,
|
||||
} from "../../../redux/slices/configSlice";
|
||||
import { setDialogMessage, setShowDialog } from "../../../redux/slices/uiSlice";
|
||||
import { cycleProfile } from "../../../redux/thunks/cycleProfile";
|
||||
import { getFontSize, isMetaEquivalentKeyPressed } from "../../../util";
|
||||
import PopoverTransition from "../../mainInput/InputToolbar/PopoverTransition";
|
||||
import { AssistantSelect } from "./AssistantSelect";
|
||||
import { ModelSelect, modelSelectTitle } from "./ModelSelect";
|
||||
import { MAX_HEIGHT_PX } from "./shared";
|
||||
|
||||
const StyledPopoverButton = styled(Popover.Button)`
|
||||
font-family: inherit;
|
||||
display: flex;
|
||||
align-items: center;
|
||||
gap: 2px;
|
||||
border: none;
|
||||
cursor: pointer;
|
||||
font-size: ${getFontSize() - 2}px;
|
||||
background: transparent;
|
||||
color: ${lightGray};
|
||||
&:focus {
|
||||
outline: none;
|
||||
}
|
||||
`;
|
||||
|
||||
const StyledPopoverPanel = styled(Popover.Panel)<{ $showabove: boolean }>`
|
||||
margin-top: 4px;
|
||||
position: absolute;
|
||||
padding: 0px;
|
||||
cursor: default;
|
||||
|
||||
display: flex;
|
||||
flex-direction: row;
|
||||
|
||||
border-radius: ${defaultBorderRadius};
|
||||
border: 0.5px solid ${lightGray};
|
||||
background-color: ${vscInputBackground};
|
||||
|
||||
${(props) => (props.$showabove ? "bottom: 100%;" : "top: 100%;")}
|
||||
`;
|
||||
|
||||
function AssistantAndModelSelect() {
|
||||
const dispatch = useAppDispatch();
|
||||
const defaultModel = useAppSelector(selectDefaultModel);
|
||||
const [showAbove, setShowAbove] = useState(false);
|
||||
const buttonRef = useRef<HTMLButtonElement>(null);
|
||||
const selectedProfileId = useAppSelector(
|
||||
(store) => store.session.selectedProfileId,
|
||||
);
|
||||
|
||||
const { profiles, selectedProfile } = useAuth();
|
||||
|
||||
useEffect(() => {
|
||||
const handleResize = () => calculatePosition();
|
||||
window.addEventListener("resize", handleResize);
|
||||
return () => window.removeEventListener("resize", handleResize);
|
||||
}, []);
|
||||
|
||||
function calculatePosition() {
|
||||
if (!buttonRef.current) {
|
||||
return;
|
||||
}
|
||||
const rect = buttonRef.current.getBoundingClientRect();
|
||||
const spaceBelow = window.innerHeight - rect.bottom;
|
||||
const spaceAbove = rect.top;
|
||||
const dropdownHeight = MAX_HEIGHT_PX;
|
||||
|
||||
setShowAbove(spaceBelow < dropdownHeight && spaceAbove > spaceBelow);
|
||||
}
|
||||
|
||||
function onClickAddModel(e: any) {
|
||||
e.stopPropagation();
|
||||
e.preventDefault();
|
||||
|
||||
// Close the dropdown
|
||||
if (buttonRef.current) {
|
||||
buttonRef.current.click();
|
||||
}
|
||||
dispatch(setShowDialog(true));
|
||||
dispatch(
|
||||
setDialogMessage(
|
||||
<AddModelForm
|
||||
onDone={() => {
|
||||
dispatch(setShowDialog(false));
|
||||
}}
|
||||
/>,
|
||||
),
|
||||
);
|
||||
}
|
||||
|
||||
useEffect(() => {
|
||||
let lastToggleTime = 0;
|
||||
const DEBOUNCE_MS = 500;
|
||||
|
||||
const handleKeyDown = (event: KeyboardEvent) => {
|
||||
if (event.key === "'" && isMetaEquivalentKeyPressed(event as any)) {
|
||||
const now = Date.now();
|
||||
|
||||
if (event.shiftKey) {
|
||||
dispatch(cycleDefaultModel("next"));
|
||||
} else {
|
||||
if (now - lastToggleTime >= DEBOUNCE_MS) {
|
||||
dispatch(cycleProfile());
|
||||
lastToggleTime = now;
|
||||
}
|
||||
}
|
||||
}
|
||||
};
|
||||
|
||||
window.addEventListener("keydown", handleKeyDown);
|
||||
return () => {
|
||||
window.removeEventListener("keydown", handleKeyDown);
|
||||
};
|
||||
}, []);
|
||||
|
||||
return (
|
||||
<Popover>
|
||||
<div className="relative">
|
||||
<StyledPopoverButton
|
||||
data-testid="model-select-button"
|
||||
ref={buttonRef}
|
||||
className="h-[18px] overflow-hidden"
|
||||
style={{ padding: 0 }}
|
||||
onClick={calculatePosition}
|
||||
>
|
||||
<div className="flex max-w-[33vw] items-center gap-0.5 text-gray-400 transition-colors duration-200">
|
||||
{selectedProfile?.id === "local" ? (
|
||||
<>
|
||||
<DocumentIcon
|
||||
className="mr-1 h-4 w-4 flex-shrink-0"
|
||||
aria-hidden="true"
|
||||
/>
|
||||
<span className="truncate">
|
||||
{modelSelectTitle(defaultModel) || "Select model"}
|
||||
</span>
|
||||
</>
|
||||
) : (
|
||||
<>
|
||||
<SparklesIcon
|
||||
className="mr-1 h-4 w-4 flex-shrink-0"
|
||||
aria-hidden="true"
|
||||
/>
|
||||
<span className="truncate">
|
||||
{selectedProfile?.title || "Select assistant"}
|
||||
{" / "}
|
||||
{modelSelectTitle(defaultModel) || "Select model"}
|
||||
</span>
|
||||
</>
|
||||
)}
|
||||
<ChevronDownIcon
|
||||
className="h-3 w-3 flex-shrink-0"
|
||||
aria-hidden="true"
|
||||
/>
|
||||
</div>
|
||||
</StyledPopoverButton>
|
||||
<PopoverTransition>
|
||||
<StyledPopoverPanel
|
||||
$showabove={showAbove}
|
||||
className="flex max-w-[90vw] overflow-hidden"
|
||||
style={{ zIndex: 1000 }}
|
||||
>
|
||||
<AssistantSelect
|
||||
onClose={() => {
|
||||
if (buttonRef.current) {
|
||||
buttonRef.current.click();
|
||||
}
|
||||
}}
|
||||
/>
|
||||
<ModelSelect
|
||||
selectedProfileId={selectedProfileId}
|
||||
onClickAddModel={onClickAddModel}
|
||||
/>
|
||||
</StyledPopoverPanel>
|
||||
</PopoverTransition>
|
||||
</div>
|
||||
</Popover>
|
||||
);
|
||||
}
|
||||
|
||||
export default AssistantAndModelSelect;
|
||||
Some files were not shown because too many files have changed in this diff Show more
Loading…
Add table
Reference in a new issue