Skip to content

Commit 1675b9a

Browse files
committed
Use the :decision-reason from the tool call state.
Note: This is a slight breaking change. In a toolCallReject, the :reason changed from :user-choice to :user-choice-deny.
1 parent c7b0a2a commit 1675b9a

File tree

1 file changed

+4
-5
lines changed

1 file changed

+4
-5
lines changed

src/eca/features/chat.clj

Lines changed: 4 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -500,19 +500,18 @@
500500
:details details
501501
:summary summary})))
502502
;; assert: In :rejected state
503-
(let [[reject-reason reject-text] (if (= :deny approval)
504-
[:user-config "Tool call denied by user config"]
505-
[:user-choice "Tool call rejected by user choice"])]
503+
(let [tool-call-state (get-tool-call-state @db* chat-id id)
504+
{:keys [code text]} (:decision-reason tool-call-state)]
506505
(add-to-history! {:role "tool_call" :content tool-call})
507506
(add-to-history! {:role "tool_call_output"
508507
:content (assoc tool-call :output {:error true
509-
:contents [{:text reject-text
508+
:contents [{:text text
510509
:type :text}]})})
511510
(transition-tool-call! db* chat-ctx id :send-reject
512511
{:origin origin
513512
:name name
514513
:arguments arguments
515-
:reason reject-reason
514+
:reason code
516515
:details details
517516
:summary summary})))))))]
518517
(assert-chat-not-stopped! chat-ctx)

0 commit comments

Comments
 (0)