fix(codex): load context defaults from CPA model definitions
- Resolve context limits from core model definitions, aliases, and configuration - Preserve user overrides and display context sources and fallback hints - Refresh defaults from CPA when restoring all model settings - Keep restore-all available without customizations and remove its icon - Allow saving restored defaults even when values remain unchanged - Add regression coverage for context resolution and default restoration
This commit is contained in:
1 parent
ce9944c316
commit
40ba85d6f0
10 files changed
+452
-66
No files matched your search
@@ -25,6 +25,7 @@ export type CodexModelConfiguration = {
|
||||
export type CodexCatalogEditorModel = {
|
||||
slug: string;
|
||||
hasOfficialTemplate: boolean;
|
||||
contextSource: "definition" | "configuration" | "compatibility" | "template";
|
||||
customized: boolean;
|
||||
configuration: CodexModelConfiguration;
|
||||
defaults: CodexModelConfiguration;
|
||||
@@ -35,6 +36,14 @@ export type CodexCatalogEditorSnapshot = {
|
||||
models: CodexCatalogEditorModel[];
|
||||
};
|
||||
|
||||
export function codexContextSourceHint(model: CodexCatalogEditorModel): MessageKey {
|
||||
if (model.configuration.context_window !== model.defaults.context_window
|
||||
|| model.configuration.max_context_window !== model.defaults.max_context_window) {
|
||||
return "agents.catalog.contextSource.customized";
|
||||
}
|
||||
return `agents.catalog.contextSource.${model.contextSource ?? "template"}`;
|
||||
}
|
||||
|
||||
export type CodexCatalogEditorSaveResult = {
|
||||
snapshot: CodexCatalogEditorSnapshot;
|
||||
synchronizationError: string | null;
|
||||
|
||||
Reference in new issue
Block a user