fix(webui): resign replayed assistant media

This commit is contained in:
Xubin Ren
2026-06-02 16:18:57 +08:00
parent a371907809
commit 21c60b0c97
4 changed files with 126 additions and 22 deletions
+22
View File
@@ -84,6 +84,28 @@ def test_replay_infers_video_media_from_attachment_name() -> None:
]
def test_replay_resigns_assistant_media_paths_before_stale_urls() -> None:
msgs = replay_transcript_to_ui_messages(
[
{"event": "user", "chat_id": "t-video-resign", "text": "render"},
{
"event": "message",
"chat_id": "t-video-resign",
"text": "video ready",
"media": ["/tmp/intro.mp4"],
"media_urls": [{"url": "/api/media/old-sig/old-payload", "name": "intro.mp4"}],
},
],
augment_assistant_media=lambda paths: [
{"kind": "video", "url": f"/api/media/new-sig/{paths[0].split('/')[-1]}", "name": "intro.mp4"},
],
)
assert msgs[1]["media"] == [
{"kind": "video", "url": "/api/media/new-sig/intro.mp4", "name": "intro.mp4"},
]
def test_replay_infers_svg_media_from_attachment_name() -> None:
msgs = replay_transcript_to_ui_messages(
[