mirror of
https://github.com/zed-industries/zed.git
synced 2026-11-20 23:50:25 +01:00
a4b9dc5f52
# Objective - Add Z.ai GLM, now hosted by Mistral as a third-party open model, to the built-in Mistral model list. - Fix the thinking selector never appearing for Mistral models that support reasoning (mistral-medium-latest, mistral-small-latest). ## Solution - Added a `ZaiGlmLatest` variant to `mistral::Model` that uses Mistral's `zai-glm-latest` model id: 1M token context window, tool calling enabled, image input disabled, thinking enabled. The provider builds its model list by iterating this enum, so no further wiring was needed. - This PR initially targeted GLM 5.2 (`zai-glm-5-2`), but Mistral released 5.3 while it was open. Switching to the `zai-glm-latest` alias keeps Zed on the newest GLM release without requiring a new PR each time Mistral bumps the version, mirroring how Mistral's own model ids work for their flagship models. - Implemented the missing `LanguageModel::supports_thinking()` override in the Mistral provider, delegating to `mistral::Model::supports_thinking()`. The request-building code already sent `reasoning_effort` and serialized thinking parts, but the UI toggle was hidden because the trait method fell back to the default `false`. ## Testing - `./script/clippy -p mistral` and `cargo check -p language_models` pass. - Existing unit tests in the provider cover the `reasoning_effort` request mapping; no new behavior beyond the enum variant and the trait delegation. - Reviewers can test with a Mistral API key: `zai-glm-latest` appears in the model dropdown, and the thinking toggle now shows for zai-glm-latest, mistral-medium-latest, and mistral-small-latest. - Tested on macOS; changes are platform-independent. ## Self-Review Checklist: - [x] I've reviewed my own diff for quality, security, and reliability - [x] Unsafe blocks (if any) have justifying comments - [x] The content adheres to Zed's UI standards ([UX/UI](https://github.com/zed-industries/zed/blob/main/CONTRIBUTING.md#uiux-checklist) and [icon](https://github.com/zed-industries/zed/blob/main/crates/icons/README.md) guidelines) - [x] Tests cover the new/changed behavior - [x] Performance impact has been considered and is acceptable --- Release Notes: - Added Z.ai GLM to the Mistral provider and fixed the thinking toggle for Mistral Small and Medium. --------- Co-authored-by: dino <dinojoaocosta@gmail.com>