Skip to content

Commit 7e9a8c4

Browse files
committed
fix: making changes from the code review
1 parent edd6f3d commit 7e9a8c4

File tree

1 file changed

+2
-13
lines changed

1 file changed

+2
-13
lines changed

src/core/task/Task.ts

Lines changed: 2 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -2097,27 +2097,16 @@ export class Task extends EventEmitter<TaskEvents> implements TaskLike {
20972097
// Display grounding sources to the user if they exist
20982098
if (pendingGroundingSources.length > 0) {
20992099
const citationLinks = pendingGroundingSources.map((source, i) => `[${i + 1}](${source.url})`)
2100-
const sourcesText = `Sources: ${citationLinks.join(", ")}`
2100+
const sourcesText = `${t("common:gemini.sources")} ${citationLinks.join(", ")}`
21012101

21022102
await this.say("text", sourcesText, undefined, false, undefined, undefined, {
21032103
isNonInteractive: true,
21042104
})
21052105
}
21062106

2107-
// Strip grounding sources from assistant message before persisting to API history
2108-
// This prevents state persistence issues while maintaining user experience
2109-
let cleanAssistantMessage = assistantMessage
2110-
if (pendingGroundingSources.length > 0) {
2111-
// Remove any grounding source references that might have been integrated into the message
2112-
cleanAssistantMessage = assistantMessage
2113-
.replace(/\[\d+\]\s+[^:\n]+:\s+https?:\/\/[^\s\n]+/g, "") // e.g., "[1] Example Source: https://example.com"
2114-
.replace(/Sources?:\s*[\s\S]*?(?=\n\n|\n$|$)/g, "") // e.g., "Sources: [1](url1), [2](url2)"
2115-
.trim()
2116-
}
2117-
21182107
await this.addToApiConversationHistory({
21192108
role: "assistant",
2120-
content: [{ type: "text", text: cleanAssistantMessage }],
2109+
content: [{ type: "text", text: assistantMessage }],
21212110
})
21222111

21232112
TelemetryService.instance.captureConversationMessage(this.taskId, "assistant")

0 commit comments

Comments
 (0)