DeepSeek 是一家專注于人工智能技術研發的公司,致力于開發高性能、低成本的 AI 模型。DeepSeek-V3 是 DeepSeek 公司推出的最新一代 AI 模型。其前身是 DeepSeek-V2.5,經過持續的優化和升級,V3 版本在性能、速度和成本方面都取得了顯著提升。DeepSeek-V3 的發布表明,國產 AI 模型在技術層面已經具備與國際頂尖模型(例如 GPT-4o)競爭的實力。
接下來,我們把DeepSeek接入到PyCharm中,并利用其能力輔助我們進行代碼開發
首先來看一下效果,我們可以直接選中代碼,并對代碼段進行解釋
我們也可以通過選中代碼,對代碼進行修改
創建API key
首先進入DeepSeek官網,官網鏈接如下
https://www.deepseek.com/
點擊API開放平臺:
點擊左側“API Keys”,點擊創建API key,輸出名稱為“AI代碼提示”,也可以使用其它自定義的名稱
點擊“創建',一定要記錄此處的API key,可以先將API key復制在其它地方。
在PyCharm中下載Continue插件
打開PyCharm,打開文件->設置->插件,搜索“Continue”,點擊安裝。
等待插件安裝完畢后,點擊“應用”,插件安裝成功。
配置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。
保存文件后,即可開始使用。