From 8f7f4e1ad516cb2eef582cc8e2dfdcbb5575b2b6 Mon Sep 17 00:00:00 2001 From: MrlolDev Date: Fri, 15 Dec 2023 21:22:03 +0100 Subject: [PATCH] fix --- src/models/text/google.ts | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/models/text/google.ts b/src/models/text/google.ts index 3d50dd5..e5f83df 100644 --- a/src/models/text/google.ts +++ b/src/models/text/google.ts @@ -142,7 +142,7 @@ export default { const cost = 0; let resultLength = 0; for await (const item of streamingResp.stream) { - res.result = item.candidates[0].content.parts[0].text; + res.result = item.candidates[0].content.parts[0].text || ""; resultLength = item.usageMetadata?.candidates_token_count || 0; promptLength = item.usageMetadata?.prompt_token_count || 0; event.emit("data", res);