将spark移动到service
This commit is contained in:
parent
e8a268ca22
commit
d0d9cbd294
|
|
@ -171,6 +171,6 @@ func ReceiveOllamaSession(userID, sessionID int, channel string, msg proto.WSMes
|
|||
func ReceiveSparkSession(userID, sessionID int, channel string, msg proto.WSMessageReq, modelParam proto.ModelParam) (error, uint) {
|
||||
var resErr error
|
||||
var resID uint
|
||||
worker.Spark(modelParam, msg.Msg, channel, sessionID, userID)
|
||||
Spark(modelParam, msg.Msg, channel, sessionID, userID)
|
||||
return resErr, resID
|
||||
}
|
||||
|
|
|
|||
|
|
@ -1,9 +1,9 @@
|
|||
package worker
|
||||
package service
|
||||
|
||||
import (
|
||||
"StuAcaWorksAI/dao"
|
||||
"StuAcaWorksAI/proto"
|
||||
"StuAcaWorksAI/service"
|
||||
"StuAcaWorksAI/worker"
|
||||
"crypto/hmac"
|
||||
"crypto/sha256"
|
||||
"encoding/base64"
|
||||
|
|
@ -164,7 +164,7 @@ func Spark(modelParam proto.ModelParam, question, channel string, SessionID, Use
|
|||
} else {
|
||||
answer += data.Payload.Choices.Text[0].Content
|
||||
}
|
||||
go service.CreateAIStreamMsg(UserID, 4, SessionID, data, modelParam.Model)
|
||||
go CreateAIStreamMsg(UserID, 4, SessionID, data, modelParam.Model)
|
||||
SparkToGeneralMassageAndSendMsgQueue(&data, channel, SessionID, UserID)
|
||||
}
|
||||
|
||||
|
|
@ -198,7 +198,7 @@ func SparkToGeneralMassageAndSendMsgQueue(data *SparkResponse, channel string, S
|
|||
|
||||
//发送消息
|
||||
wsMsgStr, _ := json.Marshal(wsMsg)
|
||||
Publish(channel, string(wsMsgStr), time.Second*60)
|
||||
worker.Publish(channel, string(wsMsgStr), time.Second*60)
|
||||
}
|
||||
|
||||
// 生成参数
|
||||
Loading…
Reference in New Issue