[Bugfix][Frontend] Validate reused prompt token ids; render messages for media and echo (#55771)

Signed-off-by: Shijie Lyu <sjlyu@amazon.com>
Co-authored-by: Shijie Lyu <sjlyu@amazon.com>
Co-authored-by: Claude <noreply@anthropic.com>
This commit is contained in:
Shijie Lyu
2026-09-29 10:36:22 +08:00
committed by GitHub
co-authored by Shijie Lyu Claude
parent 0af34418e9
commit c6843d397c
6 changed files with 239 additions and 2 deletions
+6 -1
View File
@@ -1810,6 +1810,11 @@ PART_TYPES_TO_SKIP_NONE_CONTENT = (
"refusal",
)
# Content part types parsed as text rather than multimodal data.
TEXT_PART_TYPES = frozenset(
{"text", "input_text", "output_text", "refusal", "thinking"}
)
def _parse_chat_message_content_parts(
role: str,
@@ -1904,7 +1909,7 @@ def _parse_chat_message_content_part(
)
return None
if part_type in ("text", "input_text", "output_text", "refusal", "thinking"):
if part_type in TEXT_PART_TYPES:
str_content = cast(str, content)
_reject_reserved_placeholder_in_text(str_content, mm_parser.model_config)
if wrap_dicts: