type progress

This commit is contained in:
Dallin Romney 2025-04-10 16:46:09 -07:00
commit fd151bf7b8
42 changed files with 604 additions and 166 deletions

View file

@ -31,6 +31,62 @@ jobs:
if: steps.root-cache.outputs.cache-hit != 'true'
run: npm ci
install-config-yaml:
needs: install-root
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- uses: actions/setup-node@v4
with:
node-version-file: ".nvmrc"
- uses: actions/cache@v4
with:
path: node_modules
key: ${{ runner.os }}-root-node-modules-${{ hashFiles('package-lock.json') }}
- uses: actions/cache@v4
id: config-yaml-cache
with:
path: packages/config-yaml/node_modules
key: ${{ runner.os }}-config-yaml-node-modules-${{ hashFiles('packages/config-yaml/package-lock.json') }}
- name: Install config-yaml dependencies
if: steps.config-yaml-cache.outputs.cache-hit != 'true'
run: |
cd packages/config-yaml
npm ci
config-yaml-checks:
needs: install-config-yaml
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- uses: actions/setup-node@v4
with:
node-version-file: ".nvmrc"
- uses: actions/cache@v4
with:
path: node_modules
key: ${{ runner.os }}-root-node-modules-${{ hashFiles('package-lock.json') }}
- uses: actions/cache@v4
id: config-yaml-cache
with:
path: packages/config-yaml/node_modules
key: ${{ runner.os }}-config-yaml-node-modules-${{ hashFiles('packages/config-yaml/package-lock.json') }}
- name: Build and check config-yaml
run: |
cd packages/config-yaml
npx tsc --noEmit
# Tests are currently failing, commenting out for now
# npm test
npm run build
install-core:
needs: install-root
runs-on: ubuntu-latest
@ -60,7 +116,7 @@ jobs:
npm ci
core-checks:
needs: install-core
needs: [install-core, install-config-yaml]
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
@ -81,6 +137,17 @@ jobs:
path: core/node_modules
key: ${{ runner.os }}-core-node-modules-${{ hashFiles('core/package-lock.json') }}
- uses: actions/cache@v4
id: config-yaml-cache
with:
path: packages/config-yaml/node_modules
key: ${{ runner.os }}-config-yaml-node-modules-${{ hashFiles('packages/config-yaml/package-lock.json') }}
- name: Build config-yaml
run: |
cd packages/config-yaml
npm run build
- name: Type check and lint
run: |
cd core
@ -90,7 +157,7 @@ jobs:
OPENAI_API_KEY: ${{ secrets.OPENAI_API_KEY }}
install-gui:
needs: [install-root, install-core]
needs: [install-root, install-core, install-config-yaml]
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
@ -115,6 +182,17 @@ jobs:
path: gui/node_modules
key: ${{ runner.os }}-gui-node-modules-${{ hashFiles('gui/package-lock.json') }}
- uses: actions/cache@v4
id: config-yaml-cache
with:
path: packages/config-yaml/node_modules
key: ${{ runner.os }}-config-yaml-node-modules-${{ hashFiles('packages/config-yaml/package-lock.json') }}
- name: Build config-yaml
run: |
cd packages/config-yaml
npm run build
- name: Install gui dependencies
if: steps.gui-cache.outputs.cache-hit != 'true'
run: |
@ -147,13 +225,24 @@ jobs:
path: gui/node_modules
key: ${{ runner.os }}-gui-node-modules-${{ hashFiles('gui/package-lock.json') }}
- uses: actions/cache@v4
id: config-yaml-cache
with:
path: packages/config-yaml/node_modules
key: ${{ runner.os }}-config-yaml-node-modules-${{ hashFiles('packages/config-yaml/package-lock.json') }}
- name: Build config-yaml
run: |
cd packages/config-yaml
npm run build
- name: Type check
run: |
cd gui
npx tsc --noEmit
binary-checks:
needs: [install-root, install-core]
needs: [install-root, install-core, install-config-yaml]
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
@ -178,6 +267,17 @@ jobs:
path: binary/node_modules
key: ${{ runner.os }}-binary-node-modules-${{ hashFiles('binary/package-lock.json') }}
- uses: actions/cache@v4
id: config-yaml-cache
with:
path: packages/config-yaml/node_modules
key: ${{ runner.os }}-config-yaml-node-modules-${{ hashFiles('packages/config-yaml/package-lock.json') }}
- name: Build config-yaml
run: |
cd packages/config-yaml
npm run build
- name: Install binary dependencies
if: steps.binary-cache.outputs.cache-hit != 'true'
run: |
@ -190,7 +290,7 @@ jobs:
npx tsc --noEmit
install-vscode:
needs: [install-root, install-core]
needs: [install-root, install-core, install-config-yaml]
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
@ -215,6 +315,17 @@ jobs:
path: extensions/vscode/node_modules
key: ${{ runner.os }}-vscode-node-modules-${{ hashFiles('extensions/vscode/package-lock.json') }}
- uses: actions/cache@v4
id: config-yaml-cache
with:
path: packages/config-yaml/node_modules
key: ${{ runner.os }}-config-yaml-node-modules-${{ hashFiles('packages/config-yaml/package-lock.json') }}
- name: Build config-yaml
run: |
cd packages/config-yaml
npm run build
- name: Install vscode dependencies
if: steps.vscode-cache.outputs.cache-hit != 'true'
run: |
@ -249,14 +360,26 @@ jobs:
path: extensions/vscode/node_modules
key: ${{ runner.os }}-vscode-node-modules-${{ hashFiles('extensions/vscode/package-lock.json') }}
- uses: actions/cache@v4
id: config-yaml-cache
with:
path: packages/config-yaml/node_modules
key: ${{ runner.os }}-config-yaml-node-modules-${{ hashFiles('packages/config-yaml/package-lock.json') }}
- name: Build config-yaml
run: |
cd packages/config-yaml
npm run build
- name: Type check and lint
run: |
cd extensions/vscode
npm run write-build-timestamp
npx tsc --noEmit
npm run lint
core-tests:
needs: install-core
needs: [install-core, install-config-yaml]
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
@ -270,6 +393,17 @@ jobs:
path: core/node_modules
key: ${{ runner.os }}-core-node-modules-${{ hashFiles('core/package-lock.json') }}
- uses: actions/cache@v4
id: config-yaml-cache
with:
path: packages/config-yaml/node_modules
key: ${{ runner.os }}-config-yaml-node-modules-${{ hashFiles('packages/config-yaml/package-lock.json') }}
- name: Build config-yaml
run: |
cd packages/config-yaml
npm run build
- name: Run core tests
run: |
cd core
@ -285,7 +419,7 @@ jobs:
vscode-get-test-file-matrix:
runs-on: ubuntu-latest
needs: [install-root, install-vscode]
needs: [install-root, install-vscode, install-config-yaml]
outputs:
test_file_matrix: ${{ steps.vscode-get-test-file-matrix.outputs.test_file_matrix }}
steps:
@ -297,6 +431,17 @@ jobs:
path: extensions/vscode/node_modules
key: ${{ runner.os }}-vscode-node-modules-${{ hashFiles('extensions/vscode/package-lock.json') }}
- uses: actions/cache@v4
id: config-yaml-cache
with:
path: packages/config-yaml/node_modules
key: ${{ runner.os }}-config-yaml-node-modules-${{ hashFiles('packages/config-yaml/package-lock.json') }}
- name: Build config-yaml
run: |
cd packages/config-yaml
npm run build
- name: Get test files
id: vscode-get-test-file-matrix
run: |
@ -320,7 +465,7 @@ jobs:
vscode-package-extension:
runs-on: ubuntu-latest
needs: [install-vscode, install-core]
needs: [install-vscode, install-core, install-config-yaml]
steps:
- uses: actions/checkout@v4
@ -340,6 +485,17 @@ jobs:
path: core/node_modules
key: ${{ runner.os }}-core-node-modules-${{ hashFiles('core/package-lock.json') }}
- uses: actions/cache@v4
id: config-yaml-cache
with:
path: packages/config-yaml/node_modules
key: ${{ runner.os }}-config-yaml-node-modules-${{ hashFiles('packages/config-yaml/package-lock.json') }}
- name: Build config-yaml
run: |
cd packages/config-yaml
npm run build
- name: Package extension
run: |
cd extensions/vscode
@ -353,7 +509,7 @@ jobs:
vscode-download-e2e-dependencies:
runs-on: ubuntu-latest
needs: [install-vscode, install-core]
needs: [install-vscode, install-core, install-config-yaml]
steps:
- uses: actions/checkout@v4
@ -373,6 +529,17 @@ jobs:
path: extensions/vscode/e2e/storage
key: ${{ runner.os }}-vscode-storage-${{ hashFiles('extensions/vscode/package-lock.json') }}
- uses: actions/cache@v4
id: config-yaml-cache
with:
path: packages/config-yaml/node_modules
key: ${{ runner.os }}-config-yaml-node-modules-${{ hashFiles('packages/config-yaml/package-lock.json') }}
- name: Build config-yaml
run: |
cd packages/config-yaml
npm run build
- name: Download Dependencies
if: steps.storage-cache.outputs.cache-hit != 'true'
run: |
@ -394,6 +561,7 @@ jobs:
vscode-package-extension,
install-vscode,
install-core,
install-config-yaml,
]
runs-on: ubuntu-latest
# Tests requiring secrets need approval from maintainers
@ -434,6 +602,17 @@ jobs:
name: vscode-e2e-dependencies
path: extensions/vscode/e2e/storage
- uses: actions/cache@v4
id: config-yaml-cache
with:
path: packages/config-yaml/node_modules
key: ${{ runner.os }}-config-yaml-node-modules-${{ hashFiles('packages/config-yaml/package-lock.json') }}
- name: Build config-yaml
run: |
cd packages/config-yaml
npm run build
- name: Fix VSCode binary permissions
run: |
chmod +x extensions/vscode/e2e/storage/VSCode-linux-x64/code
@ -476,7 +655,7 @@ jobs:
path: extensions/vscode/e2e/storage/screenshots
gui-tests:
needs: [install-gui, install-core]
needs: [install-gui, install-core, install-config-yaml]
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
@ -496,6 +675,17 @@ jobs:
path: core/node_modules
key: ${{ runner.os }}-core-node-modules-${{ hashFiles('core/package-lock.json') }}
- uses: actions/cache@v4
id: config-yaml-cache
with:
path: packages/config-yaml/node_modules
key: ${{ runner.os }}-config-yaml-node-modules-${{ hashFiles('packages/config-yaml/package-lock.json') }}
- name: Build config-yaml
run: |
cd packages/config-yaml
npm run build
- name: Install GUI dependencies
if: steps.gui-cache.outputs.cache-hit != 'true'
run: cd gui && npm ci
@ -508,7 +698,7 @@ jobs:
npm test
jetbrains-tests:
needs: [install-root, core-checks]
needs: [install-root, core-checks, install-config-yaml]
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
@ -517,6 +707,17 @@ jobs:
path: core/node_modules
key: ${{ runner.os }}-core-node-modules-${{ hashFiles('core/package-lock.json') }}
- uses: actions/cache@v4
id: config-yaml-cache
with:
path: packages/config-yaml/node_modules
key: ${{ runner.os }}-config-yaml-node-modules-${{ hashFiles('packages/config-yaml/package-lock.json') }}
- name: Build config-yaml
run: |
cd packages/config-yaml
npm run build
- name: Setup Java
uses: actions/setup-java@v4.5.0
with:
@ -627,6 +828,8 @@ jobs:
- vscode-e2e-tests
- gui-tests
- jetbrains-tests
- config-yaml-checks
- install-config-yaml
steps:
- name: Decide whether the needed jobs succeeded or failed

