refactor(codex): remove configuration wizard and unify provider setup experience

- Remove CodexQuickWizardModal component (~300 lines)
- Add "Custom (Blank Template)" preset with annotated TOML template
- Unify configuration experience across Claude/Codex/Gemini
- Remove wizard-related i18n keys, keep apiUrlLabel for CodexFormFields
- Simplify component integration by removing wizard state management

This change reduces code complexity by ~250 lines while providing better
user education through commented configuration templates in Chinese.

Users can now:
1. Select "Custom (Blank Template)" preset
2. See annotated TOML template with inline documentation
3. Follow step-by-step comments to configure custom providers

BREAKING CHANGE: Configuration wizard UI removed, replaced with template-based approach
This commit is contained in:
Jason
2025-11-16 12:29:18 +08:00
parent 031ea3a58f
commit 6a6980c82c
7 changed files with 49 additions and 419 deletions

View File

@@ -1,6 +1,5 @@
import React, { useState, useEffect } from "react";
import { CodexAuthSection, CodexConfigSection } from "./CodexConfigSections";
import { CodexQuickWizardModal } from "./CodexQuickWizardModal";
import { CodexCommonConfigModal } from "./CodexCommonConfigModal";
interface CodexConfigEditorProps {
@@ -27,14 +26,6 @@ interface CodexConfigEditorProps {
authError: string;
configError: string; // config.toml 错误提示
onWebsiteUrlChange?: (url: string) => void; // 更新网址回调
isTemplateModalOpen?: boolean; // 模态框状态
setIsTemplateModalOpen?: (open: boolean) => void; // 设置模态框状态
onNameChange?: (name: string) => void; // 更新供应商名称回调
}
const CodexConfigEditor: React.FC<CodexConfigEditorProps> = ({
@@ -50,21 +41,9 @@ const CodexConfigEditor: React.FC<CodexConfigEditorProps> = ({
commonConfigError,
authError,
configError,
onWebsiteUrlChange,
onNameChange,
isTemplateModalOpen: externalTemplateModalOpen,
setIsTemplateModalOpen: externalSetTemplateModalOpen,
}) => {
const [isCommonConfigModalOpen, setIsCommonConfigModalOpen] = useState(false);
// Use internal state or external state
const [internalTemplateModalOpen, setInternalTemplateModalOpen] =
useState(false);
const isTemplateModalOpen =
externalTemplateModalOpen ?? internalTemplateModalOpen;
const setIsTemplateModalOpen =
externalSetTemplateModalOpen ?? setInternalTemplateModalOpen;
// Auto-open common config modal if there's an error
useEffect(() => {
if (commonConfigError && !isCommonConfigModalOpen) {
@@ -72,23 +51,6 @@ const CodexConfigEditor: React.FC<CodexConfigEditorProps> = ({
}
}, [commonConfigError, isCommonConfigModalOpen]);
const handleQuickWizardApply = (
auth: string,
config: string,
extras: { websiteUrl?: string; displayName?: string },
) => {
onAuthChange(auth);
onConfigChange(config);
if (onWebsiteUrlChange && extras.websiteUrl) {
onWebsiteUrlChange(extras.websiteUrl);
}
if (onNameChange && extras.displayName) {
onNameChange(extras.displayName);
}
};
return (
<div className="space-y-6">
{/* Auth JSON Section */}
@@ -110,13 +72,6 @@ const CodexConfigEditor: React.FC<CodexConfigEditorProps> = ({
configError={configError}
/>
{/* Quick Wizard Modal */}
<CodexQuickWizardModal
isOpen={isTemplateModalOpen}
onClose={() => setIsTemplateModalOpen(false)}
onApply={handleQuickWizardApply}
/>
{/* Common Config Modal */}
<CodexCommonConfigModal
isOpen={isCommonConfigModalOpen}