|
@@ -6,6 +6,7 @@ import (
|
|
|
"eta/eta_api/models/ai_summary"
|
|
|
"eta/eta_api/models/aimod"
|
|
|
"eta/eta_api/models/sandbox"
|
|
|
+ saModel "eta/eta_api/models/semantic_analysis"
|
|
|
aiSummaryService "eta/eta_api/services/ai_summary"
|
|
|
"eta/eta_api/services/aiser"
|
|
|
"eta/eta_api/utils"
|
|
@@ -924,14 +925,34 @@ func (this *AiController) AiSummaryDetail() {
|
|
|
|
|
|
aiSummaryId, _ := this.GetInt("AiSummaryId")
|
|
|
|
|
|
- detail, err := ai_summary.GetAiSummaryById(aiSummaryId)
|
|
|
+ detail, err := ai_summary.GetAiSummaryItemById(aiSummaryId)
|
|
|
if err != nil && err.Error() != utils.ErrNoRow() {
|
|
|
br.Success = true
|
|
|
br.Msg = "获取沙盘信息失败"
|
|
|
br.ErrMsg = "获取沙盘信息失败,Err:" + err.Error()
|
|
|
return
|
|
|
}
|
|
|
+ resp := ai_summary.AiSummaryDetailResp{
|
|
|
+ AiSummaryItems: detail,
|
|
|
+ }
|
|
|
|
|
|
+ if detail.SaDocId >0 {
|
|
|
+ item := new(saModel.SaDoc)
|
|
|
+ e := item.GetItemById(detail.SaDocId)
|
|
|
+ if e != nil {
|
|
|
+ if e.Error() == utils.ErrNoRow() {
|
|
|
+ br.Msg = "文档已被删除, 请刷新页面"
|
|
|
+ return
|
|
|
+ }
|
|
|
+ br.Msg = "获取失败"
|
|
|
+ br.ErrMsg = "获取文档信息失败, Err: " + e.Error()
|
|
|
+ return
|
|
|
+ }
|
|
|
+ resp.SaDocTitle = item.Title
|
|
|
+ }
|
|
|
+
|
|
|
+
|
|
|
+ br.Data = resp
|
|
|
br.Ret = 200
|
|
|
br.Success = true
|
|
|
br.Msg = "获取成功"
|
|
@@ -990,15 +1011,22 @@ func (this *AiController) AddAiSummary() {
|
|
|
Sort: maxSort + 1,
|
|
|
}
|
|
|
|
|
|
- _, err = ai_summary.AddAiSummary(summary)
|
|
|
+ id, err := ai_summary.AddAiSummary(summary)
|
|
|
if err != nil {
|
|
|
br.Msg = "保存分类失败"
|
|
|
br.ErrMsg = "保存分类失败,Err:" + err.Error()
|
|
|
return
|
|
|
}
|
|
|
+
|
|
|
+ resp := ai_summary.AiSummaryAddResp{
|
|
|
+ AiSummaryId: int(id),
|
|
|
+ UniqueCode: strconv.Itoa(req.ClassifyId) + "_" + strconv.Itoa(int(id)),
|
|
|
+ }
|
|
|
+
|
|
|
br.Ret = 200
|
|
|
br.Msg = "保存成功"
|
|
|
br.Success = true
|
|
|
+ br.Data = resp
|
|
|
}
|
|
|
|
|
|
// @Title 生成ai纪要
|
|
@@ -1030,7 +1058,25 @@ func (this *AiController) GenerateAiSummary() {
|
|
|
return
|
|
|
}
|
|
|
if req.SaDocId > 0 {
|
|
|
+ // 获取段落
|
|
|
+ sectionOB := new(saModel.SaDocSection)
|
|
|
+ sectionCond := fmt.Sprintf(` AND %s = ?`, saModel.SaDocSectionColumns.DocId)
|
|
|
+ sectionPars := make([]interface{}, 0)
|
|
|
+ sectionPars = append(sectionPars, req.SaDocId)
|
|
|
+ sectionList, e := sectionOB.GetItemsByCondition(sectionCond, sectionPars, []string{}, "")
|
|
|
+ if e != nil {
|
|
|
+ br.Msg = "获取失败"
|
|
|
+ br.ErrMsg = "获取段落信息失败, Err: " + e.Error()
|
|
|
+ return
|
|
|
+ }
|
|
|
+ secIds := make([]int, 0)
|
|
|
+ for _, s := range sectionList {
|
|
|
+ secIds = append(secIds, s.SaDocSectionId)
|
|
|
+ }
|
|
|
|
|
|
+ for _, v := range sectionList {
|
|
|
+ req.OriginContent += v.Content + "<br>"
|
|
|
+ }
|
|
|
}
|
|
|
|
|
|
if utils.Re == nil {
|