Skip to content

Commit

Permalink
Fix output for run-less prompts
Browse files Browse the repository at this point in the history
* the output-handler was expecting maps but with just prompts
  it's a coll
  • Loading branch information
slimslenderslacks committed Aug 19, 2024
1 parent fa0d673 commit 89e9589
Showing 1 changed file with 10 additions and 3 deletions.
13 changes: 10 additions & 3 deletions src/prompts.clj
Original file line number Diff line number Diff line change
Expand Up @@ -296,9 +296,16 @@
[nil "--help" "print option summary"]])

(def output-handler (fn [x]
(jsonrpc/notify :message {:content (json/generate-string (if (= "error" (:done x))
(update x :messages last)
(select-keys x [:done])))})))
(jsonrpc/notify
:message
{:content
(json/generate-string
(if (map? x)
(if (= "error" (:done x))
(update x :messages last)
(select-keys x [:done]))
x))})))

(defn output-prompts [coll]
(->> coll
(mapcat (fn [{:keys [role content]}]
Expand Down

0 comments on commit 89e9589

Please sign in to comment.