mirror of
https://github.com/google-gemini/gemini-cli.git
synced 2026-05-14 22:02:59 -07:00
fix(core): pass config to supportsModernFeatures to respect model definition flags
This commit is contained in:
@@ -53,7 +53,7 @@ export const CodebaseInvestigatorAgent = (
|
||||
): LocalAgentDefinition<typeof CodebaseInvestigationReportSchema> => {
|
||||
// Use Preview Flash model if the main model supports modern features.
|
||||
// If the main model is not a modern model, use the default pro model.
|
||||
const model = supportsModernFeatures(config.getModel())
|
||||
const model = supportsModernFeatures(config.getModel(), config)
|
||||
? PREVIEW_GEMINI_FLASH_MODEL
|
||||
: DEFAULT_GEMINI_MODEL;
|
||||
|
||||
@@ -97,7 +97,7 @@ export const CodebaseInvestigatorAgent = (
|
||||
generateContentConfig: {
|
||||
temperature: 0.1,
|
||||
topP: 0.95,
|
||||
thinkingConfig: supportsModernFeatures(model)
|
||||
thinkingConfig: supportsModernFeatures(model, config)
|
||||
? {
|
||||
includeThoughts: true,
|
||||
thinkingLevel: ThinkingLevel.HIGH,
|
||||
|
||||
@@ -397,11 +397,21 @@ export function isCustomModel(
|
||||
* This includes Gemini 3 models and any custom models.
|
||||
*
|
||||
* @param model The model name to check.
|
||||
* @param config Optional config object for dynamic model configuration.
|
||||
* @returns True if the model supports modern features like thoughts.
|
||||
*/
|
||||
export function supportsModernFeatures(model: string): boolean {
|
||||
export function supportsModernFeatures(
|
||||
model: string,
|
||||
config?: ModelCapabilityContext,
|
||||
): boolean {
|
||||
if (config?.getExperimentalDynamicModelConfiguration?.() === true) {
|
||||
const definition = config.modelConfigService.getModelDefinition(model);
|
||||
if (definition?.features?.thinking !== undefined) {
|
||||
return definition.features.thinking;
|
||||
}
|
||||
}
|
||||
if (isGemini3Model(model)) return true;
|
||||
return isCustomModel(model);
|
||||
return isCustomModel(model, config);
|
||||
}
|
||||
|
||||
/**
|
||||
|
||||
@@ -569,7 +569,10 @@ export class GeminiChat {
|
||||
abortSignal,
|
||||
};
|
||||
|
||||
let contentsToUse: Content[] = supportsModernFeatures(modelToUse)
|
||||
let contentsToUse: Content[] = supportsModernFeatures(
|
||||
modelToUse,
|
||||
this.context.config,
|
||||
)
|
||||
? [...contentsForPreviewModel]
|
||||
: [...requestContents];
|
||||
|
||||
@@ -613,7 +616,10 @@ export class GeminiChat {
|
||||
);
|
||||
lastModelToUse = modelToUse;
|
||||
// Re-evaluate contentsToUse based on the new model's feature support
|
||||
contentsToUse = supportsModernFeatures(modelToUse)
|
||||
contentsToUse = supportsModernFeatures(
|
||||
modelToUse,
|
||||
this.context.config,
|
||||
)
|
||||
? [...contentsForPreviewModel]
|
||||
: [...requestContents];
|
||||
}
|
||||
|
||||
@@ -69,7 +69,7 @@ export class PromptProvider {
|
||||
context.config.getHasAccessToPreviewModel?.() ?? true,
|
||||
context.config,
|
||||
);
|
||||
const isModernModel = supportsModernFeatures(desiredModel);
|
||||
const isModernModel = supportsModernFeatures(desiredModel, context.config);
|
||||
const activeSnippets = isModernModel ? snippets : legacySnippets;
|
||||
const contextFilenames = getAllGeminiMdFilenames();
|
||||
|
||||
@@ -280,7 +280,7 @@ export class PromptProvider {
|
||||
context.config.getHasAccessToPreviewModel?.() ?? true,
|
||||
context.config,
|
||||
);
|
||||
const isModernModel = supportsModernFeatures(desiredModel);
|
||||
const isModernModel = supportsModernFeatures(desiredModel, context.config);
|
||||
const activeSnippets = isModernModel ? snippets : legacySnippets;
|
||||
return activeSnippets.getCompressionPrompt(
|
||||
context.config.getApprovedPlanPath(),
|
||||
|
||||
Reference in New Issue
Block a user