mirror of
https://github.com/google-gemini/gemini-cli.git
synced 2026-04-28 22:14:52 -07:00
fix: Show experiment values in settings UI for compressionThreshold (#16267)
Co-authored-by: Vedant Mahajan <vedant.04.mahajan@gmail.com>
This commit is contained in:
@@ -16,6 +16,8 @@ import type {
|
||||
SettingsValue,
|
||||
} from '../config/settingsSchema.js';
|
||||
import { getSettingsSchema } from '../config/settingsSchema.js';
|
||||
import type { Config } from '@google/gemini-cli-core';
|
||||
import { ExperimentFlags } from '@google/gemini-cli-core';
|
||||
|
||||
// The schema is now nested, but many parts of the UI and logic work better
|
||||
// with a flattened structure and dot-notation keys. This section flattens the
|
||||
@@ -96,6 +98,28 @@ export function getDefaultValue(key: string): SettingsValue {
|
||||
return getFlattenedSchema()[key]?.default;
|
||||
}
|
||||
|
||||
/**
|
||||
* Get the effective default value for a setting, checking experiment values when available.
|
||||
* For settings like compressionThreshold, this will return the experiment value if set,
|
||||
* otherwise falls back to the schema default.
|
||||
*/
|
||||
export function getEffectiveDefaultValue(
|
||||
key: string,
|
||||
config?: Config,
|
||||
): SettingsValue {
|
||||
if (key === 'model.compressionThreshold' && config) {
|
||||
const experiments = config.getExperiments();
|
||||
const experimentValue =
|
||||
experiments?.flags[ExperimentFlags.CONTEXT_COMPRESSION_THRESHOLD]
|
||||
?.floatValue;
|
||||
if (experimentValue !== undefined && experimentValue !== 0) {
|
||||
return experimentValue;
|
||||
}
|
||||
}
|
||||
|
||||
return getDefaultValue(key);
|
||||
}
|
||||
|
||||
/**
|
||||
* Get all setting keys that require restart
|
||||
*/
|
||||
|
||||
Reference in New Issue
Block a user