mirror of
https://github.com/google-gemini/gemini-cli.git
synced 2026-03-10 22:21:22 -07:00
fix(zed): Fix broken 'auto' model selection in Zed integration (#9769)
This commit is contained in:
@@ -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: {
|
||||
|
||||
Reference in New Issue
Block a user