You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
64 lines
1.8 KiB
64 lines
1.8 KiB
package echomeet
|
|
|
|
import (
|
|
"yunyan/comm"
|
|
"yunyan/pb"
|
|
"yunyan/utils"
|
|
"fmt"
|
|
)
|
|
|
|
// @Summary 处理阿里云录音文件转写回调
|
|
// @Description 接收阿里云录音文件转写异步回调结果
|
|
// @Tags Echomeet
|
|
// @Accept json
|
|
// @Produce json
|
|
// @Param notify body pb.EchomeetAliCallbackReq true "阿里云回调参数"
|
|
// @Success 200 {object} comm.HttpResult{data=pb.EchomeetAliCallbackResp} "处理结果"
|
|
// @Router /api/home/echomeet_alibackcall [post]
|
|
func (this *apiComp) AliBackCall(session comm.IUserSession, req *pb.EchomeetAliCallbackReq) (resp *pb.EchomeetAliCallbackResp, errdata *pb.ErrorData) {
|
|
model, err := this.module.model.getrecordByTaskId(req.TaskId)
|
|
if err != nil {
|
|
errdata = &pb.ErrorData{
|
|
Code: pb.ErrorCode_DBError,
|
|
Message: err.Error(),
|
|
}
|
|
return
|
|
}
|
|
|
|
// 21050001 = 成功
|
|
if req.StatusCode != 21050001 {
|
|
model.State = pb.DBEchoMeetRecordState_TranscribeFail
|
|
this.module.model.saverecord(model)
|
|
resp = &pb.EchomeetAliCallbackResp{}
|
|
return
|
|
}
|
|
|
|
personnels := make(map[string]struct{})
|
|
contexts := make([]*pb.ContextStruct, 0)
|
|
if req.Result != nil {
|
|
for _, s := range req.Result.Sentences {
|
|
speaker := fmt.Sprintf("Speaker_%s", s.SpeakerId)
|
|
contexts = append(contexts, &pb.ContextStruct{
|
|
Meetingid: model.Id,
|
|
Content: s.Text,
|
|
Starttime: s.BeginTime,
|
|
Endtime: s.EndTime,
|
|
Speaker: speaker,
|
|
})
|
|
personnels[s.SpeakerId] = struct{}{}
|
|
}
|
|
}
|
|
|
|
model.Personnel = ""
|
|
for k := range personnels {
|
|
model.Personnel += fmt.Sprintf("[Speaker_%s] ", k)
|
|
}
|
|
model.Original = utils.ToString(contexts)
|
|
model.State = pb.DBEchoMeetRecordState_AwaitSummarizing
|
|
this.module.tasks.TranslateProcess(model, contexts)
|
|
this.module.model.saverecord(model)
|
|
this.module.tasks.SubmitAITask(model)
|
|
|
|
resp = &pb.EchomeetAliCallbackResp{}
|
|
return
|
|
}
|
|
|