Fix block indexing in Google provider impl
This commit is contained in:
@@ -99,12 +99,13 @@ export const streamGoogle: StreamFunction<"google-generative-ai"> = (
|
|||||||
}
|
}
|
||||||
if (isThinking) {
|
if (isThinking) {
|
||||||
currentBlock = { type: "thinking", thinking: "", thinkingSignature: undefined };
|
currentBlock = { type: "thinking", thinking: "", thinkingSignature: undefined };
|
||||||
|
output.content.push(currentBlock);
|
||||||
stream.push({ type: "thinking_start", contentIndex: blockIndex(), partial: output });
|
stream.push({ type: "thinking_start", contentIndex: blockIndex(), partial: output });
|
||||||
} else {
|
} else {
|
||||||
currentBlock = { type: "text", text: "" };
|
currentBlock = { type: "text", text: "" };
|
||||||
|
output.content.push(currentBlock);
|
||||||
stream.push({ type: "text_start", contentIndex: blockIndex(), partial: output });
|
stream.push({ type: "text_start", contentIndex: blockIndex(), partial: output });
|
||||||
}
|
}
|
||||||
output.content.push(currentBlock);
|
|
||||||
}
|
}
|
||||||
if (currentBlock.type === "thinking") {
|
if (currentBlock.type === "thinking") {
|
||||||
currentBlock.thinking += part.text;
|
currentBlock.thinking += part.text;
|
||||||
|
|||||||
Reference in New Issue
Block a user