最近国产大模型 DeepSeek v3 新版本于2024年12月26日正式发布并开源,凭借其优秀的模型推理能力,讨论度非常之高 🔥
1月27日,苹果App Store中国区免费榜显示,DeepSeek成为中国区第一,在国内国际引起巨大反响,名副其实成为国产 AI 之光~
在本篇文章中,我们将为大家介绍,如何在 PyCharm 中基于开源 AI 编程辅助插件 Continue,配置基于 DeepSeek 的 API 接口,实现常用的 AI 编程辅助等功能。
1、创建 Deepseek API 密钥
首先,我们来创建提供给 Continue 使用的 API 密钥,我们可以访问 Deepseek 开放平台对应页面( Service Unavailable ),点击「 创建API key 」,如下所示
填写 key 名称后,会生成对应的 key,如下所示
2、安装 Continue
打开 PyCharm 我们安装 Continue,如下所示:打开文件 -> 设置 -> 插件,搜索“Continue”,点击安装,等待插件安装完毕后,点击“应用”,插件安装成功。
3、配置Continue
插件安装成功后,在右侧的标签栏中,会显示一个 Continue 的标签,我们点击即可进入,随后点击设置按键,如下图。
点击后,文本编辑区将会弹出配置文件。
我们对配置文件进行修改,将内容替换为下面的内容:
{
"completionOptions": {
"BaseCompletionOptions": {
"temperature": 0.0,
"maxTokens": 256
}
},
"models": [
{
"title": "DeepSeek",
"model": "deepseek-chat",
"contextLength": 128000,
"apiKey": "REDACTED",
"provider": "deepseek",
"apiBase": "https://api.deepseek.com/beta"
}
],
"tabAutocompleteModel": {
"title": "DeepSeek Coder",
"model": "deepseek-coder",
"apiKey": "REDACTED",
"provider": "deepseek",
"apiBase": "https://api.deepseek.com/beta"
},
"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": "folder",
"params": {}
},
{
"name": "codebase",
"params": {}
}
],
"slashCommands": [
{
"name": "share",
"description": "Export the current chat session to markdown"
},
{
"name": "commit",
"description": "Generate a git commit message"
}
]
}
当我们对内容进行修改时,将会弹出如下提示,我们点击确定
随后,我们将以下两处的 apiKey 替换为先前在官网申请的的 API key,保存后,即可开始使用
4、使用效果
这里,我们演示代码解释功能和代码优化功能。如下所示,直接选中代码,可以对代码段进行解释
如下所示,我们也可以通过选中代码,对代码进行修改
如果你想深入探索更多内容,可以查阅对应的官网进行学习:
- Continue官网:Continue
- Deepseek文档:Service Unavailable
如果你喜欢本文,欢迎点赞,并且关注我们的微信公众号:Python技术极客,我们会持续更新分享 Python 开发编程、数据分析、数据挖掘、AI 人工智能、网络爬虫等技术文章!让大家在Python 技术领域持续精进提升,成为更好的自己!
添加作者微信(coder_0101),拉你进入行业技术交流群,进行技术交流!