🐛 fix(gemini): align thinkingLevel config resolution across the stack#13457
Conversation
|
@Zhouguanyang is attempting to deploy a commit to the LobeHub OSS Team on Vercel. A member of the Team first needs to authorize it. |
There was a problem hiding this comment.
Sorry @Zhouguanyang, you have reached your weekly rate limit of 500000 diff characters.
Please try again later or upgrade to continue using Sourcery
|
@sxjeru @ONLY-yours - This PR fixes Gemini thinking config consistency across the Google provider runtime, ModelSwitchPanel UI sliders, and the model params resolver. Please coordinate on the review. |
Codecov Report❌ Patch coverage is Additional details and impacted files@@ Coverage Diff @@
## canary #13457 +/- ##
=========================================
Coverage 66.48% 66.49%
=========================================
Files 1972 1972
Lines 160184 160210 +26
Branches 18340 16054 -2286
=========================================
+ Hits 106504 106527 +23
- Misses 53560 53563 +3
Partials 120 120
Flags with carried forward coverage won't be shown. Click here to find out more.
🚀 New features to boost your workflow:
|
|
@codex review |
|
Codex Review: Didn't find any major issues. Another round soon, please! ℹ️ About Codex in GitHubCodex has been enabled to automatically review pull requests in this repo. Reviews are triggered when you
If Codex has suggestions, it will comment; otherwise it will react with 👍. When you sign up for Codex through ChatGPT, Codex can also answer questions or update the PR, like "@codex address that feedback". |
|
@codex review |
|
Codex Review: Didn't find any major issues. Hooray! ℹ️ About Codex in GitHubCodex has been enabled to automatically review pull requests in this repo. Reviews are triggered when you
If Codex has suggestions, it will comment; otherwise it will react with 👍. When you sign up for Codex through ChatGPT, Codex can also answer questions or update the PR, like "@codex address that feedback". |
There was a problem hiding this comment.
Sorry @Zhouguanyang, you have reached your weekly rate limit of 500000 diff characters.
Please try again later or upgrade to continue using Sourcery
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: cfd2a72ed5
ℹ️ About Codex in GitHub
Codex has been enabled to automatically review pull requests in this repo. Reviews are triggered when you
- Open a pull request for review
- Mark a draft as ready
- Comment "@codex review".
If Codex has suggestions, it will comment; otherwise it will react with 👍.
When you sign up for Codex through ChatGPT, Codex can also answer questions or update the PR, like "@codex address that feedback".
- Google runtime: omit empty thinkingConfig to avoid sending thinkingConfig: {} upstream.\n- UI: ThinkingLevel2/3/4/5 sliders read/write only their own config key.\n- Resolver: map model extend params thinkingLevel* to matching chatConfig key (no fallback/priority logic).\n- Tests: add regression coverage for empty thinkingConfig omission.
2661240 to
b8883cf
Compare
|
@codex review |
|
Codex Review: Didn't find any major issues. What shall we delve into next? ℹ️ About Codex in GitHubCodex has been enabled to automatically review pull requests in this repo. Reviews are triggered when you
If Codex has suggestions, it will comment; otherwise it will react with 👍. When you sign up for Codex through ChatGPT, Codex can also answer questions or update the PR, like "@codex address that feedback". |
|
❤️ Great PR @Zhouguanyang ❤️ The growth of project is inseparable from user feedback and contribution, thanks for your contribution! If you are interesting with the lobehub developer community, please join our discord and then dm @arvinxx or @canisminor1990. They will invite you to our private developer channel. We are talking about the lobe-chat development or sharing ai newsletter around the world. |
💻 Change Type
🔗 Related Issue
fixes #12959
🔀 Description of Change
本 PR 修复 Gemini 3.x
thinking参数在 UI / Resolver / Runtime 链路上的一致性问题,避免请求携带空的thinkingConfig: {},并保证不同模型能够稳定读取并下发正确的thinkingLevel*配置。thinkingConfigpackages/model-runtime/src/providers/google/index.tsnormalizeThinkingConfig:当includeThoughts/thinkingBudget/thinkingLevel全部为undefined时返回undefined,避免发送thinkingConfig: {}。packages/model-runtime/src/providers/google/index.test.tsgemini-3.1-pro-preview未显式设置thinking参数时,断言最终请求config.thinkingConfig === undefined。ThinkingLevelsliders 读写正确的配置 keysrc/features/ModelSwitchPanel/components/ControlsForm/createLevelSlider.tsxsrc/features/ModelSwitchPanel/components/ControlsForm/ThinkingLevel2Slider.tsxsrc/features/ModelSwitchPanel/components/ControlsForm/ThinkingLevel3Slider.tsxsrc/features/ModelSwitchPanel/components/ControlsForm/ThinkingLevel4Slider.tsxsrc/features/ModelSwitchPanel/components/ControlsForm/ThinkingLevel5Slider.tsxThinkingLevel2/3/4/5sliders 分别读写thinkingLevel2/3/4/5。extendParams精确映射thinkingLevel*src/services/chat/mecha/modelParamsResolver.tsthinkingLevel/thinkingLevel2/thinkingLevel3/thinkingLevel4/thinkingLevel5时,只从chatConfig中读取对应的同名 key,并下发到extendParams.thinkingLevel。thinkingLevel*参数时,优先使用第一个已显式配置的 key;只有在所有相关 key 都未配置时,才回落到默认值。thinkingLevel/thinkingLevel2/thinkingLevel3->highthinkingLevel4/thinkingLevel5->minimalthinkingLevel*复用其它 key,也避免已配置值被更前面的默认值覆盖。thinkingLevel*映射与优先级覆盖src/services/chat/mecha/modelParamsResolver.test.tsthinkingLevel*同时存在时显式值优先🧪 How to Test
bunx vitest run --silent='passed-only' 'src/services/chat/mecha/modelParamsResolver.test.ts'cd packages/model-runtime && bunx vitest run --silent='passed-only' 'src/providers/google/index.test.ts'📸 Screenshots / Videos
📝 Additional Information