Skip to content

Commit 5aad5eb

Browse files
committed
Fix some commands not working.
1 parent 63105b7 commit 5aad5eb

File tree

5 files changed

+15
-3
lines changed

5 files changed

+15
-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+
- Fix some commands not working.
6+
57
## 0.24.1
68

79
- Fix build

docs/features.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -50,6 +50,7 @@ The built-in commands are:
5050

5151
`/costs`: shows costs about current session.
5252
`/repo-map-show`: shows the current repoMap context of the session.
53+
`/resume`: resume a chat from previous session of this workspace folder.
5354

5455
#### Custom commands
5556

src/eca/db.clj

Lines changed: 9 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -96,7 +96,15 @@
9696
(merge state-db
9797
(select-keys global-cache [:chats]))))))
9898

99-
(defn update-workspaces-cache! [db]
99+
(defn ^:private normalize-db-for-write [db]
100100
(-> (select-keys db [:chats])
101+
(update :chats (fn [chats]
102+
(into {}
103+
(map (fn [[k v]]
104+
[k (dissoc v :tool-calls)]))
105+
chats)))))
106+
107+
(defn update-workspaces-cache! [db]
108+
(-> (normalize-db-for-write db)
101109
(assoc :version version)
102110
(upsert-cache! (transit-global-db-file (:workspace-folders db)))))

src/eca/features/chat.clj

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -295,6 +295,7 @@
295295
(defn ^:private message-content->chat-content [role message-content]
296296
(case role
297297
("user"
298+
"system"
298299
"assistant") (reduce
299300
(fn [m content]
300301
(case (:type content)

src/eca/features/commands.clj

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -116,9 +116,9 @@
116116
(str "Total output tokens: " total-output-tokens)
117117
(str "Total cost: $" (shared/tokens->cost total-input-tokens total-input-cache-creation-tokens total-input-cache-read-tokens total-output-tokens model db)))]
118118
{:type :chat-messages
119-
:chats {chat-id [{:role :system :content [{:type :text :text text}]}]}})
119+
:chats {chat-id [{:role "system" :content [{:type :text :text text}]}]}})
120120
"repo-map-show" {:type :chat-messages
121-
:chats {chat-id [{:role :system :content [{:type :text :text (f.index/repo-map db {:as-string? true})}]}]}}
121+
:chats {chat-id [{:role "system" :content [{:type :text :text (f.index/repo-map db {:as-string? true})}]}]}}
122122

123123
"resume" (let [chats (:chats db)]
124124
;; Override current chat with first chat

0 commit comments

Comments
 (0)