hongze 1 year ago
parent
commit
5da0050bb0
1 changed files with 4 additions and 0 deletions
  1. 4 0
      controllers/ai/ai_file.go

+ 4 - 0
controllers/ai/ai_file.go

@@ -366,6 +366,7 @@ func (this *AiFileController) FileRetrieve() {
 		chatItem.AiChatTopicId = int(topicId)
 		chatItem.Ask = req.Ask
 		chatItem.AskUuid = utils.MD5(req.Ask)
+		chatItem.Answer = answer
 		chatItem.Model = "gpt-4-1106-preview"
 		chatItem.SysUserId = this.SysUser.AdminId
 		chatItem.SysUserRealName = this.SysUser.RealName
@@ -377,11 +378,13 @@ func (this *AiFileController) FileRetrieve() {
 			br.ErrMsg = "生成话题记录失败,Err:" + err.Error()
 			return
 		}
+		req.AiChatTopicId = int(topicId)
 	} else {
 		chatItem := new(aimod.AiChat)
 		chatItem.AiChatTopicId = req.AiChatTopicId
 		chatItem.Ask = req.Ask
 		chatItem.AskUuid = utils.MD5(req.Ask)
+		chatItem.Answer = answer
 		chatItem.Model = "gpt-4-1106-preview"
 		chatItem.SysUserId = this.SysUser.AdminId
 		chatItem.SysUserRealName = this.SysUser.RealName
@@ -412,6 +415,7 @@ func (this *AiFileController) FileRetrieve() {
 		}
 	}
 
+	resp.AiChatTopicId = req.AiChatTopicId
 	resp.Ask = req.Ask
 	resp.Answer = answer
 	br.Ret = 200