feat: Revamp ModelEditorDialog and ModelSettings for improved UI and validation

- Replaced the dialog component with a custom modal layout for better user experience.
- Enhanced form structure with custom styles and validation for required fields.
- Updated model source selection and added dynamic placeholders based on model type.
- Improved API validation logic for model saving in both ModelEditorDialog and ModelSettings.
- Refactored styles for better alignment and responsiveness across components.
This commit is contained in:
wizardchen
2025-11-07 00:30:15 +08:00
parent 7cc986e282
commit b3a0d00fc3
3 changed files with 383 additions and 221 deletions
+5 -3
View File
@@ -163,6 +163,8 @@ type UpdateModelRequest struct {
Description string `json:"description"`
Parameters types.ModelParameters `json:"parameters"`
IsDefault bool `json:"is_default"`
Source types.ModelSource `json:"source"`
Type types.ModelType `json:"type"`
}
// UpdateModel handles the HTTP request to update an existing model
@@ -206,13 +208,13 @@ func (h *ModelHandler) UpdateModel(c *gin.Context) {
if req.Name != "" {
model.Name = req.Name
}
if req.Description != "" {
model.Description = req.Description
}
model.Description = req.Description
if req.Parameters != (types.ModelParameters{}) {
model.Parameters = req.Parameters
}
model.IsDefault = req.IsDefault
model.Source = req.Source
model.Type = req.Type
logger.Infof(ctx, "Updating model, ID: %s, Name: %s", id, model.Name)
if err := h.service.UpdateModel(ctx, model); err != nil {