- Location:
frontend-next/src/components/workspace/openai-settings-view.tsx - Key Features:
- Horizontal tab layout (Models, API Keys)
- Multi-step setup flow
- API key validation and management
- Model fetching and configuration
- Real-time API integration
- Tab Management:
activeTabstate for switching between 'keys' and 'models' - Keys Management:
keysarray for storing API keyseditingKeyfor edit modekeyFormfor form dataisValidatingKeyfor validation stateisKeyModalOpenfor modal control
- Models Management:
modelConfigsfor configured modelsavailableModelsfor fetched modelsisAddModelModalOpenfor modal controlselectedKeyForModelfor key selection
- TanStack Query Usage:
useQueryfor fetching keys and model configsuseMutationfor CRUD operations- Query invalidation for real-time updates
- API Endpoints:
/openai-providersfor key management/openai-model-configsfor model configurations- Real API calls to OpenAI for model fetching
- Horizontal Tabs: Models and API Keys sections
- Empty States: Dedicated empty state components for no keys/models
- Modal Dialogs: For adding/editing keys and models
- Dropdown Menus: For key selection when multiple keys exist
- Loading States: Spinners and disabled states during operations
- Toast Notifications: Success/error feedback
- Provider Configuration: API endpoints, model structure, validation rules
- Generic API Service: Unified interface for different provider APIs
- Configurable UI Elements: Provider-specific labels, descriptions, icons
- Model Capabilities: Different providers have different capability structures
- Validation Logic: Provider-specific API key validation patterns