feat: support xunfei v3.5

This commit is contained in:
papersnake 2024-01-30 15:51:47 +08:00 committed by GitHub
parent 2cd1a78203
commit 7a6c66be8d
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194

View File

@ -252,9 +252,12 @@ func getXunfeiAuthUrl(c *gin.Context, apiKey string, apiSecret string) (string,
logger.SysLog("api_version not found, use default: " + apiVersion)
}
domain := "general"
if apiVersion != "v1.1" {
if apiVersion != "v1.1" && apiVersion != "v3.5" {
domain += strings.Split(apiVersion, ".")[0]
}
if apiVersion == "v3.5" {
domain += "v3.5"
}
authUrl := buildXunfeiAuthUrl(fmt.Sprintf("wss://spark-api.xf-yun.com/%s/chat", apiVersion), apiKey, apiSecret)
return domain, authUrl
}