Skip to content

Commit 4530db4

Browse files
committed
feat(gui): let the openai native group manage its own context window
The native card was the one provider card with no context control and no "+" button. The cause was a single `!isNative` guard hiding three things at once, and `isNative` meant "every row in this group is native" — which is not the same question as "is this the passthrough provider". Groups now carry `nativeProviderGroup` for identity. The badge, the hint and the sort order follow it, so adding one custom model no longer turns the passthrough card into an ordinary one halfway through the session. The cap switch and the custom-add button are now visible for the native group; both already worked server-side. The context-window button stays hidden there on purpose: its modal saves through PATCH /api/providers, which the canonical `openai` seed check answers with a 400. The cap select is the control that actually reaches native rows, so that is what the card offers. That select gets a native-only ladder of the three windows the family has a contract for — 272k (live catalog), 372k (previous contract) and 1.05M (measured) — instead of the generic 100k…950k list. Its option set is chosen alongside the list, since the select only inserts a saved value when its own set is missing it. `fmtK` also learns to say "1.05M": it used to render that as "1050k".
1 parent 5395e7d commit 4530db4

13 files changed

Lines changed: 137 additions & 39 deletions

File tree

‎gui/src/i18n/de.ts‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -482,7 +482,7 @@ export const de: Record<TKey, string> = {
482482
"models.subtitle.routing": "Policy-Profile, Dry-Run-Auswertung und quellenbasierte Routing-Analysen.",
483483
"models.subtitle": "Steuere, welche Modelle Codex sieht — natives GPT-Passthrough und geroutete Anbieter, nach Anbieter gruppiert (Kopfzeile zum Einklappen anklicken). Ausgeblendete Modelle fehlen in Katalog und Auswahl, bleiben aber per genauer ID aufrufbar. Änderungen gelten bei der nächsten Codex-Runde — opencodex invalidiert Codex 5-Minuten-Modell-Cache, kein Neustart nötig.",
484484
"models.nativeGroupLabel": "OpenAI nativ",
485-
"models.nativeHint": "Passthrough-Modelle verwenden die unter Anbieter gewählte Pool- oder Direkt-Option. Ausblenden entfernt sie aus der Codex-Auswahl (Katalogeintrag bleibt, Reaktivierung stellt exakt wieder her).",
485+
"models.nativeHint": "Passthrough-Modelle verwenden die unter Anbieter gewählte Pool- oder Direkt-Option. Ausblenden entfernt sie aus der Codex-Auswahl (Katalogeintrag bleibt, Reaktivierung stellt exakt wieder her). Ein hier hinzugefügtes Modell wird als gerouteter `openai/<model>`-Selektor registriert, nicht als neue reine Passthrough-ID.",
486486
"models.active": "{active}/{total} sichtbar",
487487
"models.workspace.providers": "Anbieter",
488488
"models.workspace.allProviders": "Alle Anbieter",

‎gui/src/i18n/en.ts‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -507,7 +507,7 @@ export const en = {
507507
"models.subtitle.routing": "Policy profiles, dry-run evaluation, and source-backed routing analytics.",
508508
"models.subtitle": "Toggle which models Codex sees — native GPT passthrough and routed providers, grouped by provider (click a header to collapse). Hidden models stay off the catalog + model picker but remain directly callable by exact id. Changes apply on the next Codex turn — opencodex invalidates Codex's 5-min model cache so no restart is needed.",
509509
"models.nativeGroupLabel": "OpenAI native",
510-
"models.nativeHint": "Passthrough models use the Pool or Direct account option selected on Providers. Toggling one off hides it from the Codex picker (the catalog entry is kept, so re-enabling restores it exactly).",
510+
"models.nativeHint": "Passthrough models use the Pool or Direct account option selected on Providers. Toggling one off hides it from the Codex picker (the catalog entry is kept, so re-enabling restores it exactly). Adding a model here registers a routed `openai/<model>` selector, not a new bare passthrough id.",
511511
"models.active": "{active}/{total} visible",
512512
"models.workspace.providers": "Providers",
513513
"models.workspace.allProviders": "All providers",

‎gui/src/i18n/fr.ts‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -492,7 +492,7 @@ export const fr: Record<TKey, string> = {
492492
"models.subtitle.routing": "Profils de stratégie, évaluation à blanc et analyses de routage fondées sur les sources.",
493493
"models.subtitle": "Choisissez les modèles visibles par Codex — accès direct aux GPT natifs et fournisseurs routés, regroupés par fournisseur (cliquez sur un en-tête pour le réduire). Les modèles masqués sont retirés du catalogue et du sélecteur, mais restent directement accessibles par leur identifiant exact. Les modifications s’appliquent au prochain tour Codex — opencodex invalide le cache de modèles de Codex de 5 min, sans nécessiter de redémarrage.",
494494
"models.nativeGroupLabel": "OpenAI natif",
495-
"models.nativeHint": "Les modèles en accès direct utilisent l’option de compte Groupe ou Direct sélectionnée dans Fournisseurs. La désactivation d’un modèle le masque dans le sélecteur Codex (son entrée de catalogue est conservée afin que sa réactivation la restaure à l’identique).",
495+
"models.nativeHint": "Les modèles en accès direct utilisent l’option de compte Groupe ou Direct sélectionnée dans Fournisseurs. La désactivation d’un modèle le masque dans le sélecteur Codex (son entrée de catalogue est conservée afin que sa réactivation la restaure à l’identique). Ajouter un modèle ici enregistre un sélecteur routé `openai/<model>`, et non un nouvel identifiant passthrough brut.",
496496
"models.active": "{active}/{total} visibles",
497497
"models.workspace.providers": "Fournisseurs",
498498
"models.workspace.allProviders": "Tous les fournisseurs",

‎gui/src/i18n/ja.ts‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -490,7 +490,7 @@ export const ja: Record<TKey, string> = {
490490
"models.subtitle.routing": "ポリシープロファイル、dry-run 評価、そして根拠の残るルーティング分析です。",
491491
"models.subtitle": "Codex に表示するモデルを切り替えます — ネイティブ GPT パススルーとルーティングプロバイダー、プロバイダー別(ヘッダーをクリックで折りたたみ)。非表示モデルはカタログとピッカーから外れますが、正確な id での直接呼び出しは可能です。変更は次回の Codex ターンで適用 — opencodex は Codex の 5 分間モデルキャッシュを無効化するので再起動は不要です。",
492492
"models.nativeGroupLabel": "OpenAI ネイティブ",
493-
"models.nativeHint": "パススルーモデルはプロバイダーで選択したプールまたはダイレクトアカウントオプションを使用します。一つオフにすると Codex ピッカーから隠します(カタログエントリは保持されるので、再有効化で正確に復元されます)。",
493+
"models.nativeHint": "パススルーモデルはプロバイダーで選択したプールまたはダイレクトアカウントオプションを使用します。一つオフにすると Codex ピッカーから隠します(カタログエントリは保持されるので、再有効化で正確に復元されます)。 ここでモデルを追加すると、bare passthrough id ではなくルーティングされた `openai/<model>` セレクタとして登録されます。",
494494
"models.active": "{active}/{total} 表示中",
495495
"models.workspace.providers": "プロバイダー",
496496
"models.workspace.allProviders": "すべてのプロバイダー",

‎gui/src/i18n/ko.ts‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -493,7 +493,7 @@ export const ko: Record<TKey, string> = {
493493
"models.subtitle.routing": "정책 프로필, dry-run 평가, 그리고 근거가 남는 라우팅 분석입니다.",
494494
"models.subtitle": "Codex가 보는 모델을 켜고 끕니다 — 네이티브 GPT passthrough와 라우팅된 모델을 프로바이더별로 묶어 보여줍니다(헤더를 클릭하면 접힘). 숨긴 모델은 카탈로그와 선택기에서 빠지지만 정확한 id로 직접 호출할 수 있습니다. 변경 사항은 다음 Codex 턴에 적용됩니다 — opencodex가 Codex의 5분 모델 캐시를 무효화하므로 재시작이 필요 없습니다.",
495495
"models.nativeGroupLabel": "OpenAI 네이티브",
496-
"models.nativeHint": "프로바이더에서 선택한 풀 또는 직접 계정 옵션으로 서빙되는 passthrough 모델입니다. 끄면 Codex 선택기에서 숨겨지고, 카탈로그 항목은 유지되므로 다시 켜면 그대로 복원됩니다.",
496+
"models.nativeHint": "프로바이더에서 선택한 풀 또는 직접 계정 옵션으로 서빙되는 passthrough 모델입니다. 끄면 Codex 선택기에서 숨겨지고, 카탈로그 항목은 유지되므로 다시 켜면 그대로 복원됩니다. 여기서 모델을 추가하면 bare passthrough id가 아니라 라우팅된 `openai/<model>` selector로 등록됩니다.",
497497
"models.active": "{active}/{total} 표시",
498498
"models.workspace.providers": "프로바이더",
499499
"models.workspace.allProviders": "모든 프로바이더",

‎gui/src/i18n/ru.ts‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -495,7 +495,7 @@ export const ru: Record<TKey, string> = {
495495
"models.subtitle.routing": "Профили политик, оценка в режиме dry-run и аналитика маршрутизации с подтверждением источников.",
496496
"models.subtitle": "Управляйте тем, какие модели видит Codex — нативные GPT (сквозной проброс) и модели маршрутизируемых провайдеров, сгруппированные по провайдеру (нажмите на заголовок, чтобы свернуть группу). Скрытые модели исчезают из каталога и селектора, но остаются вызываемыми по точному id. Изменения применяются на следующем ходе Codex — opencodex сбрасывает 5-минутный кэш моделей Codex, поэтому перезапуск не требуется.",
497497
"models.nativeGroupLabel": "Нативные OpenAI",
498-
"models.nativeHint": "Модели сквозного проброса используют режим аккаунта (пул или прямое подключение), выбранный на странице «Провайдеры». Отключение модели скрывает её из селектора Codex (запись в каталоге сохраняется, поэтому при повторном включении она восстанавливается в точности).",
498+
"models.nativeHint": "Модели сквозного проброса используют режим аккаунта (пул или прямое подключение), выбранный на странице «Провайдеры». Отключение модели скрывает её из селектора Codex (запись в каталоге сохраняется, поэтому при повторном включении она восстанавливается в точности). Добавление модели здесь регистрирует маршрутизируемый селектор `openai/<model>`, а не новый «голый» passthrough-идентификатор.",
499499
"models.active": "{active}/{total} видимо",
500500
"models.workspace.providers": "Провайдеры",
501501
"models.workspace.allProviders": "Все провайдеры",

‎gui/src/i18n/tr.ts‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -498,7 +498,7 @@ export const tr: Record<TKey, string> = {
498498
"models.subtitle.routing": "Politika profilleri ve simülasyon değerlendirmesi.",
499499
"models.subtitle": "Codex'in göreceği modelleri açıp kapatın.",
500500
"models.nativeGroupLabel": "Yerel OpenAI",
501-
"models.nativeHint": "Doğrudan geçiş modelleri Sağlayıcılar bölümünde seçilen Havuz veya Doğrudan seçeneğini kullanır.",
501+
"models.nativeHint": "Doğrudan geçiş modelleri Sağlayıcılar bölümünde seçilen Havuz veya Doğrudan seçeneğini kullanır. Buradan model eklemek, yeni bir düz passthrough kimliği değil, yönlendirilmiş bir `openai/<model>` seçici kaydeder.",
502502
"models.active": "{active}/{total} görünür",
503503
"models.workspace.providers": "Sağlayıcılar",
504504
"models.workspace.allProviders": "Tüm sağlayıcılar",

‎gui/src/i18n/zh-TW.ts‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -374,7 +374,7 @@ export const zhTW: Record<TKey, string> = {
374374
"prov.openaiApiSetup": "設定 API 金鑰",
375375
"models.subtitle": "開關 Codex 可見的模型 — 原生 GPT passthrough 與已路由模型按供應商分組(點選標題可摺疊)。已停用的模型會從目錄和模型選擇器中隱藏。更改在下一個 Codex 回合生效 — opencodex 會使 Codex 的 5 分鐘模型快取失效,因此無需重新啟動。",
376376
"models.nativeGroupLabel": "OpenAI 原生",
377-
"models.nativeHint": "Passthrough 模型使用在供應商頁面選擇的帳號池或直連選項。關閉後會從 Codex 選擇器中隱藏(目錄條目保留,重新開啟即可完整恢復)。",
377+
"models.nativeHint": "Passthrough 模型使用在供應商頁面選擇的帳號池或直連選項。關閉後會從 Codex 選擇器中隱藏(目錄條目保留,重新開啟即可完整恢復)。 在此新增模型會註冊為路由的 `openai/<model>` 選擇器,而非新的裸 passthrough id。",
378378
"models.active": "{active}/{total} 已啟用",
379379
"models.workspace.providers": "供應商",
380380
"models.workspace.allProviders": "所有供應商",

‎gui/src/i18n/zh.ts‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -490,7 +490,7 @@ export const zh: Record<TKey, string> = {
490490
"models.subtitle.routing": "策略配置、dry-run 评估,以及有据可查的路由分析。",
491491
"models.subtitle": "开关 Codex 可见的模型 — 原生 GPT passthrough 与已路由模型按提供方分组(点击标题可折叠)。隐藏的模型不会出现在目录和模型选择器中,但仍可按精确 id 直接调用。更改在下一个 Codex 回合生效 — opencodex 会使 Codex 的 5 分钟模型缓存失效,因此无需重启。",
492492
"models.nativeGroupLabel": "OpenAI 原生",
493-
"models.nativeHint": "Passthrough 模型使用在提供方页面选择的账户池或直连选项。关闭后会从 Codex 选择器中隐藏(目录条目保留,重新开启即可完整恢复)。",
493+
"models.nativeHint": "Passthrough 模型使用在提供方页面选择的账户池或直连选项。关闭后会从 Codex 选择器中隐藏(目录条目保留,重新开启即可完整恢复)。 在此添加模型将注册为路由的 `openai/<model>` 选择器,而不是新的裸 passthrough id。",
494494
"models.active": "{active}/{total} 可见",
495495
"models.workspace.providers": "提供方",
496496
"models.workspace.allProviders": "所有提供方",

‎gui/src/models-groups.ts‎

Lines changed: 11 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -23,6 +23,15 @@ export interface ProviderModelGroup<Row> {
2323
provider: string;
2424
rows: Row[];
2525
native: boolean;
26+
/**
27+
* The provider itself is the Codex-login native passthrough, independent of what its rows
28+
* currently look like.
29+
*
30+
* `native` above answers "is every row native", which flips to false the moment a user adds
31+
* one custom model. Card identity — the native badge, the native hint, the sort — has to
32+
* survive that, so it keys off this instead.
33+
*/
34+
nativeProviderGroup: boolean;
2635
liveModels: boolean;
2736
configuredModels: string[];
2837
contextWindow?: number;
@@ -58,6 +67,7 @@ export function buildProviderModelGroups<Row extends { provider: string; native?
5867
provider,
5968
rows: providerRows,
6069
native: providerRows.length > 0 && providerRows.every(row => row.native === true),
70+
nativeProviderGroup: providerRows.some(row => row.native === true),
6171
liveModels: configured?.liveModels !== false,
6272
configuredModels: configured?.models ?? [],
6373
contextWindow: configured?.contextWindow,
@@ -66,7 +76,7 @@ export function buildProviderModelGroups<Row extends { provider: string; native?
6676
};
6777
})
6878
.sort((a, b) => {
69-
if (a.native !== b.native) return a.native ? -1 : 1;
79+
if (a.nativeProviderGroup !== b.nativeProviderGroup) return a.nativeProviderGroup ? -1 : 1;
7080
return a.provider.localeCompare(b.provider);
7181
});
7282
}

0 commit comments

Comments
 (0)