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.

ollama: Fix thinking being also sent as content (#55540)

marius85100065107c90b10d
diff --git a/crates/language_models/src/provider/ollama.rs b/crates/language_models/src/provider/ollama.rs
index d117bce3784..df9f8f383e0 100644
--- a/crates/language_models/src/provider/ollama.rs
+++ b/crates/language_models/src/provider/ollama.rs
@@ -381,11 +381,14 @@ impl OllamaLanguageModel {
}
}
Role::Assistant => {
- let content = msg.string_contents();
+ let mut text_content = String::new();
let mut thinking = None;
let mut tool_calls = Vec::new();
for content in msg.content.into_iter() {
match content {
+ MessageContent::Text(text) => {
+ text_content.push_str(&text);
+ }
MessageContent::Thinking { text, .. } if !text.is_empty() => {
thinking = Some(text)
}
@@ -402,7 +405,7 @@ impl OllamaLanguageModel {
}
}
messages.push(ChatMessage::Assistant {
- content,
+ content: text_content,
tool_calls: Some(tool_calls),
images: if images.is_empty() {
None