mirror of
https://github.com/patriceckhart/zot.git
synced 2026-06-27 05:46:34 +02:00
The first assistant turn always streamed correctly, but any follow-up assistant text after a tool round-trip popped in all at once when the turn ended instead of typewriter-streaming. Two bugs, fixed together: 1) handleEvent had no case for EvAssistantStart. The core emits this event at the top of every oneTurn including every follow-up, but the tui was ignoring it. So after the first EvAssistantMessage fired (for the tool_use message), streamOn stayed false, subsequent EvTextDelta events filled i.streaming but never made it on-screen because StreamingActive wasn't flipped back on. Added case core.EvAssistantStart that resets the buffer and sets streamOn=true. Belt-and-suspenders: the EvTextDelta case also sets streamOn=true so stray delta sequences without a preceding start still render. 2) The belt-and-suspenders guard in redraw() was too aggressive: it hid streaming whenever the last transcript message was assistant-role, which is always true during a follow-up turn (the last message is the assistant tool_use from the previous oneTurn). Narrowed to a strict duplicate check: only hide streaming when assistantText(lastMsg) == streamingBuffer, meaning EvAssistantMessage already promoted this exact text into the transcript but the next render tick hasnt flipped streamOn off yet. That is the only actual race this guard was protecting against. Added a tiny assistantText helper (concatenate TextBlocks of a message) to implement the dedupe check. Kept in the same file; no new package API. |
||
|---|---|---|
| .. | ||
| agent | ||
| assets | ||
| auth | ||
| core | ||
| extproto | ||
| provider | ||
| skills | ||
| tui | ||