vscode 如何通过Continue引入AI 助手deepseek

第一步:

在deepseek 官网上注册账号,得到APIKeys(deepseek官网地址)
在这里插入图片描述创建属于自己的APIKey,然后复制这个key,(注意保存自己的key)!

第二步:

打开vscode,在插件市场安装Continue插件,
在这里插入图片描述点击设置,添加deepseek模型,默认的模型用不了。在这里插入图片描述**通过这个方法添加deepseek模型后,如果不起作用,建议通过config.json文件添加**
通过这个方法添加deepseek模型后,如果不起作用,建议通过config.json文件添加
文件内容:

{
 "completionOptions": {
 "BaseCompletionOptions": {
 "temperature": 0,
 "maxTokens": 256
    }
  },
 "models": [
    {
 "title": "DeepSeek",
 "model": "deepseek-chat",
 "contextLength": 128000,
 "apiKey": "你的ak",
 "provider": "openai",
 "apiBase": "https://api.deepseek.com/beta"
    },
    {
 "title": "DeepSeek Coder",
 "model": "deepseek-coder",
 "contextLength": 128000,
 "provider": "deepseek",
 "apiKey": "你的ak"
    }
  ],
 "tabAutocompleteModel": {
 "title": "DeepSeek",
 "model": "deepseek-chat",
 "apiKey": "你的ak",
 "provider": "openai",
 "apiBase": "https://api.deepseek.com/beta"
  },
 "slashCommands": [
    {
 "name": "edit",
 "description": "Edit highlighted code"
    },
    {
 "name": "comment",
 "description": "Write comments for the highlighted code"
    },
    {
 "name": "share",
 "description": "Export the current chat session to markdown"
    },
    {
 "name": "cmd",
 "description": "Generate a shell command"
    }
  ],
 "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"
    }
  ],
 "contextProviders": [
    {
 "name": "diff",
 "params": {}
    },
    {
 "name": "open",
 "params": {}
    },
    {
 "name": "terminal",
 "params": {}
    }
  ]
}

  

在这里插入图片描述
添加完成后,出现如图的模型选择,就可以正常使用了。没有生效的话,可以重新打开vscode。

### 配置 VSCode 中的 Continue 插件以使用 DeepSeek API 为了在 Visual Studio Code (VSCode) 中配置 Continue 插件并集成 DeepSeek API,需遵循特定步骤确保两者能够协同工作。这不仅有助于提高开发效率,还能增强代码的质量。 #### 安装 Continue 插件 首先,在 VSCode 的扩展市场中搜索 `Continue` 并安装该插件[^2]。这是实现 AI 辅助编程的基础步骤之一。 #### 获取 DeepSeek API 访问权限 接着,访问 DeepSeek 官方网站注册账号,并申请获取 API 密钥。此密钥对于后续配置至关重要,因为它允许开发者连接到 DeepSeek 提供的服务[^1]。 #### 修改 Continue 设置文件 完成上述准备工作之后,打开 `.continue/config.json` 文件(如果没有找到,则创建一个新的)。在此 JSON 文件内添加如下所示的内容: ```json { "api_key": "your_deepseek_api_key_here", "model": "deepseek" } ``` 这段配置指定了要使用的模型名称以及对应的 API 密钥,从而让 Continue 能够识别并与指定的 DeepSeek 服务通信。 #### 测试集成效果 保存更改后的设置文件后重启 VSCode 或者重新加载窗口 (`Ctrl+R`) 来使新配置生效。此时可以通过编写一段简单的测试程序验证是否成功集成了 DeepSeek 功能。尝试触发一些常见的编码场景,观察是否有来自 DeepSeek 的建议或自动补全提示出现。 通过以上操作,便能够在 VSCode 中顺利地利用 Continue 插件来调用 DeepSeek API 进行更高效的编程活动。
评论
成就一亿技术人!
拼手气红包6.0元
还能输入1000个字符
 
红包 添加红包
表情包 插入表情
 条评论被折叠 查看
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值