mirror of
https://github.com/HKUDS/nanobot.git
synced 2026-08-07 21:08:34 +03:00
refactor(webui): remove legacy session messages route
This commit is contained in:
@@ -1074,9 +1074,8 @@ async def test_process_message_persists_media_paths_on_user_turn(tmp_path: Path)
|
||||
"""User turns that attach images must record the media paths alongside
|
||||
the text so the webui can rehydrate previews on session replay.
|
||||
|
||||
This is the producer half of the signed-media-URL round-trip: paths are
|
||||
stored here, then :meth:`WebSocketChannel._augment_media_urls` maps them
|
||||
onto signed URLs on the way out.
|
||||
The WebUI transcript replay can use these paths to restore attachment
|
||||
previews when it backfills from canonical session history.
|
||||
"""
|
||||
img_a = tmp_path / "uuid-1.png"
|
||||
img_a.write_bytes(_PNG_1X1)
|
||||
|
||||
@@ -1,9 +1,6 @@
|
||||
"""Tests for subagent announce text shaping on external channel surfaces."""
|
||||
|
||||
from nanobot.utils.subagent_channel_display import (
|
||||
scrub_subagent_announce_body,
|
||||
scrub_subagent_messages_for_channel,
|
||||
)
|
||||
from nanobot.utils.subagent_channel_display import scrub_subagent_announce_body
|
||||
|
||||
|
||||
def test_scrub_subagent_keeps_header_and_result_only() -> None:
|
||||
@@ -22,24 +19,6 @@ Summarize this naturally for the user. Keep it brief."""
|
||||
assert "Summarize" not in out
|
||||
|
||||
|
||||
def test_scrub_subagent_messages_mutates_matching_rows() -> None:
|
||||
messages: list[dict] = [
|
||||
{"role": "assistant", "content": "hi"},
|
||||
{
|
||||
"role": "assistant",
|
||||
"content": (
|
||||
"[Subagent 'x' completed successfully]\n\nTask: t\n\nResult:\nr\n\nSummarize this naturally"
|
||||
),
|
||||
"injected_event": "subagent_result",
|
||||
},
|
||||
]
|
||||
scrub_subagent_messages_for_channel(messages)
|
||||
assert messages[0]["content"] == "hi"
|
||||
assert "Task:" not in messages[1]["content"]
|
||||
assert "[Subagent 'x' completed successfully]" in messages[1]["content"]
|
||||
assert "r" in messages[1]["content"]
|
||||
|
||||
|
||||
def test_scrub_normalizes_crlf_before_result_marker() -> None:
|
||||
raw = "[Subagent 'z' failed]\r\n\r\nTask: x\r\n\r\nResult:\r\none line\r\n\r\nSummarize this naturally"
|
||||
out = scrub_subagent_announce_body(raw)
|
||||
|
||||
Reference in New Issue
Block a user