mirror of
https://github.com/google-gemini/gemini-cli.git
synced 2026-04-20 10:10:56 -07:00
Remove useModelRouter experimental flag (#13593)
This commit is contained in:
@@ -750,99 +750,6 @@ describe('Server Config (config.ts)', () => {
|
||||
});
|
||||
});
|
||||
|
||||
describe('Model Router with Auth', () => {
|
||||
it('should disable model router by default for oauth-personal', async () => {
|
||||
const config = new Config({
|
||||
...baseParams,
|
||||
useModelRouter: true,
|
||||
});
|
||||
await config.refreshAuth(AuthType.LOGIN_WITH_GOOGLE);
|
||||
expect(config.getUseModelRouter()).toBe(true);
|
||||
});
|
||||
|
||||
it('should enable model router by default for other auth types', async () => {
|
||||
const config = new Config({
|
||||
...baseParams,
|
||||
useModelRouter: true,
|
||||
});
|
||||
await config.refreshAuth(AuthType.USE_GEMINI);
|
||||
expect(config.getUseModelRouter()).toBe(true);
|
||||
});
|
||||
|
||||
it('should disable model router for specified auth type', async () => {
|
||||
const config = new Config({
|
||||
...baseParams,
|
||||
useModelRouter: true,
|
||||
disableModelRouterForAuth: [AuthType.USE_GEMINI],
|
||||
});
|
||||
await config.refreshAuth(AuthType.USE_GEMINI);
|
||||
expect(config.getUseModelRouter()).toBe(false);
|
||||
});
|
||||
|
||||
it('should enable model router for other auth type', async () => {
|
||||
const config = new Config({
|
||||
...baseParams,
|
||||
useModelRouter: true,
|
||||
disableModelRouterForAuth: [],
|
||||
});
|
||||
await config.refreshAuth(AuthType.LOGIN_WITH_GOOGLE);
|
||||
expect(config.getUseModelRouter()).toBe(true);
|
||||
});
|
||||
|
||||
it('should keep model router disabled when useModelRouter is false', async () => {
|
||||
const config = new Config({
|
||||
...baseParams,
|
||||
useModelRouter: false,
|
||||
disableModelRouterForAuth: [AuthType.USE_GEMINI],
|
||||
});
|
||||
await config.refreshAuth(AuthType.LOGIN_WITH_GOOGLE);
|
||||
expect(config.getUseModelRouter()).toBe(false);
|
||||
});
|
||||
|
||||
it('should keep the user-chosen model after refreshAuth, even when model router is disabled for the auth type', async () => {
|
||||
const config = new Config({
|
||||
...baseParams,
|
||||
useModelRouter: true,
|
||||
disableModelRouterForAuth: [AuthType.USE_GEMINI],
|
||||
});
|
||||
const chosenModel = 'gemini-1.5-pro-latest';
|
||||
config.setModel(chosenModel);
|
||||
|
||||
await config.refreshAuth(AuthType.USE_GEMINI);
|
||||
|
||||
expect(config.getUseModelRouter()).toBe(false);
|
||||
expect(config.getModel()).toBe(chosenModel);
|
||||
});
|
||||
|
||||
it('should keep the user-chosen model after refreshAuth, when model router is enabled for the auth type', async () => {
|
||||
const config = new Config({
|
||||
...baseParams,
|
||||
useModelRouter: true,
|
||||
disableModelRouterForAuth: [AuthType.USE_GEMINI],
|
||||
});
|
||||
const chosenModel = 'gemini-1.5-pro-latest';
|
||||
config.setModel(chosenModel);
|
||||
|
||||
await config.refreshAuth(AuthType.LOGIN_WITH_GOOGLE);
|
||||
|
||||
expect(config.getUseModelRouter()).toBe(true);
|
||||
expect(config.getModel()).toBe(chosenModel);
|
||||
});
|
||||
|
||||
it('should NOT switch to auto model if cli provides specific model, even if router is enabled', async () => {
|
||||
const config = new Config({
|
||||
...baseParams,
|
||||
useModelRouter: true,
|
||||
model: 'gemini-flash-latest',
|
||||
});
|
||||
|
||||
await config.refreshAuth(AuthType.LOGIN_WITH_GOOGLE);
|
||||
|
||||
expect(config.getUseModelRouter()).toBe(true);
|
||||
expect(config.getModel()).toBe('gemini-flash-latest');
|
||||
});
|
||||
});
|
||||
|
||||
describe('ContinueOnFailedApiCall Configuration', () => {
|
||||
it('should default continueOnFailedApiCall to false when not provided', () => {
|
||||
const config = new Config(baseParams);
|
||||
|
||||
@@ -48,7 +48,6 @@ import {
|
||||
DEFAULT_GEMINI_EMBEDDING_MODEL,
|
||||
DEFAULT_GEMINI_FLASH_MODEL,
|
||||
DEFAULT_GEMINI_MODEL,
|
||||
DEFAULT_GEMINI_MODEL_AUTO,
|
||||
DEFAULT_THINKING_MODE,
|
||||
} from './models.js';
|
||||
import { shouldAttemptBrowserLaunch } from '../utils/browser.js';
|
||||
@@ -288,7 +287,6 @@ export interface ConfigParameters {
|
||||
useWriteTodos?: boolean;
|
||||
policyEngineConfig?: PolicyEngineConfig;
|
||||
output?: OutputSettings;
|
||||
useModelRouter?: boolean;
|
||||
enableMessageBusIntegration?: boolean;
|
||||
disableModelRouterForAuth?: AuthType[];
|
||||
codebaseInvestigatorSettings?: CodebaseInvestigatorSettings;
|
||||
@@ -402,9 +400,6 @@ export class Config {
|
||||
private readonly messageBus: MessageBus;
|
||||
private readonly policyEngine: PolicyEngine;
|
||||
private readonly outputSettings: OutputSettings;
|
||||
private useModelRouter: boolean;
|
||||
private readonly initialUseModelRouter: boolean;
|
||||
private readonly disableModelRouterForAuth?: AuthType[];
|
||||
private readonly enableMessageBusIntegration: boolean;
|
||||
private readonly codebaseInvestigatorSettings: CodebaseInvestigatorSettings;
|
||||
private readonly continueOnFailedApiCall: boolean;
|
||||
@@ -519,9 +514,6 @@ export class Config {
|
||||
this.enableToolOutputTruncation = params.enableToolOutputTruncation ?? true;
|
||||
this.useSmartEdit = params.useSmartEdit ?? true;
|
||||
this.useWriteTodos = params.useWriteTodos ?? true;
|
||||
this.initialUseModelRouter = params.useModelRouter ?? false;
|
||||
this.useModelRouter = this.initialUseModelRouter;
|
||||
this.disableModelRouterForAuth = params.disableModelRouterForAuth ?? [];
|
||||
this.enableHooks = params.enableHooks ?? false;
|
||||
|
||||
// Enable MessageBus integration if:
|
||||
@@ -643,14 +635,6 @@ export class Config {
|
||||
}
|
||||
|
||||
async refreshAuth(authMethod: AuthType) {
|
||||
this.useModelRouter = this.initialUseModelRouter;
|
||||
if (this.disableModelRouterForAuth?.includes(authMethod)) {
|
||||
this.useModelRouter = false;
|
||||
if (this.model === DEFAULT_GEMINI_MODEL_AUTO) {
|
||||
this.model = DEFAULT_GEMINI_MODEL;
|
||||
}
|
||||
}
|
||||
|
||||
// Vertex and Genai have incompatible encryption and sending history with
|
||||
// thoughtSignature from Genai to Vertex will fail, we need to strip them
|
||||
if (
|
||||
@@ -1341,10 +1325,6 @@ export class Config {
|
||||
: OutputFormat.TEXT;
|
||||
}
|
||||
|
||||
getUseModelRouter(): boolean {
|
||||
return this.useModelRouter;
|
||||
}
|
||||
|
||||
async getGitService(): Promise<GitService> {
|
||||
if (!this.gitService) {
|
||||
this.gitService = new GitService(this.targetDir, this.storage);
|
||||
|
||||
@@ -216,7 +216,6 @@ describe('Gemini Client (client.ts)', () => {
|
||||
getChatCompression: vi.fn().mockReturnValue(undefined),
|
||||
getSkipNextSpeakerCheck: vi.fn().mockReturnValue(false),
|
||||
getUseSmartEdit: vi.fn().mockReturnValue(false),
|
||||
getUseModelRouter: vi.fn().mockReturnValue(false),
|
||||
getShowModelInfoInChat: vi.fn().mockReturnValue(false),
|
||||
getContinueOnFailedApiCall: vi.fn(),
|
||||
getProjectRoot: vi.fn().mockReturnValue('/test/project/root'),
|
||||
|
||||
@@ -248,7 +248,6 @@ function createMockConfig(overrides: Partial<Config> = {}): Config {
|
||||
getTruncateToolOutputLines: () => DEFAULT_TRUNCATE_TOOL_OUTPUT_LINES,
|
||||
getToolRegistry: () => defaultToolRegistry,
|
||||
getUseSmartEdit: () => false,
|
||||
getUseModelRouter: () => false,
|
||||
getGeminiClient: () => null,
|
||||
getEnableMessageBusIntegration: () => false,
|
||||
getMessageBus: () => null,
|
||||
|
||||
@@ -60,7 +60,6 @@ describe('executeToolCall', () => {
|
||||
DEFAULT_TRUNCATE_TOOL_OUTPUT_THRESHOLD,
|
||||
getTruncateToolOutputLines: () => DEFAULT_TRUNCATE_TOOL_OUTPUT_LINES,
|
||||
getUseSmartEdit: () => false,
|
||||
getUseModelRouter: () => false,
|
||||
getGeminiClient: () => null, // No client needed for these tests
|
||||
getEnableMessageBusIntegration: () => false,
|
||||
getMessageBus: () => null,
|
||||
|
||||
@@ -312,7 +312,7 @@ describe('ClearcutLogger', () => {
|
||||
|
||||
it('logs all user settings', () => {
|
||||
const { logger } = setup({
|
||||
config: { useSmartEdit: true, useModelRouter: true },
|
||||
config: { useSmartEdit: true },
|
||||
});
|
||||
|
||||
vi.stubEnv('TERM_PROGRAM', 'vscode');
|
||||
|
||||
@@ -1544,7 +1544,6 @@ describe('loggers', () => {
|
||||
getUsageStatisticsEnabled: () => true,
|
||||
getContentGeneratorConfig: () => null,
|
||||
getUseSmartEdit: () => null,
|
||||
getUseModelRouter: () => null,
|
||||
isInteractive: () => false,
|
||||
} as unknown as Config;
|
||||
|
||||
@@ -1595,7 +1594,6 @@ describe('loggers', () => {
|
||||
getUsageStatisticsEnabled: () => true,
|
||||
getContentGeneratorConfig: () => null,
|
||||
getUseSmartEdit: () => null,
|
||||
getUseModelRouter: () => null,
|
||||
isInteractive: () => false,
|
||||
} as unknown as Config;
|
||||
|
||||
@@ -1648,7 +1646,6 @@ describe('loggers', () => {
|
||||
getUsageStatisticsEnabled: () => true,
|
||||
getContentGeneratorConfig: () => null,
|
||||
getUseSmartEdit: () => null,
|
||||
getUseModelRouter: () => null,
|
||||
isInteractive: () => false,
|
||||
} as unknown as Config;
|
||||
|
||||
|
||||
@@ -90,7 +90,6 @@ describe('SmartEditTool', () => {
|
||||
getSessionId: vi.fn(() => 'mock-session-id'),
|
||||
getContentGeneratorConfig: vi.fn(() => ({ authType: 'mock' })),
|
||||
getUseSmartEdit: vi.fn(() => false),
|
||||
getUseModelRouter: vi.fn(() => false),
|
||||
getProxy: vi.fn(() => undefined),
|
||||
getGeminiClient: vi.fn().mockReturnValue(geminiClient),
|
||||
getBaseLlmClient: vi.fn().mockReturnValue(baseLlmClient),
|
||||
|
||||
Reference in New Issue
Block a user