Skip to main content

斜杠命令

斜杠命令是通过输入'/'并从下拉菜单中选择来激活的快捷方式。例如,内置的'/edit'斜杠命令允许您直接将编辑流式传输到您的编辑器中。

斜杠命令

内置斜杠命令

要使用任何内置的斜杠命令,请打开 config.json 并将其添加到 slashCommands 列表中。

/share

生成当前聊天历史记录的可共享Markdown转录。

config.json
{
"slashCommands": [
{
"name": "share",
"description": "Export the current chat session to markdown",
"params": { "outputDir": "~/.continue/session-transcripts" }
}
]
}

使用outputDir参数来指定您希望保存markdown文件的位置。

/cmd

从自然语言生成一个shell命令,并且(仅在VS Code中)自动将其粘贴到终端中。

config.json
{
"slashCommands": [
{
"name": "cmd",
"description": "Generate a shell command"
}
]
}

/commit

向LLM展示您当前的git diff,并要求它生成提交信息。

config.json
{
"slashCommands": [
{
"name": "commit",
"description": "Generate a commit message for the current changes"
}
]
}

/http

在您自己的HTTP端点上编写自定义斜杠命令。在您设置的端点的params对象中设置'url'。该端点应返回一系列字符串更新,这些更新将流式传输到Continue侧边栏。请参阅我们的基本FastAPI示例以供参考。

config.json
{
"slashCommands": [
{
"name": "http",
"description": "Does something custom",
"params": { "url": "<my server endpoint>" }
}
]
}

/issue

描述您想要生成的问题,继续将变成一个格式良好的标题和正文,然后给您一个草稿的链接,以便您可以提交。请确保设置您想要为其生成问题的存储库的URL。

config.json
{
"slashCommands": [
{
"name": "issue",
"description": "Generate a link to a drafted GitHub issue",
"params": { "repositoryUrl": "https://github.com/continuedev/continue" }
}
]
}

/onboard

板载斜杠命令通过分析项目结构、README文件和依赖文件,帮助您熟悉新项目。它识别关键文件夹,解释它们的用途,并突出显示使用的流行包。此外,它还提供了对项目架构的见解。

config.json
{
"slashCommands": [
{
"name": "onboard",
"description": "Familiarize yourself with the codebase"
}
]
}

模型上下文协议

模型上下文协议是由Anthropic提出的一个标准,旨在统一提示、上下文和工具使用。Continue通过创建斜杠命令支持MCP的“提示”。阅读他们的快速入门,了解如何设置本地服务器,然后像这样配置你的config.json

{
"experimental": {
"modelContextProtocolServers": [
{
"transport": {
"type": "stdio",
"command": "uvx",
"args": ["mcp-server-sqlite", "--db-path", "/Users/NAME/test.db"]
}
}
]
}
}

构建你自己的斜杠命令

你可以通过遵循本教程来构建你自己的斜杠命令。