mirror of
https://github.com/QwenLM/qwen-code.git
synced 2025-12-20 08:47:44 +00:00
fix(cli): Group cancelled tool call responses to prevent API errors (#3333)
This commit is contained in:
@@ -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(
|
||||
|
||||
Reference in New Issue
Block a user