Skip to content

Commit

Permalink
适配星火最新websocket接口
Browse files Browse the repository at this point in the history
  • Loading branch information
pwh-pwh committed Aug 1, 2024
1 parent 800cad3 commit f067654
Showing 1 changed file with 10 additions and 2 deletions.
12 changes: 10 additions & 2 deletions config/spark.go
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@ import (
"errors"
"os"
"regexp"
"strings"
)

const (
Expand All @@ -23,6 +24,9 @@ type SparkConfig struct {
}

func extractVersion(url string) string {
if strings.Contains(url, "pro-128k") {
return "pro-128k"
}
// 使用正则表达式匹配版本号
regex := regexp.MustCompile(`v(\d+)\.(\d+)`)
matches := regex.FindStringSubmatch(url)
Expand All @@ -43,16 +47,20 @@ func GetSparkConfig() (cfg *SparkConfig, err error) {
var sparkDomainVersion = ""

switch version {
case "pro-128k":
sparkDomainVersion = "pro-128k"
case "4.0":
sparkDomainVersion = "4.0Ultra"
case "3.5":
sparkDomainVersion = "generalv3.5"
case "3.1":
sparkDomainVersion = "generalv3"
case "2.1":
sparkDomainVersion = "generalv2"
case "1.5":
case "1.1":
sparkDomainVersion = "general"
default:
sparkDomainVersion = ""
sparkDomainVersion = "general"
}

cfg = &SparkConfig{
Expand Down

0 comments on commit f067654

Please sign in to comment.