Refactor model provider configuration to providerId-keyed structure (V4)#2220
Refactor model provider configuration to providerId-keyed structure (V4)#2220
Conversation
…sioning - Changed references from V3 to current version in migration tests to reflect the new SETTINGS_VERSION. - Updated test assertions to verify migration to the latest version instead of hardcoded version numbers. - Introduced new migration logic for transitioning from V3 to V4 settings structure. - Enhanced model provider configuration to support new providerId format and ensure backward compatibility.
📋 Review SummaryThis PR introduces settings version V4 with a significant refactoring of the model provider configuration structure, changing from 🔍 General Feedback
🎯 Specific Feedback🔴 Critical
🟡 High
🟢 Medium
🔵 Low
✅ Highlights
|
Code Coverage Summary
CLI Package - Full Text ReportCore Package - Full Text ReportFor detailed HTML reports, please see the 'coverage-reports-22.x-ubuntu-latest' artifact from the main CI run. |
Add generateProviderIdFromBaseUrl function to create more user-friendly provider IDs by extracting domain names from baseUrl (e.g., api.openai.com → openai). Falls back to authType-based naming when URL parsing fails. Update documentation to reflect v4 configuration format with providerId structure, including new migration guide section. Co-authored-by: Qwen-Coder <qwen-coder@alibabacloud.com>
…ix chars - Change selection indicator from ● to › for better visual alignment - Add prefix character system (›, ↑, ↓) aligned with SessionPicker - Add centerSelection prop to keep selected item centered in visible window - Change scroll indicators from ▲/▼ to ↑/↓ for Unicode consistency - Update DescriptiveRadioButtonSelect to support centerSelection - Add height=2 and description fallback for consistent layout Co-authored-by: Qwen-Coder <qwen-coder@alibabacloud.com>
Update migration tests to expect providerIds generated from baseUrl domains (e.g., 'my-proxy' instead of 'openai-2', 'api-1' instead of 'openai'). feat(ui): enable scroll indicators in ModelDialog Add maxItemsToShow, showScrollArrows, and centerSelection props to BaseSelectionList in ModelDialog for improved scrolling UX. Co-authored-by: Qwen-Coder <qwen-coder@alibabacloud.com>
Add backupSettingsFile call before updating Coding Plan provider configuration to preserve user settings in case of migration issues. Co-authored-by: Qwen-Coder <qwen-coder@alibabacloud.com>
Update test snapshots to reflect the change from ● to › for selection indicator, and fix useCodingPlanUpdates test mock. Co-authored-by: Qwen-Coder <qwen-coder@alibabacloud.com>
|
toV4Model drops capabilities field during migration In packages/cli/src/config/migration/versions/v3-to-v4.ts, the toV4Model function strips envKey and baseUrl (correctly), but also silently drops the capabilities field. The new ModelConfig type does include an optional capabilities field. Users who had capabilities: { vision: true } on V3 models will lose that data after migration. The test changes in modelsConfig.test.ts confirm this — expectations changed from isVision: true / capabilities: { vision: true } to isVision: false / capabilities: {}, which suggests capabilities on provider models may be silently broken. |
TLDR
This PR introduces settings version V4 with a refactored model provider configuration structure, changing from authType-keyed arrays to providerId-keyed objects. It adds a new
--providerIdCLI flag for explicit provider selection and implements the V3→V4 migration path. All existing tests are updated to reflect the new settings version and configuration format.Todo Actions
Dive Deeper
Settings Migration V3→V4
v3-to-v4.tsmigration that transformsmodelProvidersfrom an array format (keyed by authType) to an object format (keyed by providerId){ authType, envKey, baseUrl?, models: [] }ALL_MIGRATIONSto include the V3→V4 migrationModel Provider Configuration Refactor
Before (V3):
After (V4):
This change allows multiple providers of the same authType with different configurations.
CLI Changes
--providerIdflag to allow explicit provider selection at startupauth.tsto iterate over provider objects instead of authType-keyed arrays--providerIdover settingsTest Updates
SETTINGS_VERSIONconstant instead of hardcoded version numbersReviewer Test Plan
Test settings migration:
npm test -- integration-tests/settings-migration.test.tsVerify V1, V2, and V3 settings all migrate correctly to V4
Test CLI provider selection:
Verify the specified provider is selected
Test auth validation:
Run full test suite:
npm testTesting Matrix
Linked issues / bug
Fixes #1820