refactor(codex): simplify custom template with minimal config
**Changes:** - Remove all comments from custom template (align with Claude/Gemini) - Remove base_url field from template (user fills in form instead) - Simplify getCodexCustomTemplate() - no locale parameter needed - Keep preset configurations unchanged with their baseUrl values **Template now contains only:** - model_provider, model, model_reasoning_effort - disable_response_storage - [model_providers.custom] section with minimal fields **Benefits:** - ✅ Cleaner, more focused template - ✅ Consistent with other apps (no comments) - ✅ Forces users to fill base_url via form field - ✅ Reduced template size from 35+ lines to 12 lines Net change: -74 lines (codexTemplates.ts)
This commit is contained in:
@@ -90,7 +90,7 @@ export function ProviderForm({
|
||||
initialData,
|
||||
showButtons = true,
|
||||
}: ProviderFormProps) {
|
||||
const { t, i18n } = useTranslation();
|
||||
const { t } = useTranslation();
|
||||
const isEditMode = Boolean(initialData);
|
||||
|
||||
const [selectedPresetId, setSelectedPresetId] = useState<string | null>(
|
||||
@@ -221,14 +221,13 @@ export function ProviderForm({
|
||||
[originalHandleCodexConfigChange, debouncedValidate],
|
||||
);
|
||||
|
||||
// Codex 新建模式:初始化时自动填充模板(支持国际化)
|
||||
// Codex 新建模式:初始化时自动填充模板
|
||||
useEffect(() => {
|
||||
if (appId === "codex" && !initialData && selectedPresetId === "custom") {
|
||||
const locale = (i18n.language || "zh").startsWith("zh") ? "zh" : "en";
|
||||
const template = getCodexCustomTemplate(locale);
|
||||
const template = getCodexCustomTemplate();
|
||||
resetCodexConfig(template.auth, template.config);
|
||||
}
|
||||
}, [appId, initialData, selectedPresetId, resetCodexConfig, i18n.language]);
|
||||
}, [appId, initialData, selectedPresetId, resetCodexConfig]);
|
||||
|
||||
useEffect(() => {
|
||||
form.reset(defaultValues);
|
||||
@@ -535,10 +534,9 @@ export function ProviderForm({
|
||||
setActivePreset(null);
|
||||
form.reset(defaultValues);
|
||||
|
||||
// Codex 自定义模式:加载模板(支持国际化)
|
||||
// Codex 自定义模式:加载模板
|
||||
if (appId === "codex") {
|
||||
const locale = (i18n.language || "zh").startsWith("zh") ? "zh" : "en";
|
||||
const template = getCodexCustomTemplate(locale);
|
||||
const template = getCodexCustomTemplate();
|
||||
resetCodexConfig(template.auth, template.config);
|
||||
}
|
||||
// Gemini 自定义模式:重置为空配置
|
||||
|
||||
Reference in New Issue
Block a user