添加腾讯混元大模型支持,修改openai循环引用问题
This commit is contained in:
parent
de7ed81607
commit
785714fc46
|
|
@ -3,7 +3,6 @@ package generalModel
|
|||
import (
|
||||
"StuAcaWorksAI/dao"
|
||||
"StuAcaWorksAI/proto"
|
||||
"StuAcaWorksAI/service"
|
||||
"StuAcaWorksAI/worker"
|
||||
"context"
|
||||
"encoding/json"
|
||||
|
|
@ -47,7 +46,12 @@ func OpenAI(modelParam proto.ModelParam, imCtx *proto.IMParamContext, platform s
|
|||
|
||||
for stream.Next() {
|
||||
chunk := stream.Current()
|
||||
go service.CreateAIStreamMsg(imCtx.UserID, imCtx.ModelID, imCtx.SessionID, chunk, modelParam.Model)
|
||||
msgStr, err3 := json.Marshal(chunk)
|
||||
if err3 != nil {
|
||||
log.Println("openai stream msg Error parsing JSON:", err)
|
||||
}
|
||||
//go service.CreateAIStreamMsg(imCtx.UserID, imCtx.ModelID, imCtx.SessionID, chunk, modelParam.Model)
|
||||
go dao.InsertAIStreamMsgToDB(imCtx.UserID, imCtx.SessionID, uint(imCtx.ModelID), string(msgStr), modelParam.Model) //存入数据库
|
||||
acc.AddChunk(chunk)
|
||||
if _, ok := acc.JustFinishedToolCall(); ok {
|
||||
chunk.Created = -1 // 这里由于没有返回结束标志,所以用该字段来判断
|
||||
|
|
|
|||
Loading…
Reference in New Issue