mirror of
https://github.com/google-gemini/gemini-cli.git
synced 2026-04-24 12:04:56 -07:00
do not persist the fallback model (#15483)
This commit is contained in:
@@ -1641,6 +1641,18 @@ describe('Config getHooks', () => {
|
||||
|
||||
expect(onModelChange).toHaveBeenCalledWith(DEFAULT_GEMINI_MODEL);
|
||||
});
|
||||
|
||||
it('should NOT call onModelChange when a new model is set as a fallback', () => {
|
||||
const onModelChange = vi.fn();
|
||||
const config = new Config({
|
||||
...baseParams,
|
||||
onModelChange,
|
||||
});
|
||||
|
||||
config.setModel(DEFAULT_GEMINI_MODEL, true);
|
||||
|
||||
expect(onModelChange).not.toHaveBeenCalled();
|
||||
});
|
||||
});
|
||||
});
|
||||
|
||||
|
||||
@@ -877,13 +877,13 @@ export class Config {
|
||||
return this.model;
|
||||
}
|
||||
|
||||
setModel(newModel: string): void {
|
||||
setModel(newModel: string, isFallbackModel: boolean = false): void {
|
||||
if (this.model !== newModel || this._activeModel !== newModel) {
|
||||
this.model = newModel;
|
||||
// When the user explicitly sets a model, that becomes the active model.
|
||||
this._activeModel = newModel;
|
||||
coreEvents.emitModelChanged(newModel);
|
||||
if (this.onModelChange) {
|
||||
if (this.onModelChange && !isFallbackModel) {
|
||||
this.onModelChange(newModel);
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user