mirror of
https://github.com/HKUDS/nanobot.git
synced 2026-05-20 08:32:25 +00:00
* feat(settings): expand settings api payload * feat(webui): build app-style settings center * feat(webui): add centered chat search dialog * fix(webui): shorten chat search label * fix(webui): center dialog entrance animation * fix(webui): simplify chat search results * fix(webui): tighten mobile settings navigation * feat(webui): persist sidebar state * feat(webui): add sidebar organization controls * refactor(webui): organize backend helpers * refactor(webui): remove utils compatibility shims * refactor(session): move shared webui helpers out of webui package * feat(webui): add image generation settings * style(webui): refine settings overview layout * fix(webui): localize settings zh-CN copy * style(webui): add settings status indicators * feat(webui): show sidebar run indicators * fix(webui): persist sidebar run indicators * fix(webui): highlight settings pending status * fix(webui): align settings test with provider update * fix(utils): preserve legacy webui helper imports
21 lines
940 B
Python
21 lines
940 B
Python
"""Tests for WebUI on-disk cleanup (legacy JSON + transcript JSONL)."""
|
|
|
|
from __future__ import annotations
|
|
|
|
from nanobot.webui.thread_disk import delete_webui_thread, webui_thread_file_path
|
|
from nanobot.webui.transcript import append_transcript_object, webui_transcript_path
|
|
|
|
|
|
def test_delete_webui_thread_removes_legacy_json_and_transcript(tmp_path, monkeypatch) -> None:
|
|
monkeypatch.setattr("nanobot.config.paths.get_data_dir", lambda: tmp_path)
|
|
key = "websocket:k1"
|
|
json_path = webui_thread_file_path(key)
|
|
json_path.parent.mkdir(parents=True, exist_ok=True)
|
|
json_path.write_text('{"x":1}', encoding="utf-8")
|
|
append_transcript_object(key, {"event": "user", "chat_id": "k1", "text": "hi"})
|
|
assert webui_transcript_path(key).is_file()
|
|
assert delete_webui_thread(key) is True
|
|
assert not json_path.is_file()
|
|
assert not webui_transcript_path(key).is_file()
|
|
assert delete_webui_thread(key) is False
|