refactor(ui): remove redundant KimiModelSelector and unify model configuration
Remove KimiModelSelector component and useKimiModelSelector hook to eliminate code duplication and unify model configuration across all Claude-compatible providers. **Problem Statement:** Previously, we maintained two separate implementations for the same functionality: - KimiModelSelector: API-driven dropdown with 211 lines of code - ClaudeFormFields: Simple text inputs for model configuration After removing API fetching logic from KimiModelSelector, both components became functionally identical (4 text inputs), violating DRY principle and creating unnecessary maintenance burden. **Changes:** Backend (Rust): - No changes (model normalization logic already in place) Frontend (React): - Delete KimiModelSelector.tsx (-211 lines) - Delete useKimiModelSelector.ts (-142 lines) - Update ClaudeFormFields.tsx: remove Kimi-specific props (-35 lines) - Update ProviderForm.tsx: unify display logic (-31 lines) - Clean up hooks/index.ts: remove useKimiModelSelector export (-1 line) Configuration: - Update Kimi preset: kimi-k2-turbo-preview → kimi-k2-0905-preview * Uses official September 2025 release * 256K context window (vs 128K in older version) Internationalization: - Remove kimiSelector.* i18n keys (15 keys × 2 languages = -36 lines) - Remove providerForm.kimiApiKeyHint **Unified Architecture:** Before (complex branching): ProviderForm ├─ if Kimi → useKimiModelSelector → KimiModelSelector (4 inputs) └─ else → useModelState → ClaudeFormFields inline (4 inputs) After (single path): ProviderForm └─ useModelState → ClaudeFormFields (4 inputs for all providers) Display logic simplified: - Old: shouldShowModelSelector = category !== "official" && !shouldShowKimiSelector - New: shouldShowModelSelector = category !== "official" **Impact:** Code Quality: - Remove 457 lines of redundant code (-98.5%) - Eliminate dual-track maintenance - Improve code consistency - Pass TypeScript type checking with zero errors - Zero remaining references to deleted code User Experience: - Consistent UI across all providers (including Kimi) - Same model configuration workflow for everyone - No functional changes from user perspective Architecture: - Single source of truth for model configuration - Easier to extend for future providers - Reduced bundle size (removed lucide-react icons dependency) **Testing:** - ✅ TypeScript compilation passes - ✅ No dangling references - ✅ All model configuration fields functional - ✅ Display logic works for official/cn_official/aggregator categories **Migration Notes:** - Existing Kimi users: configurations automatically upgraded to new model name - No manual intervention required - Backend normalization ensures backward compatibility
This commit is contained in:
@@ -5,7 +5,6 @@ export { useModelState } from "./useModelState";
|
||||
export { useCodexConfigState } from "./useCodexConfigState";
|
||||
export { useApiKeyLink } from "./useApiKeyLink";
|
||||
export { useCustomEndpoints } from "./useCustomEndpoints";
|
||||
export { useKimiModelSelector } from "./useKimiModelSelector";
|
||||
export { useTemplateValues } from "./useTemplateValues";
|
||||
export { useCommonConfigSnippet } from "./useCommonConfigSnippet";
|
||||
export { useCodexCommonConfig } from "./useCodexCommonConfig";
|
||||
|
||||
Reference in New Issue
Block a user