fix: stopped sentences recorded only as far as heard, search words as plain query, paused video said so

- Playback sends how long the clip playing when a request was stopped had played (tts_played
  last_ms); the worker cuts the last sentence of that recording to it.
- botBrowser open takes the search words as plain `query`: the tool puts them, encoded, into the
  address's empty search parameter or types them into the site's search box. The description
  tells the model to search this way and never put words into an address itself (live: 아이유
  hand-encoded into 아이우). Eval (qwen3:8b, 3 runs): right words reach YouTube 1/3 -> 3/3.
- When a page's main video does not play (also after the tool pressed play, or it failed to load),
  a note after the page says it is not playing and not to say it plays. Eval: a paused video
  reported as playing 1/3 -> 0/3.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
javis-bot
2026-11-16 16:12:04 +09:00
parent 9a91bc9ab6
commit 420c9c73f3
10 changed files with 216 additions and 41 deletions

View File

@@ -464,7 +464,8 @@ def test_a_spoken_answer_is_kept_only_as_far_as_the_app_played_it(tmp_path):
# Made in full, then stopped while its first sentence played.
await ws.send(json.dumps({"type": "tts", "id": "r1", "text": "오늘은 맑아요. 기온은 17.5도예요."}))
await recv_until(ws, lambda m: isinstance(m, dict) and m.get("type") == "tts_done")
await ws.send(json.dumps({"type": "tts_played", "id": "r1", "played": 1, "cancelled": True}))
# Stopped 2 ms into its first sentence (FakeTts: 10 samples per character, 24 kHz).
await ws.send(json.dumps({"type": "tts_played", "id": "r1", "played": 1, "cancelled": True, "last_ms": 2}))
# Stopped before any of it was heard: nothing to keep.
await ws.send(json.dumps({"type": "tts", "id": "r2", "text": "두 번째 답이에요."}))
await recv_until(ws, lambda m: isinstance(m, dict) and m.get("type") == "tts_done")
@@ -479,7 +480,7 @@ def test_a_spoken_answer_is_kept_only_as_far_as_the_app_played_it(tmp_path):
day, lines = _index(tmp_path)
assert [(l["id"], l["cancelled"]) for l in lines] == [("r1", True)]
with wave.open(str(day / lines[0]["file"])) as w:
assert w.getnframes() == len("오늘은 맑아요.") * 10, "only the sentence that was played"
assert w.getnframes() == 24000 * 2 // 1000, "only the part of the sentence that was played"
@pytest.mark.unit