rename popup chat to floating chat

This commit is contained in:
2026-03-08 22:53:31 +01:00
parent 0bd46937d3
commit 34f01234c9
8 changed files with 102 additions and 102 deletions

View File

@@ -1,12 +1,12 @@
"""Tests for app.core.output_formatter — HomeFormatter and PopupFormatter."""
"""Tests for app.core.output_formatter — HomeFormatter and FloatingFormatter."""
from __future__ import annotations
import pytest
from app.core.output_formatter import HomeFormatter, PopupFormatter
from app.core.output_formatter import HomeFormatter, FloatingFormatter
from app.schemas import (
WsPopupDomain,
WsFloatingDomain,
WsStreamBlock,
WsStreamEnd,
WsStreamStart,
@@ -134,12 +134,12 @@ async def test_home_formatter_frame_order():
assert isinstance(frames[-1], WsStreamEnd)
# ── PopupFormatter ────────────────────────────────────────────────────────────
# ── FloatingFormatter ────────────────────────────────────────────────────────────
@pytest.mark.asyncio
async def test_popup_formatter_domain_emitted_first():
async def test_floating_formatter_domain_emitted_first():
req_id = "pop-1"
formatter = PopupFormatter(request_id=req_id)
formatter = FloatingFormatter(request_id=req_id)
tokens = [
("task_agent", ""), # domain signal
("task_agent", "Hello"),
@@ -147,19 +147,19 @@ async def test_popup_formatter_domain_emitted_first():
]
frames = await collect(formatter, _stream(*tokens))
assert isinstance(frames[0], WsPopupDomain)
assert isinstance(frames[0], WsFloatingDomain)
assert frames[0].domain == "tasks"
assert frames[0].request_id == req_id
@pytest.mark.asyncio
async def test_popup_formatter_text_only():
async def test_floating_formatter_text_only():
req_id = "pop-2"
formatter = PopupFormatter(request_id=req_id)
formatter = FloatingFormatter(request_id=req_id)
tokens = [("checkpoint_agent", ""), ("checkpoint_agent", "Summary")]
frames = await collect(formatter, _stream(*tokens))
assert isinstance(frames[0], WsPopupDomain)
assert isinstance(frames[0], WsFloatingDomain)
assert frames[0].domain == "checkpoints"
text_frames = [f for f in frames if isinstance(f, WsStreamText)]
assert len(text_frames) == 1
@@ -167,10 +167,10 @@ async def test_popup_formatter_text_only():
@pytest.mark.asyncio
async def test_popup_formatter_no_block_frames():
"""PopupFormatter must never emit WsStreamBlock."""
async def test_floating_formatter_no_block_frames():
"""FloatingFormatter must never emit WsStreamBlock."""
req_id = "pop-3"
formatter = PopupFormatter(request_id=req_id)
formatter = FloatingFormatter(request_id=req_id)
tokens = [
("note_agent", ""),
("note_agent", '{"type": "chart", "chartType": "bar", "data": []}'),
@@ -180,16 +180,16 @@ async def test_popup_formatter_no_block_frames():
@pytest.mark.asyncio
async def test_popup_formatter_end_frame():
async def test_floating_formatter_end_frame():
req_id = "pop-4"
formatter = PopupFormatter(request_id=req_id)
formatter = FloatingFormatter(request_id=req_id)
frames = await collect(formatter, _stream(("project_agent", ""), ("project_agent", "Done")))
assert isinstance(frames[-1], WsStreamEnd)
@pytest.mark.asyncio
async def test_popup_formatter_unknown_agent_defaults_to_tasks():
async def test_floating_formatter_unknown_agent_defaults_to_tasks():
req_id = "pop-5"
formatter = PopupFormatter(request_id=req_id)
formatter = FloatingFormatter(request_id=req_id)
frames = await collect(formatter, _stream(("unknown_agent", ""), ("unknown_agent", "hi")))
assert frames[0].domain == "tasks"