fix: add model display name
This commit is contained in:
@@ -38,6 +38,7 @@ func NewModelHandler(service interfaces.ModelService) *ModelHandler {
|
||||
// Contains all fields required to create a new model in the system
|
||||
type CreateModelRequest struct {
|
||||
Name string `json:"name" binding:"required"`
|
||||
DisplayName string `json:"display_name"`
|
||||
Type types.ModelType `json:"type" binding:"required"`
|
||||
Source types.ModelSource `json:"source" binding:"required"`
|
||||
Description string `json:"description"`
|
||||
@@ -89,6 +90,7 @@ func (h *ModelHandler) CreateModel(c *gin.Context) {
|
||||
model := &types.Model{
|
||||
TenantID: tenantID,
|
||||
Name: secutils.SanitizeForLog(req.Name),
|
||||
DisplayName: secutils.SanitizeForLog(req.DisplayName),
|
||||
Type: types.ModelType(secutils.SanitizeForLog(string(req.Type))),
|
||||
Source: req.Source,
|
||||
Description: secutils.SanitizeForLog(req.Description),
|
||||
@@ -201,6 +203,7 @@ func (h *ModelHandler) ListModels(c *gin.Context) {
|
||||
// Contains fields that can be updated for an existing model
|
||||
type UpdateModelRequest struct {
|
||||
Name string `json:"name"`
|
||||
DisplayName *string `json:"display_name"`
|
||||
Description string `json:"description"`
|
||||
Parameters types.ModelParameters `json:"parameters"`
|
||||
Source types.ModelSource `json:"source"`
|
||||
@@ -256,6 +259,9 @@ func (h *ModelHandler) UpdateModel(c *gin.Context) {
|
||||
if req.Name != "" {
|
||||
model.Name = req.Name
|
||||
}
|
||||
if req.DisplayName != nil {
|
||||
model.DisplayName = secutils.SanitizeForLog(*req.DisplayName)
|
||||
}
|
||||
model.Description = req.Description
|
||||
|
||||
// SSRF validation for updated model BaseURL
|
||||
|
||||
Reference in New Issue
Block a user