add 'type' field for ChatModel, support Chat and Image model

This commit is contained in:
RockYang
2024-12-25 18:57:18 +08:00
parent cbf06eea24
commit acee2d9d81
35 changed files with 766 additions and 698 deletions

View File

@@ -43,6 +43,7 @@ func (h *ChatModelHandler) Save(c *gin.Context) {
Temperature float32 `json:"temperature"` // 模型温度
KeyId int `json:"key_id,omitempty"`
CreatedAt int64 `json:"created_at"`
Type string `json:"type"`
}
if err := c.ShouldBindJSON(&data); err != nil {
resp.ERROR(c, types.InvalidArgs)
@@ -65,7 +66,7 @@ func (h *ChatModelHandler) Save(c *gin.Context) {
item.MaxContext = data.MaxContext
item.Temperature = data.Temperature
item.KeyId = data.KeyId
item.Type = data.Type
var res *gorm.DB
if data.Id > 0 {
res = h.DB.Save(&item)