diff --git a/core/config/load.ts b/core/config/load.ts index 5400bc81b..157ae28ae 100644 --- a/core/config/load.ts +++ b/core/config/load.ts @@ -559,6 +559,7 @@ async function finalToBrowserConfig( requestOptions: m.requestOptions, promptTemplates: m.promptTemplates as any, capabilities: m.capabilities, + roles: m.roles, })), systemMessage: final.systemMessage, completionOptions: final.completionOptions, diff --git a/core/config/profile/PlatformProfileLoader.ts b/core/config/profile/PlatformProfileLoader.ts index 7650cb0e3..04f1d3acf 100644 --- a/core/config/profile/PlatformProfileLoader.ts +++ b/core/config/profile/PlatformProfileLoader.ts @@ -1,5 +1,4 @@ -import { ConfigResult } from "@continuedev/config-yaml"; -import { AssistantUnrolled } from "@continuedev/config-yaml/dist/schemas/index.js"; +import { ConfigResult, AssistantUnrolled } from "@continuedev/config-yaml"; import { ControlPlaneClient } from "../../control-plane/client.js"; import { ContinueConfig, IDE, IdeSettings } from "../../index.js"; diff --git a/core/config/types.ts b/core/config/types.ts index 384da0c8f..2a68c4c35 100644 --- a/core/config/types.ts +++ b/core/config/types.ts @@ -956,7 +956,7 @@ declare global { fixGrammar?: string; } - interface ModelRoles { + interface ExperimentalModelRoles { inlineEdit?: string; applyCodeBlock?: string; repoMapFileSelection?: string; @@ -1024,7 +1024,7 @@ declare global { interface ExperimentalConfig { contextMenuPrompts?: ContextMenuConfig; - modelRoles?: ModelRoles; + modelRoles?: ExperimentalModelRoles; defaultContext?: DefaultContextProvider[]; promptPath?: string; diff --git a/core/config/util.ts b/core/config/util.ts index 6d28dcbcb..06acdf2b1 100644 --- a/core/config/util.ts +++ b/core/config/util.ts @@ -7,7 +7,7 @@ import { IDE, ILLM, ModelDescription, - ModelRoles, + ExperimentalModelRoles, } from "../"; import { GlobalContext } from "../util/GlobalContext"; import { editConfigJson } from "../util/paths"; @@ -34,7 +34,10 @@ export function addContextProvider(provider: ContextProviderWithParams) { }); } -export function addModel(model: ModelDescription, role?: keyof ModelRoles) { +export function addModel( + model: ModelDescription, + role?: keyof ExperimentalModelRoles, +) { editConfigJson((config) => { if (config.models?.some((m: any) => stringify(m) === stringify(model))) { return config; @@ -85,7 +88,7 @@ export function deleteModel(title: string) { }); } -export function getModelByRole( +export function getModelByRole( config: ContinueConfig, role: T, ): ILLM | undefined { diff --git a/core/config/yaml/convertFromJson.ts b/core/config/yaml/convertFromJson.ts index 576e196c8..a989d2631 100644 --- a/core/config/yaml/convertFromJson.ts +++ b/core/config/yaml/convertFromJson.ts @@ -1,5 +1,4 @@ -import { ModelConfig } from "@continuedev/config-yaml"; -import { AssistantUnrolled } from "@continuedev/config-yaml/dist/schemas"; +import { ModelConfig, AssistantUnrolled } from "@continuedev/config-yaml"; import { SerializedContinueConfig } from "../.."; diff --git a/core/config/yaml/default.ts b/core/config/yaml/default.ts index 0bc872f88..c9ca4dc8e 100644 --- a/core/config/yaml/default.ts +++ b/core/config/yaml/default.ts @@ -1,4 +1,4 @@ -import { AssistantUnrolled } from "@continuedev/config-yaml/dist/schemas"; +import { AssistantUnrolled } from "@continuedev/config-yaml"; // TODO export const defaultConfigYaml: AssistantUnrolled = { diff --git a/core/config/yaml/loadYaml.ts b/core/config/yaml/loadYaml.ts index 7bf59c343..57660ce53 100644 --- a/core/config/yaml/loadYaml.ts +++ b/core/config/yaml/loadYaml.ts @@ -7,10 +7,10 @@ import { parseAssistantUnrolled, validateConfigYaml, } from "@continuedev/config-yaml"; +import { ModelRole } from "@continuedev/config-yaml"; import { fetchwithRequestOptions } from "@continuedev/fetch"; import { - BrowserSerializedContinueConfig, ContinueConfig, IContextProvider, IDE, @@ -18,9 +18,11 @@ import { IdeType, SlashCommand, } from "../.."; +import { slashFromCustomCommand } from "../../commands"; import { AllRerankers } from "../../context/allRerankers"; import { MCPManagerSingleton } from "../../context/mcp"; import CodebaseContextProvider from "../../context/providers/CodebaseContextProvider"; +import DocsContextProvider from "../../context/providers/DocsContextProvider"; import FileContextProvider from "../../context/providers/FileContextProvider"; import { contextProviderClassFromName } from "../../context/providers/index"; import PromptFilesContextProvider from "../../context/providers/PromptFilesContextProvider"; @@ -30,15 +32,13 @@ import FreeTrial from "../../llm/llms/FreeTrial"; import TransformersJsEmbeddingsProvider from "../../llm/llms/TransformersJsEmbeddingsProvider"; import { slashCommandFromPromptFileV1 } from "../../promptFiles/v1/slashCommandFromPromptFile"; import { getAllPromptFiles } from "../../promptFiles/v2/getPromptFiles"; +import { allTools } from "../../tools"; +import { GlobalContext } from "../../util/GlobalContext"; import { getConfigYamlPath } from "../../util/paths"; import { getSystemPromptDotFile } from "../getSystemPromptDotFile"; import { PlatformConfigMetadata } from "../profile/PlatformProfileLoader"; - -import { slashFromCustomCommand } from "../../commands"; -import DocsContextProvider from "../../context/providers/DocsContextProvider"; -import { allTools } from "../../tools"; -import { GlobalContext } from "../../util/GlobalContext"; import { modifyContinueConfigWithSharedConfig } from "../sharedConfig"; + import { clientRenderHelper } from "./clientRender"; import { llmsFromModelConfig } from "./models"; @@ -134,12 +134,10 @@ async function configYamlToContinueConfig( }; // Models + const modelsArrayRoles: ModelRole[] = ["chat", "summarize", "apply", "edit"]; for (const model of config.models ?? []) { - if ( - ["chat", "summarize", "apply", "edit"].some((role: any) => - model.roles?.includes(role), - ) - ) { + model.roles = model.roles ?? ["chat"]; // Default to chat role if not specified + if (modelsArrayRoles.some((role) => model.roles?.includes(role))) { // Main model array const llms = await llmsFromModelConfig( model, @@ -245,6 +243,7 @@ async function configYamlToContinueConfig( } // Embeddings Provider + // IMPORTANT this currently will grab the first model found with an embed role const embedConfig = config.models?.find((model) => model.roles?.includes("embed"), ); @@ -269,6 +268,7 @@ async function configYamlToContinueConfig( } // Reranker + // IMPORTANT this currently will grab the first model found with a rerank role const rerankConfig = config.models?.find((model) => model.roles?.includes("rerank"), ); @@ -402,5 +402,3 @@ export async function loadContinueConfigFromYaml( configLoadInterrupted: false, }; } - -export { type BrowserSerializedContinueConfig }; diff --git a/core/index.d.ts b/core/index.d.ts index b1d15847a..ca55db8a0 100644 --- a/core/index.d.ts +++ b/core/index.d.ts @@ -1,6 +1,6 @@ import Parser from "web-tree-sitter"; import { GetGhTokenArgs } from "./protocol/ide"; - +import { ModelRole } from "@continuedev/config-yaml"; declare global { interface Window { ide?: "vscode"; @@ -94,6 +94,8 @@ export interface ILLM extends LLMOptions { apiKey?: string; apiBase?: string; cacheBehavior?: CacheBehavior; + capabilities?: ModelCapability; + roles?: ModelRole[]; deployment?: string; apiVersion?: string; @@ -480,6 +482,8 @@ export interface LLMOptions { aiGatewaySlug?: string; apiBase?: string; cacheBehavior?: CacheBehavior; + capabilities?: ModelCapability; + roles?: ModelRole[]; useLegacyCompletionsEndpoint?: boolean; @@ -503,9 +507,6 @@ export interface LLMOptions { // AWS and GCP Options region?: string; - // GCP Options - capabilities?: ModelCapability; - // GCP and Watsonx Options projectId?: string; @@ -923,8 +924,9 @@ export interface ModelDescription { systemMessage?: string; requestOptions?: RequestOptions; promptTemplates?: { [key: string]: string }; - capabilities?: ModelCapability; cacheBehavior?: CacheBehavior; + capabilities?: ModelCapability; + roles?: ModelRole[]; } export interface EmbedOptions { @@ -1015,7 +1017,7 @@ export interface ContextMenuConfig { fixGrammar?: string; } -export interface ModelRoles { +export interface ExperimentalModelRoles { inlineEdit?: string; applyCodeBlock?: string; repoMapFileSelection?: string; @@ -1083,7 +1085,7 @@ export type DefaultContextProvider = ContextProviderWithParams & { export interface ExperimentalConfig { contextMenuPrompts?: ContextMenuConfig; - modelRoles?: ModelRoles; + modelRoles?: ExperimentalModelRoles; defaultContext?: DefaultContextProvider[]; promptPath?: string; diff --git a/core/llm/index.ts b/core/llm/index.ts index 4989f14fa..7e3c37fc2 100644 --- a/core/llm/index.ts +++ b/core/llm/index.ts @@ -56,6 +56,7 @@ import { toCompleteBody, toFimBody, } from "./openaiTypeConverters.js"; +import { ModelRole } from "@continuedev/config-yaml"; export abstract class BaseLLM implements ILLM { static providerName: string; @@ -121,6 +122,7 @@ export abstract class BaseLLM implements ILLM { apiBase?: string; cacheBehavior?: CacheBehavior; capabilities?: ModelCapability; + roles?: ModelRole[]; deployment?: string; apiVersion?: string; @@ -209,6 +211,7 @@ export abstract class BaseLLM implements ILLM { } this.accountId = options.accountId; this.capabilities = options.capabilities; + this.roles = options.roles; this.deployment = options.deployment; this.apiVersion = options.apiVersion; diff --git a/core/package-lock.json b/core/package-lock.json index 4179cc7a5..cf94c1af2 100644 --- a/core/package-lock.json +++ b/core/package-lock.json @@ -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.28", + "@continuedev/config-yaml": "file:///Users/dallin/documents/code/continuedev/continue/packages/config-yaml/dist", "@continuedev/fetch": "^1.0.4", "@continuedev/llm-info": "^1.0.2", "@continuedev/openai-adapters": "^1.0.10", @@ -106,6 +106,7 @@ "node": ">=20.11.0" } }, + "../../../../../documents/code/continuedev/continue/packages/config-yaml/dist": {}, "node_modules/@75lb/deep-merge": { "version": "1.1.2", "resolved": "https://registry.npmjs.org/@75lb/deep-merge/-/deep-merge-1.1.2.tgz", @@ -3038,14 +3039,8 @@ } }, "node_modules/@continuedev/config-yaml": { - "version": "1.0.28", - "resolved": "https://registry.npmjs.org/@continuedev/config-yaml/-/config-yaml-1.0.28.tgz", - "integrity": "sha512-XTTRHeIYgLlwzPkub2jAPx4TqRf47g/TR2K9AIdZYQRNxYuHAeFRRqaIaAZPdykZATg30vdGQGGdssVr6IyCCg==", - "dependencies": { - "@continuedev/config-types": "^1.0.14", - "yaml": "^2.6.1", - "zod": "^3.23.8" - } + "resolved": "../../../../../documents/code/continuedev/continue/packages/config-yaml/dist", + "link": true }, "node_modules/@continuedev/fetch": { "version": "1.0.4", diff --git a/core/package.json b/core/package.json index f6f194d7f..c488404a1 100644 --- a/core/package.json +++ b/core/package.json @@ -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.28", + "@continuedev/config-yaml": "file:///Users/dallin/documents/code/continuedev/continue/packages/config-yaml/dist", "@continuedev/fetch": "^1.0.4", "@continuedev/llm-info": "^1.0.2", "@continuedev/openai-adapters": "^1.0.10", diff --git a/core/protocol/core.ts b/core/protocol/core.ts index 8eafca5a1..43985583c 100644 --- a/core/protocol/core.ts +++ b/core/protocol/core.ts @@ -18,7 +18,7 @@ import type { IdeSettings, LLMFullCompletionOptions, ModelDescription, - ModelRoles, + ExperimentalModelRoles, PromptLog, RangeInFile, SerializedContinueConfig, @@ -52,7 +52,7 @@ export type ToCoreFromIdeOrWebviewProtocol = { "config/addModel": [ { model: SerializedContinueConfig["models"][number]; - role?: keyof ModelRoles; + role?: keyof ExperimentalModelRoles; }, void, ]; diff --git a/extensions/vscode/config_schema.json b/extensions/vscode/config_schema.json index d9dab076b..44cb6dfc3 100644 --- a/extensions/vscode/config_schema.json +++ b/extensions/vscode/config_schema.json @@ -1683,33 +1683,6 @@ } ] }, - "ModelRoles": { - "title": "ModelRoles", - "type": "object", - "properties": { - "default": { - "title": "Default", - "description": "The default model. If other model roles are not set, they will fall back to default.", - "type": "string" - }, - "chat": { - "title": "Chat", - "description": "The model to use for chat. If not set, will fall back to default.", - "type": "string" - }, - "edit": { - "title": "Edit", - "description": "The model to use for editing. If not set, will fall back to default.", - "type": "string" - }, - "summarize": { - "title": "Summarize", - "description": "The model to use for summarization. If not set, will fall back to default.", - "type": "string" - } - }, - "required": ["default"] - }, "SlashCommand": { "title": "SlashCommand", "type": "object", diff --git a/extensions/vscode/package-lock.json b/extensions/vscode/package-lock.json index 2e51c407e..52939ae0b 100644 --- a/extensions/vscode/package-lock.json +++ b/extensions/vscode/package-lock.json @@ -1,12 +1,12 @@ { "name": "continue", - "version": "0.9.262", + "version": "0.9.263", "lockfileVersion": 3, "requires": true, "packages": { "": { "name": "continue", - "version": "0.9.262", + "version": "0.9.263", "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.28", + "@continuedev/config-yaml": "file:///Users/dallin/documents/code/continuedev/continue/packages/config-yaml/dist", "@continuedev/fetch": "^1.0.4", "@continuedev/llm-info": "^1.0.2", "@continuedev/openai-adapters": "^1.0.10", diff --git a/gui/package-lock.json b/gui/package-lock.json index 5c134a9e6..283dd47f8 100644 --- a/gui/package-lock.json +++ b/gui/package-lock.json @@ -7,7 +7,7 @@ "name": "gui", "license": "Apache-2.0", "dependencies": { - "@continuedev/config-yaml": "^1.0.28", + "@continuedev/config-yaml": "file:///Users/dallin/documents/code/continuedev/continue/packages/config-yaml/dist", "@headlessui/react": "^1.7.17", "@heroicons/react": "^2.0.18", "@reduxjs/toolkit": "^2.3.0", @@ -99,6 +99,7 @@ "node": ">=20.11.0" } }, + "../../../../../documents/code/continuedev/continue/packages/config-yaml/dist": {}, "../core": { "name": "@continuedev/core", "version": "1.0.13", @@ -108,7 +109,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.28", + "@continuedev/config-yaml": "file:///Users/dallin/documents/code/continuedev/continue/packages/config-yaml/dist", "@continuedev/fetch": "^1.0.4", "@continuedev/llm-info": "^1.0.2", "@continuedev/openai-adapters": "^1.0.10", @@ -547,23 +548,9 @@ "integrity": "sha512-0hYQ8SB4Db5zvZB4axdMHGwEaQjkZzFjQiN9LVYvIFB2nSUHW9tYpxWriPrWDASIxiaXax83REcLxuSdnGPZtw==", "dev": true }, - "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.28", - "resolved": "https://registry.npmjs.org/@continuedev/config-yaml/-/config-yaml-1.0.28.tgz", - "integrity": "sha512-XTTRHeIYgLlwzPkub2jAPx4TqRf47g/TR2K9AIdZYQRNxYuHAeFRRqaIaAZPdykZATg30vdGQGGdssVr6IyCCg==", - "dependencies": { - "@continuedev/config-types": "^1.0.14", - "yaml": "^2.6.1", - "zod": "^3.23.8" - } + "resolved": "../../../../../documents/code/continuedev/continue/packages/config-yaml/dist", + "link": true }, "node_modules/@emotion/is-prop-valid": { "version": "1.3.1", @@ -13735,6 +13722,7 @@ "version": "2.6.1", "resolved": "https://registry.npmjs.org/yaml/-/yaml-2.6.1.tgz", "integrity": "sha512-7r0XPzioN/Q9kXBro/XPnA6kznR73DHq+GXh5ON7ZozRO6aMjbmiBuKste2wslTFkC5d1dw0GooOCepZXJ2SAg==", + "dev": true, "bin": { "yaml": "bin.mjs" }, @@ -13754,14 +13742,6 @@ "url": "https://github.com/sponsors/sindresorhus" } }, - "node_modules/zod": { - "version": "3.24.1", - "resolved": "https://registry.npmjs.org/zod/-/zod-3.24.1.tgz", - "integrity": "sha512-muH7gBL9sI1nciMZV67X5fTKKBLtwpZ5VBp1vsOQzj1MhrBZ4wlVCm3gedKZWLp0Oyel8sIGfeiz54Su+OVT+A==", - "funding": { - "url": "https://github.com/sponsors/colinhacks" - } - }, "node_modules/zwitch": { "version": "2.0.4", "resolved": "https://registry.npmjs.org/zwitch/-/zwitch-2.0.4.tgz", diff --git a/gui/package.json b/gui/package.json index b19106429..ecaafb023 100644 --- a/gui/package.json +++ b/gui/package.json @@ -15,7 +15,7 @@ "test:watch": "vitest" }, "dependencies": { - "@continuedev/config-yaml": "^1.0.28", + "@continuedev/config-yaml": "file:///Users/dallin/documents/code/continuedev/continue/packages/config-yaml/dist", "@headlessui/react": "^1.7.17", "@heroicons/react": "^2.0.18", "@reduxjs/toolkit": "^2.3.0", diff --git a/packages/config-yaml/package.json b/packages/config-yaml/package.json index 005112b06..a4b386bbe 100644 --- a/packages/config-yaml/package.json +++ b/packages/config-yaml/package.json @@ -1,6 +1,6 @@ { "name": "@continuedev/config-yaml", - "version": "1.0.28", + "version": "1.0.29", "description": "", "main": "dist/index.js", "types": "dist/index.d.ts", diff --git a/packages/config-yaml/src/converter.ts b/packages/config-yaml/src/converter.ts index 56d5326d2..13f54cb8c 100644 --- a/packages/config-yaml/src/converter.ts +++ b/packages/config-yaml/src/converter.ts @@ -1,6 +1,6 @@ import { ConfigJson } from "@continuedev/config-types"; import { ConfigYaml } from "./schemas/index.js"; -import { ModelRoles } from "./schemas/models.js"; +import { ModelRole } from "./schemas/models.js"; type ModelYaml = NonNullable[number]; type ContextYaml = NonNullable[number]; @@ -8,7 +8,7 @@ type PromptYaml = NonNullable[number]; function convertModel( m: ConfigJson["models"][number], - roles: ModelRoles[], + roles: ModelRole[], ): ModelYaml { return { name: m.title, diff --git a/packages/config-yaml/src/index.ts b/packages/config-yaml/src/index.ts index 0fcd5ae10..51f9287c0 100644 --- a/packages/config-yaml/src/index.ts +++ b/packages/config-yaml/src/index.ts @@ -8,5 +8,5 @@ export * from "./load/merge.js"; export * from "./load/proxySecretResolution.js"; export * from "./load/unroll.js"; export * from "./schemas/index.js"; -export type { ModelConfig } from "./schemas/models.js"; +export type { ModelConfig, ModelRole } from "./schemas/models.js"; export * from "./validation.js"; diff --git a/packages/config-yaml/src/schemas/models.ts b/packages/config-yaml/src/schemas/models.ts index b5e40fcc1..05df2c1ad 100644 --- a/packages/config-yaml/src/schemas/models.ts +++ b/packages/config-yaml/src/schemas/models.ts @@ -29,7 +29,7 @@ export const modelRolesSchema = z.enum([ "apply", "summarize", ]); -export type ModelRoles = z.infer; +export type ModelRole = z.infer; export const completionOptionsSchema = z.object({ contextLength: z.number().optional(),