fix(core): respect custom Gemini baseUrl from modelProviders#3212
fix(core): respect custom Gemini baseUrl from modelProviders#3212
Conversation
📋 Review SummaryThis PR fixes issue #3166 by ensuring the custom Gemini 🔍 General Feedback
🎯 Specific Feedback🔵 Low
✅ Highlights
|
There was a problem hiding this comment.
Pull request overview
This PR fixes Gemini provider configuration so a custom baseUrl from resolved ContentGeneratorConfig (e.g., via modelProviders in settings.json) is forwarded into the Gemini SDK client options, restoring expected proxy/custom-endpoint support.
Changes:
- Forward
config.baseUrlinto Gemini SDKhttpOptions(while preserving existing header behavior). - Add regression tests covering both configured and missing
baseUrlcases forcreateGeminiContentGenerator.
Reviewed changes
Copilot reviewed 2 out of 2 changed files in this pull request and generated 1 comment.
| File | Description |
|---|---|
| packages/core/src/core/geminiContentGenerator/index.ts | Conditionally adds httpOptions.baseUrl when config.baseUrl is configured. |
| packages/core/src/core/geminiContentGenerator/index.test.ts | Adds tests ensuring baseUrl is forwarded (and omitted when not provided). |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
There was a problem hiding this comment.
Pull request overview
Copilot reviewed 2 out of 2 changed files in this pull request and generated no new comments.
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
Code Coverage Summary
CLI Package - Full Text ReportCore Package - Full Text ReportFor detailed HTML reports, please see the 'coverage-reports-22.x-ubuntu-latest' artifact from the main CI run. |
|
@doudouOUC 截图可以放在PR的描述中,不用放在仓库中~ |
This reverts commit ecfef1d.
|
@pomelo-nwu 按你的要求,已把复现文档和图片从仓库移除,仅保留在 PR comments 中。 CLI 实际复现与修复验证(2026-04-14):
结果:
截图:
|
wenshao
left a comment
There was a problem hiding this comment.
No issues found. LGTM! ✅ — gpt-5.4 via Qwen Code /review


Summary
config.baseUrlinto Gemini SDKhttpOptionsincreateGeminiContentGeneratorhttpOptions.baseUrlwhen configuredbaseUrlpathsRoot cause
createGeminiContentGeneratoronly forwarded headers and droppedContentGeneratorConfig.baseUrl, so Gemini requests always fell back to the default Google endpoint.Validation
Unit tests:
cd packages/core && npx vitest run src/core/geminiContentGenerator/index.test.tscd packages/core && npx vitest run src/core/geminiContentGenerator/geminiContentGenerator.test.tsCLI runtime reproduction (2026-04-14):
dddb56d8859274fd86a304e9b13b8b7d61009dd75c97b8e8c21451df2d13ae274afd51deed008f9eDEBUG=1 npm start -- --yolo -p "ping" --output-format textbaseUrl: "http://127.0.0.1:8787"Reproduction result:
generativelanguage.googleapis.com, returnsAPI_KEY_INVALID.POST /v1beta/models/gemini-2.0-flash:streamGenerateContent?alt=sse) and returnsMOCK_OK_FROM_CUSTOM_BASEURL.Screenshot evidence is provided in PR comments (not repository docs).
Fixes #3166