瀏覽代碼

修改文件上传

hongze 1 年之前
父節點
當前提交
13b35a5aed
共有 2 個文件被更改,包括 5 次插入4 次删除
  1. 4 4
      controllers/ai/ai_file.go
  2. 1 0
      models/aimod/ai.go

+ 4 - 4
controllers/ai/ai_file.go

@@ -123,7 +123,7 @@ func (this *AiFileController) FileUpload() {
 
 	if aiChatTopicId <= 0 { //新增
 		topic := new(aimod.AiChatTopic)
-		topic.TopicName = fileName
+		topic.TopicName = path.Base(uploadFileName)
 		topic.SysUserId = this.SysUser.AdminId
 		topic.SysUserRealName = this.SysUser.RealName
 		topic.CreateTime = time.Now()
@@ -139,8 +139,8 @@ func (this *AiFileController) FileUpload() {
 		aiChatTopicId = int(topicId)
 		chatItem := new(aimod.AiChat)
 		chatItem.AiChatTopicId = aiChatTopicId
-		chatItem.Ask = fileName
-		chatItem.AskUuid = utils.MD5(fileName)
+		chatItem.Ask = uploadFileName
+		chatItem.AskUuid = utils.MD5(uploadFileName)
 		chatItem.Model = "gpt-4-1106-preview"
 		chatItem.SysUserId = this.SysUser.AdminId
 		chatItem.SysUserRealName = this.SysUser.RealName
@@ -160,7 +160,7 @@ func (this *AiFileController) FileUpload() {
 	} else {
 		chatItem := new(aimod.AiChat)
 		chatItem.AiChatTopicId = aiChatTopicId
-		chatItem.Ask = fileName
+		chatItem.Ask = uploadFileName
 		chatItem.AskUuid = utils.MD5(fileName)
 		chatItem.Model = "gpt-4-1106-preview"
 		chatItem.SysUserId = this.SysUser.AdminId

+ 1 - 0
models/aimod/ai.go

@@ -93,6 +93,7 @@ type AiChatView struct {
 	Model          string
 	OpenaiFileId   string `description:"文件ID"`
 	OpenaiFileName string `description:"文件名称"`
+	OpenaiFilePath string `description:"文件路径"`
 	CreateTime     string `description:"创建时间"`
 	ModifyTime     string `description:"修改时间"`
 }