Skip to content
This repository has been archived by the owner on Apr 24, 2024. It is now read-only.

Commit

Permalink
fix: gemini
Browse files Browse the repository at this point in the history
  • Loading branch information
MrlolDev committed Dec 15, 2023
1 parent 893f3d2 commit 8767c1b
Showing 1 changed file with 3 additions and 1 deletion.
4 changes: 3 additions & 1 deletion src/models/text/google.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down

0 comments on commit 8767c1b

Please # to comment.