Repository navigation
fix(core): keep a v1 provider's baseURL when api is also set - #62570
Conversation
There was a problem hiding this comment.
The fix works. I reproduced #50286 from source: on the base, the migrated config's providers.llama.cpp.settings.baseURL is "openai"; with this change it keeps http://127.0.0.1:4000/v1. The new test case fails on the base and passes here. provider.test.ts passes (42/42) and typecheck:tsc for core is clean.
Public API: no keys or endpoints change. Only the migrated value differs: a v1 provider that sets both api and options.baseURL now keeps its baseURL. Configs that set only api behave as before.
Non-blocking: migrateModel (around line 246) still uses { ...settings, baseURL: info.provider.api }. If a model sets its own provider.api, that value still overrides the baseURL, and model settings probably take priority over the provider's options.baseURL. If v1 gave the provider's options.baseURL priority there too, the model-level line may need the same change. That's a much rarer setup than the one in the issue, so it can be a follow-up.
222f0d5 to
9e84c88
Compare
There was a problem hiding this comment.
This push only rebases the fix onto newer dev; the change is the same as the version I reviewed before. I re-ran the #50286 reproduction on the new head and baseURL is still kept. provider.test.ts passes and core type-checks. Public API is unchanged. Nothing new to raise.
There was a problem hiding this comment.
The new commit is fine: an empty options.baseURL now falls back to api, and a non-empty options.baseURL still takes precedence. I re-ran the #50286 reproduction on the new head and baseURL is kept. provider.test.ts passes, including the new case, and core type-checks. Public API is unchanged. Nothing new to raise.
Issue for this PR
Closes #50286
Type of change
What does this PR do?
A v1-style provider that sets both
apiandoptions.baseURLloses its endpoint when the config is migrated:apioverwritesbaseURL, so requests go to the wrong place (or to a literalopenaiURL). In v1,options.baseURLtook precedence overapi, so the migration now keeps the user'sbaseURLand only falls back toapiwhen none is set.How did you verify your code works?
Loaded the config from the issue and read back the migrated config. Dev shows
baseURL: "openai"; this branch keepshttp://127.0.0.1:4000/v1. Added a case to the v1-vs-native provider table test, which fails on dev; typecheck and config tests pass.Checklist