Skip to content

Commit 981c44d

Browse files
committed
Fix providers disappearing from /login after saving an API key.
Fixes #196
1 parent b70e46f commit 981c44d

8 files changed

Lines changed: 9 additions & 9 deletions

File tree

CHANGELOG.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,7 @@
22

33
## Unreleased
44

5+
- Fix providers (openai, anthropic, google, azure, deepseek, openrouter, z-ai) disappearing from `/login` after saving an API key. #196
56
- Bump plumcp to 0.2.0-beta5.
67
- Fix auto-continue clobbering new prompt status and losing the stop button.
78
- Add configurable shell for `shell_command` tool via `toolCall.shellCommand.path` and `toolCall.shellCommand.args`. #370

src/eca/llm_providers/anthropic.clj

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -608,7 +608,7 @@
608608
(if (string/starts-with? input "sk-")
609609
(do
610610
(config/update-global-config! {:providers {"anthropic" {:key input}}})
611-
(swap! db* update :auth dissoc provider)
611+
(swap! db* assoc-in [:auth provider] {:step :login/done :type :auth/token})
612612
(send-msg! (format "API key and models saved to %s" (.getCanonicalPath (config/global-config-file))))
613613
(f.login/login-done! ctx))
614614
(send-msg! (format "Invalid API key '%s'" input))))

src/eca/llm_providers/azure.clj

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -30,6 +30,6 @@
3030
{}
3131
(string/split input #","))
3232
:key api-key}}}))
33-
(swap! db* update :auth dissoc provider)
33+
(swap! db* assoc-in [:auth provider] {:step :login/done :type :auth/token})
3434
(send-msg! (format "API key, url and models saved to %s" (.getCanonicalPath (config/global-config-file))))
3535
(f.login/login-done! ctx))

src/eca/llm_providers/deepseek.clj

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -24,6 +24,6 @@
2424
{}
2525
(string/split input #","))
2626
:key api-key}}}))
27-
(swap! db* update :auth dissoc provider)
27+
(swap! db* assoc-in [:auth provider] {:step :login/done :type :auth/token})
2828
(send-msg! (format "API key and models saved to %s" (.getCanonicalPath (config/global-config-file))))
2929
(f.login/login-done! ctx))

src/eca/llm_providers/google.clj

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,7 @@
1313
(if (not (string/blank? input))
1414
(do
1515
(config/update-global-config! {:providers {"google" {:key input}}})
16-
(swap! db* update :auth dissoc provider)
16+
(swap! db* assoc-in [:auth provider] {:step :login/done :type :auth/token})
1717
(send-msg! (format "API key saved to %s" (.getCanonicalPath (config/global-config-file))))
1818
(f.login/login-done! ctx))
1919
(send-msg! (format "Invalid API key '%s'" input))))

src/eca/llm_providers/openai.clj

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -428,10 +428,9 @@
428428
(defmethod f.login/login-step ["openai" :login/waiting-api-key] [{:keys [input db* provider send-msg!] :as ctx}]
429429
(if (string/starts-with? input "sk-")
430430
(do (config/update-global-config! {:providers {"openai" {:key input}}})
431-
(swap! db* update :auth dissoc provider)
431+
(swap! db* assoc-in [:auth provider] {:step :login/done :type :auth/token})
432432
(send-msg! (str "API key saved in " (.getCanonicalPath (config/global-config-file))))
433-
434-
(f.login/login-done! ctx :update-cache? false))
433+
(f.login/login-done! ctx))
435434
(send-msg! (format "Invalid API key '%s'" input))))
436435

437436
(defmethod f.login/login-step ["openai" :login/renew-token] [{:keys [db* provider] :as ctx}]

src/eca/llm_providers/openrouter.clj

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -24,6 +24,6 @@
2424
{}
2525
(string/split input #","))
2626
:key api-key}}}))
27-
(swap! db* update :auth dissoc provider)
27+
(swap! db* assoc-in [:auth provider] {:step :login/done :type :auth/token})
2828
(send-msg! (format "API key and models saved to %s" (.getCanonicalPath (config/global-config-file))))
2929
(f.login/login-done! ctx))

src/eca/llm_providers/z_ai.clj

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -24,6 +24,6 @@
2424
{}
2525
(string/split input #","))
2626
:key api-key}}}))
27-
(swap! db* update :auth dissoc provider)
27+
(swap! db* assoc-in [:auth provider] {:step :login/done :type :auth/token})
2828
(send-msg! (format "API key and models saved to %s" (.getCanonicalPath (config/global-config-file))))
2929
(f.login/login-done! ctx))

0 commit comments

Comments
 (0)