Skip to content

armgit / zed

Public Imported from GitHub
0

Code at the speed of thought – Zed is a high-performance, multiplayer code editor from the creators of Atom and Tree-sitter.

assistant2: Include some text in the tool result messages (#25825)

Marshall Bowers71866d631467
diff --git a/crates/assistant2/src/active_thread.rs b/crates/assistant2/src/active_thread.rs
index 9963f8913bf..e420aa9c558 100644
--- a/crates/assistant2/src/active_thread.rs
+++ b/crates/assistant2/src/active_thread.rs
@@ -270,8 +270,15 @@ impl ActiveThread {
let model_registry = LanguageModelRegistry::read_global(cx);
if let Some(model) = model_registry.active_model() {
self.thread.update(cx, |thread, cx| {
- // Insert an empty user message to contain the tool results.
- thread.insert_user_message("", Vec::new(), cx);
+ // Insert a user message to contain the tool results.
+ thread.insert_user_message(
+ // TODO: Sending up a user message without any content results in the model sending back
+ // responses that also don't have any content. We currently don't handle this case well,
+ // so for now we provide some text to keep the model on track.
+ "Here are the tool results.",
+ Vec::new(),
+ cx,
+ );
thread.send_to_model(model, RequestKind::Chat, true, cx);
});
}
@@ -295,10 +302,7 @@ impl ActiveThread {
let colors = cx.theme().colors();
// Don't render user messages that are just there for returning tool results.
- if message.role == Role::User
- && message.text.is_empty()
- && self.thread.read(cx).message_has_tool_results(message_id)
- {
+ if message.role == Role::User && self.thread.read(cx).message_has_tool_results(message_id) {
return Empty.into_any();
}