|
7 | 7 | [eca.features.index :as f.index] |
8 | 8 | [eca.features.prompt :as f.prompt] |
9 | 9 | [eca.features.tools.mcp :as f.mcp] |
| 10 | + [eca.llm-api :as llm-api] |
10 | 11 | [eca.shared :as shared :refer [multi-str]])) |
11 | 12 |
|
12 | 13 | (set! *warn-on-reflection* true) |
|
82 | 83 | :type :native |
83 | 84 | :description "Resume the chats from this session workspaces." |
84 | 85 | :arguments []} |
| 86 | + {:name "doctor" |
| 87 | + :type :native |
| 88 | + :description "Check ECA details for troubleshooting." |
| 89 | + :arguments []} |
85 | 90 | {:name "repo-map-show" |
86 | 91 | :type :native |
87 | 92 | :description "Actual repoMap of current session." |
|
109 | 114 | raw-content |
110 | 115 | (map-indexed vector args))))) |
111 | 116 |
|
| 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 | + |
112 | 133 | (defn handle-command! [command args chat-id model instructions config db*] |
113 | 134 | (let [db @db* |
114 | 135 | custom-commands (custom-commands config (:workspace-folders db))] |
|
136 | 157 | (str "Total cost: $" (shared/tokens->cost total-input-tokens total-input-cache-creation-tokens total-input-cache-read-tokens total-output-tokens model db)))] |
137 | 158 | {:type :chat-messages |
138 | 159 | :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)}]}]}} |
139 | 162 | "repo-map-show" {:type :chat-messages |
140 | 163 | :chats {chat-id [{:role "system" :content [{:type :text :text (f.index/repo-map db config {:as-string? true})}]}]}} |
141 | 164 | "prompt-show" {:type :chat-messages |
|
0 commit comments