Skip to content

Commit bec6afd

Browse files
committed
Add support for deepseek login
1 parent 7c9927b commit bec6afd

File tree

5 files changed

+41
-1
lines changed

5 files changed

+41
-1
lines changed

CHANGELOG.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,7 @@
55
- Support more providers login via `/login`.
66
- openai
77
- openrouter
8+
- deepseek
89

910
## 0.46.0
1011

docs/models.md

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -189,6 +189,14 @@ Only set this when your provider uses a different path or expects query paramete
189189

190190
[DeepSeek](https://deepseek.com) offers powerful reasoning and coding models:
191191

192+
1. Login via the chat command `/login`.
193+
2. Type 'deepseek' and send it.
194+
3. Specify your Deepseek API key.
195+
4. Inform at least a model, ex: `deepseek-chat`
196+
5. Done, it should be saved to your global config.
197+
198+
or manually via config:
199+
192200
```javascript
193201
{
194202
"providers": {

src/eca/db.clj

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -33,7 +33,8 @@
3333
:auth {"anthropic" {}
3434
"github-copilot" {}
3535
"openai" {}
36-
"openrouter" {}}})
36+
"openrouter" {}
37+
"deepseek" {}}})
3738

3839
(defonce db* (atom initial-db))
3940

src/eca/llm_api.clj

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,7 @@
99
[eca.llm-providers.openai :as llm-providers.openai]
1010
[eca.llm-providers.openai-chat :as llm-providers.openai-chat]
1111
[eca.llm-providers.openrouter]
12+
[eca.llm-providers.deepseek]
1213
[eca.llm-util :as llm-util]
1314
[eca.logger :as logger]))
1415

src/eca/llm_providers/deepseek.clj

Lines changed: 29 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,29 @@
1+
(ns eca.llm-providers.deepseek
2+
(:require
3+
[clojure.string :as string]
4+
[eca.config :as config]
5+
[eca.features.login :as f.login]))
6+
7+
(defmethod f.login/login-step ["deepseek" :login/start] [{:keys [db* chat-id provider send-msg!]}]
8+
(swap! db* assoc-in [:chats chat-id :login-provider] provider)
9+
(swap! db* assoc-in [:auth provider] {:step :login/waiting-api-key})
10+
(send-msg! "Paste your API Key"))
11+
12+
(defmethod f.login/login-step ["deepseek" :login/waiting-api-key] [{:keys [input db* provider send-msg!]}]
13+
(swap! db* assoc-in [:auth provider] {:step :login/waiting-models
14+
:api-key input})
15+
(send-msg! "Inform one or more models (separated by `,`):"))
16+
17+
(defmethod f.login/login-step ["deepseek" :login/waiting-models] [{:keys [input db* provider send-msg!] :as ctx}]
18+
(let [api-key (get-in @db* [:auth provider :api-key])]
19+
(config/update-global-config! {:providers {"deepseek" {:api "openai-chat"
20+
:url "https://api.deepseek.com"
21+
:models (reduce
22+
(fn [models model-str]
23+
(assoc models (string/trim model-str) {}))
24+
{}
25+
(string/split input #","))
26+
:key api-key}}}))
27+
(swap! db* assoc-in [:auth provider] nil)
28+
(send-msg! (format "API key and models saved to %s" (.getCanonicalPath (config/global-config-file))))
29+
(f.login/login-done! ctx))

0 commit comments

Comments
 (0)