tui-thinking-display修正

This commit is contained in:
2026-04-28 16:22:45 +09:00
parent cf4c454a03
commit f385f06abc
4 changed files with 97 additions and 3 deletions
+8
View File
@@ -131,6 +131,9 @@ impl App {
}
Event::ThinkingDone { text } => {
if let Some(b) = self.last_streaming_thinking_mut() {
// Delta-accumulated text wins. `text` here is the
// Done payload (full body), used only as a fallback
// for providers that don't stream deltas.
if b.text.is_empty() {
b.text = text;
}
@@ -325,6 +328,11 @@ impl App {
}
fn mark_orphan_thinking_incomplete(&mut self) {
// A turn can carry several thinking blocks; we walk all the way
// to `TurnHeader` and convert every still-Streaming one rather
// than breaking on the first Finished hit (which is what the
// tool-call equivalent does, since tool calls finalize in
// submission order).
for b in self.blocks.iter_mut().rev() {
match b {
Block::Thinking(t) => {
+4 -3
View File
@@ -45,9 +45,10 @@ pub struct ThinkingBlock {
}
pub enum ThinkingState {
/// Live block: actively streaming. `started_at` is `None` only for
/// blocks materialised from `Event::History`, which never enter the
/// streaming state.
/// Live block: actively streaming. `started_at` powers the
/// `Thinking... (Xs)` live timer. History-restored blocks never
/// enter this state — they materialise as `Finished { elapsed_secs:
/// None }` since the original duration is not persisted.
Streaming { started_at: Instant },
/// Block ended cleanly with `ThinkingDone`.
Finished { elapsed_secs: Option<u64> },