mirror of
https://github.com/farion1231/cc-switch.git
synced 2026-07-26 06:24:32 +08:00
12112e9d7d
**Changes:** - Create src/config/codexTemplates.ts with getCodexCustomTemplate factory - Support both Chinese and English templates based on i18n.language - Remove 70 lines of duplicated template strings from ProviderForm.tsx - Update both useEffect and handlePresetChange to use template factory - Clean up unused "Custom (Blank Template)" preset entry **Benefits:** - ✅ Eliminates code duplication (35-line template repeated twice) - ✅ Adds internationalization support for English users - ✅ Follows project architecture (templates in config/ directory) - ✅ Improves maintainability (single source of truth) - ✅ Net reduction: 34 lines (81 additions, 115 deletions) **Technical Details:** - Template selection logic: (i18n.language || "zh").startsWith("zh") ? "zh" : "en" - Templates are identical except for comments language - Both auth and config are returned as a single CodexTemplate object Addresses DRY principle violation and architectural concerns identified in code review.