PyCharm接入DeepSeek实现AI编程

目录

效果演示

[创建API key](#创建API key)

在PyCharm中下载CodeGPT插件

配置Continue


DeepSeek 是一家专注于人工智能技术研发的公司,致力于开发高性能、低成本的 AI 模型。DeepSeek-V3 是 DeepSeek 公司推出的最新一代 AI 模型。其前身是 DeepSeek-V2.5,经过持续的优化和升级,V3 版本在性能、速度和成本方面都取得了显著提升。DeepSeek-V3 的发布表明,国产 AI 模型在技术层面已经具备与国际顶尖模型(例如 GPT-4o)竞争的实力。

接下来,我们把DeepSeek接入到PyCharm中,并利用其能力辅助我们进行代码开发。

效果演示

首先来看一下效果。

我们可以直接选中代码,并对代码段进行解释

我们也可以通过选中代码,对代码进行修改

创建API key

首先进入DeepSeek官网,官网链接如下:

DeepSeek | 深度求索https://www.deepseek.com/https://www.deepseek.com/点击API开放平台:

DeepSeek会为每个人赠送10元余额

点击左侧"API Keys",点击创建API key,输出名称为"AI代码提示",也可以使用其它自定义的名称。

点击"创建",一定要记录此处的API key,可以先将API key复制在其它地方。

在PyCharm中下载Continue插件

打开PyCharm,打开文件->设置->插件,搜索"Continue",点击安装。

等待插件安装完毕后,点击"应用",插件安装成功。

配置Continue

插件安装成功后,在右侧的标签栏中,会显示一个Continue的标签,我们点击即可进入,随后点击设置按键,如下图。

点击后,文本编辑区将会弹出配置文件。

我们对配置文件进行修改,将内容替换为下面的内容:

javascript 复制代码
{
  "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。

保存文件后,即可开始使用。

相关推荐
风筝超冷43 分钟前
Seq2Seq - 编码器(Encoder)和解码器(Decoder)
人工智能·深度学习·seq2seq
uncle_ll1 小时前
李宏毅NLP-3-语音识别part2-LAS
人工智能·自然语言处理·语音识别·las
helloworld工程师1 小时前
Spring AI应用:利用DeepSeek+嵌入模型+Milvus向量数据库实现检索增强生成--RAG应用(超详细)
人工智能·spring·milvus
Python×CATIA工业智造2 小时前
基于PySide6与pycatia的CATIA绘图比例智能调节工具开发全解析
python·pycharm·自动化·catia二次开发
終不似少年遊*3 小时前
【NLP解析】多头注意力+掩码机制+位置编码:Transformer三大核心技术详解
人工智能·自然语言处理·大模型·nlp·transformer·注意力机制
清岚_lxn5 小时前
原生SSE实现AI智能问答+Vue3前端打字机流效果
前端·javascript·人工智能·vue·ai问答
_一条咸鱼_7 小时前
大厂AI 大模型面试:注意力机制原理深度剖析
人工智能·深度学习·机器学习
FIT2CLOUD飞致云7 小时前
四月月报丨MaxKB正在被能源、交通、金属矿产等行业企业广泛采纳
人工智能·开源
_一条咸鱼_7 小时前
大厂AI大模型面试:泛化能力原理
人工智能·深度学习·机器学习
Pitayafruit8 小时前
🔓AI赋能开源:如何借助MCP快速解锁开源项目并提交你的首个PR
ai编程·cursor·mcp