fix(models): recognize google-generative-ai as google-gemini api type#241
Merged
1186258278 merged 1 commit intoqingchencloud:mainfrom Apr 24, 2026
Merged
Conversation
The frontend PROVIDER_PRESETS defines Google's api field as 'google-generative-ai', but normalize_model_api_type() only recognized 'google-gemini'. This caused the type to fall through to 'openai-completions', making list_remote_models(), test_model(), and probe_model() all send an 'Authorization: Bearer' header instead of the correct '?key=' query param — resulting in 401 Unauthorized from Google's Generative Language API. Fix: add 'google-generative-ai' as an alias for 'google-gemini' in the normalize_model_api_type() match arm. Fixes qingchencloud#239
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:#239
前端
PROVIDER_PRESETS中,Google 供应商的api字段被定义为"google-generative-ai",而后端normalize_model_api_type()函数只识别"google-gemini"。这导致
google-generative-ai类型被 fallthrough 到默认的"openai-completions",进而使list_remote_models()、test_model()、probe_model()等函数都错误地发送Authorization: Bearer请求头,而非 Google Generative Language API 要求的?key=查询参数,最终返回 401 Unauthorized。修复
在
normalize_model_api_type()的 match arm 中,将"google-generative-ai"作为"google-gemini"的别名加入:影响范围
src-tauri/src/commands/config.rs,仅修改 1 行"google-gemini"的配置行为不变api: "google-generative-ai"配置 Google 供应商时,获取模型列表、测试连接均可正常工作