continue
continue copied to clipboard
Fix: Prioritize user-defined embed models over Transformers.js built-in
Description
When defining an embed model with roles: [embed] in the YAML config file, the extension defaults to using the built-in Transformers.js embedder instead of the user-defined model. This PR fixes this issue by ensuring user-configured embed models in config.yaml are prioritized over the built-in Transformers.js model.
Changes Made
- Updated
core/config/yaml/loadYaml.tsto:- Only add the Transformers.js embedder when no other embed models exist
- Explicitly initialize the selected embed model to prioritize non-Transformers.js models
- Enhanced
core/config/selectedModels.tsto prioritize non-Transformers.js models when selecting the initial embed model
Testing
I've tested these changes with a custom OpenAI-compatible embed model defined in config.yaml with roles: [embed], and confirmed that:
- The custom model is now automatically selected on startup
- The built-in Transformers.js model is still available as a fallback
- The changes don't affect other model roles
Checklist
- [x] I've read the contributing guide
- [x] The relevant docs, if any, have been updated or created
- [x] The relevant tests, if any, have been updated or created