feat(models): let system admins edit builtin model config
Allow platform system administrators to update builtin model parameters and credentials from the management UI while keeping secrets masked in API responses. UI edits clear YAML ownership so startup reconciliation no longer overwrites runtime overrides.
This commit is contained in:
@@ -615,6 +615,12 @@ func (h *ModelHandler) UpdateModel(c *gin.Context) {
|
||||
newParams.AppSecret = storedAppSecret
|
||||
// Preserve backend-managed fields not sent by the frontend either.
|
||||
newParams.ParameterSize = model.Parameters.ParameterSize
|
||||
if newParams.InterfaceType == "" {
|
||||
newParams.InterfaceType = model.Parameters.InterfaceType
|
||||
}
|
||||
if newParams.AppID == "" {
|
||||
newParams.AppID = model.Parameters.AppID
|
||||
}
|
||||
if newParams.ExtraConfig == nil {
|
||||
newParams.ExtraConfig = model.Parameters.ExtraConfig
|
||||
}
|
||||
@@ -625,6 +631,10 @@ func (h *ModelHandler) UpdateModel(c *gin.Context) {
|
||||
|
||||
logger.Infof(ctx, "Updating model, ID: %s, Name: %s", id, model.Name)
|
||||
if err := h.service.UpdateModel(ctx, model); err != nil {
|
||||
if appErr, ok := errors.IsAppError(err); ok {
|
||||
c.Error(appErr)
|
||||
return
|
||||
}
|
||||
logger.ErrorWithFields(ctx, err, nil)
|
||||
c.Error(errors.NewInternalServerError(err.Error()))
|
||||
return
|
||||
|
||||
Reference in New Issue
Block a user