mirror of
https://github.com/CherryHQ/cherry-studio.git
synced 2026-07-03 20:30:52 +08:00
### What this PR does Before this PR: - Grok 4.3 did not fully support reasoning effort through the xAI responses path. - Cherry Studio did not expose the Grok 4.3 reasoning options consistently in model configuration. - The local @ai-sdk/xai patch could fail pnpm install after manual patch edits. After this PR: - Grok 4.3 correctly maps `reasoning_effort` to xAI responses with `none`, `low`, `medium`, and `high`. - The renderer exposes Grok 4.3 as a supported reasoning model with the correct option set. - The local @ai-sdk/xai patch is regenerated and narrowed to the responses path so pnpm install succeeds. Fixes # N/A ### Why we need it and why it was done in this way The following tradeoffs were made: - The change is scoped to the xAI responses path because Grok is already routed to `xai-responses` in this repository. - A local patch is still required because the latest stable `@ai-sdk/xai` release does not yet support `none` for xAI responses `reasoningEffort`. - The patch was narrowed to responses-only to avoid widening behavior for the base xAI chat path. The following alternatives were considered: - Upgrading directly to the latest stable `@ai-sdk/xai`, but the latest stable release still does not support `none` for responses `reasoningEffort`. - Broadening the patch to cover xAI chat options as well, but that would expand behavior beyond the required Grok 4.3 responses path. Links to places where the discussion took place: None ### Breaking changes None. If this PR introduces breaking changes, please describe the changes and the impact on users. ### Special notes for your reviewer - Focused validation passed with `pnpm install`, `pnpm typecheck:web`, and targeted Vitest suites for xAI/Grok reasoning and model config. - Full `pnpm test` on Windows still has unrelated baseline failures outside this change set. ### Checklist This checklist is not enforcing, but it's a reminder of items that could be relevant to every PR. Approvers are expected to review this list. - [x] PR: The PR description is expressive enough and will help future contributors - [x] Code: [Write code that humans can understand](https://en.wikiquote.org/wiki/Martin_Fowler#code-for-humans) and [Keep it simple](https://en.wikipedia.org/wiki/KISS_principle) - [x] Refactor: You have [left the code cleaner than you found it (Boy Scout Rule)](https://learning.oreilly.com/library/view/97-things-every/9780596809515/ch08.html) - [x] Upgrade: Impact of this change on upgrade flows was considered and addressed if required - [x] Documentation: A [user-guide update](https://docs.cherry-ai.com) was considered and is present (link) or not required. Check this only when the PR introduces or changes a user-facing feature or behavior. - [x] Self-review: I have reviewed my own code (e.g., via [`/gh-pr-review`](/.claude/skills/gh-pr-review/SKILL.md), `gh pr diff`, or GitHub UI) before requesting review from others ### Release note <!-- Write your release note: 1. Enter your extended release note in the below block. If the PR requires additional action from users switching to the new release, include the string "action required". 2. If no release note is required, just write "NONE". 3. Only include user-facing changes (new features, bug fixes visible to users, UI changes, behavior changes). For CI, maintenance, internal refactoring, build tooling, or other non-user-facing work, write "NONE". --> ```release-note Fixed Grok 4.3 reasoning effort support in xAI responses so Cherry Studio now correctly exposes and applies the `none`, `low`, `medium`, and `high` reasoning levels. ``` --------- Signed-off-by: ousugo <dkzydkzyxh@gmail.com> Co-authored-by: ousugo <dkzydkzyxh@gmail.com> Co-authored-by: SuYao <sy20010504@gmail.com>
51 lines
2.4 KiB
Diff
51 lines
2.4 KiB
Diff
diff --git a/dist/index.d.mts b/dist/index.d.mts
|
|
index 189db002d116a9aef1d33ee2060199a5a27997df..ec8e7c2505d026e2405a6b70dcc2eb8774581db9 100644
|
|
--- a/dist/index.d.mts
|
|
+++ b/dist/index.d.mts
|
|
@@ -64,6 +64,7 @@ type XaiResponsesModelId = 'grok-4-1-fast-reasoning' | 'grok-4-1-fast-non-reason
|
|
*/
|
|
declare const xaiLanguageModelResponsesOptions: z.ZodObject<{
|
|
reasoningEffort: z.ZodOptional<z.ZodEnum<{
|
|
+ none: "none";
|
|
low: "low";
|
|
high: "high";
|
|
medium: "medium";
|
|
diff --git a/dist/index.d.ts b/dist/index.d.ts
|
|
index 189db002d116a9aef1d33ee2060199a5a27997df..ec8e7c2505d026e2405a6b70dcc2eb8774581db9 100644
|
|
--- a/dist/index.d.ts
|
|
+++ b/dist/index.d.ts
|
|
@@ -64,6 +64,7 @@ type XaiResponsesModelId = 'grok-4-1-fast-reasoning' | 'grok-4-1-fast-non-reason
|
|
*/
|
|
declare const xaiLanguageModelResponsesOptions: z.ZodObject<{
|
|
reasoningEffort: z.ZodOptional<z.ZodEnum<{
|
|
+ none: "none";
|
|
low: "low";
|
|
high: "high";
|
|
medium: "medium";
|
|
diff --git a/dist/index.js b/dist/index.js
|
|
index 70ebc50a4122d8be59e52302318b2d9b46ff8283..4b33aba56b540cf128b39e8b3be7fbd78628d405 100644
|
|
--- a/dist/index.js
|
|
+++ b/dist/index.js
|
|
@@ -1702,7 +1702,7 @@ var xaiLanguageModelResponsesOptions = import_v47.z.object({
|
|
* Constrains how hard a reasoning model thinks before responding.
|
|
* Possible values are `low` (uses fewer reasoning tokens), `medium` and `high` (uses more reasoning tokens).
|
|
*/
|
|
- reasoningEffort: import_v47.z.enum(["low", "medium", "high"]).optional(),
|
|
+ reasoningEffort: import_v47.z.enum(["none", "low", "medium", "high"]).optional(),
|
|
logprobs: import_v47.z.boolean().optional(),
|
|
topLogprobs: import_v47.z.number().int().min(0).max(8).optional(),
|
|
/**
|
|
diff --git a/dist/index.mjs b/dist/index.mjs
|
|
index f3978c488e067c34f9bc1f4a9a80f10c8f3978f1..7b079a5285db62669a50804221a5fb00baaa9115 100644
|
|
--- a/dist/index.mjs
|
|
+++ b/dist/index.mjs
|
|
@@ -1705,7 +1705,7 @@ var xaiLanguageModelResponsesOptions = z7.object({
|
|
* Constrains how hard a reasoning model thinks before responding.
|
|
* Possible values are `low` (uses fewer reasoning tokens), `medium` and `high` (uses more reasoning tokens).
|
|
*/
|
|
- reasoningEffort: z7.enum(["low", "medium", "high"]).optional(),
|
|
+ reasoningEffort: z7.enum(["none", "low", "medium", "high"]).optional(),
|
|
logprobs: z7.boolean().optional(),
|
|
topLogprobs: z7.number().int().min(0).max(8).optional(),
|
|
/**
|