move context restriction properties to model level autocompleteOptions
- added context restriction properties to model autocompleteOptions schema - discarded changes to add global tabAutocompleteOptions to config schema - added experimental parameters to both config-types. - added YAML alternative note to json reference. - updated YAML configuration example with per-model options. - added reference documentation with parameters for autocomplete options.
This commit is contained in:
parent
f1a6c8eb0c
commit
8fe5077e60
11 changed files with 102 additions and 39 deletions
|
|
@ -10,8 +10,8 @@ import { BracketMatchingService } from "./filtering/BracketMatchingService.js";
|
|||
import { CompletionStreamer } from "./generation/CompletionStreamer.js";
|
||||
import { postprocessCompletion } from "./postprocessing/index.js";
|
||||
import { shouldPrefilter } from "./prefiltering/index.js";
|
||||
import { getAllSnippetsWithoutRace } from "./snippets/index.js";
|
||||
import { renderPromptWithTokenLimit } from "./templating/index.js";
|
||||
import { getAllSnippetsWithoutRace } from "./snippets/index.js";
|
||||
import { GetLspDefinitionsFunction } from "./types.js";
|
||||
import { AutocompleteDebouncer } from "./util/AutocompleteDebouncer.js";
|
||||
import { AutocompleteLoggingService } from "./util/AutocompleteLoggingService.js";
|
||||
|
|
|
|||
|
|
@ -429,7 +429,6 @@ async function configYamlToContinueConfig(options: {
|
|||
})),
|
||||
false,
|
||||
);
|
||||
continueConfig.tabAutocompleteOptions = config.tabAutocompleteOptions;
|
||||
|
||||
return { config: continueConfig, errors: localErrors };
|
||||
}
|
||||
|
|
|
|||
|
|
@ -20,6 +20,7 @@ export const DEFAULT_AUTOCOMPLETE_OPTS: TabAutocompleteOptions = {
|
|||
useImports: true,
|
||||
transform: true,
|
||||
showWhateverWeHaveAtXMs: 300,
|
||||
// Experimental options: true = enabled, false = disabled, number = enabled w priority
|
||||
experimental_includeClipboard: true,
|
||||
experimental_includeRecentlyVisitedRanges: true,
|
||||
experimental_includeRecentlyEditedRanges: true,
|
||||
|
|
|
|||
|
|
@ -84,7 +84,7 @@ Then, add the model to your configuration:
|
|||
|
||||
Once the model has been downloaded, you should begin to see completions in VS Code.
|
||||
|
||||
NOTE: Typically, thinking-type models are not recommended as they generate more slowly and are not suitable for scenarios that require speed.
|
||||
NOTE: Typically, thinking-type models are not recommended as they generate more slowly and are not suitable for scenarios that require speed.
|
||||
|
||||
However, if you use any thinking-switchable models, you can configure these models for autocomplete functions by turning off the thinking mode.
|
||||
|
||||
|
|
@ -92,7 +92,7 @@ For example:
|
|||
|
||||
<Tabs>
|
||||
<Tab title="YAML">
|
||||
```yaml title="config.yaml"
|
||||
```yaml title="config.yaml"
|
||||
models:
|
||||
- name: Qwen3 without Thinking for Autocomplete
|
||||
provider: ollama
|
||||
|
|
@ -122,9 +122,32 @@ The following settings can be configured for autocompletion in the IDE extension
|
|||
- `Multiline Autocompletions`: Controls multiline completions for autocomplete. Can be set to `always`, `never`, or `auto`. Defaults to `auto`
|
||||
- `Disable autocomplete in files`: List of comma-separated glob pattern to disable autocomplete in matching files. E.g., "\_/.md, \*/.txt"
|
||||
|
||||
### `config.json` Configuration
|
||||
### Autocomplete Configuration
|
||||
|
||||
The `config.json` configuration format (deprecated) offers further configuration options through `tabAutocompleteOptions`. See the [JSON Reference](/reference) for more details.
|
||||
#### YAML Configuration
|
||||
|
||||
The `config.yaml` format offers model-level configuration using the `autocompleteOptions` field. See the [YAML Reference](/reference#models) for more details.
|
||||
|
||||
```yaml
|
||||
models:
|
||||
- name: Codestral
|
||||
provider: mistral
|
||||
model: codestral-latest
|
||||
roles:
|
||||
- autocomplete
|
||||
autocompleteOptions:
|
||||
disable: false
|
||||
maxPromptTokens: 1024
|
||||
debounceDelay: 250
|
||||
modelTimeout: 150
|
||||
maxSuffixPercentage: 0.2
|
||||
prefixPercentage: 0.3
|
||||
onlyMyCode: true
|
||||
```
|
||||
|
||||
#### JSON Configuration (Deprecated)
|
||||
|
||||
The `config.json` configuration format offers configuration options through `tabAutocompleteOptions`. See the [JSON Reference](/reference/json-reference#tabautocomplete-options) for more details.
|
||||
|
||||
## FAQs
|
||||
|
||||
|
|
|
|||
|
|
@ -176,9 +176,10 @@ The `models` section defines the language models used in your configuration. Mod
|
|||
- `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`: Enables function/tool calling support (required for Agent mode)
|
||||
- `image_input`: Enables image upload and processing support
|
||||
|
||||
|
||||
Continue automatically detects these capabilities for most models, but you can override this when using custom deployments or if autodetection isn't working correctly. See the [Model Capabilities guide](/customize/deep-dives/model-capabilities) for detailed information.
|
||||
|
||||
- `maxStopWords`: Maximum number of stop words allowed, to avoid API errors with extensive lists.
|
||||
|
|
@ -228,6 +229,21 @@ 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.
|
||||
|
||||
- `autocompleteOptions`: If the model includes role `autocomplete`, these settings apply for tab autocompletion:
|
||||
|
||||
- `disable`: If `true`, disables autocomplete for this model.
|
||||
- `maxPromptTokens`: Maximum number of tokens for the autocomplete prompt.
|
||||
- `debounceDelay`: Delay before triggering autocomplete in milliseconds.
|
||||
- `modelTimeout`: Model timeout for autocomplete requests in milliseconds.
|
||||
- `maxSuffixPercentage`: Maximum percentage of prompt allocated for suffix.
|
||||
- `prefixPercentage`: Percentage of input allocated for prefix.
|
||||
- `template`: Custom template for autocomplete using Mustache syntax. You can use the `{{{ prefix }}}`, `{{{ suffix }}}`, `{{{ filename }}}`, `{{{ reponame }}}`, and `{{{ language }}}` variables.
|
||||
- `onlyMyCode`: Only includes code within the repository for context.
|
||||
- `useCache`: If `true`, enables caching for completions.
|
||||
- `useImports`: If `true`, includes imports in context.
|
||||
- `useRecentlyEdited`: If `true`, includes recently edited files in context.
|
||||
- `useRecentlyOpened`: If `true`, includes recently opened files in context.
|
||||
|
||||
**Example:**
|
||||
|
||||
```yaml title="config.yaml"
|
||||
|
|
@ -247,6 +263,10 @@ models:
|
|||
model: codestral-latest
|
||||
roles:
|
||||
- autocomplete
|
||||
autocompleteOptions:
|
||||
debounceDelay: 250
|
||||
maxPromptTokens: 1024
|
||||
onlyMyCode: true
|
||||
- name: My Model - OpenAI-Compatible
|
||||
provider: openai
|
||||
apiBase: http://my-endpoint/v1
|
||||
|
|
@ -456,6 +476,10 @@ models:
|
|||
model: starcoder
|
||||
roles:
|
||||
- autocomplete
|
||||
autocompleteOptions:
|
||||
debounceDelay: 350
|
||||
maxPromptTokens: 1024
|
||||
onlyMyCode: true
|
||||
defaultCompletionOptions:
|
||||
temperature: 0.3
|
||||
stop:
|
||||
|
|
@ -531,4 +555,8 @@ models:
|
|||
useLegacyCompletionsEndpoint: false
|
||||
roles:
|
||||
- autocomplete
|
||||
autocompleteOptions:
|
||||
debounceDelay: 350
|
||||
maxPromptTokens: 1024
|
||||
onlyMyCode: true
|
||||
```
|
||||
|
|
|
|||
|
|
@ -101,6 +101,12 @@ config.json
|
|||
|
||||
Specifies options for tab autocompletion behavior.
|
||||
|
||||
<Info>
|
||||
**Note**: Many of these parameters can also be configured per-model using the
|
||||
`autocompleteOptions` field in `config.yaml`. See the [YAML
|
||||
Reference](/reference#models) for more details.
|
||||
</Info>
|
||||
|
||||
**Properties:**
|
||||
|
||||
- `disable`: If `true`, disables tab autocomplete (default: `false`).
|
||||
|
|
@ -468,16 +474,19 @@ Several experimental config parameters are available, as described below:
|
|||
- `defaultContext`: Defines the default context for the LLM. Uses the same format as `contextProviders` but includes an additional `query` property to specify custom query parameters.=
|
||||
|
||||
- `modelRoles`:
|
||||
|
||||
- `inlineEdit`: Model title for inline edits.
|
||||
- `applyCodeBlock`: Model title for applying code blocks.
|
||||
- `repoMapFileSelection`: Model title for repo map selections.
|
||||
|
||||
- `quickActions`: Array of custom quick actions
|
||||
|
||||
- `title` (**required**): Display title for the quick action.
|
||||
- `prompt` (**required**): Prompt for quick action.
|
||||
- `sendToChat`: If `true`, sends result to chat; else inserts in document. Default is `false`.
|
||||
|
||||
- `contextMenuPrompts`:
|
||||
|
||||
- `comment`: Prompt for commenting code.
|
||||
- `docstring`: Prompt for adding docstrings.
|
||||
- `fix`: Prompt for fixing code.
|
||||
|
|
@ -529,15 +538,18 @@ Some deprecated `config.json` settings are no longer stored in config and have b
|
|||
- `disableSessionTitles`/`ui.getChatTitles`: This value will be migrated to the safest merged value (`true` if either are `true`). `getChatTitles` takes precedence if set to false
|
||||
|
||||
- `tabAutocompleteOptions`
|
||||
|
||||
- `useCache`: This value will override during migration.
|
||||
- `disableInFiles`: This value will be migrated to the safest merged value (arrays of file matches merged/deduplicated)
|
||||
- `multilineCompletions`: This value will override during migration.
|
||||
|
||||
- `experimental`
|
||||
|
||||
- `useChromiumForDocsCrawling`: This value will override during migration.
|
||||
- `readResponseTTS`: This value will override during migration.
|
||||
|
||||
- `ui` - all will override during migration
|
||||
|
||||
- `codeBlockToolbarPosition`
|
||||
- `fontSize`
|
||||
- `codeWrap`
|
||||
|
|
|
|||
|
|
@ -6,7 +6,7 @@ import { IdeMessengerContext } from "../../../context/IdeMessenger";
|
|||
|
||||
type SectionKey = Exclude<
|
||||
keyof ConfigYaml,
|
||||
"name" | "version" | "schema" | "metadata" | "tabAutocompleteOptions"
|
||||
"name" | "version" | "schema" | "metadata"
|
||||
>;
|
||||
|
||||
interface EditBlockButtonProps<T extends SectionKey> {
|
||||
|
|
|
|||
|
|
@ -136,27 +136,30 @@ export const uiOptionsSchema = z.object({
|
|||
export type UiOptions = z.infer<typeof uiOptionsSchema>;
|
||||
|
||||
export const tabAutocompleteOptionsSchema = z.object({
|
||||
disable: z.boolean().optional(),
|
||||
maxPromptTokens: z.number().optional(),
|
||||
debounceDelay: z.number().optional(),
|
||||
maxSuffixPercentage: z.number().optional(),
|
||||
prefixPercentage: z.number().optional(),
|
||||
disable: z.boolean(),
|
||||
maxPromptTokens: z.number(),
|
||||
debounceDelay: z.number(),
|
||||
maxSuffixPercentage: z.number(),
|
||||
prefixPercentage: z.number(),
|
||||
transform: z.boolean().optional(),
|
||||
template: z.string().optional(),
|
||||
multilineCompletions: z.enum(["always", "never", "auto"]).optional(),
|
||||
slidingWindowPrefixPercentage: z.number().optional(),
|
||||
slidingWindowSize: z.number().optional(),
|
||||
useCache: z.boolean().optional(),
|
||||
onlyMyCode: z.boolean().optional(),
|
||||
useRecentlyEdited: z.boolean().optional(),
|
||||
useRecentlyOpened: z.boolean().optional(),
|
||||
multilineCompletions: z.enum(["always", "never", "auto"]),
|
||||
slidingWindowPrefixPercentage: z.number(),
|
||||
slidingWindowSize: z.number(),
|
||||
useCache: z.boolean(),
|
||||
onlyMyCode: z.boolean(),
|
||||
useRecentlyEdited: z.boolean(),
|
||||
disableInFiles: z.array(z.string()).optional(),
|
||||
useImports: z.boolean().optional(),
|
||||
// Experimental options
|
||||
experimental_includeClipboard: z.boolean().optional(),
|
||||
experimental_includeRecentlyVisitedRanges: z.boolean().optional(),
|
||||
experimental_includeRecentlyEditedRanges: z.boolean().optional(),
|
||||
experimental_includeDiff: z.boolean().optional(),
|
||||
// Experimental options: true = enabled, false = disabled, number = enabled w priority
|
||||
experimental_includeClipboard: z.union([z.boolean(), z.number()]).optional(),
|
||||
experimental_includeRecentlyVisitedRanges: z
|
||||
.union([z.boolean(), z.number()])
|
||||
.optional(),
|
||||
experimental_includeRecentlyEditedRanges: z
|
||||
.union([z.boolean(), z.number()])
|
||||
.optional(),
|
||||
experimental_includeDiff: z.union([z.boolean(), z.number()]).optional(),
|
||||
experimental_enableStaticContextualization: z.boolean().optional(),
|
||||
});
|
||||
export type TabAutocompleteOptions = z.infer<
|
||||
|
|
|
|||
|
|
@ -309,19 +309,11 @@ export async function unrollBlocks(
|
|||
const unrolledAssistant: AssistantUnrolled = {
|
||||
name: assistant.name,
|
||||
version: assistant.version,
|
||||
...(assistant.tabAutocompleteOptions && {
|
||||
tabAutocompleteOptions: assistant.tabAutocompleteOptions,
|
||||
}),
|
||||
};
|
||||
|
||||
const sections: (keyof Omit<
|
||||
ConfigYaml,
|
||||
| "name"
|
||||
| "version"
|
||||
| "rules"
|
||||
| "schema"
|
||||
| "metadata"
|
||||
| "tabAutocompleteOptions"
|
||||
"name" | "version" | "rules" | "schema" | "metadata"
|
||||
>)[] = ["models", "context", "data", "mcpServers", "prompts", "docs"];
|
||||
|
||||
// Process all sections in parallel
|
||||
|
|
|
|||
|
|
@ -1,4 +1,3 @@
|
|||
import { tabAutocompleteOptionsSchema } from "@continuedev/config-types";
|
||||
import * as z from "zod";
|
||||
import { commonModelSlugs } from "./commonSlugs.js";
|
||||
import { dataSchema } from "./data/index.js";
|
||||
|
|
@ -146,7 +145,6 @@ export const configYamlSchema = baseConfigYamlSchema.extend({
|
|||
.optional(),
|
||||
prompts: z.array(blockOrSchema(promptSchema)).optional(),
|
||||
docs: z.array(blockOrSchema(docSchema)).optional(),
|
||||
tabAutocompleteOptions: tabAutocompleteOptionsSchema.optional(),
|
||||
});
|
||||
|
||||
export type ConfigYaml = z.infer<typeof configYamlSchema>;
|
||||
|
|
@ -159,7 +157,6 @@ export const assistantUnrolledSchema = baseConfigYamlSchema.extend({
|
|||
rules: z.array(ruleSchema.nullable()).optional(),
|
||||
prompts: z.array(promptSchema.nullable()).optional(),
|
||||
docs: z.array(docSchema.nullable()).optional(),
|
||||
tabAutocompleteOptions: tabAutocompleteOptionsSchema.optional(),
|
||||
});
|
||||
|
||||
export type AssistantUnrolled = z.infer<typeof assistantUnrolledSchema>;
|
||||
|
|
@ -172,7 +169,6 @@ export const assistantUnrolledSchemaNonNullable = baseConfigYamlSchema.extend({
|
|||
rules: z.array(ruleSchema).optional(),
|
||||
prompts: z.array(promptSchema).optional(),
|
||||
docs: z.array(docSchema).optional(),
|
||||
tabAutocompleteOptions: tabAutocompleteOptionsSchema.optional(),
|
||||
});
|
||||
|
||||
export type AssistantUnrolledNonNullable = z.infer<
|
||||
|
|
@ -258,7 +254,6 @@ export const configSchema = z.object({
|
|||
proxy: z.string().optional(),
|
||||
api_base: z.string().optional(),
|
||||
api_key: z.string().optional(),
|
||||
tabAutocompleteOptions: tabAutocompleteOptionsSchema.optional(),
|
||||
});
|
||||
|
||||
export type Config = z.infer<typeof configSchema>;
|
||||
|
|
|
|||
|
|
@ -119,6 +119,16 @@ export const autocompleteOptionsSchema = z.object({
|
|||
prefixPercentage: z.number().optional(),
|
||||
template: z.string().optional(),
|
||||
onlyMyCode: z.boolean().optional(),
|
||||
useCache: z.boolean().optional(),
|
||||
useImports: z.boolean().optional(),
|
||||
useRecentlyEdited: z.boolean().optional(),
|
||||
useRecentlyOpened: z.boolean().optional(),
|
||||
// Experimental options: true = enabled, false = disabled, number = enabled w priority
|
||||
experimental_includeClipboard: z.boolean().optional(),
|
||||
experimental_includeRecentlyVisitedRanges: z.boolean().optional(),
|
||||
experimental_includeRecentlyEditedRanges: z.boolean().optional(),
|
||||
experimental_includeDiff: z.boolean().optional(),
|
||||
experimental_enableStaticContextualization: z.boolean().optional(),
|
||||
});
|
||||
|
||||
/** Prompt templates use Handlebars syntax */
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue