summaryrefslogtreecommitdiff
path: root/packages/cli/src/ui/hooks/useGeminiStream.ts
diff options
context:
space:
mode:
authorN. Taylor Mullen <[email protected]>2025-07-05 13:56:39 -0700
committerGitHub <[email protected]>2025-07-05 20:56:39 +0000
commit4be32d1f73bc2d9e4d22a71eee7b142e9b0aa577 (patch)
tree0ae13be2d74c73ad1943c126a44e5fd11292ac8d /packages/cli/src/ui/hooks/useGeminiStream.ts
parent8adc5869735a224f153a04f483a21c3638e77a9f (diff)
fix(cli): Group cancelled tool call responses to prevent API errors (#3333)
Diffstat (limited to 'packages/cli/src/ui/hooks/useGeminiStream.ts')
-rw-r--r--packages/cli/src/ui/hooks/useGeminiStream.ts16
1 files changed, 8 insertions, 8 deletions
diff --git a/packages/cli/src/ui/hooks/useGeminiStream.ts b/packages/cli/src/ui/hooks/useGeminiStream.ts
index e2226761..bba01bc9 100644
--- a/packages/cli/src/ui/hooks/useGeminiStream.ts
+++ b/packages/cli/src/ui/hooks/useGeminiStream.ts
@@ -636,20 +636,20 @@ export const useGeminiStream = (
const responsesToAdd = geminiTools.flatMap(
(toolCall) => toolCall.response.responseParts,
);
+ const combinedParts: Part[] = [];
for (const response of responsesToAdd) {
- let parts: Part[];
if (Array.isArray(response)) {
- parts = response;
+ combinedParts.push(...response);
} else if (typeof response === 'string') {
- parts = [{ text: response }];
+ combinedParts.push({ text: response });
} else {
- parts = [response];
+ combinedParts.push(response);
}
- geminiClient.addHistory({
- role: 'user',
- parts,
- });
}
+ geminiClient.addHistory({
+ role: 'user',
+ parts: combinedParts,
+ });
}
const callIdsToMarkAsSubmitted = geminiTools.map(