View file

@ -48,7 +48,7 @@
"@aws-sdk/client-sagemaker-runtime": "^3.777.0",
"@aws-sdk/credential-providers": "^3.778.0",
"@continuedev/config-types": "^1.0.13",
"@continuedev/config-yaml": "^1.0.71",
"@continuedev/config-yaml": "file:../packages/config-yaml",
"@continuedev/fetch": "^1.0.4",
"@continuedev/llm-info": "^1.0.8",
"@continuedev/openai-adapters": "^1.0.18",

View file

@ -34,13 +34,18 @@ export function ctxItemToRifWithContents(
): RangeInFileWithContents {
let startLine = 0;
let endLine = 0;
let adjustLines = linesOffByOne ? 1 : 0;
const nameSplit = item.name.split("(");
if (nameSplit.length > 1) {
const lines = nameSplit[1].split(")")[0].split("-");
startLine = Number.parseInt(lines[0], 10) - (linesOffByOne ? 1 : 0);
endLine = Number.parseInt(lines[1], 10) - (linesOffByOne ? 1 : 0);
startLine = Number.parseInt(lines[0], 10);
if (startLine === 0) {
adjustLines = 0; // safety to make sure doesn't go negative
}
startLine -= adjustLines;
endLine = Number.parseInt(lines[1], 10) - adjustLines;
}
const rif: RangeInFileWithContents = {

View file

@ -18,8 +18,6 @@ import {
ContinueConfig,
ContinueRcJson,
CustomContextProvider,
CustomLLM,
EmbeddingsProviderDescription,
IContextProvider,
IDE,
IdeInfo,
@ -27,9 +25,10 @@ import {
IdeType,
ILLM,
ILLMLogger,
JSONEmbeddingsProviderDescription,
JSONRerankerDescription,
LLMOptions,
ModelDescription,
RerankerDescription,
SerializedContinueConfig,
SlashCommand,
} from "..";
@ -70,7 +69,11 @@ import { localPathToUri } from "../util/pathToUri";
import { getSystemPromptDotFile } from "./getSystemPromptDotFile";
import { modifyAnyConfigWithSharedConfig } from "./sharedConfig";
import { getModelByRole, isSupportedLanceDbCpuTargetForLinux } from "./util";
import {
getModelByRole,
isSupportedLanceDbCpuTargetForLinux,
serializePromptTemplates,
} from "./util";
import { validateConfig } from "./validation.js";
export function resolveSerializedConfig(
@ -201,12 +204,6 @@ async function serializedToIntermediateConfig(
return config;
}
function isModelDescription(
llm: ModelDescription | CustomLLM,
): llm is ModelDescription {
return (llm as ModelDescription).title !== undefined;
}
export function isContextProviderWithParams(
contextProvider: CustomContextProvider | ContextProviderWithParams,
): contextProvider is ContextProviderWithParams {
@ -240,7 +237,7 @@ async function intermediateToFinalConfig({
// Auto-detect models
let models: BaseLLM[] = [];
for (const desc of config.models) {
if (isModelDescription(desc)) {
if ("title" in desc) {
const llm = await llmFromDescription(
desc,
ide.readFile.bind(ide),
@ -349,7 +346,7 @@ async function intermediateToFinalConfig({
? config.tabAutocompleteModel
: [config.tabAutocompleteModel]
).map(async (desc) => {
if (isModelDescription(desc)) {
if ("title" in desc) {
const llm = await llmFromDescription(
desc,
ide.readFile.bind(ide),
@ -430,7 +427,7 @@ async function intermediateToFinalConfig({
// Embeddings Provider
function getEmbeddingsILLM(
embedConfig: EmbeddingsProviderDescription | ILLM | undefined,
embedConfig: JSONEmbeddingsProviderDescription | ILLM | undefined,
): ILLM | null {
if (embedConfig) {
// config.ts-injected ILLM
@ -465,7 +462,7 @@ async function intermediateToFinalConfig({
// Reranker
function getRerankingILLM(
rerankingConfig: ILLM | RerankerDescription | undefined,
rerankingConfig: ILLM | JSONRerankerDescription | undefined,
): ILLM | null {
if (!rerankingConfig) {
return null;
@ -474,7 +471,7 @@ async function intermediateToFinalConfig({
if ("providerName" in rerankingConfig) {
return rerankingConfig;
}
const { name, params } = config.reranker as RerankerDescription;
const { name, params } = config.reranker as JSONRerankerDescription;
if (name === "llm") {
const llm = models.find((model) => model.title === params?.modelTitle);
@ -607,8 +604,10 @@ function llmToSerializedModelDescription(llm: ILLM): ModelDescription {
contextLength: llm.contextLength,
template: llm.template,
completionOptions: llm.completionOptions,
systemMessage: llm.systemMessage,
baseChatSystemMessage: llm.baseChatSystemMessage,
requestOptions: llm.requestOptions,
promptTemplates: llm.promptTemplates as any,
promptTemplates: serializePromptTemplates(llm.promptTemplates),
capabilities: llm.capabilities,
roles: llm.roles,
configurationStatus: llm.getConfigurationStatus(),

View file

@ -958,7 +958,7 @@ declare global {
cacheBehavior?: CacheBehavior;
}
export interface EmbedOptions {
export interface JSONEmbedOptions {
apiBase?: string;
apiKey?: string;
model?: string;
@ -982,7 +982,7 @@ declare global {
provider: string;
}
export interface RerankerDescription {
export interface JSONRerankerDescription {
name: string;
params?: { [key: string]: any };
}
@ -1161,7 +1161,7 @@ declare global {
tabAutocompleteModel?: ModelDescription | ModelDescription[];
tabAutocompleteOptions?: Partial<TabAutocompleteOptions>;
ui?: ContinueUIConfig;
reranker?: RerankerDescription;
reranker?: JSONRerankerDescription;
experimental?: ExperimentalConfig;
analytics?: AnalyticsConfig;
docs?: SiteIndexingConfig[];
@ -1212,7 +1212,7 @@ declare global {
/** UI styles customization */
ui?: ContinueUIConfig;
/** Options for the reranker */
reranker?: RerankerDescription | ILLM;
reranker?: JSONRerankerDescription | ILLM;
/** Experimental configuration */
experimental?: ExperimentalConfig;
/** Analytics configuration */
@ -1255,7 +1255,7 @@ declare global {
userToken?: string;
embeddingsProvider?: string;
ui?: ContinueUIConfig;
reranker?: RerankerDescription;
reranker?: JSONRerankerDescription;
experimental?: ExperimentalConfig;
analytics?: AnalyticsConfig;
docs?: SiteIndexingConfig[];

45
core/config/util.test.ts Normal file
View file

@ -0,0 +1,45 @@
import { PromptTemplate } from "..";
import { serializePromptTemplates } from "./util";
describe("serializePromptTemplates", () => {
it("should return undefined for undefined input", () => {
expect(serializePromptTemplates(undefined)).toBeUndefined();
});
it("should convert function templates to empty strings", () => {
const functionTemplate: PromptTemplate = () => "Generated template";
const templates: Record<string, PromptTemplate> = {
template1: functionTemplate,
};
const result = serializePromptTemplates(templates);
expect(result).toEqual({ template1: "" });
});
it("should pass through string templates unchanged", () => {
const templates: Record<string, PromptTemplate> = {
template1: "This is a static template",
template2: "Another static template",
};
const result = serializePromptTemplates(templates);
expect(result).toEqual(templates);
});
it("should handle mixed template types", () => {
const functionTemplate: PromptTemplate = () => "Generated template";
const templates: Record<string, PromptTemplate> = {
function: functionTemplate,
string: "This is a static template",
};
const result = serializePromptTemplates(templates);
expect(result).toEqual({
function: "",
string: "This is a static template",
});
});
});

View file

@ -7,6 +7,7 @@ import {
IDE,
ILLM,
ModelDescription,
PromptTemplate,
} from "../";
import { GlobalContext } from "../util/GlobalContext";
import { editConfigFile } from "../util/paths";
@ -169,3 +170,22 @@ async function showUnsupportedCpuToast(ide: IDE) {
);
}
}
/**
* This is required because users are only able to define prompt templates as a
* string, while internally we also allow prompt templates to be functions
* @param templates
* @returns
*/
export function serializePromptTemplates(
templates: Record<string, PromptTemplate> | undefined,
): Record<string, string> | undefined {
if (!templates) return undefined;
return Object.fromEntries(
Object.entries(templates).map(([key, template]) => {
const serialized = typeof template === "function" ? "" : template;
return [key, serialized];
}),
);
}

View file

@ -65,6 +65,7 @@ async function modelConfigToBaseLLM({
title: model.name,
rules: config.rules,
promptTemplates: model.promptTemplates,
baseChatSystemMessage: model.chatOptions?.baseSystemMessage,
capabilities: {
tools: model.capabilities?.includes("tool_use"),
uploadImage: model.capabilities?.includes("image_input"),

106
core/index.d.ts vendored
View file

@ -77,39 +77,19 @@ export type PromptTemplateFunction = (
export type PromptTemplate = string | PromptTemplateFunction;
export interface ILLM extends LLMOptions {
type RequiredLLMOptions =
| "uniqueId"
| "contextLength"
| "embeddingId"
| "maxEmbeddingChunkSize"
| "maxEmbeddingBatchSize"
| "completionOptions";
export interface ILLM
extends Omit<LLMOptions, RequiredLLMOptions>,
Required<Pick<LLMOptions, RequiredLLMOptions>> {
get providerName(): string;
uniqueId: string;
model: string;
title?: string;
// systemMessage?: string;
contextLength: number;
maxStopWords?: number;
completionOptions: CompletionOptions;
requestOptions?: RequestOptions;
promptTemplates?: Record<string, PromptTemplate>;
templateMessages?: (messages: ChatMessage[]) => string;
llmLogger?: ILLMLogger;
llmRequestHook?: (model: string, prompt: string) => any;
apiKey?: string;
apiBase?: string;
cacheBehavior?: CacheBehavior;
capabilities?: ModelCapability;
roles?: ModelRole[];
deployment?: string;
apiVersion?: string;
apiType?: string;
region?: string;
projectId?: string;
// Embedding options
embeddingId: string;
maxEmbeddingChunkSize: number;
maxEmbeddingBatchSize: number;
complete(
prompt: string,
signal: AbortSignal,
@ -580,7 +560,7 @@ export interface LLMOptions {
title?: string;
uniqueId?: string;
// systemMessage?: string;
baseChatSystemMessage?: string;
contextLength?: number;
maxStopWords?: number;
completionOptions?: CompletionOptions;
@ -1048,9 +1028,8 @@ export interface ModelDescription {
model: string;
apiKey?: string;
// continueProperties
apiKeyLocation?: string;
apiBase?: string;
apiKeyLocation?: string;
orgScopeId?: string | null;
onPremProxyUrl?: string | null;
@ -1059,7 +1038,7 @@ export interface ModelDescription {
maxStopWords?: number;
template?: TemplateType;
completionOptions?: BaseCompletionOptions;
systemMessage?: string;
baseChatSystemMessage?: string;
requestOptions?: RequestOptions;
promptTemplates?: { [key: string]: string };
cacheBehavior?: CacheBehavior;
@ -1068,7 +1047,7 @@ export interface ModelDescription {
configurationStatus?: LLMConfigurationStatuses;
}
export interface EmbedOptions {
export interface JSONEmbedOptions {
apiBase?: string;
apiKey?: string;
model?: string;
@ -1089,11 +1068,11 @@ export interface EmbedOptions {
projectId?: string;
}
export interface EmbeddingsProviderDescription extends EmbedOptions {
export interface JSONEmbeddingsProviderDescription extends JSONEmbedOptions {
provider: string;
}
export interface RerankerDescription {
export interface JSONRerankerDescription {
name: string;
params?: { [key: string]: any };
}
@ -1313,11 +1292,42 @@ export interface AnalyticsConfig {
clientKey?: string;
}
export interface JSONModelDescription {
title: string;
provider: string;
model: string;
apiKey?: string;
apiBase?: string;
apiKeyLocation?: string;
onPremProxyUrl?: string | null; // not included in schema/docs
contextLength?: number;
maxStopWords?: number;
template?: TemplateType;
completionOptions?: BaseCompletionOptions;
systemMessage?: string;
requestOptions?: RequestOptions;
cacheBehavior?: CacheBehavior;
region?: string;
profile?: string;
modelArn?: string;
apiType?: "openai" | "azure";
apiVersion?: string;
deployment?: string;
projectId?: string;
accountId?: string;
aiGatewaySlug?: string;
useLegacyCompletionsEndpoint?: boolean;
deploymentId?: string;
}
// config.json
export interface SerializedContinueConfig {
env?: string[];
allowAnonymousTelemetry?: boolean;
models: ModelDescription[];
models: JSONModelDescription[];
systemMessage?: string;
completionOptions?: BaseCompletionOptions;
requestOptions?: RequestOptions;
@ -1327,11 +1337,11 @@ export interface SerializedContinueConfig {
disableIndexing?: boolean;
disableSessionTitles?: boolean;
userToken?: string;
embeddingsProvider?: EmbeddingsProviderDescription;
tabAutocompleteModel?: ModelDescription | ModelDescription[];
embeddingsProvider?: JSONEmbeddingsProviderDescription;
tabAutocompleteModel?: JSONModelDescription | JSONModelDescription[];
tabAutocompleteOptions?: Partial<TabAutocompleteOptions>;
ui?: ContinueUIConfig;
reranker?: RerankerDescription;
reranker?: JSONRerankerDescription;
experimental?: ExperimentalConfig;
analytics?: AnalyticsConfig;
docs?: SiteIndexingConfig[];
@ -1348,11 +1358,11 @@ export type ContinueRcJson = Partial<SerializedContinueConfig> & {
export interface Config {
/** If set to true, Continue will collect anonymous usage data to improve the product. If set to false, we will collect nothing. Read here to learn more: https://docs.continue.dev/telemetry */
allowAnonymousTelemetry?: boolean;
/** Each entry in this array will originally be a ModelDescription, the same object from your config.json, but you may add CustomLLMs.
/** Each entry in this array will originally be a JSONModelDescription, the same object from your config.json, but you may add CustomLLMs.
* A CustomLLM requires you only to define an AsyncGenerator that calls the LLM and yields string updates. You can choose to define either `streamCompletion` or `streamChat` (or both).
* Continue will do the rest of the work to construct prompt templates, handle context items, prune context, etc.
*/
models: (CustomLLM | ModelDescription)[];
models: (CustomLLM | JSONModelDescription)[];
/** A system message to be followed by all of your models */
systemMessage?: string;
/** The default completion options for all models */
@ -1372,18 +1382,18 @@ export interface Config {
/** An optional token to identify a user. Not used by Continue unless you write custom coniguration that requires such a token */
userToken?: string;
/** The provider used to calculate embeddings. If left empty, Continue will use transformers.js to calculate the embeddings with all-MiniLM-L6-v2 */
embeddingsProvider?: EmbeddingsProviderDescription | ILLM;
embeddingsProvider?: JSONEmbeddingsProviderDescription | ILLM;
/** The model that Continue will use for tab autocompletions. */
tabAutocompleteModel?:
| CustomLLM
| ModelDescription
| (CustomLLM | ModelDescription)[];
| JSONModelDescription
| (CustomLLM | JSONModelDescription)[];
/** Options for tab autocomplete */
tabAutocompleteOptions?: Partial<TabAutocompleteOptions>;
/** UI styles customization */
ui?: ContinueUIConfig;
/** Options for the reranker */
reranker?: RerankerDescription | ILLM;
reranker?: JSONRerankerDescription | ILLM;
/** Experimental configuration */
experimental?: ExperimentalConfig;
/** Analytics configuration */

View file

@ -1,14 +1,41 @@
import { ChatHistoryItem, ChatMessage, MessagePart } from "../";
import { normalizeToMessageParts } from "../util/messageContent";
const DEFAULT_SYSTEM_MESSAGE = `<important_rules>
Always include the language and file name in the info string when you write code blocks. If you are editing "src/main.py" for example, your code block should start with '\`\`\`python src/main.py'.
const DEFAULT_SYSTEM_MESSAGE = `\
<important_rules>
Always include the language and file name in the info string when you write code blocks.
If you are editing "src/main.py" for example, your code block should start with '\`\`\`python src/main.py'
When addressing code modification requests, present a concise code snippet that
emphasizes only the necessary changes and uses abbreviated placeholders for
unmodified sections. For instance:
\`\`\`typescript /path/to/file
// ... rest of code here ...
{{ modified code here }}
// ... rest of code here ...
{{ another modification }}
// ... rest of code here ...
\`\`\`
Since users have access to their complete file, they prefer reading only the
relevant modifications. It's perfectly acceptable to omit unmodified portions
at the beginning, middle, or end of files using these "lazy" comments. Only
provide the complete file when explicitly requested. Include a concise explanation
of changes unless the user specifically asks for code only.
</important_rules>`;
const CANCELED_TOOL_CALL_MESSAGE =
"This tool call was cancelled by the user. You should clarify next steps, as they don't wish for you to use this tool.";
export function constructMessages(history: ChatHistoryItem[]): ChatMessage[] {
export function constructMessages(
history: ChatHistoryItem[],
baseChatSystemMessage: string | undefined,
): ChatMessage[] {
const filteredHistory = history.filter(
(item) => item.message.role !== "system",
);
@ -16,7 +43,7 @@ export function constructMessages(history: ChatHistoryItem[]): ChatMessage[] {
msgs.push({
role: "system",
content: DEFAULT_SYSTEM_MESSAGE,
content: baseChatSystemMessage ?? DEFAULT_SYSTEM_MESSAGE,
});
for (let i = 0; i < filteredHistory.length; i++) {

View file

@ -127,6 +127,7 @@ export abstract class BaseLLM implements ILLM {
model: string;
title?: string;
baseChatSystemMessage?: string;
contextLength: number;
maxStopWords?: number | undefined;
completionOptions: CompletionOptions;
@ -147,7 +148,7 @@ export abstract class BaseLLM implements ILLM {
cacheBehavior?: CacheBehavior;
capabilities?: ModelCapability;
roles: ModelRole[];
roles?: ModelRole[];
rules?: RuleWithSource[];
deployment?: string;
@ -194,6 +195,7 @@ export abstract class BaseLLM implements ILLM {
this.title = options.title;
this.uniqueId = options.uniqueId ?? "None";
this.baseChatSystemMessage = options.baseChatSystemMessage;
this.contextLength =
options.contextLength ?? llmInfo?.contextLength ?? DEFAULT_CONTEXT_LENGTH;
this.maxStopWords = options.maxStopWords ?? this.maxStopWords;
@ -246,7 +248,7 @@ export abstract class BaseLLM implements ILLM {
}
this.accountId = options.accountId;
this.capabilities = options.capabilities;
this.role = options.role;
this.roles = options.roles;
this.rules = options.rules;
this.deployment = options.deployment;
@ -310,6 +312,7 @@ export abstract class BaseLLM implements ILLM {
supportsImages: this.supportsImages(),
prompt: undefined,
completionRole,
baseSystemMessage: this.baseChatSystemMessage,
rules: this.rules ?? [],
});
}

View file

@ -108,7 +108,8 @@
"node": ">=20.11.0"
}
},
"../../../../../documents/code/continuedev/continue/packages/config-yaml": {
"../packages/config-yaml": {
"name": "@continuedev/config-yaml",
"version": "1.0.78",
"license": "Apache-2.0",
"dependencies": {

View file

@ -20,7 +20,6 @@ import type {
FileSymbolMap,
IdeSettings,
LLMFullCompletionOptions,
ModelDescription,
PromptLog,
RangeInFile,
SerializedContinueConfig,
@ -187,7 +186,17 @@ export type ToCoreFromIdeOrWebviewProtocol = {
"docs/getSuggestedDocs": [undefined, void];
"docs/initStatuses": [undefined, void];
"docs/getDetails": [{ startUrl: string }, DocsIndexingDetails];
addAutocompleteModel: [{ model: ModelDescription }, void];
addAutocompleteModel: [
{
model: {
title: string;
provider: string;
model: string;
apiKey?: string;
};
},
void,
];
"auth/getAuthUrl": [{ useOnboarding: boolean }, { url: string }];
"tools/call": [

View file

@ -13,3 +13,27 @@ When editing code, Chat and Edit model output often doesn't clearly align with e
Generally speaking, models proficient in chat and edit can also be used for applying code.
Explore apply models in [the hub](https://hub.continue.dev/explore/models?roles=apply).
## Prompt templating
You can customize the prompt template used for applying code changes by setting the `promptTemplates.apply` property in your model configuration. Continue uses [Handlebars syntax](https://handlebarsjs.com/guide/) for templating.
Available variables for the apply template:
- `{{{original_code}}}` - The original code before changes
- `{{{new_code}}}` - The new code after changes
Example:
```yaml
models:
- name: My Custom Apply Template
provider: anthropic
model: claude-3-5-sonnet-latest
promptTemplates:
apply: |
Original: {{{original_code}}}
New: {{{new_code}}}
Please generate the final code without any markers or explanations.
```

View file

@ -46,3 +46,37 @@ In Continue, you can add `edit` to a model's roles to specify that it can be use
</Tabs>
Explore edit models in [the hub](https://hub.continue.dev/explore/models?roles=edit). Generally, our recommendations for Edit overlap with recommendations for Chat.
## Prompt templating
You can customize the prompt template used for editing code by setting the `promptTemplates.edit` property in your model configuration. Continue uses [Handlebars syntax](https://handlebarsjs.com/guide/) for templating.
Available variables for the edit template:
- `{{{userInput}}}` - The user's edit request/instruction
- `{{{language}}}` - The programming language of the code
- `{{{codeToEdit}}}` - The code that's being edited
- `{{{prefix}}}` - Content before the edit area
- `{{{suffix}}}` - Content after the edit area
- `{{{supportsCompletions}}}` - Whether the model supports completions API
- `{{{supportsPrefill}}}` - Whether the model supports prefill capability
Example:
```yaml
models:
- name: My Custom Edit Template
provider: openai
model: gpt-4o
promptTemplates:
edit: |
`Here is the code before editing:
\`\`\`{{{language}}}
{{{codeToEdit}}}
\`\`\`
Here is the edit requested:
"{{{userInput}}}"
Here is the code after editing:`
```

View file

@ -51,8 +51,8 @@ func = get_registry().get("openai").create(
class CodeChunks(LanceModel):
filename: str
text: str = func.SourceField()
# 1536 is the embedding dimension of the `voyage-code-3` model.
vector: Vector(1536) = func.VectorField()
# 1024 is the default dimension for `voyage-code-3`: https://docs.voyageai.com/docs/embeddings#model-choices
vector: Vector(1024) = func.VectorField()
table = db.create_table("code_chunks", schema=CodeChunks, mode="overwrite")
table.add([

View file

@ -145,15 +145,13 @@ The `models` section defines the language models used in your configuration. Mod
- `apiBase`: Can be used to override the default API base that is specified per model
- `roles`: An array specifying the roles this model can fulfill, such as `chat`, `autocomplete`, `embed`, `rerank`, `edit`, `apply`, `summarize`. The default value is `[chat, edit, apply, summarize]`. Note that the `summarize` role is not currently used.
- `capabilities`: Array of strings denoting model capabilities, which will overwrite Continue's autodetection based on provider and model. Supported capabilities include `tool_use` and `image_input`.
- `promptTemplates`: Can be used to override the default prompt templates for different model roles. Valid values are [`edit`](./customize/model-roles/edit.mdx#prompt-templating) and [`apply`](./customize/model-roles/apply.mdx#prompt-templating).
- `chatOptions`: If the model includes role `chat`, these settings apply for Chat and Agent mode:
- `baseSystemMessage`: Can be used to override the default system prompt.
- `embedOptions`: If the model includes role `embed`, these settings apply for embeddings:
- `maxChunkSize`: Maximum tokens per document chunk. Minimum is 128 tokens.
- `maxBatchSize`: Maximum number of chunks per request. Minimum is 1 chunk.
- `defaultCompletionOptions`: Default completion options for model settings.
**Properties:**
- `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).
@ -161,11 +159,7 @@ The `models` section defines the language models used in your configuration. Mod
- `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.
@ -178,7 +172,7 @@ The `models` section defines the language models used in your configuration. Mod
- `key`: Path to the client certificate key file.
- `passphrase`: Optional passphrase for the client certificate key file.
#### Example:
#### Example
```yaml title="config.yaml"
models:

View file

@ -3,6 +3,7 @@ node_modules/
out/
.vscode-test/
data/
src/.buildTimestamp.ts
src/client
.continue

View file

@ -1,12 +1,12 @@
{
"name": "continue",
"version": "1.1.22",
"version": "1.1.23",
"lockfileVersion": 3,
"requires": true,
"packages": {
"": {
"name": "continue",
"version": "1.1.22",
"version": "1.1.23",
"license": "Apache-2.0",
"dependencies": {
"@continuedev/fetch": "^1.0.3",
@ -106,7 +106,7 @@
"@aws-sdk/client-sagemaker-runtime": "^3.777.0",
"@aws-sdk/credential-providers": "^3.778.0",
"@continuedev/config-types": "^1.0.13",
"@continuedev/config-yaml": "^1.0.71",
"@continuedev/config-yaml": "file:../packages/config-yaml",
"@continuedev/fetch": "^1.0.4",
"@continuedev/llm-info": "^1.0.8",
"@continuedev/openai-adapters": "^1.0.18",

View file

@ -2,7 +2,7 @@
"name": "continue",
"icon": "media/icon.png",
"author": "Continue Dev, Inc",
"version": "1.1.22",
"version": "1.1.23",
"repository": {
"type": "git",
"url": "https://github.com/continuedev/continue"
@ -607,6 +607,7 @@
"build-test": "npm run esbuild && node esbuild.test.mjs",
"test": "npm run build-test && node ./out/runTestOnVSCodeHost.js",
"quick-test": "npm run build-test && node ./out/runTestOnVSCodeHost.js",
"write-build-timestamp": "node scripts/write-build-timestamp.js",
"prepackage": "node scripts/prepackage.js",
"package": "node scripts/package.js",
"package-all": "node scripts/package-all.js",

View file

@ -1,4 +1,5 @@
const fs = require("fs");
const { writeBuildTimestamp } = require("./utils");
const esbuild = require("esbuild");
@ -49,6 +50,8 @@ const esbuildConfig = {
};
(async () => {
// Create .buildTimestamp.js before starting the first build
writeBuildTimestamp();
// Bundles the extension into one file
if (flags.includes("--watch")) {
const ctx = await esbuild.context(esbuildConfig);
@ -74,7 +77,7 @@ const esbuildConfig = {
});
console.log("Triggering VS Code Extension esbuild rebuild...");
fs.utimesSync(inFile, new Date(), new Date());
writeBuildTimestamp();
} else {
await esbuild.build(esbuildConfig);
}

View file

@ -10,7 +10,7 @@ const {
autodetectPlatformAndArch,
} = require("../../../scripts/util/index");
const { copyConfigSchema } = require("./utils");
const { copyConfigSchema, writeBuildTimestamp } = require("./utils");
// Clear folders that will be packaged to ensure clean slate
rimrafSync(path.join(__dirname, "..", "bin"));
@ -71,6 +71,9 @@ const isMacTarget = target?.startsWith("darwin");
process.chdir("extensions/vscode");
}
// Make sure we have an initial timestamp file
writeBuildTimestamp();
// Install node_modules //
execCmdSync("npm install");
console.log("[info] npm install in extensions/vscode completed");

View file

@ -511,6 +511,20 @@ async function copyScripts() {
console.log("[info] Copied script files");
}
// We can't simply touch one of our files to trigger a rebuild, because
// esbuild doesn't always use modifications times to detect changes -
// for example, if it finds a file changed within the last 3 seconds,
// it will fall back to full-contents-comparison for that file
//
// So to facilitate development workflows, we always include a timestamp string
// in the build
function writeBuildTimestamp() {
fs.writeFileSync(
"src/.buildTimestamp.ts",
`export default "${new Date().toISOString()}";\n`,
);
}
module.exports = {
copyConfigSchema,
installNodeModules,
@ -526,4 +540,5 @@ module.exports = {
downloadRipgrepBinary,
copyTokenizers,
copyScripts,
writeBuildTimestamp,
};

View file

@ -0,0 +1,3 @@
const { writeBuildTimestamp } = require("./utils");
writeBuildTimestamp();

View file

@ -8,6 +8,7 @@ import { Telemetry } from "core/util/posthog";
import * as vscode from "vscode";
import { getExtensionVersion } from "./util/util";
export { default as buildTimestamp } from "./.buildTimestamp";
async function dynamicImportAndActivate(context: vscode.ExtensionContext) {
await setupCa();

52
gui/package-lock.json generated
View file

@ -7,7 +7,7 @@
"name": "gui",
"license": "Apache-2.0",
"dependencies": {
"@continuedev/config-yaml": "^1.0.77",
"@continuedev/config-yaml": "file:../packages/config-yaml",
"@headlessui/react": "^2.2.0",
"@heroicons/react": "^2.0.18",
"@reduxjs/toolkit": "^2.3.0",
@ -109,7 +109,7 @@
"@aws-sdk/client-sagemaker-runtime": "^3.777.0",
"@aws-sdk/credential-providers": "^3.778.0",
"@continuedev/config-types": "^1.0.13",
"@continuedev/config-yaml": "^1.0.77",
"@continuedev/config-yaml": "file:../packages/config-yaml",
"@continuedev/fetch": "^1.0.4",
"@continuedev/llm-info": "^1.0.8",
"@continuedev/openai-adapters": "^1.0.18",
@ -204,6 +204,27 @@
"node": ">=20.11.0"
}
},
"../packages/config-yaml": {
"name": "@continuedev/config-yaml",
"version": "1.0.78",
"license": "Apache-2.0",
"dependencies": {
"@continuedev/config-types": "^1.0.14",
"yaml": "^2.6.1",
"zod": "^3.24.2"
},
"bin": {
"config-yaml": "dist/cli.js"
},
"devDependencies": {
"@types/jest": "^29.5.14",
"@types/node": "^20.0.0",
"cross-env": "^7.0.3",
"jest": "^29.7.0",
"ts-jest": "^29.2.3",
"ts-node": "^10.9.2"
}
},
"node_modules/@adobe/css-tools": {
"version": "4.4.0",
"resolved": "https://registry.npmjs.org/@adobe/css-tools/-/css-tools-4.4.0.tgz",
@ -544,23 +565,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.77",
"resolved": "https://registry.npmjs.org/@continuedev/config-yaml/-/config-yaml-1.0.77.tgz",
"integrity": "sha512-Vke6jp4bENjJc9fO1tavOnbYXRmmSIEzNhYeQ6DzZVl92+8rWwdO6zhbrK0r4FGjHnH0cJgyK/q0zX9/l+6asw==",
"dependencies": {
"@continuedev/config-types": "^1.0.14",
"yaml": "^2.6.1",
"zod": "^3.24.2"
}
"resolved": "../packages/config-yaml",
"link": true
},
"node_modules/@emotion/is-prop-valid": {
"version": "1.3.1",
@ -13773,6 +13780,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"
},
@ -13792,14 +13800,6 @@
"url": "https://github.com/sponsors/sindresorhus"
}
},
"node_modules/zod": {
"version": "3.24.2",
"resolved": "https://registry.npmjs.org/zod/-/zod-3.24.2.tgz",
"integrity": "sha512-lY7CDW43ECgW9u1TcT3IoXHflywfVqDYze4waEz812jR/bZ8FHDsl7pFQoSZTz5N+2NqRXs8GBwnAwo3ZNxqhQ==",
"funding": {
"url": "https://github.com/sponsors/colinhacks"
}
},
"node_modules/zwitch": {
"version": "2.0.4",
"resolved": "https://registry.npmjs.org/zwitch/-/zwitch-2.0.4.tgz",

View file

@ -15,7 +15,7 @@
"test:watch": "vitest"
},
"dependencies": {
"@continuedev/config-yaml": "^1.0.77",
"@continuedev/config-yaml": "file:../packages/config-yaml",
"@headlessui/react": "^2.2.0",
"@heroicons/react": "^2.0.18",
"@reduxjs/toolkit": "^2.3.0",

View file

@ -4,7 +4,10 @@ import { useContext } from "react";
import { useAuth } from "../../../context/Auth";
import { IdeMessengerContext } from "../../../context/IdeMessenger";
type SectionKey = Exclude<keyof ConfigYaml, "name" | "version" | "schema">;
type SectionKey = Exclude<
keyof ConfigYaml,
"name" | "version" | "schema" | "metadata"
>;
interface EditBlockButtonProps<T extends SectionKey> {
blockType: T;

View file

@ -134,10 +134,10 @@ export function ExpandableToolbarPreview(props: ExpandableToolbarPreviewProps) {
useEffect(() => {
const resizeObserver = new ResizeObserver(() => {
setContentDims({
width: contentRef.current?.scrollWidth ?? 0,
height: contentRef.current?.scrollHeight ?? 0,
});
setContentDims(prevValue => ({
width: contentRef.current?.scrollWidth ?? prevValue.width,
height: contentRef.current?.scrollHeight ?? prevValue.height,
}));
});
if (contentRef.current) {

View file

@ -42,7 +42,7 @@ function ContextItemsPeekItem({ contextItem }: ContextItemsPeekItemProps) {
const isRangeInFile = name.includes(" (") && name.endsWith(")");
if (isRangeInFile) {
const rif = ctxItemToRifWithContents(contextItem);
const rif = ctxItemToRifWithContents(contextItem, true);
ideMessenger.ide.showLines(
rif.filepath,
rif.range.start.line,

View file

@ -52,9 +52,11 @@ export default function ApplyActions(props: ApplyActionsProps) {
case "streaming":
return (
<div className="flex items-center rounded bg-zinc-700 pl-2 pr-1">
<span className="inline-flex items-center gap-2 text-xs text-gray-400">
<span className="inline-flex w-min items-center gap-2 text-center text-xs text-gray-400">
Applying changes
<Spinner />
<div>
<Spinner />
</div>
</span>
</div>
);

View file

@ -223,7 +223,7 @@ function ModelSelect() {
ref={buttonRef}
className="h-[18px] gap-1 border-none text-gray-400"
>
<span className="line-clamp-1 hover:brightness-110">
<span className="line-clamp-1 break-all hover:brightness-110">
{modelSelectTitle(selectedChatModel) || "Select model"}
</span>
<ChevronDownIcon

View file

@ -100,9 +100,9 @@ const AssistantSelectOption = ({
}}
>
<div className="flex w-full items-center justify-between gap-2 bg-transparent">
<div className="flex w-full items-center gap-1.5">
<div className="flex w-full items-center gap-1">
<div className="flex h-4 w-4 flex-shrink-0">
<AssistantIcon assistant={profile} />
<AssistantIcon size={3.5} assistant={profile} />
</div>
<span
className={`line-clamp-1 flex-1 ${selected ? "font-semibold" : ""}`}
@ -291,7 +291,7 @@ export default function AssistantSelect() {
<Transition>
<ListboxOptions className="pb-0">
<div className="flex gap-1.5 px-2.5 py-1">
<div className="flex justify-between gap-1.5 px-2.5 py-1">
<span>Assistants</span>
<div
className="flex cursor-pointer flex-row items-center gap-1 hover:brightness-125"
@ -301,7 +301,7 @@ export default function AssistantSelect() {
buttonRef.current?.click();
}}
>
<ArrowPathIcon className="h-2.5 w-2.5" />
<ArrowPathIcon className="text-lightgray h-2.5 w-2.5" />
</div>
</div>
@ -375,7 +375,7 @@ export default function AssistantSelect() {
{currentOrg?.iconUrl ? (
<img
src={currentOrg.iconUrl}
className="h-3 w-3 rounded-full"
className="h-2.5 w-2.5 rounded-full"
/>
) : (
<BuildingOfficeIcon className="h-4 w-4" />

View file

@ -50,7 +50,7 @@ function useSetup() {
organizations,
selectedOrgId,
} = result;
debugger;
if (isInitial && hasDoneInitialConfigLoad.current) {
return;
}

View file

@ -85,7 +85,10 @@ export const streamResponseThunk = createAsyncThunk<
// Construct messages from updated history
const updatedHistory = getState().session.history;
const messages = constructMessages([...updatedHistory]);
const messages = constructMessages(
[...updatedHistory],
selectedChatModel?.baseChatSystemMessage,
);
posthog.capture("step run", {
step_name: "User Input",

View file

@ -59,7 +59,10 @@ export const streamResponseAfterToolCall = createAsyncThunk<
dispatch(setActive());
const updatedHistory = getState().session.history;
const messages = constructMessages([...updatedHistory]);
const messages = constructMessages(
[...updatedHistory],
selectedChatModel?.baseChatSystemMessage,
);
unwrapResult(await dispatch(streamNormalInput({ messages })));
}),
);

View file

@ -1,20 +1,31 @@
{
"name": "@continuedev/config-types",
"version": "1.0.13",
"version": "1.0.14",
"lockfileVersion": 3,
"requires": true,
"packages": {
"": {
"name": "@continuedev/config-types",
"version": "1.0.13",
"version": "1.0.14",
"license": "Apache-2.0",
"dependencies": {
"zod": "^3.23.8"
"zod": "^3.24.2"
},
"devDependencies": {
"@types/node": "^20.11.19",
"typescript": "^5.5.2"
}
},
"node_modules/@types/node": {
"version": "20.17.30",
"resolved": "https://registry.npmjs.org/@types/node/-/node-20.17.30.tgz",
"integrity": "sha512-7zf4YyHA+jvBNfVrk2Gtvs6x7E8V+YDW05bNfG2XkWDJfYRXrTiP/DsB2zSYTaHX0bGIujTBQdMVAhb+j7mwpg==",
"dev": true,
"license": "MIT",
"dependencies": {
"undici-types": "~6.19.2"
}
},
"node_modules/typescript": {
"version": "5.5.2",
"resolved": "https://registry.npmjs.org/typescript/-/typescript-5.5.2.tgz",
@ -28,10 +39,18 @@
"node": ">=14.17"
}
},
"node_modules/undici-types": {
"version": "6.19.8",
"resolved": "https://registry.npmjs.org/undici-types/-/undici-types-6.19.8.tgz",
"integrity": "sha512-ve2KP6f/JnbPBFyobGHuerC9g1FYGn/F8n1LWTwNxCEzd6IfqTwUQcNXgEtmmQ6DlRrC1hrSrBnCZPokRrDHjw==",
"dev": true,
"license": "MIT"
},
"node_modules/zod": {
"version": "3.23.8",
"resolved": "https://registry.npmjs.org/zod/-/zod-3.23.8.tgz",
"integrity": "sha512-XBx9AXhXktjUqnepgTiE5flcKIYWi/rme0Eaj+5Y0lftuGBq+jyRu/md4WnuxqgP1ubdpNCsYEYPxrzVHD8d6g==",
"version": "3.24.2",
"resolved": "https://registry.npmjs.org/zod/-/zod-3.24.2.tgz",
"integrity": "sha512-lY7CDW43ECgW9u1TcT3IoXHflywfVqDYze4waEz812jR/bZ8FHDsl7pFQoSZTz5N+2NqRXs8GBwnAwo3ZNxqhQ==",
"license": "MIT",
"funding": {
"url": "https://github.com/sponsors/colinhacks"
}

View file

@ -12,9 +12,10 @@
"author": "Nate Sesti and Ty Dunn",
"license": "Apache-2.0",
"devDependencies": {
"@types/node": "^20.11.19",
"typescript": "^5.5.2"
},
"dependencies": {
"zod": "^3.24.2"
}
}
}

View file

@ -1,12 +1,12 @@
{
"name": "@continuedev/config-yaml",
"version": "1.0.72",
"version": "1.0.78",
"lockfileVersion": 3,
"requires": true,
"packages": {
"": {
"name": "@continuedev/config-yaml",
"version": "1.0.72",
"version": "1.0.78",
"license": "Apache-2.0",
"dependencies": {
"@continuedev/config-types": "^1.0.14",

View file

@ -298,7 +298,7 @@ export async function unrollBlocks(
const sections: (keyof Omit<
ConfigYaml,
"name" | "version" | "rules" | "schema"
"name" | "version" | "rules" | "schema" | "metadata"
>)[] = ["models", "context", "data", "mcpServers", "prompts", "docs"];
// For each section, replace "uses/with" blocks with the real thing

View file

@ -56,6 +56,11 @@ export const embedOptionsSchema = z.object({
});
export type EmbedOptions = z.infer<typeof embedOptionsSchema>;
export const chatOptionsSchema = z.object({
baseSystemMessage: z.string().optional(),
});
export type ChatOptions = z.infer<typeof chatOptionsSchema>;
/** Prompt templates use Handlebars syntax */
const promptTemplatesSchema = z.object({
apply: z.string().optional(),
@ -73,6 +78,7 @@ const baseModelFields = {
defaultCompletionOptions: completionOptionsSchema.optional(),
requestOptions: requestOptionsSchema.optional(),
embedOptions: embedOptionsSchema.optional(),
chatOptions: chatOptionsSchema.optional(),
promptTemplates: promptTemplatesSchema.optional(),
env: z
.record(z.string(), z.union([z.string(), z.boolean(), z.number()]))

View file

@ -139,8 +139,7 @@ export class GeminiApi implements BaseLlmApi {
parts:
typeof msg.content === "string"
? [{ text: msg.content }]
: // @ts-ignore
msg.content.map(this._oaiPartToGeminiPart),
: msg.content.map(this._oaiPartToGeminiPart),
};
})
.filter((c) => c !== null);
@ -149,7 +148,7 @@ export class GeminiApi implements BaseLlmApi {
const finalBody: any = {
generationConfig,
contents,
// if this.systemMessage is defined, reformat it for Gemini API
// if there is a system message, reformat it for Gemini API
...(sysMsg &&
!isV1API && {
systemInstruction: { parts: [{ text: sysMsg.content }] },