Repository navigation
fix(llm): 修复 Gemini 在裸 base URL 与当前模型下校验失败 - #1246
Open
DragonNameLeo wants to merge 2 commits into
Open
DragonNameLeo wants to merge 2 commits into
DragonNameLeo wants to merge 2 commits into
Conversation
…models - Default a bare https://generativelanguage.googleapis.com to /v1beta for generateContent / streamGenerateContent, matching model listing and the Gemini ASR path (validation previously 404'd while model listing worked). - Retry once without thinkingConfig when the model rejects the channel-level thinking-off config with a 400, instead of failing the call. - Switch the LLM / Omni default model from gemini-2.5-flash (no longer available to new users) to gemini-3.5-flash-lite. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01YJvDYNu6QoSEhJ4yGSuRqk
… off gemini-3.5-flash-lite (the Gemini channel default) answers the thinking-off config (thinkingBudget 0) with the generic "Request contains an invalid argument.", so the earlier retry that looked for "thinking" in the error body never fired and validation kept failing with a bare 400. - On a 400 for a request that carried thinkingConfig, re-send it once without thinkingConfig. If that passes, fail with llmThinkingRequired instead of the HTTP error; any other 400 keeps its original error. - Pass the code through validation (polish failures arrive as "LLM provider failed: parse error: <code>") and show it in the provider settings and the channel list as "turn Thinking on", in all eight UI languages. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01Abbfv5hvANpC7Sku5KEXJ3
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
摘要
无对应 issue。
Gemini LLM 渠道填写裸
https://generativelanguage.googleapis.com时,模型列表可以拉取,但校验 / 调用返回 404;默认模型gemini-2.5-flash对新用户已不可用;关闭思考时发送的thinkingBudget: 0会被gemini-3.5-flash-lite等模型以 400 拒绝,且错误信息只是通用的Request contains an invalid argument.,用户无从判断原因。本 PR 修复前两点,并在第三种情况下明确提示用户打开「思考」开关。修复 / 新增 / 改进
generateContent/streamGenerateContent对裸 host 默认补/v1beta,与模型列表、Gemini ASR(asr::gemini::endpoint_url)一致;已带路径的 base URL 不变gemini-3.5-flash-lite,并用export_provider_descriptors重新生成浏览器预览用的 provider 目录thinkingConfig的请求返回 400 时,去掉thinkingConfig再探测一次(unary / SSE 均是):探测成功说明是模型拒绝关闭思考,返回llmThinkingRequired;探测失败则保留原 HTTP 错误。Gemini 对此返回的是通用错误信息,无法按文案判断,所以用探测区分llmThinkingRequired提示「请打开模型旁的「思考」开关后重新验证」,八种界面语言均已补充(settings.providers.llmThinkingRequired、settings.channels.errThinking)sanitize_validation_error改为按后缀匹配parse error: <code>:润色失败的消息形如LLM provider failed: parse error: <code>,原先的全等匹配会把llmResponseIncomplete等错误码在校验时吞成通用失败content_urls_default_bare_host_to_v1beta、rejected_thinking_off_asks_to_turn_thinking_on、other_invalid_arguments_keep_the_http_error、only_a_400_with_thinking_config_is_probed、validation_keeps_llm_codes_from_polish_failures兼容
thinkingConfig的 400 才会多发一次探测请求测试计划
cargo test --locked -p openless-core --lib -- llm_gemini provider_service provider_rulescargo run --locked -p openless-core --example export_provider_descriptorsnpx tsx src/lib/ipc/providers.test.ts、npx tsx src/pages/settings/ChannelList.test.ts、npx tsc --noEmit🤖 Generated with Claude Code
https://claude.ai/code/session_01Abbfv5hvANpC7Sku5KEXJ3