mirror of
https://github.com/google-gemini/gemini-cli.git
synced 2026-03-13 23:51:16 -07:00
fix: deduplicate agent response text from task history
Task history contains multiple status-update messages that may reference the same A2UI surface. Use only the last non-empty agent response to avoid duplicate text in Chat output.
This commit is contained in:
@@ -81,10 +81,13 @@ export function renderResponse(
|
||||
responseTexts.push(`_${thought.subject}_: ${thought.description}`);
|
||||
}
|
||||
|
||||
// Add agent response text (from A2UI surfaces)
|
||||
for (const agentResponse of agentResponses) {
|
||||
if (agentResponse.text) {
|
||||
responseTexts.push(agentResponse.text);
|
||||
// Add agent response text (from A2UI surfaces).
|
||||
// Use only the last non-empty response since later updates supersede earlier
|
||||
// ones for the same surface (history contains multiple status-update messages).
|
||||
for (let i = agentResponses.length - 1; i >= 0; i--) {
|
||||
if (agentResponses[i].text) {
|
||||
responseTexts.push(agentResponses[i].text);
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user