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.

deepseek: Simplify error mapping in DeepSeek stream_completion (#57582)

Xiaobo Liua6780a5a4769
diff --git a/crates/deepseek/src/deepseek.rs b/crates/deepseek/src/deepseek.rs
index cb369413f10..56609a47492 100644
--- a/crates/deepseek/src/deepseek.rs
+++ b/crates/deepseek/src/deepseek.rs
@@ -319,10 +319,7 @@ pub async fn stream_completion(
if line == "[DONE]" {
None
} else {
- match serde_json::from_str(line) {
- Ok(response) => Some(Ok(response)),
- Err(error) => Some(Err(anyhow!(error))),
- }
+ Some(serde_json::from_str(line).map_err(Into::into))
}
}
Err(error) => Some(Err(anyhow!(error))),