mirror of
https://github.com/google-gemini/gemini-cli.git
synced 2026-06-13 21:07:00 -07:00
refactor(config): use getExperimentValue for existing experiment getters
This commit is contained in:
@@ -3021,9 +3021,7 @@ export class Config implements McpContext, AgentLoopContext {
|
||||
}
|
||||
|
||||
async getUserCaching(): Promise<boolean | undefined> {
|
||||
await this.ensureExperimentsLoaded();
|
||||
|
||||
return this.experiments?.flags[ExperimentFlags.USER_CACHING]?.boolValue;
|
||||
return this.getExperimentValue<boolean>(ExperimentFlags.USER_CACHING);
|
||||
}
|
||||
|
||||
async getPlanModeRoutingEnabled(): Promise<boolean> {
|
||||
@@ -3031,11 +3029,11 @@ export class Config implements McpContext, AgentLoopContext {
|
||||
}
|
||||
|
||||
async getNumericalRoutingEnabled(): Promise<boolean> {
|
||||
await this.ensureExperimentsLoaded();
|
||||
|
||||
const flag =
|
||||
this.experiments?.flags[ExperimentFlags.ENABLE_NUMERICAL_ROUTING];
|
||||
return flag?.boolValue ?? true;
|
||||
return (
|
||||
this.getExperimentValue<boolean>(
|
||||
ExperimentFlags.ENABLE_NUMERICAL_ROUTING,
|
||||
) ?? false
|
||||
);
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -3060,28 +3058,24 @@ export class Config implements McpContext, AgentLoopContext {
|
||||
}
|
||||
|
||||
async getClassifierThreshold(): Promise<number | undefined> {
|
||||
await this.ensureExperimentsLoaded();
|
||||
|
||||
const flag = this.experiments?.flags[ExperimentFlags.CLASSIFIER_THRESHOLD];
|
||||
if (flag?.intValue !== undefined) {
|
||||
return parseInt(flag.intValue, 10);
|
||||
}
|
||||
return flag?.floatValue;
|
||||
return this.getExperimentValue<number>(
|
||||
ExperimentFlags.CLASSIFIER_THRESHOLD,
|
||||
);
|
||||
}
|
||||
|
||||
async getBannerTextNoCapacityIssues(): Promise<string> {
|
||||
await this.ensureExperimentsLoaded();
|
||||
return (
|
||||
this.experiments?.flags[ExperimentFlags.BANNER_TEXT_NO_CAPACITY_ISSUES]
|
||||
?.stringValue ?? ''
|
||||
this.getExperimentValue<string>(
|
||||
ExperimentFlags.BANNER_TEXT_NO_CAPACITY_ISSUES,
|
||||
) ?? ''
|
||||
);
|
||||
}
|
||||
|
||||
async getBannerTextCapacityIssues(): Promise<string> {
|
||||
await this.ensureExperimentsLoaded();
|
||||
return (
|
||||
this.experiments?.flags[ExperimentFlags.BANNER_TEXT_CAPACITY_ISSUES]
|
||||
?.stringValue ?? ''
|
||||
this.getExperimentValue<string>(
|
||||
ExperimentFlags.BANNER_TEXT_CAPACITY_ISSUES,
|
||||
) ?? ''
|
||||
);
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user