fix(chat): enforce retrieved image output in answers
When retrieved context or tool results contain Markdown images, dynamically append output requirements to system prompts and final-answer instructions. Also normalize fullwidth image parentheses in the frontend renderer so localized model output still renders correctly.
This commit is contained in:
@@ -161,7 +161,7 @@ templates:
|
||||
- WRONG (all grouped at end of answer):
|
||||
<kb doc="文档A" chunk_id="xxx" /><kb doc="文档B" chunk_id="yyy" />
|
||||
* **Structured:** Clear hierarchy and logic.
|
||||
* **Rich Media (Markdown with Images):** When retrieved chunks contain Markdown images or an "images" field with URLs, reuse relevant images in your response using standard Markdown image syntax: . Preserve each image URL exactly and place images at contextually appropriate positions within the answer. Images help users better understand the content, especially for diagrams, charts, screenshots, or visual explanations.
|
||||
* **Rich Media (Markdown with Images — REQUIRED):** When any retrieved chunk or tool result contains Markdown images or an "images" field with URLs, treat those images as relevant by default. Unless the user explicitly requests text-only output or every retrieved image is clearly unrelated, the final answer MUST include at least one relevant image using standard Markdown syntax: ``. Copy the complete Markdown image and URL exactly. Parentheses MUST be ASCII half-width `(` and `)`; NEVER use full-width `(` or `)`. Place each 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. Silently verify this requirement before finishing.
|
||||
|
||||
### System Status
|
||||
Web Search: {{web_search_status}}
|
||||
@@ -263,7 +263,7 @@ templates:
|
||||
- **External MCP Tools (if any are exposed in your tool list):** Use them when the user's question requires real-time data, external system lookups, or actions that do NOT live inside the wiki (e.g. querying a ticketing system, calling an internal API, fetching live metrics). Treat their responses as additional evidence, not as a replacement for wiki content.
|
||||
- **Skills (if an `### Available Skills` section appears later in this prompt):** Before answering, scan the listed skills. If the user's intent matches a skill's triggers, call `read_skill(skill_name="...")` to load its full instructions, then follow them. Skills are especially useful for specialized output formatting or domain-specific procedures.
|
||||
- When the user @MCP or @Skill, a short `<must_use>` block also appears before the question — follow it with highest priority; wiki content remains the primary source of truth for domain facts, and MCP/skills are complementary.
|
||||
6. **Synthesize:** Once you have gathered sufficient information from reading multiple interconnected pages (and optionally source documents, MCP results, or skill guidance), synthesize your answer and deliver it by writing it as your reply, then stop (no further tool calls in that final message). If you encountered relevant Markdown images in the source documents, reuse them in your answer and preserve their URLs exactly.
|
||||
6. **Synthesize:** Once you have gathered sufficient information from reading multiple interconnected pages (and optionally source documents, MCP results, or skill guidance), synthesize your answer and deliver it by writing it as your reply, then stop (no further tool calls in that final message). If retrieved source documents contain Markdown images, the final answer MUST include at least one unless the user explicitly requests text-only output or every image is clearly unrelated. Copy the complete Markdown image syntax and URL exactly, using ASCII half-width `(` and `)` only—never full-width `(` or `)`. Place images after the paragraphs they support. When multiple images support different sections, distribute them across those sections instead of stopping after the first image. Verify image inclusion before finishing.
|
||||
7. **Flag Issues (If Necessary):** If you discover that a wiki page contains factual errors, mixed entities (e.g., two different products combined into one page), or outdated information, OR if the user points out such errors, use the `wiki_flag_issue` tool to submit a maintenance report for that page before you write your final answer.
|
||||
</workflow>
|
||||
|
||||
|
||||
@@ -28,7 +28,11 @@ templates:
|
||||
- If the user's question cannot be answered, honestly inform the user and provide reasonable suggestions
|
||||
|
||||
## Output Format
|
||||
- Output your final result in Markdown format with images when applicable
|
||||
- Output your final result in Markdown format
|
||||
- When retrieved information contains Markdown images, treat them as relevant by default. Unless the user explicitly requests text-only output or every image is clearly unrelated, the final answer MUST include at least one relevant image copied from the retrieved information with its URL preserved exactly
|
||||
- Image Markdown MUST use ASCII half-width parentheses exactly as ``; never use full-width `(` or `)`
|
||||
- Place each image immediately after the paragraph it supports; before finishing, silently verify that the answer satisfies this image requirement
|
||||
- When multiple retrieved images support different sections, distribute them across those sections instead of stopping after the first image
|
||||
- Ensure the output is concise yet comprehensive, well-organized, clear, and non-repetitive
|
||||
|
||||
## CRITICAL: Language Rule
|
||||
|
||||
Reference in New Issue
Block a user