lmstudio: Fix streaming not working in v0.3.15 (#30013)

Closes #29781

Tested this with llama3, gemma3 and qwen3.

This is a breaking change, which means after adding this code changes in
future version zed we will require atleast lmstudio >= 0.3.15. For
context why it's breaking changes check out the issue: #29781.

What this doesn't try to solve is:

* Tool calling, thinking text rendering. Will raise a seperate PR for
these as those are not required in this PR to make it work.


https://github.com/user-attachments/assets/945f9c73-6323-4a88-92e2-2219b760a249

Release Notes:

- lmstudio: Fixed Zed support for LMStudio >= v0.3.15 (breaking change -- older versions are no longer supported).

---------

Co-authored-by: Peter Tripp <peter@zed.dev>
This commit is contained in:
Umesh Yadav 2025-05-06 22:29:36 +05:30 committed by GitHub
parent bbfcd885ab
commit a743035286
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
2 changed files with 54 additions and 30 deletions

View file

@ -221,6 +221,14 @@ pub enum CompatibilityType {
Mlx,
}
#[derive(Serialize, Deserialize, Debug, Eq, PartialEq)]
pub struct ResponseMessageDelta {
pub role: Option<Role>,
pub content: Option<String>,
#[serde(default, skip_serializing_if = "Option::is_none")]
pub tool_calls: Option<Vec<ToolCallChunk>>,
}
pub async fn complete(
client: &dyn HttpClient,
api_url: &str,