diff --git a/src/models/text/google.ts b/src/models/text/google.ts index da377b9..672dcbb 100644 --- a/src/models/text/google.ts +++ b/src/models/text/google.ts @@ -163,11 +163,13 @@ export default { if (item.candidates?.length == 0) continue; if (!item.candidates[0]?.content?.parts) continue; if (item.candidates[0]?.content?.parts.length == 0) continue; - 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); } + const final = await streamingResp.response + res.result = final.candidates[0]?.content?.parts[0]?.text || ""; res.cost += (promptLength / 1000) * 0.0001; res.cost += (resultLength / 1000) * 0.0002; res.done = true;