feat: frontend turn_html_replace SSE handler for regenerate live-swap (T86)

This commit is contained in:
Joseph Doherty
2026-04-26 22:26:09 -04:00
parent 82701d3c18
commit aea20a2c83
10 changed files with 212 additions and 17 deletions
+9 -3
View File
@@ -104,10 +104,16 @@ def test_read_recent_dialogue_returns_chronological_pairs(tmp_path):
with open_db(db) as conn:
out = read_recent_dialogue(conn, "chat_a", limit=10)
assert out == [
{"speaker": "you", "text": "hello"},
{"speaker": "bot_a", "text": "Original."},
# Each entry now carries the source ``event_log.id`` as ``event_id``
# (T86 follow-up) so the chat-detail Jinja loop can stamp
# ``id="turn-<n>"`` on each rendered turn DIV — needed by the
# ``turn_html_replace`` SSE handler for in-place regenerate swaps.
speakers = [(e["speaker"], e["text"]) for e in out]
assert speakers == [
("you", "hello"),
("bot_a", "Original."),
]
assert all("event_id" in e and isinstance(e["event_id"], int) for e in out)
def test_read_recent_dialogue_filters_superseded_and_other_chats(tmp_path):