跳到主内容

配置

您可以轻松地从 Continue 聊天侧边栏访问您的助手配置。通过按下 cmd/ctrl + L (VS Code) 或 cmd/ctrl + J (JetBrains) 打开侧边栏,然后点击主聊天输入框上方的助手选择器。然后,您可以将鼠标悬停在某个助手上,并点击 new window (Hub 助手) 或 gear (本地助手) 图标。

configure an assistant

Hub 助手

Hub 助手可以在 Hub 中进行管理。请参阅 编辑助手

YAML 配置

本地用户级别的配置存储在您的主目录的 config.yaml 文件中,并可在此进行编辑。

  • ~/.continue/config.yaml (MacOS / Linux)
  • %USERPROFILE%\.continue\config.yaml (Windows)

要打开此 config.yaml 文件,您需要在聊天输入框的右上角打开助手下拉菜单。在该下拉菜单中,“本地助手”选项旁边,选择齿轮图标。它将打开本地的 config.yaml 文件。

local-config-open-steps

编辑此文件时,您可以在输入时看到可用的选项建议,或查看下面的参考。当您从 IDE 保存配置文件时,Continue 会自动刷新以考虑您的更改。配置文件在使用 Continue 时首次自动创建,如果不存在,则始终自动生成默认值。

在此处查看 config.yaml 的完整参考。

已弃用的配置方法

信息

在此处查看 config.json 迁移指南

  • config.json - 原始配置格式,存储在与 config.yaml 相同位置的文件中
  • .continuerc.json - 工作区级别配置
  • config.ts - 高级配置(可能不需要)- 您主目录中的一个 TypeScript 文件,可用于程序化地修改(合并config.json 模式
    • ~/.continue/config.ts (MacOS / Linux)
    • %USERPROFILE%\.continue\config.ts (Windows)

.continuerc.json

.continuerc.json 的格式与 config.json 相同,外加一个额外的属性 mergeBehavior,可以设置为 "merge" 或 "overwrite"。如果设置为 "merge"(默认),则 .continuerc.json 将应用在 config.json 之上(数组和对象会合并)。如果设置为 "overwrite",则 .continuerc.json 的每个顶层属性将覆盖 config.json 中的相应属性。

示例

.continuerc.json
{
"tabAutocompleteOptions": {
"disable": true
},
"mergeBehavior": "overwrite"
}

config.ts

config.yamlconfig.json 可以处理绝大多数必要的配置,因此我们建议尽可能使用它们。但是,如果您需要程序化地扩展 Continue 配置,可以使用 config.ts 文件,该文件放置在 ~/.continue/config.ts (MacOS / Linux) 或 %USERPROFILE%\.continue\config.ts (Windows)。

config.ts 必须导出一个 modifyConfig 函数,例如:

config.ts
export function modifyConfig(config: Config): Config {
config.slashCommands?.push({
name: "commit",
description: "Write a commit message",
run: async function* (sdk) {
// The getDiff function takes a boolean parameter that indicates whether
// to include unstaged changes in the diff or not.
const diff = await sdk.ide.getDiff(false); // Pass false to exclude unstaged changes
for await (const message of sdk.llm.streamComplete(
`${diff}\n\nWrite a commit message for the above changes. Use no more than 20 tokens to give a brief description in the imperative mood (e.g. 'Add feature' not 'Added feature'):`,
new AbortController().signal,
{
maxTokens: 20,
},
)) {
yield message;
}
},
});
return config;
}

有关如何使用 config.ts 的示例,请参阅编写自定义斜杠命令编写自定义上下文提供者