Skip to content

Commit ad0368f

Browse files
committed
Improve /compact UI
1 parent 6133cbe commit ad0368f

File tree

2 files changed

+14
-0
lines changed

2 files changed

+14
-0
lines changed

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+
- Improve `/compact` UI in chat after running, cleaning chat and showing the new summary.
56
- Better config values dynamic string parse:
67
- Support `${classapath:path/to/eca/classpath/file}` in dynamic string parse.
78
- Support `${netrc:api.foo.com}` in dynamic string parse to parse keys. #200

src/eca/features/commands.clj

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -220,6 +220,19 @@
220220
(swap! db* assoc-in [:chats chat-id :total-output-tokens] nil)
221221
(swap! db* assoc-in [:chats chat-id :total-input-cache-creation-tokens] nil)
222222
(swap! db* assoc-in [:chats chat-id :total-input-cache-read-tokens] nil)
223+
(messenger/chat-cleared messenger {:chat-id chat-id :messages true})
224+
(messenger/chat-content-received
225+
messenger
226+
{:chat-id chat-id
227+
:role :system
228+
:content {:type :text
229+
:text "Compacted chat to:\n\n"}})
230+
(messenger/chat-content-received
231+
messenger
232+
{:chat-id chat-id
233+
:role :assistant
234+
:content {:type :text
235+
:text (get-in @db* [:chats chat-id :last-summary])}})
223236
(when-let [usage (shared/usage-msg->usage {:input-tokens 0 :output-tokens 0} full-model {:chat-id chat-id :db* db*})]
224237
(messenger/chat-content-received
225238
messenger

0 commit comments

Comments
 (0)