修复ppt消息问题
This commit is contained in:
parent
0f3baa0147
commit
925bce4a1c
|
|
@ -259,11 +259,11 @@ func SparkDoCreateOutline(userReq *proto.SparkCreateOutlineRequest, base *proto.
|
||||||
log.Println("Spark create outline Error:", err)
|
log.Println("Spark create outline Error:", err)
|
||||||
return outline, err
|
return outline, err
|
||||||
}
|
}
|
||||||
outlineStr, _ := json.Marshal(userReq)
|
outlineStr, _ := json.Marshal(outline)
|
||||||
//返回的数据保存
|
//返回的数据保存
|
||||||
service.CreateAIStreamMsg(base.UserID, base.ModelID, int(base.SessionID), outline, modelParam.Model)
|
service.CreateAIStreamMsg(base.UserID, base.ModelID, int(base.SessionID), outline, modelParam.Model)
|
||||||
//保存大纲
|
//保存大纲
|
||||||
err3, userMsgID = service.CreateMessage(proto.ModelToUserMsgType, int(sessionID), base.UserID, int(model.ID), string(outlineStr), proto.UserToModelPPTMsgType, int(funcs[0].ID))
|
err3, userMsgID = service.CreateMessage(proto.ModelToUserMsgType, int(sessionID), int(model.ID), base.UserID, string(outlineStr), proto.UserToModelPPTMsgType, int(funcs[0].ID))
|
||||||
if err3 != nil {
|
if err3 != nil {
|
||||||
log.Println("Create message error:", err3, userMsgID)
|
log.Println("Create message error:", err3, userMsgID)
|
||||||
return proto.SparkCreateOutlineResponse{}, err3
|
return proto.SparkCreateOutlineResponse{}, err3
|
||||||
|
|
@ -317,12 +317,12 @@ func SparkDoCreatePPTByOutline(userReq *proto.SparkCreatePPTByOutlineUserRequest
|
||||||
service.CreateAIStreamMsg(base.UserID, base.ModelID, int(base.SessionID), resp, modelParam.Model) //保存消息
|
service.CreateAIStreamMsg(base.UserID, base.ModelID, int(base.SessionID), resp, modelParam.Model) //保存消息
|
||||||
//新协程获取ppt制作进度
|
//新协程获取ppt制作进度
|
||||||
userReq.Sid = resp.Data.SID
|
userReq.Sid = resp.Data.SID
|
||||||
go SparkDoGetPPTInfoBySID(&modelParam, userReq, base)
|
go SparkDoGetPPTInfoBySID(&modelParam, userReq, base, &model) //根据大纲生成ppt
|
||||||
return resp, nil
|
return resp, nil
|
||||||
}
|
}
|
||||||
|
|
||||||
// 每3秒查询一次ppt制作情况
|
// 每3秒查询一次ppt制作情况
|
||||||
func SparkDoGetPPTInfoBySID(modelParam *proto.ModelParam, userReq *proto.SparkCreatePPTByOutlineUserRequest, base *proto.SparkCreatePPTBaseInfo) {
|
func SparkDoGetPPTInfoBySID(modelParam *proto.ModelParam, userReq *proto.SparkCreatePPTByOutlineUserRequest, base *proto.SparkCreatePPTBaseInfo, model *dao.Model) {
|
||||||
//定时
|
//定时
|
||||||
ticker := time.NewTicker(3 * time.Second)
|
ticker := time.NewTicker(3 * time.Second)
|
||||||
defer ticker.Stop()
|
defer ticker.Stop()
|
||||||
|
|
@ -365,6 +365,12 @@ func SparkDoGetPPTInfoBySID(modelParam *proto.ModelParam, userReq *proto.SparkCr
|
||||||
if fileRecord.ID == 0 || fileAuth.ID == 0 {
|
if fileRecord.ID == 0 || fileAuth.ID == 0 {
|
||||||
log.Println("save file info failed", fileRecord.ID, fileAuth.ID)
|
log.Println("save file info failed", fileRecord.ID, fileAuth.ID)
|
||||||
}
|
}
|
||||||
|
//将model发送的消息保存到数据库
|
||||||
|
err3, userMsgID := service.CreateMessage(proto.ModelToUserMsgType, int(base.SessionID), int(model.ID), base.UserID, string(respStr), proto.UserToModelPPTMsgType, base.FunctionID)
|
||||||
|
if err3 != nil {
|
||||||
|
log.Println("Create message error:", err3, userMsgID)
|
||||||
|
}
|
||||||
|
log.Println("spark create ppt by outline success,msg id:", userMsgID)
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue