|
@@ -39,6 +39,7 @@ func (this *AiFileController) FileUpload() {
|
|
br.ErrMsg = "获取资源信息失败,Err:" + err.Error()
|
|
br.ErrMsg = "获取资源信息失败,Err:" + err.Error()
|
|
return
|
|
return
|
|
}
|
|
}
|
|
|
|
+ model := this.GetString("Model")
|
|
|
|
|
|
aiChatTopicId, _ := this.GetInt("AiChatTopicId")
|
|
aiChatTopicId, _ := this.GetInt("AiChatTopicId")
|
|
|
|
|
|
@@ -96,7 +97,7 @@ func (this *AiFileController) FileUpload() {
|
|
ResourceUrl: resourceUrl,
|
|
ResourceUrl: resourceUrl,
|
|
ResourceName: uploadFileName,
|
|
ResourceName: uploadFileName,
|
|
}
|
|
}
|
|
- uploadResult, err := aiser.OpenAiFileUpload(resourceUrl, uploadFileName)
|
|
|
|
|
|
+ uploadResult, err := aiser.OpenAiFileUpload(resourceUrl, uploadFileName, model)
|
|
if err != nil {
|
|
if err != nil {
|
|
br.Msg = "文件上传失败"
|
|
br.Msg = "文件上传失败"
|
|
br.ErrMsg = "文件上传失败,Err:" + err.Error()
|
|
br.ErrMsg = "文件上传失败,Err:" + err.Error()
|
|
@@ -148,7 +149,7 @@ func (this *AiFileController) FileUpload() {
|
|
chatItem.AiChatTopicId = aiChatTopicId
|
|
chatItem.AiChatTopicId = aiChatTopicId
|
|
chatItem.Ask = uploadFileName
|
|
chatItem.Ask = uploadFileName
|
|
chatItem.AskUuid = utils.MD5(uploadFileName)
|
|
chatItem.AskUuid = utils.MD5(uploadFileName)
|
|
- chatItem.Model = "gpt-4-1106-preview"
|
|
|
|
|
|
+ chatItem.Model = EnabledModelsForMap[model]
|
|
chatItem.SysUserId = this.SysUser.AdminId
|
|
chatItem.SysUserId = this.SysUser.AdminId
|
|
chatItem.SysUserRealName = this.SysUser.RealName
|
|
chatItem.SysUserRealName = this.SysUser.RealName
|
|
if uploadResult != nil && uploadResult.Data != nil {
|
|
if uploadResult != nil && uploadResult.Data != nil {
|
|
@@ -169,7 +170,7 @@ func (this *AiFileController) FileUpload() {
|
|
chatItem.AiChatTopicId = aiChatTopicId
|
|
chatItem.AiChatTopicId = aiChatTopicId
|
|
chatItem.Ask = uploadFileName
|
|
chatItem.Ask = uploadFileName
|
|
chatItem.AskUuid = utils.MD5(fileName)
|
|
chatItem.AskUuid = utils.MD5(fileName)
|
|
- chatItem.Model = "gpt-4-1106-preview"
|
|
|
|
|
|
+ chatItem.Model = EnabledModelsForMap[model]
|
|
chatItem.SysUserId = this.SysUser.AdminId
|
|
chatItem.SysUserId = this.SysUser.AdminId
|
|
chatItem.SysUserRealName = this.SysUser.RealName
|
|
chatItem.SysUserRealName = this.SysUser.RealName
|
|
if uploadResult != nil && uploadResult.Data != nil {
|
|
if uploadResult != nil && uploadResult.Data != nil {
|
|
@@ -331,7 +332,7 @@ func (this *AiFileController) FileRetrieve() {
|
|
frList = append(frList, *frItem)
|
|
frList = append(frList, *frItem)
|
|
}
|
|
}
|
|
|
|
|
|
- fileRetrieveResp, err := aiser.FileRetrieve(assistantId, threadId, frList, req.OpenaiFileId)
|
|
|
|
|
|
+ fileRetrieveResp, err := aiser.FileRetrieve(assistantId, threadId, req.Model, frList, req.OpenaiFileId)
|
|
if err != nil {
|
|
if err != nil {
|
|
br.Msg = "获取数据失败!"
|
|
br.Msg = "获取数据失败!"
|
|
br.ErrMsg = "获取数据失败,FileRetrieve,Err:" + err.Error()
|
|
br.ErrMsg = "获取数据失败,FileRetrieve,Err:" + err.Error()
|
|
@@ -370,7 +371,7 @@ func (this *AiFileController) FileRetrieve() {
|
|
chatItem.Ask = req.Ask
|
|
chatItem.Ask = req.Ask
|
|
chatItem.AskUuid = utils.MD5(req.Ask)
|
|
chatItem.AskUuid = utils.MD5(req.Ask)
|
|
chatItem.Answer = answer
|
|
chatItem.Answer = answer
|
|
- chatItem.Model = "gpt-4-1106-preview"
|
|
|
|
|
|
+ chatItem.Model = EnabledModelsForMap[req.Model]
|
|
chatItem.SysUserId = this.SysUser.AdminId
|
|
chatItem.SysUserId = this.SysUser.AdminId
|
|
chatItem.SysUserRealName = this.SysUser.RealName
|
|
chatItem.SysUserRealName = this.SysUser.RealName
|
|
chatItem.CreateTime = time.Now()
|
|
chatItem.CreateTime = time.Now()
|
|
@@ -388,7 +389,7 @@ func (this *AiFileController) FileRetrieve() {
|
|
chatItem.Ask = req.Ask
|
|
chatItem.Ask = req.Ask
|
|
chatItem.AskUuid = askUuid
|
|
chatItem.AskUuid = askUuid
|
|
chatItem.Answer = answer
|
|
chatItem.Answer = answer
|
|
- chatItem.Model = "gpt-4-1106-preview"
|
|
|
|
|
|
+ chatItem.Model = EnabledModelsForMap[req.Model]
|
|
chatItem.SysUserId = this.SysUser.AdminId
|
|
chatItem.SysUserId = this.SysUser.AdminId
|
|
chatItem.SysUserRealName = this.SysUser.RealName
|
|
chatItem.SysUserRealName = this.SysUser.RealName
|
|
chatItem.CreateTime = time.Now()
|
|
chatItem.CreateTime = time.Now()
|
|
@@ -417,7 +418,7 @@ func (this *AiFileController) FileRetrieve() {
|
|
return
|
|
return
|
|
}
|
|
}
|
|
}
|
|
}
|
|
-
|
|
|
|
|
|
+ resp.Model = aimod.ModelViewMap[req.Model]
|
|
resp.AiChatTopicId = req.AiChatTopicId
|
|
resp.AiChatTopicId = req.AiChatTopicId
|
|
resp.Ask = req.Ask
|
|
resp.Ask = req.Ask
|
|
resp.Answer = answer
|
|
resp.Answer = answer
|
|
@@ -427,3 +428,8 @@ func (this *AiFileController) FileRetrieve() {
|
|
br.Data = resp
|
|
br.Data = resp
|
|
return
|
|
return
|
|
}
|
|
}
|
|
|
|
+
|
|
|
|
+var EnabledModelsForMap = map[string]string{
|
|
|
|
+ "Kimi": "moonshot-v1-32k",
|
|
|
|
+ "GPT-4 Turbo": "gpt-4-1106-preview",
|
|
|
|
+}
|