feat(agent): add per-agent citation output toggle

Move citation protocol injection to the system layer so custom prompts no
longer own citation syntax. Agents can disable inline citations while source
aliases still encode and decode tool arguments correctly.
This commit is contained in:
wizardchen
2026-07-16 21:46:52 +08:00
committed by lyingbug
parent 014164ae44
commit b862c2e45d
26 changed files with 292 additions and 78 deletions
+5 -6
View File
@@ -19,8 +19,8 @@ func finalAnswerImageRequirement(hasRetrievedImage bool) string {
return ""
}
return `
6. Retrieved tool results contain Markdown images. Unless the user explicitly requested text-only output or every image is clearly unrelated, the final answer MUST include at least one relevant Markdown image copied verbatim from the tool results. Preserve its complete URL exactly. Use ASCII half-width parentheses exactly as ![alt](url) and never use full-width ( or ). Place the image immediately after the paragraph it supports. When multiple images support different sections, distribute them across those sections instead of stopping after the first image.
7. Before finishing, silently verify that the answer contains a Markdown image when requirement 6 applies.`
5. Retrieved tool results contain Markdown images. Unless the user explicitly requested text-only output or every image is clearly unrelated, the final answer MUST include at least one relevant Markdown image copied verbatim from the tool results. Preserve its complete URL exactly. Use ASCII half-width parentheses exactly as ![alt](url) and never use full-width ( or ). Place the image immediately after the paragraph it supports. When multiple images support different sections, distribute them across those sections instead of stopping after the first image.
6. Before finishing, silently verify that the answer contains a Markdown image when requirement 5 applies.`
}
// streamFinalAnswerToEventBus streams the final answer generation through EventBus
@@ -80,10 +80,9 @@ User question: %s
Requirements:
1. Answer based on the actually retrieved content
2. Cite supporting knowledge chunks and web pages only with their supplied compact form: <ref id="cN"/> or <ref id="wN"/>
3. Organize the answer in a structured format
4. If information is insufficient, honestly state so
5. IMPORTANT: Respond in the same language as the user's question
2. Organize the answer in a structured format
3. If information is insufficient, honestly state so
4. IMPORTANT: Respond in the same language as the user's question
%s
Now generate the final answer:`, query, imageRequirement)