mirror of
https://github.com/google-gemini/gemini-cli.git
synced 2026-05-12 12:54:07 -07:00
Disable model routing for oauth users (#11889)
Co-authored-by: matt korwel <matt.korwel@gmail.com>
This commit is contained in:
@@ -46,6 +46,7 @@ import {
|
||||
DEFAULT_GEMINI_EMBEDDING_MODEL,
|
||||
DEFAULT_GEMINI_FLASH_MODEL,
|
||||
DEFAULT_GEMINI_MODEL,
|
||||
DEFAULT_GEMINI_MODEL_AUTO,
|
||||
DEFAULT_THINKING_MODE,
|
||||
} from './models.js';
|
||||
import { shouldAttemptBrowserLaunch } from '../utils/browser.js';
|
||||
@@ -279,6 +280,7 @@ export interface ConfigParameters {
|
||||
output?: OutputSettings;
|
||||
useModelRouter?: boolean;
|
||||
enableMessageBusIntegration?: boolean;
|
||||
disableModelRouterForAuth?: AuthType[];
|
||||
codebaseInvestigatorSettings?: CodebaseInvestigatorSettings;
|
||||
continueOnFailedApiCall?: boolean;
|
||||
retryFetchErrors?: boolean;
|
||||
@@ -377,7 +379,9 @@ export class Config {
|
||||
private readonly messageBus: MessageBus;
|
||||
private readonly policyEngine: PolicyEngine;
|
||||
private readonly outputSettings: OutputSettings;
|
||||
private readonly useModelRouter: boolean;
|
||||
private useModelRouter: boolean;
|
||||
private readonly initialUseModelRouter: boolean;
|
||||
private readonly disableModelRouterForAuth?: AuthType[];
|
||||
private readonly enableMessageBusIntegration: boolean;
|
||||
private readonly codebaseInvestigatorSettings: CodebaseInvestigatorSettings;
|
||||
private readonly continueOnFailedApiCall: boolean;
|
||||
@@ -477,7 +481,11 @@ export class Config {
|
||||
this.enableToolOutputTruncation = params.enableToolOutputTruncation ?? true;
|
||||
this.useSmartEdit = params.useSmartEdit ?? true;
|
||||
this.useWriteTodos = params.useWriteTodos ?? false;
|
||||
this.useModelRouter = params.useModelRouter ?? false;
|
||||
this.initialUseModelRouter = params.useModelRouter ?? false;
|
||||
this.useModelRouter = this.initialUseModelRouter;
|
||||
this.disableModelRouterForAuth = params.disableModelRouterForAuth ?? [
|
||||
AuthType.LOGIN_WITH_GOOGLE,
|
||||
];
|
||||
this.enableMessageBusIntegration =
|
||||
params.enableMessageBusIntegration ?? false;
|
||||
this.codebaseInvestigatorSettings = {
|
||||
@@ -551,6 +559,16 @@ export class Config {
|
||||
}
|
||||
|
||||
async refreshAuth(authMethod: AuthType) {
|
||||
this.useModelRouter = this.initialUseModelRouter;
|
||||
if (this.disableModelRouterForAuth?.includes(authMethod)) {
|
||||
this.useModelRouter = false;
|
||||
if (this.model === DEFAULT_GEMINI_MODEL_AUTO) {
|
||||
this.model = DEFAULT_GEMINI_MODEL;
|
||||
}
|
||||
} else if (this.useModelRouter && this.model === DEFAULT_GEMINI_MODEL) {
|
||||
this.model = DEFAULT_GEMINI_MODEL_AUTO;
|
||||
}
|
||||
|
||||
// Vertex and Genai have incompatible encryption and sending history with
|
||||
// thoughtSignature from Genai to Vertex will fail, we need to strip them
|
||||
if (
|
||||
|
||||
Reference in New Issue
Block a user