From d0d9cbd2944c60bacedc6f86f615bd78b09bebf4 Mon Sep 17 00:00:00 2001 From: junleea <354425203@qq.com> Date: Tue, 25 Mar 2025 14:44:58 +0800 Subject: [PATCH] =?UTF-8?q?=E5=B0=86spark=E7=A7=BB=E5=8A=A8=E5=88=B0servic?= =?UTF-8?q?e?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- service/imService.go | 2 +- {worker => service}/spark.go | 8 ++++---- 2 files changed, 5 insertions(+), 5 deletions(-) rename {worker => service}/spark.go (97%) diff --git a/service/imService.go b/service/imService.go index 4f1b6d2..594dab4 100644 --- a/service/imService.go +++ b/service/imService.go @@ -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 } diff --git a/worker/spark.go b/service/spark.go similarity index 97% rename from worker/spark.go rename to service/spark.go index 4784a9c..c4343f4 100644 --- a/worker/spark.go +++ b/service/spark.go @@ -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) } // 生成参数