You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
refactor(env): modernize model configuration environment variables
This PR refactors the model configuration system with improved naming conventions
and better type safety while maintaining backward compatibility.
Key Changes:
1. Environment Variable Naming Convention Updates:
- Renamed OPENAI_* → MODEL_* for public API variables
* OPENAI_API_KEY → MODEL_API_KEY (deprecated, backward compatible)
* OPENAI_BASE_URL → MODEL_BASE_URL (deprecated, backward compatible)
- Renamed MIDSCENE_*_VL_MODE → MIDSCENE_*_LOCATOR_MODE across all intents
* MIDSCENE_VL_MODE → MIDSCENE_LOCATOR_MODE
* MIDSCENE_VQA_VL_MODE → MIDSCENE_VQA_LOCATOR_MODE
* MIDSCENE_PLANNING_VL_MODE → MIDSCENE_PLANNING_LOCATOR_MODE
* MIDSCENE_GROUNDING_VL_MODE → MIDSCENE_GROUNDING_LOCATOR_MODE
- Updated all internal MIDSCENE_*_OPENAI_* → MIDSCENE_*_MODEL_*
* MIDSCENE_VQA_OPENAI_API_KEY → MIDSCENE_VQA_MODEL_API_KEY
* MIDSCENE_PLANNING_OPENAI_API_KEY → MIDSCENE_PLANNING_MODEL_API_KEY
* MIDSCENE_GROUNDING_OPENAI_API_KEY → MIDSCENE_GROUNDING_MODEL_API_KEY
* (and corresponding BASE_URL variables)
2. Type System Improvements:
- Split TModelConfigFn into public and internal types
- Public API (TModelConfigFn) no longer exposes 'intent' parameter
- Internal type (TModelConfigFnInternal) maintains intent parameter
- Users can still optionally use intent parameter via type casting
3. Backward Compatibility:
- Maintained compatibility for documented public variables (OPENAI_API_KEY, OPENAI_BASE_URL)
- New variables take precedence, fallback to legacy names if not set
- Only public documented variables are deprecated, internal variables renamed directly
4. Updated Files:
- packages/shared/src/env/types.ts - Type definitions and constants
- packages/shared/src/env/constants.ts - Config key mappings
- packages/shared/src/env/decide-model-config.ts - Compatibility logic
- packages/shared/src/env/model-config-manager.ts - Type casting implementation
- packages/shared/src/env/init-debug.ts - Debug variable updates
- All test files updated to use new variable names
Testing:
- All 24 model-config-manager tests passing
- Overall test suite: 241 tests passing
🤖 Generated with [Claude Code](https://claude.com/claude-code)
Co-Authored-By: Claude <[email protected]>
0 commit comments