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:
@@ -424,6 +424,13 @@ func (e *AgentEngine) appendToolResults(
|
||||
messages []chat.Message,
|
||||
step types.AgentStep,
|
||||
) []chat.Message {
|
||||
if stepContainsMarkdownImage(step) {
|
||||
// Keep the requirement at system priority even when a custom Agent prompt
|
||||
// replaces the built-in template. Appending it once, when image-bearing
|
||||
// evidence first appears, also avoids burdening text-only turns.
|
||||
messages = appendAgentRetrievedImageRequirement(messages)
|
||||
}
|
||||
|
||||
// Add assistant message with tool calls (if any)
|
||||
if step.Thought != "" || len(step.ToolCalls) > 0 || step.ReasoningContent != "" {
|
||||
assistantMsg := chat.Message{
|
||||
|
||||
Reference in New Issue
Block a user