File tree Expand file tree Collapse file tree 2 files changed +18
-0
lines changed
Expand file tree Collapse file tree 2 files changed +18
-0
lines changed Original file line number Diff line number Diff line change @@ -597,6 +597,21 @@ export class GeminiChat {
597597 ) ;
598598 }
599599
600+ if ( beforeModelResult . modifiedModel ) {
601+ modelToUse = resolveModel (
602+ beforeModelResult . modifiedModel ,
603+ useGemini3_1 ,
604+ useGemini3_1FlashLite ,
605+ false ,
606+ hasAccessToPreview ,
607+ this . context . config ,
608+ ) ;
609+ lastModelToUse = modelToUse ;
610+ // Re-evaluate contentsToUse based on the new model's feature support
611+ contentsToUse = supportsModernFeatures ( modelToUse )
612+ ? [ ...contentsForPreviewModel ]
613+ : [ ...requestContents ] ;
614+ }
600615 if ( beforeModelResult . modifiedConfig ) {
601616 Object . assign ( config , beforeModelResult . modifiedConfig ) ;
602617 }
Original file line number Diff line number Diff line change @@ -48,6 +48,8 @@ export interface BeforeModelHookResult {
4848 reason ?: string ;
4949 /** Synthetic response to return instead of calling the model (if blocked) */
5050 syntheticResponse ?: GenerateContentResponse ;
51+ /** Modified model override (if not blocked) */
52+ modifiedModel ?: string ;
5153 /** Modified config (if not blocked) */
5254 modifiedConfig ?: GenerateContentConfig ;
5355 /** Modified contents (if not blocked) */
@@ -292,6 +294,7 @@ export class HookSystem {
292294 beforeModelOutput . applyLLMRequestModifications ( llmRequest ) ;
293295 return {
294296 blocked : false ,
297+ modifiedModel : modifiedRequest ?. model ,
295298 modifiedConfig : modifiedRequest ?. config ,
296299 modifiedContents : modifiedRequest ?. contents ,
297300 } ;
You can’t perform that action at this time.
0 commit comments