Skip to content

Commit caf0763

Browse files
committed
Add /doctor command
1 parent b046c41 commit caf0763

File tree

3 files changed

+31
-3
lines changed

3 files changed

+31
-3
lines changed

CHANGELOG.md

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,8 @@
22

33
## Unreleased
44

5+
- Add `/doctor` command to help with troubleshooting
6+
57
## 0.29.1
68

79
- Fix args streaming in toolCallPrepare to not repeat the args. https://github.com/editor-code-assistant/eca-nvim/issues/28

docs/features.md

Lines changed: 6 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -74,9 +74,12 @@ Eca supports commands that usually are triggered via shash (`/`) in the chat, co
7474

7575
The built-in commands are:
7676

77-
`/costs`: shows costs about current session.
78-
`/repo-map-show`: shows the current repoMap context of the session.
79-
`/resume`: resume a chat from previous session of this workspace folder.
77+
`/init`: Create/update the AGENT.md file with details about the workspace for best LLM output quality.
78+
`/costs`: Show costs about current session.
79+
`/resume`: Resume a chat from previous session of this workspace folder.
80+
`/doctor`: Show information about ECA, useful for troubleshooting.
81+
`/repo-map-show`: Show the current repoMap context of the session.
82+
`/prompt-show`: Show the final prompt sent to LLM with all contexts and ECA details.
8083

8184
#### Custom commands
8285

src/eca/features/commands.clj

Lines changed: 23 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,7 @@
77
[eca.features.index :as f.index]
88
[eca.features.prompt :as f.prompt]
99
[eca.features.tools.mcp :as f.mcp]
10+
[eca.llm-api :as llm-api]
1011
[eca.shared :as shared :refer [multi-str]]))
1112

1213
(set! *warn-on-reflection* true)
@@ -82,6 +83,10 @@
8283
:type :native
8384
:description "Resume the chats from this session workspaces."
8485
:arguments []}
86+
{:name "doctor"
87+
:type :native
88+
:description "Check ECA details for troubleshooting."
89+
:arguments []}
8590
{:name "repo-map-show"
8691
:type :native
8792
:description "Actual repoMap of current session."
@@ -109,6 +114,22 @@
109114
raw-content
110115
(map-indexed vector args)))))
111116

117+
(defn ^:private doctor-msg [db config]
118+
(let [model (llm-api/default-model db config)]
119+
(multi-str (str "ECA version:" (config/eca-version))
120+
""
121+
(str "Default model: " model)
122+
""
123+
(str "Relevant env vars: " (reduce (fn [s [key val]]
124+
(if (or (string/includes? key "KEY")
125+
(string/includes? key "API")
126+
(string/includes? key "URL")
127+
(string/includes? key "BASE"))
128+
(str s key "=" val "\n")
129+
s))
130+
""
131+
(System/getenv))))))
132+
112133
(defn handle-command! [command args chat-id model instructions config db*]
113134
(let [db @db*
114135
custom-commands (custom-commands config (:workspace-folders db))]
@@ -136,6 +157,8 @@
136157
(str "Total cost: $" (shared/tokens->cost total-input-tokens total-input-cache-creation-tokens total-input-cache-read-tokens total-output-tokens model db)))]
137158
{:type :chat-messages
138159
:chats {chat-id [{:role "system" :content [{:type :text :text text}]}]}})
160+
"doctor" {:type :chat-messages
161+
:chats {chat-id [{:role "system" :content [{:type :text :text (doctor-msg db config)}]}]}}
139162
"repo-map-show" {:type :chat-messages
140163
:chats {chat-id [{:role "system" :content [{:type :text :text (f.index/repo-map db config {:as-string? true})}]}]}}
141164
"prompt-show" {:type :chat-messages

0 commit comments

Comments
 (0)