diff --git a/src/agent/mod.rs b/src/agent/mod.rs index 6fcd403..449c2eb 100644 --- a/src/agent/mod.rs +++ b/src/agent/mod.rs @@ -370,6 +370,7 @@ impl Agent { /// Find the index of the in-progress streaming entry (unstamped assistant message). fn streaming_index(&self) -> Option { self.context.conversation.entries().iter().rposition(|ce| { + if ce.token_ids.is_empty() { return false; } let m = ce.entry.message(); m.role == Role::Assistant && m.timestamp.is_none() }) diff --git a/src/user/chat.rs b/src/user/chat.rs index 92126cb..334958d 100644 --- a/src/user/chat.rs +++ b/src/user/chat.rs @@ -417,8 +417,11 @@ impl InteractScreen { use crate::agent::api::Role; use crate::agent::context::ConversationEntry; - if let ConversationEntry::Memory { .. } = entry { - return vec![]; + match entry { + ConversationEntry::Memory { .. } + | ConversationEntry::Thinking(_) + | ConversationEntry::Log(_) => return vec![], + _ => {} } let msg = entry.message(); @@ -489,7 +492,8 @@ impl InteractScreen { } // Only stop at assistant if it matches - otherwise keep going - if matches && self.last_entries[i].entry.message().role == Role::Assistant { + if matches && !self.last_entries[i].token_ids.is_empty() + && self.last_entries[i].entry.message().role == Role::Assistant { break; } }