修复ppt消息,添加消息大纲等信息

This commit is contained in:
junleea 2025-04-05 18:56:39 +08:00
parent 925bce4a1c
commit 27f236f97a
2 changed files with 13 additions and 6 deletions

View File

@ -251,7 +251,7 @@ func CreateUserFile(userID int, fileAuthName string, fileID int, UploadType stri
if fileAuth.ID != 0 { if fileAuth.ID != 0 {
log.Println("file auth name already exist, please change another name: ", fileAuthName) log.Println("file auth name already exist, please change another name: ", fileAuthName)
//将要保存的文件名改为fileAuthName+uuid //将要保存的文件名改为fileAuthName+uuid
strs := strings.Split(fileAuthName, ".") strs := strings.Split(fileAuth.UserFileName, ".")
fileAuthName = strs[0] + "_1." + strs[1] fileAuthName = strs[0] + "_1." + strs[1]
//return fileAuth //return fileAuth
} }

View File

@ -341,12 +341,10 @@ func SparkDoGetPPTInfoBySID(modelParam *proto.ModelParam, userReq *proto.SparkCr
log.Println("Spark create ppt by outline Error:", err) log.Println("Spark create ppt by outline Error:", err)
return return
} }
respStr, _ := json.Marshal(resp) outlineStr, _ := json.Marshal(userReq.Outline)
resp.Desc = string(outlineStr) //大纲信息
service.CreateAIStreamMsg(base.UserID, base.ModelID, int(base.SessionID), resp, modelParam.Model) //保存消息 service.CreateAIStreamMsg(base.UserID, base.ModelID, int(base.SessionID), resp, modelParam.Model) //保存消息
//添加到消息队列,用于前端查询 var respStr []byte
key := fmt.Sprintf("user-%d-session-%d-create-pptx", base.UserID, base.SessionID)
worker.SetRedisWithExpire(key, string(respStr), time.Second*60*60) //设置60分钟过期
log.Println("Spark create ppt status set redis key:", key, "value:", string(respStr))
if resp.Code != 0 { if resp.Code != 0 {
log.Println("Spark create ppt by outline Error:", resp) log.Println("Spark create ppt by outline Error:", resp)
return return
@ -365,6 +363,9 @@ 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)
} }
fileAuthStr, _ := json.Marshal(fileAuth)
resp.Data.AiImageStatus = string(fileAuthStr) //文件信息
respStr, _ = json.Marshal(resp)
//将model发送的消息保存到数据库 //将model发送的消息保存到数据库
err3, userMsgID := service.CreateMessage(proto.ModelToUserMsgType, int(base.SessionID), int(model.ID), base.UserID, string(respStr), proto.UserToModelPPTMsgType, base.FunctionID) err3, userMsgID := service.CreateMessage(proto.ModelToUserMsgType, int(base.SessionID), int(model.ID), base.UserID, string(respStr), proto.UserToModelPPTMsgType, base.FunctionID)
if err3 != nil { if err3 != nil {
@ -373,6 +374,12 @@ func SparkDoGetPPTInfoBySID(modelParam *proto.ModelParam, userReq *proto.SparkCr
log.Println("spark create ppt by outline success,msg id:", userMsgID) log.Println("spark create ppt by outline success,msg id:", userMsgID)
return return
} }
respStr, _ = json.Marshal(resp)
//添加到消息队列,用于前端查询
key := fmt.Sprintf("user-%d-session-%d-create-pptx", base.UserID, base.SessionID)
worker.SetRedisWithExpire(key, string(respStr), time.Second*60*60) //设置60分钟过期
log.Println("Spark create ppt status set redis key:", key, "value:", string(respStr))
} }
} }
} }