From 349700d7fb488427f3293ab0804809c97d928618 Mon Sep 17 00:00:00 2001 From: end-4 <97237370+end-4@users.noreply.github.com> Date: Mon, 21 Jul 2025 17:56:31 +0700 Subject: [PATCH] ai: gemini: fix random json spilling --- .config/quickshell/ii/services/Ai.qml | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/.config/quickshell/ii/services/Ai.qml b/.config/quickshell/ii/services/Ai.qml index 22810f2b5..f26495db6 100644 --- a/.config/quickshell/ii/services/Ai.qml +++ b/.config/quickshell/ii/services/Ai.qml @@ -613,7 +613,8 @@ Singleton { "text": chunk?.web?.title, "url": chunk?.web?.uri, } - }); + }) ?? []; + const annotations = dataJson.candidates[0]?.groundingMetadata?.groundingSupports?.map(citation => { return { "type": "url_citation", @@ -628,7 +629,7 @@ Singleton { requester.message.annotations = annotations; // console.log(JSON.stringify(requester.message, null, 2)); } catch (e) { - console.log("[AI] Could not parse response from stream: ", e); + console.log("[AI] Gemini: Could not parse buffer: ", e); requester.message.rawContent += requester.geminiBuffer; requester.message.content += requester.geminiBuffer } finally {