spark添加模型参数domain

This commit is contained in:
junleea 2025-03-24 19:57:28 +08:00
parent b0b14fef3c
commit b17df76df7
2 changed files with 4 additions and 3 deletions

View File

@ -25,6 +25,7 @@ type WSMessageReq struct {
type ModelParam struct { type ModelParam struct {
Model string `json:"model"` //模型名称 Model string `json:"model"` //模型名称
Domain string `json:"domain"` //domain参数spark需要
Url string `json:"url"` //模型地址 Url string `json:"url"` //模型地址
APPID string `json:"appid"` //应用id APPID string `json:"appid"` //应用id
APISecret string `json:"apiSecret"` //应用密钥 APISecret string `json:"apiSecret"` //应用密钥

View File

@ -123,7 +123,7 @@ func Spark(modelParam proto.ModelParam, question, channel string, SessionID, Use
//发送消息 //发送消息
go func() { go func() {
data := genSparkParams(question, modelParam.APPID) data := genSparkParams(question, modelParam.APPID, modelParam.Domain)
//将数据转换为json //将数据转换为json
//dataByte, err := json.Marshal(data) //dataByte, err := json.Marshal(data)
if err != nil { 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{ messages := []MessageContent{
{Role: "user", Content: question}, {Role: "user", Content: question},
} }
@ -211,7 +211,7 @@ func genSparkParams(question, appid string) SparkRequest {
}, },
Parameter: Parameter{ Parameter: Parameter{
Chat: ChatParameter{ Chat: ChatParameter{
Domain: "4.0Ultra", Domain: domain,
Temperature: 0.8, Temperature: 0.8,
MaxTokens: 2048, MaxTokens: 2048,
}, },