fix(webui): render local CLI image artifacts

This commit is contained in:
Xubin Ren
2026-05-24 19:43:20 +08:00
parent 9efdce276f
commit c9ff64fc0f
13 changed files with 461 additions and 10 deletions
+13
View File
@@ -42,6 +42,19 @@ def test_replay_delta_and_turn_end(tmp_path, monkeypatch) -> None:
assert msgs[1]["latencyMs"] == 42
def test_replay_augments_assistant_text() -> None:
msgs = replay_transcript_to_ui_messages(
[
{"event": "user", "chat_id": "t-img", "text": "draw"},
{"event": "delta", "chat_id": "t-img", "text": "![Diagram](diagram.png)"},
{"event": "stream_end", "chat_id": "t-img"},
],
augment_assistant_text=lambda text: text.replace("diagram.png", "/api/media/sig/payload"),
)
assert msgs[1]["content"] == "![Diagram](/api/media/sig/payload)"
def test_replay_file_edit_event_creates_file_activity(tmp_path, monkeypatch) -> None:
monkeypatch.setattr("nanobot.config.paths.get_data_dir", lambda: tmp_path)
key = "websocket:t-file"