refactor: consolidate provider form components

This commit completes Stage 2.5-2.6 of the refactoring plan by:

- Consolidating 8 provider form files (1941+ lines) into a single
  unified ProviderForm component (353 lines), reducing code by ~82%
- Implementing modern form management with react-hook-form and zod
- Adding preset provider categorization with grouped select UI
- Supporting dual-mode operation for both Claude and Codex configs
- Removing redundant subcomponents:
  - ApiKeyInput.tsx (72 lines)
  - ClaudeConfigEditor.tsx (205 lines)
  - CodexConfigEditor.tsx (667 lines)
  - EndpointSpeedTest.tsx (636 lines)
  - KimiModelSelector.tsx (195 lines)
  - PresetSelector.tsx (119 lines)

Key improvements:
- Type-safe form values with ProviderFormValues extension
- Automatic template value application for presets
- Better internationalization coverage
- Cleaner separation of concerns
- Enhanced UX with categorized preset groups

Updates AddProviderDialog and EditProviderDialog to pass appType prop
and handle preset category metadata.
This commit is contained in:
Jason
2025-10-16 13:02:38 +08:00
parent f3e7412a14
commit bb48f4f6af
12 changed files with 222 additions and 3851 deletions

View File

@@ -205,9 +205,10 @@ pnpm add class-variance-authority clsx tailwind-merge tailwindcss-animate
### 2.6 清理旧组件
- [ ] 删除 `src/components/AddProviderModal.tsx`
- [ ] 删除 `src/components/EditProviderModal.tsx`
- [ ] 更新所有引用这些组件的地方
- [x] 删除 `src/components/AddProviderModal.tsx`
- [x] 删除 `src/components/EditProviderModal.tsx`
- [x] 更新所有引用这些组件的地方
- [x] 删除 `src/components/ProviderForm.tsx``src/components/ProviderForm/`
**完成时间**: ___________
**遇到的问题**: ___________