feat: pull models list when setting up a new remote engine #4547
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Describe Your Changes
Previously, when setting up a new remote provider, users had to manually set up models. With this update, as soon as users set up a new provider, it will automatically attempt to pull models from the specified /models endpoint.
Fixes Issues
Self Checklist
This pull request includes several changes to the
JSONEngineManagementExtension
class and related configuration files to enhance the handling of remote models and engines. The most important changes include modifying theModel
type, updating the configuration, and improving the methods for adding and populating remote models.Changes to
Model
type:core/src/types/model/modelEntity.ts
: Renamed themode
property tomodel
in theModel
type.Configuration updates:
extensions/engine-management-extension/rolldown.config.mjs
: Added default payload, response body, and request headers transformations to the configuration.Enhancements to
JSONEngineManagementExtension
class:extensions/engine-management-extension/src/index.ts
: Introduced a newModelList
interface for handling remote models.extensions/engine-management-extension/src/index.ts
: Modified thegetRemoteModels
method to return aModelList
instead of an array ofModel
objects.extensions/engine-management-extension/src/index.ts
: Enhanced theaddRemoteEngine
method to include default settings and optionally persist models.extensions/engine-management-extension/src/index.ts
: Added a privatepopulateRemoteModels
method to pull and persist models from the remote provider.