chore(core): refactor model resolution and cleanup fallback logic (#15228)

This commit is contained in:
Adam Weidman
2025-12-22 10:18:51 -05:00
committed by GitHub
parent 58fd00a3df
commit d6a2f1d670
9 changed files with 28 additions and 60 deletions

View File

@@ -253,10 +253,7 @@ export const AppContainer = (props: AppContainerProps) => {
[],
);
// Helper to determine the effective model, considering the fallback state.
const getEffectiveModel = useCallback(() => config.getModel(), [config]);
const [currentModel, setCurrentModel] = useState(getEffectiveModel());
const [currentModel, setCurrentModel] = useState(config.getModel());
const [userTier, setUserTier] = useState<UserTierId | undefined>(undefined);
@@ -341,7 +338,7 @@ export const AppContainer = (props: AppContainerProps) => {
return () => {
coreEvents.off(CoreEvent.ModelChanged, handleModelChanged);
};
}, [getEffectiveModel, config]);
}, [config]);
const { consoleMessages, clearConsoleMessages: clearConsoleMessagesState } =
useConsoleMessages();

View File

@@ -27,7 +27,7 @@ import {
ToolCallEvent,
debugLogger,
ReadManyFilesTool,
getEffectiveModel,
resolveModel,
createWorkingStdio,
startupProfiler,
} from '@google/gemini-cli-core';
@@ -282,7 +282,7 @@ export class Session {
const functionCalls: FunctionCall[] = [];
try {
const model = getEffectiveModel(
const model = resolveModel(
this.config.getModel(),
this.config.getPreviewFeatures(),
);