|
@@ -50,7 +50,9 @@ func LLMKnowledgeBaseSearchDocs(search LLMKnowledgeSearch) (resp bus_response.Se
|
|
|
// AIGCBaseOnPromote aigc 生成内容
|
|
|
func AIGCBaseOnPromote(aigc AIGC) (resp bus_response.AIGCEtaResponse, err error) {
|
|
|
param := make(map[string]interface{})
|
|
|
- param["LLM"] =aigc.LLMModel
|
|
|
+ if aigc.LLMModel != "" {
|
|
|
+ param["LLM"] = aigc.LLMModel
|
|
|
+ }
|
|
|
mapping, queryErr := rag.GetArticleKbMapping(aigc.ArticleId)
|
|
|
if queryErr != nil && !errors.Is(queryErr, gorm.ErrRecordNotFound) {
|
|
|
utils.FileLog.Error("获取文章知识库信息失败,err: %v", queryErr)
|
|
@@ -159,12 +161,20 @@ func AIGCBaseOnPromote(aigc AIGC) (resp bus_response.AIGCEtaResponse, err error)
|
|
|
utils.FileLog.Error("打开文件失败,err:", err)
|
|
|
return
|
|
|
}
|
|
|
- _, httpErr = llmService.UploadFileToTemplate([]*os.File{file}, param)
|
|
|
+ uploadResp, httpErr := llmService.UploadFileToTemplate([]*os.File{file}, param)
|
|
|
if httpErr != nil {
|
|
|
utils.FileLog.Error("上传文件失败,err:", err.Error())
|
|
|
err = fmt.Errorf("上传文件失败,err:%v", httpErr)
|
|
|
return
|
|
|
}
|
|
|
+ data := uploadResp.(eta_llm_http.UploadDocsResponse)
|
|
|
+ //保存映射关系到数据库
|
|
|
+ if data.Id == "" {
|
|
|
+ utils.FileLog.Error("上传文件失败,向量库Id获取失败")
|
|
|
+ err = fmt.Errorf("上传文件失败,向量库Id获取失败")
|
|
|
+ return
|
|
|
+ }
|
|
|
+ fmt.Println(data.Id)
|
|
|
response, httpErr = llmService.FileChat(aigc.Promote, kbId, aigc.LLMModel, nil)
|
|
|
if httpErr != nil {
|
|
|
utils.FileLog.Error("内容生成失败,err:%v", httpErr.Error())
|