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:
@@ -978,16 +978,21 @@ class Session:
|
||||
if rec is None or isinstance(played, bool) or not isinstance(played, int) or played < 0:
|
||||
return
|
||||
rec["played"], rec["cancelled"] = played, bool(msg.get("cancelled"))
|
||||
last_ms = msg.get("last_ms") # how long the last sentence played before a stop
|
||||
rec["last_ms"] = last_ms if isinstance(last_ms, int) and not isinstance(last_ms, bool) and last_ms >= 0 else None
|
||||
self._record_spoken(msg["id"])
|
||||
|
||||
def _record_spoken(self, rid: str) -> None:
|
||||
"""Keep a spoken answer once it is made and the app said how much of it was heard (whole
|
||||
sentences, the last one maybe cut off by a stop)."""
|
||||
"""Keep a spoken answer once it is made and the app said how much of it was heard: the sentences
|
||||
that played, the last one cut where a stop cut it."""
|
||||
rec = self.tts_recorded.get(rid)
|
||||
if rec is None or not rec["made"] or rec["played"] is None:
|
||||
return
|
||||
self.tts_recorded.pop(rid)
|
||||
heard = rec["pcm"][:rec["played"]]
|
||||
heard = list(rec["pcm"][:rec["played"]])
|
||||
if heard and rec.get("last_ms") is not None:
|
||||
heard[-1] = heard[-1][:rec["rate"] * rec["last_ms"] // 1000]
|
||||
heard = [h for h in heard if len(h)]
|
||||
if heard and self.worker.recorder is not None:
|
||||
self.worker.recorder.spoke(rec["at"], rid, rec["text"], np.concatenate(heard), rec["rate"],
|
||||
rec["cancelled"])
|
||||
|
||||
Reference in New Issue
Block a user