fix(webui): add platform hint for MEDIA rendering

WebUI sessions construct AIAgent(platform="webui") but PLATFORM_HINTS
had no "webui" entry, so the agent received no platform hint at all.
The WebUI frontend supports rich MEDIA:/absolute/path previews for
images, audio, video, PDF, HTML, CSV, diffs, and Excalidraw, but
without a hint the agent either ignores MEDIA: or falls back to
Markdown image syntax which silently fails for local files.

Add a webui hint that documents the MEDIA: render path and warns
against ![alt](/path) for local files.

Fixes #21883
This commit is contained in:
qWaitCrypto 2026-05-08 21:36:14 +08:00 committed by kshitij
parent 7330183d08
commit aad5490e74
2 changed files with 20 additions and 0 deletions

View file

@ -789,6 +789,7 @@ class TestPromptBuilderConstants:
assert "cron" in PLATFORM_HINTS
assert "cli" in PLATFORM_HINTS
assert "api_server" in PLATFORM_HINTS
assert "webui" in PLATFORM_HINTS
def test_cli_hint_does_not_suggest_media_tags(self):
# Regression: MEDIA:/path tags are intercepted only by messaging
@ -826,6 +827,13 @@ class TestPromptBuilderConstants:
assert "MEDIA:" in hint
assert "Markdown" in hint
def test_platform_hints_webui(self):
hint = PLATFORM_HINTS["webui"]
assert "WebUI" in hint
assert "MEDIA:" in hint
assert "Markdown" in hint
assert "absolute" in hint
# =========================================================================
# Environment hints