Fix issue #654 Respect --model parameter when using custom base URL #694
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.
TLDR
Fixed the
--model
parameter being ignored when using a custom base URL. The CLI now correctly respects the model specified via-m
or--model
flags when using alternative API endpoints.Dive Deeper
The issue was in the
createContentGeneratorConfig
function inpackages/core/src/core/contentGenerator.ts
. When using OpenAI auth type (triggered when a custom base URL is set), the code was overriding the model selection with theOPENAI_MODEL
environment variable or falling back toDEFAULT_QWEN_MODEL
, completely bypassing the model specified through the CLI's--model
parameter.The fix ensures proper priority ordering:
--model
parameter) - highest priorityOPENAI_MODEL
orQWEN_MODEL
) - fallbackThis same logic was applied to both OpenAI and QWEN OAuth authentication paths to ensure consistency.
Reviewer Test Plan
To validate this fix:
Test with custom base URL and model parameter:
Test that environment variable still works as fallback:
Test precedence (CLI flag should override env var):
Testing Matrix
Linked issues / bugs
Fixes #654