File tree Expand file tree Collapse file tree 2 files changed +9
-3
lines changed
Expand file tree Collapse file tree 2 files changed +9
-3
lines changed Original file line number Diff line number Diff line change 22
33## Unreleased
44
5+ - Fix stopping a prompt corruping other cases of chat.
6+
57## 0.116.1
68
79- Fix stopping a prompt corrupting chat history with empty content blocks, causing subsequent API errors.
Original file line number Diff line number Diff line change 560560 :text (str " API limit reached. Tokens: "
561561 (json/generate-string (:tokens msg)))})
562562 (lifecycle/finish-chat-prompt! :idle (dissoc chat-ctx :on-finished-side-effect )))
563- :finish (let [response-text @received-msgs*]
563+ :finish (let [response-text @received-msgs*
564+ stopping? (identical? :stopping (get-in @db* [:chats chat-id :status ]))]
564565 (when-not (string/blank? response-text)
565566 (add-to-history! {:role " assistant"
566567 :content [{:type :text :text response-text}]}))
567- (if (and (not (string/blank? response-text))
568+ (if (and (not stopping?)
569+ (not (string/blank? response-text))
568570 (or (:premature? msg)
569571 (truncated-response? response-text))
570572 (not (:auto-continued? chat-ctx))
717719 (trigger-auto-compact! chat-ctx all-tools user-messages))
718720 (let [partial-text @received-msgs*
719721 transient-error? (contains? #{:overloaded :premature-stop } error-type)
720- can-auto-continue? (and (or transient-error?
722+ stopping? (identical? :stopping (get-in @db* [:chats chat-id :status ]))
723+ can-auto-continue? (and (not stopping?)
724+ (or transient-error?
721725 (string/includes? (or message " " ) " idle timeout" ))
722726 (not (:auto-continued? chat-ctx))
723727 (not (:on-finished-side-effect chat-ctx))
You can’t perform that action at this time.
0 commit comments