From b17df76df70de27e1c8c2b8ba34fa7656e381828 Mon Sep 17 00:00:00 2001 From: junleea <354425203@qq.com> Date: Mon, 24 Mar 2025 19:57:28 +0800 Subject: [PATCH] =?UTF-8?q?spark=E6=B7=BB=E5=8A=A0=E6=A8=A1=E5=9E=8B?= =?UTF-8?q?=E5=8F=82=E6=95=B0domain?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- proto/im.go | 1 + worker/spark.go | 6 +++--- 2 files changed, 4 insertions(+), 3 deletions(-) diff --git a/proto/im.go b/proto/im.go index da2ec67..8397809 100644 --- a/proto/im.go +++ b/proto/im.go @@ -25,6 +25,7 @@ type WSMessageReq struct { type ModelParam struct { Model string `json:"model"` //模型名称 + Domain string `json:"domain"` //domain参数,spark需要 Url string `json:"url"` //模型地址 APPID string `json:"appid"` //应用id APISecret string `json:"apiSecret"` //应用密钥 diff --git a/worker/spark.go b/worker/spark.go index beb4033..594532c 100644 --- a/worker/spark.go +++ b/worker/spark.go @@ -123,7 +123,7 @@ func Spark(modelParam proto.ModelParam, question, channel string, SessionID, Use //发送消息 go func() { - data := genSparkParams(question, modelParam.APPID) + data := genSparkParams(question, modelParam.APPID, modelParam.Domain) //将数据转换为json //dataByte, err := json.Marshal(data) if err != nil { @@ -200,7 +200,7 @@ func SparkToGeneralMassageAndSendMsgQueue(data *SparkResponse, channel string, S } // 生成参数 -func genSparkParams(question, appid string) SparkRequest { +func genSparkParams(question, appid string, domain string) SparkRequest { messages := []MessageContent{ {Role: "user", Content: question}, } @@ -211,7 +211,7 @@ func genSparkParams(question, appid string) SparkRequest { }, Parameter: Parameter{ Chat: ChatParameter{ - Domain: "4.0Ultra", + Domain: domain, Temperature: 0.8, MaxTokens: 2048, },