diff --git a/api/model/message.go b/api/model/message.go index 561fb2f..1d39d0c 100644 --- a/api/model/message.go +++ b/api/model/message.go @@ -21,7 +21,7 @@ type Message struct { ElapsedTime int64 `json:"elapsed_time" gorm:"default:0"` IsStream bool `json:"is_stream" gorm:"default:false"` QuotaContent string `json:"quota_content" gorm:"default:''"` - AgentCustomConfig string `json:"agent_custom_config" gorm:"default:''"` + AgentCustomConfig string `json:"agent_custom_config" gorm:"default:'';type:text"` BaseModel } diff --git a/web/front/src/renderer/main/views/chat/completion/index.vue b/web/front/src/renderer/main/views/chat/completion/index.vue index 01e889b..c74123a 100644 --- a/web/front/src/renderer/main/views/chat/completion/index.vue +++ b/web/front/src/renderer/main/views/chat/completion/index.vue @@ -449,7 +449,14 @@ const imageFile = ref() const validator = (item) => { return (rule, value, callback) => { if (item.required) { - const hasVal = item.value.some((item) => item.trim()) + let hasVal = false + if (['file', 'array_image', 'array_audio', 'array_video', 'array_file'].includes(item.type)) { + hasVal = Array.isArray(item.value) && item.value.length > 0 + } else if (Array.isArray(item.value)) { + hasVal = item.value.some((val) => val && String(val).trim().length > 0) + } else { + hasVal = item.value && String(item.value).trim().length > 0 + } if (hasVal) callback() else callback(new Error(`请添加${item.label}`)) } else {