fix(chat): label the vision description injected for text-only models (#6223)

When the chat model cannot see images, the separate vision call's description
is appended to the user's message. Nothing marked it as machine-derived, so the
chat model read it as the user's own prose and answered the description instead
of the question.

The label goes below the `[Image: <name>]` marker line because the client
strips the block by matching that exact prefix; renaming the marker would leave
the raw description rendered in the user's bubble.

Fixes #5573

Co-authored-by: Claude <noreply@anthropic.com>
This commit is contained in:
Vykos
2026-10-31 13:24:32 +00:00
committed by GitHub
co-authored by Claude
parent 48c3a7fc36
commit 516f046fef
2 changed files with 139 additions and 1 deletions
+7 -1
View File
@@ -282,7 +282,13 @@ class ChatHandler:
_sync_upload_vision_to_gallery(file_info, owner, vl_desc)
except Exception:
pass
enhanced_message = f"{enhanced_message}\n\n[Image: {file_info['name']}]\n{vl_desc}"
enhanced_message = f"{enhanced_message}\n\n[Image: {file_info['name']}]\n"
if vl_desc:
# A separate vision call wrote this, but the chat model sees
# one message and answers the prose as if the user wrote it
# (#5573). Label it below the marker line — the client strips
# the block by matching `[Image: <name>]\n`.
enhanced_message += f"[Image description — context only, not part of the user's message]:\n{vl_desc}"
# Surface the description to the client live so it renders as a
# collapsible "image description" on the user bubble (not just
# after a refresh that re-parses the stored message).