文章目录
一、Continue插件安装
- 打开pycharm,进入 File > Settings > Plugins,搜索 Continue 并安装
-
重启 pycharm 完成激活
”This file does not belong to the project“ 时,选择"This file",然后确定。
二、Continue插件配置
1.打开config 配置文件方法
2.remote ollama 配置
Continue 插件配置信息修改
config.json
中配置信息部分如下:
{
"models": [
{
// title 可以自己随便定义
"title": "deepseek-ai-remote/DeepSeek-R1-1.5b",
// model 为ollama 中已有模型
"model": "deepseek-r1:1.5b",
// 模型提供商写ollama
"provider": "ollama",
// remote ollama 的ip地址,端口号默认是11434
"apiBase": "http://<my endpoint>:11434"
}
]
}
配置信息写入更新后(仅替换默认config 文件中的"models"部分即可),重启pycharm即可。
3.硅基流动配置
1.首先在硅基流动官网 完成注册;
2.在个人中心 > API 密钥 中创建 API Key
3.Continue 插件配置信息修改
结构化后的硅基流动 config 配置文件如下
包含remote ollama 配置和硅基流动配置的config 文件如下
{
"models": [
{
"title": "deepseek-ai-remote/DeepSeek-R1-1.5b",
"model": "deepseek-r1:1.5b",
"provider": "ollama",
"apiBase": "http://<my endpoint>:11434"
},
{
"title": "deepseek-ai/DeepSeek-R1",
"model": "deepseek-ai/DeepSeek-R1",
"contextLength": 30000,
"provider": "openai",
"apiBase": "https://api.siliconflow.cn/v1",
"apiKey": "sk-***********************************************",
"requestOptions": {
"extraBodyProperties": {
"transforms": []
}
}
},
{
"title": "deepseek-ai/DeepSeek-V3",
"model": "deepseek-ai/DeepSeek-V3",
"contextLength": 30000,
"provider": "openai",
"apiBase": "https://api.siliconflow.cn/v1",
"apiKey": "sk-***********************************************",
"requestOptions": {
"extraBodyProperties": {
"transforms": []
}
}
}
],
"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"
},
{
"name": "explain",
"prompt": "{{{ input }}}\n\n详细解释所选代码。详细说明其功能、用途和工作原理。使用示例来说明您的解释。",
"description": "解释代码"
},
{
"name": "fix",
"prompt": "{{{ input }}}\n\n分析并修复代码中的错误。提供详细的解释和解决方案,包括但不限于语法错误、逻辑错误或性能问题。确保您的解决方案是正确的,并且能够解决所有已知的问题。",
"description": "修复代码"
},
{
"name": "check",
"prompt": "{{{ input }}}\n\n请阅读突出显示的代码并检查是否有任何错误。您应该查找以下内容并保持高度警惕:\n- 语法错误\n- 逻辑错误\n- 安全漏洞\n- 性能问题\n- 任何其他看似错误的内容\n\n一旦您发现错误,请尽可能清楚地解释,但不要使用多余的词语。例如,不要说“我认为第 5 行有一个语法错误”,而应该说“第 5 行有语法错误”。针对发现的每个错误,给出一个要点作为答案。",
"description": "检查代码是否存在错误"
}
],
"tabAutocompleteModel": [
{
"title": "deepseek-ai/DeepSeek-V3",
"provider": "openai",
"model": "deepseek-ai/DeepSeek-V3",
"contextLength": 30000,
"apiBase": "https://api.siliconflow.cn/v1",
"apiKey": "sk-***********************************************",
"useLegacyCompletionsEndpoint": false
}
],
"contextProviders": [
{
"name": "code",
"params": {
"nRetrieve": 25,
"nFinal": 5,
"useReranking": true
},
"useLegacyCompletionsEndpoint": false
},
{
"name": "docs",
"params": {}
},
{
"name": "diff",
"params": {
"nRetrieve": 25,
"nFinal": 5,
"useReranking": true
},
"useLegacyCompletionsEndpoint": false
},
{
"name": "terminal",
"params": {}
},
{
"name": "problems",
"params": {}
},
{
"name": "folder",
"params": {}
},
{
"name": "codebase",
"params": {
"nRetrieve": 25,
"nFinal": 5,
"useReranking": true
},
"useLegacyCompletionsEndpoint": false
}
],
"slashCommands": [
{
"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"
},
{
"name": "edit",
"description": "Edit selected code"
},
{
"name": "comment",
"description": "Write comments for the selected code"
}
],
"embeddingsProvider": {
"provider": "openai",
"model": "BAAI/bge-m3",
"apiBase": "https://api.siliconflow.cn/v1",
"apiKey": "sk-***********************************************"
},
"rerank": {
"title": "BAAI/bge-reranker-v2-m3",
"model": "BAAI/bge-reranker-v2-m3",
"provider": "openai",
"apiBase": "https://api.siliconflow.cn/v1",
"apiKey": "sk-***********************************************"
},
"tabAutocompleteOptions": {
"template": "Please teach me what I should write in the `hole` tag, but without any further explanation and code backticks, i.e., as if you are directly outputting to a code editor. It can be codes or comments or strings. Don't provide existing & repetitive codes. If the provided prefix and suffix contain incomplete code and statement, your response should be able to be directly concatenated to the provided prefix and suffix. Also note that I may tell you what I'd like to write inside comments. \n{{{prefix}}}<hole></hole>{{{suffix}}}\n\nPlease be aware of the environment the hole is placed, e.g., inside strings or comments or code blocks, and please don't wrap your response in ```. You should always provide non-empty output.\n",
"maxPromptTokens": 2048,
"prefixPercentage": 0.85,
"maxSuffixPercentage": 0.15,
"debounceDelay": 500,
"slidingWindowPrefixPercentage": 0.75,
"slidingWindowSize": 350,
"maxSnippetPercentage": 0.6,
"recentlyEditedSimilarityThreshold": 0.3,
"onlyMyCode": false,
"useOtherFiles": false,
"useRecentlyEdited": true,
"recentLinePrefixMatchMinLength": 7
}
}
三、continue 常用操作
1.ctrl + J 询问选中代码
2.ctrl + I 编辑代码·
3.通过/test
自动生成测试用例
4.通过/explain
进行代码解释
5.通过/fix
进行代码修复
推荐链接
1.https://docs.continue.dev/customize/model-providers/ollama
2.https://github.com/continuedev/continue/issues/1175