fix(zed): Fix broken 'auto' model selection in Zed integration (#9769)

This commit is contained in:
Shreya Keshive
2025-09-25 14:47:07 -04:00
committed by GitHub
parent d2d9ae3f91
commit f885375c72

View File

@@ -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: {