Spaces:
Paused
Paused
icebear0828 Claude Opus 4.6 commited on
Commit ·
5b8472d
1
Parent(s): 3c0eaf7
fix: auto-admit new Codex models from backend API
Browse filesPreviously applyBackendModels() filtered out any model not in the
static YAML catalog. New Codex releases (e.g. gpt-5.4-codex) were
silently dropped. Now models matching gpt-*-codex* pass through.
Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
- src/models/model-store.ts +10 -5
src/models/model-store.ts
CHANGED
|
@@ -115,6 +115,11 @@ function normalizeBackendModel(raw: BackendModelEntry): NormalizedModelWithMeta
|
|
| 115 |
};
|
| 116 |
}
|
| 117 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 118 |
/**
|
| 119 |
* Merge backend models into the catalog.
|
| 120 |
*
|
|
@@ -122,17 +127,17 @@ function normalizeBackendModel(raw: BackendModelEntry): NormalizedModelWithMeta
|
|
| 122 |
* - Backend models overwrite static models with the same ID
|
| 123 |
* (but YAML fields fill in missing backend fields)
|
| 124 |
* - Static-only models are preserved (YAML may know about models the backend doesn't list)
|
|
|
|
| 125 |
* - Aliases are never touched (always from YAML)
|
| 126 |
*/
|
| 127 |
export function applyBackendModels(backendModels: BackendModelEntry[]): void {
|
| 128 |
-
//
|
| 129 |
-
//
|
| 130 |
-
//
|
| 131 |
-
// entering the catalog and breaking resolveModelId() fallback logic.
|
| 132 |
const staticIds = new Set(_catalog.map((m) => m.id));
|
| 133 |
const filtered = backendModels.filter((raw) => {
|
| 134 |
const id = raw.slug ?? raw.id ?? raw.name ?? "";
|
| 135 |
-
return staticIds.has(id);
|
| 136 |
});
|
| 137 |
|
| 138 |
const staticMap = new Map(_catalog.map((m) => [m.id, m]));
|
|
|
|
| 115 |
};
|
| 116 |
}
|
| 117 |
|
| 118 |
+
/** Check if a model ID is a Codex model (gpt-X.Y-codex or gpt-X.Y-codex-tier). */
|
| 119 |
+
function isCodexModelId(id: string): boolean {
|
| 120 |
+
return /^gpt-\d+(\.\d+)?-codex/.test(id);
|
| 121 |
+
}
|
| 122 |
+
|
| 123 |
/**
|
| 124 |
* Merge backend models into the catalog.
|
| 125 |
*
|
|
|
|
| 127 |
* - Backend models overwrite static models with the same ID
|
| 128 |
* (but YAML fields fill in missing backend fields)
|
| 129 |
* - Static-only models are preserved (YAML may know about models the backend doesn't list)
|
| 130 |
+
* - New Codex models from backend are auto-admitted (prevents missing new releases)
|
| 131 |
* - Aliases are never touched (always from YAML)
|
| 132 |
*/
|
| 133 |
export function applyBackendModels(backendModels: BackendModelEntry[]): void {
|
| 134 |
+
// Keep models that either exist in static catalog OR are Codex models.
|
| 135 |
+
// This prevents ChatGPT-only slugs (gpt-5-2, research, etc.) from
|
| 136 |
+
// entering the catalog, while auto-admitting new Codex releases.
|
|
|
|
| 137 |
const staticIds = new Set(_catalog.map((m) => m.id));
|
| 138 |
const filtered = backendModels.filter((raw) => {
|
| 139 |
const id = raw.slug ?? raw.id ?? raw.name ?? "";
|
| 140 |
+
return staticIds.has(id) || isCodexModelId(id);
|
| 141 |
});
|
| 142 |
|
| 143 |
const staticMap = new Map(_catalog.map((m) => [m.id, m]));
|