fix: flex-mode via config/flag (#813)
* Add flexMode to stored config, and use it during config loading unless the flag is explicitly passed. * If the config asks for flexMode and the model doesn't support it, silently disable flexMode. Resolves #803
This commit is contained in:
@@ -309,7 +309,7 @@ config = {
|
|||||||
notify: Boolean(cli.flags.notify),
|
notify: Boolean(cli.flags.notify),
|
||||||
reasoningEffort:
|
reasoningEffort:
|
||||||
(cli.flags.reasoning as ReasoningEffort | undefined) ?? "high",
|
(cli.flags.reasoning as ReasoningEffort | undefined) ?? "high",
|
||||||
flexMode: Boolean(cli.flags.flexMode),
|
flexMode: cli.flags.flexMode || (config.flexMode ?? false),
|
||||||
provider,
|
provider,
|
||||||
disableResponseStorage,
|
disableResponseStorage,
|
||||||
};
|
};
|
||||||
@@ -323,15 +323,19 @@ try {
|
|||||||
}
|
}
|
||||||
|
|
||||||
// For --flex-mode, validate and exit if incorrect.
|
// For --flex-mode, validate and exit if incorrect.
|
||||||
if (cli.flags.flexMode) {
|
if (config.flexMode) {
|
||||||
const allowedFlexModels = new Set(["o3", "o4-mini"]);
|
const allowedFlexModels = new Set(["o3", "o4-mini"]);
|
||||||
if (!allowedFlexModels.has(config.model)) {
|
if (!allowedFlexModels.has(config.model)) {
|
||||||
// eslint-disable-next-line no-console
|
if (cli.flags.flexMode) {
|
||||||
console.error(
|
// eslint-disable-next-line no-console
|
||||||
`The --flex-mode option is only supported when using the 'o3' or 'o4-mini' models. ` +
|
console.error(
|
||||||
`Current model: '${config.model}'.`,
|
`The --flex-mode option is only supported when using the 'o3' or 'o4-mini' models. ` +
|
||||||
);
|
`Current model: '${config.model}'.`,
|
||||||
process.exit(1);
|
);
|
||||||
|
process.exit(1);
|
||||||
|
} else {
|
||||||
|
config.flexMode = false;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -146,6 +146,7 @@ export type StoredConfig = {
|
|||||||
notify?: boolean;
|
notify?: boolean;
|
||||||
/** Disable server-side response storage (send full transcript each request) */
|
/** Disable server-side response storage (send full transcript each request) */
|
||||||
disableResponseStorage?: boolean;
|
disableResponseStorage?: boolean;
|
||||||
|
flexMode?: boolean;
|
||||||
providers?: Record<string, { name: string; baseURL: string; envKey: string }>;
|
providers?: Record<string, { name: string; baseURL: string; envKey: string }>;
|
||||||
history?: {
|
history?: {
|
||||||
maxSize?: number;
|
maxSize?: number;
|
||||||
@@ -489,6 +490,10 @@ export const loadConfig = (
|
|||||||
}
|
}
|
||||||
// Notification setting: enable desktop notifications when set in config
|
// Notification setting: enable desktop notifications when set in config
|
||||||
config.notify = storedConfig.notify === true;
|
config.notify = storedConfig.notify === true;
|
||||||
|
// Flex-mode setting: enable the flex-mode service tier when set in config
|
||||||
|
if (storedConfig.flexMode !== undefined) {
|
||||||
|
config.flexMode = storedConfig.flexMode;
|
||||||
|
}
|
||||||
|
|
||||||
// Add default history config if not provided
|
// Add default history config if not provided
|
||||||
if (storedConfig.history !== undefined) {
|
if (storedConfig.history !== undefined) {
|
||||||
@@ -543,6 +548,7 @@ export const saveConfig = (
|
|||||||
providers: config.providers,
|
providers: config.providers,
|
||||||
approvalMode: config.approvalMode,
|
approvalMode: config.approvalMode,
|
||||||
disableResponseStorage: config.disableResponseStorage,
|
disableResponseStorage: config.disableResponseStorage,
|
||||||
|
flexMode: config.flexMode,
|
||||||
reasoningEffort: config.reasoningEffort,
|
reasoningEffort: config.reasoningEffort,
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user