diff --git a/packages/cli/src/zed-integration/zedIntegration.ts b/packages/cli/src/zed-integration/zedIntegration.ts index afd5975b63..868fbe68d2 100644 --- a/packages/cli/src/zed-integration/zedIntegration.ts +++ b/packages/cli/src/zed-integration/zedIntegration.ts @@ -25,6 +25,9 @@ import { MCPServerConfig, DiscoveredMCPTool, StreamEventType, + DEFAULT_GEMINI_MODEL, + DEFAULT_GEMINI_MODEL_AUTO, + DEFAULT_GEMINI_FLASH_MODEL, } from '@google/gemini-cli-core'; import * as acp from './acp.js'; import { AcpFileSystemService } from './fileSystemService.js'; @@ -41,6 +44,19 @@ import type { Extension } from '../config/extension.js'; import type { CliArgs } from '../config/config.js'; import { loadCliConfig } from '../config/config.js'; +/** + * Resolves the model to use based on the current configuration. + * + * If the model is set to "auto", it will use the flash model if in fallback + * mode, otherwise it will use the default model. + */ +export function resolveModel(model: string, isInFallbackMode: boolean): string { + if (model === DEFAULT_GEMINI_MODEL_AUTO) { + return isInFallbackMode ? DEFAULT_GEMINI_FLASH_MODEL : DEFAULT_GEMINI_MODEL; + } + return model; +} + export async function runZedIntegration( config: Config, settings: LoadedSettings, @@ -255,7 +271,7 @@ class Session { try { const responseStream = await chat.sendMessageStream( - this.config.getModel(), + resolveModel(this.config.getModel(), this.config.isInFallbackMode()), { message: nextMessage?.parts ?? [], config: {