Skip to content

Commit 0f51b5f

Browse files
committed
handle nil text on response chunk
1 parent 5479a4a commit 0f51b5f

File tree

2 files changed

+35
-11
lines changed

2 files changed

+35
-11
lines changed

calcit.cirru

Lines changed: 31 additions & 10 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

compact.cirru

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -281,7 +281,10 @@
281281
fn (? chunk)
282282
if (some? chunk)
283283
do
284-
swap! *text str $ either (.-text chunk) js/chunk.candidates[0].content.parts[0].text
284+
swap! *text str $ let
285+
t $ either (.-text chunk) js/chunk.candidates[0].content?.parts?.[0]?.text
286+
if (nil? t) (js/console.warn "\"empty text in:" chunk)
287+
, t
285288
d! $ :: :states cursor
286289
-> state (assoc :answer @*text) (assoc :loading? false) (assoc :done? false)
287290
d! $ :: :states cursor

0 commit comments

Comments
 (0)