From 5b6339d78cbf9d531728e7155a0a6dfb16b4165f Mon Sep 17 00:00:00 2001 From: Jason Date: Sat, 25 Apr 2026 12:12:38 +0800 Subject: [PATCH] chore(codex): hide 1M context window toggle in provider edit form Codex models no longer accept model_context_window=1000000, so the toggle and its paired auto-compact-limit input are commented out in the provider edit form. State hooks, helper imports, and i18n keys are preserved so the UI can be restored in one batch if upstream support returns. The TOML editor remains visible, allowing manual edits if needed. --- .../providers/forms/CodexConfigSections.tsx | 20 ++++++++++++------- 1 file changed, 13 insertions(+), 7 deletions(-) diff --git a/src/components/providers/forms/CodexConfigSections.tsx b/src/components/providers/forms/CodexConfigSections.tsx index 280528392..8ce78eb30 100644 --- a/src/components/providers/forms/CodexConfigSections.tsx +++ b/src/components/providers/forms/CodexConfigSections.tsx @@ -1,17 +1,17 @@ -import React, { - useCallback, - useEffect, - useMemo, - useRef, - useState, -} from "react"; +// NOTE: Codex 1M 上下文 UI 已暂时隐藏(详见下方 CodexConfigSection 内 JSX 注释)。 +// 如需恢复,请同时: +// - 在下方 React import 中加回 `useMemo` +// - 取消下面 `@/utils/providerConfigUtils` import 的注释 +import React, { useCallback, useEffect, useRef, useState } from "react"; import { useTranslation } from "react-i18next"; import JsonEditor from "@/components/JsonEditor"; +/* import { extractCodexTopLevelInt, setCodexTopLevelInt, removeCodexTopLevelField, } from "@/utils/providerConfigUtils"; +*/ interface CodexAuthSectionProps { value: string; @@ -144,6 +144,8 @@ export const CodexConfigSection: React.FC = ({ [onChange], ); + // Codex 1M 上下文相关状态/回调暂时禁用——见同文件下方 JSX 注释处的恢复说明。 + /* // Parse toggle states from TOML text const toggleStates = useMemo(() => { const contextWindow = extractCodexTopLevelInt( @@ -211,6 +213,7 @@ export const CodexConfigSection: React.FC = ({ useEffect(() => { return () => clearTimeout(compactTimerRef.current); }, []); + */ return (
@@ -249,6 +252,8 @@ export const CodexConfigSection: React.FC = ({

)} + {/* Codex 1M 上下文 UI 已隐藏:模型不再支持该字段。 + 恢复方法:(1) 取消本段 JSX 注释;(2) 取消文件顶部 import 中 useMemo / extractCodexTopLevelInt / setCodexTopLevelInt / removeCodexTopLevelField 的注释;(3) 取消下方 toggleStates / compactTimerRef / handleContextWindowToggle / handleCompactLimitChange / cleanup useEffect 的注释。
+ */}