使用Continue + Aide + DeepSeek API实现代码提示、续写、bug调试。
。
先上效果
安装插件
在VSCode中安装Aide和Continue插件
修改配置文件
进入Continue设置
{
"models": [
{
"title": "DeepSeek API",
"provider": "openai",
"model": "deepseek-coder",
"apiKey": "你的deepseek apiKey",
"apiBase": "https://api.deepseek.com/v1",
"apiType": "openai",
"useLegacyCompletionsEndpoint": false
}
],
"customCommands": [
{
"name": "test",
"prompt": "{{{ input }}}\n\nWrite a comprehensive set of unit tests for the selected code. It should setup, run tests that check for correctness including important edge cases, and teardown. Ensure that the tests are complete and sophisticated. Give the tests just as chat output, don't edit any file.",
"description": "Write unit tests for highlighted code"
}
],
"tabAutocompleteModel": {
"title": "Codestral",
"provider": "deepseek",
"model": "deepseek-coder",
"apiKey": "你的deepseek apiKey",
"apiBase": "https://api.deepseek.com"
},
"contextProviders": [
{
"name": "code",
"params": {}
},
{
"name": "docs",
"params": {}
},
{
"name": "diff",
"params": {}
},
{
"name": "terminal",
"params": {}
},
{
"name": "problems",
"params": {}
},
{
"name": "folder",
"params": {}
},
{
"name": "codebase",
"params": {}
}
],
"slashCommands": [
{
"name": "edit",
"description": "Edit selected code"
},
{
"name": "comment",
"description": "Write comments for the selected code"
},
{
"name": "share",
"description": "Export the current chat session to markdown"
},
{
"name": "cmd",
"description": "Generate a shell command"
},
{
"name": "commit",
"description": "Generate a git commit message"
}
],
"docs": []
}
APIKey获取
这里以deepseek为例,可以试用500万token,登录注册DeepSeek 开放平台,将key写入配置文件中。
注意API Key仅在创建时弹出的窗口可以复制,错过了就重新创建一个。
代码补全
使用与compilot一致,回车、tab。
对话
多文件对话
一般对话和网站使用一致,不再赘述。
这里介绍下利用Aide,可以复制多个文件为AI提示词,粘入continue对话框一起对话。
报错解决
代码报错,点击快速修复-问下Continue,可以查看解决办法
代码阅读
点击右上角按钮,AI自动阅读并注释,适合学习新库包或接手项目。
PS:笔者正在学外语哈,可以通过修改语言设置,改为中文注释。
可能遇到的问题
Continue插件不可以与GPT Runner插件一起使用,同时使用Continue将无法进行对话和补全,禁用GPT Runner后可以正常使用。 [ReadableStream.from is not a function error · Issue #1649 · continuedev/continue · GitHub] (github.com/continuedev…)