Code at the speed of thought – Zed is a high-performance, multiplayer code editor from the creators of Atom and Tree-sitter.
assistant2: Handle LLM providers that do not emit `StartMessage` events (#23485)
Marshall Bowers2c2a3ef13d03
diff --git a/crates/assistant2/src/thread.rs b/crates/assistant2/src/thread.rsindex e7c4036a55c..fa0fec39be6 100644--- a/crates/assistant2/src/thread.rs+++ b/crates/assistant2/src/thread.rs@@ -308,6 +308,13 @@ impl Thread {last_message.id,chunk,));+ } else {+ // If we won't have an Assistant message yet, assume this chunk marks the beginning+ // of a new Assistant response.+ //+ // Importantly: We do *not* want to emit a `StreamedAssistantText` event here, as it+ // will result in duplicating the text of the chunk in the rendered Markdown.+ thread.insert_message(Role::Assistant, chunk, cx);}}}