Skip to content

Commit 80c525f

Browse files
committed
core: add Spark V3.5 support.
1 parent 40cf325 commit 80c525f

File tree

2 files changed

+6
-4
lines changed

2 files changed

+6
-4
lines changed

src/main/kotlin/cc/unitmesh/devti/llms/xianghuo/XingHuoProvider.kt

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -33,6 +33,7 @@ class XingHuoProvider(val project: Project) : LLMProvider {
3333
get() = when (this) {
3434
XingHuoApiVersion.V1 -> ""
3535
XingHuoApiVersion.V2 -> "v2"
36+
XingHuoApiVersion.V3_5 -> "v3.5"
3637
else -> "v3"
3738
}
3839

@@ -128,7 +129,7 @@ class XingHuoProvider(val project: Project) : LLMProvider {
128129
val header = """
129130
|host: spark-api.xf-yun.com
130131
|date: $date
131-
|GET /v${apiVersion.value}.1/chat HTTP/1.1
132+
|GET /v${apiVersion.value}/chat HTTP/1.1
132133
""".trimMargin()
133134
val signature = hmacsha256.doFinal(header.toByteArray()).encodeBase64()
134135
val authorization =
@@ -139,7 +140,7 @@ class XingHuoProvider(val project: Project) : LLMProvider {
139140
"date" to date,
140141
"host" to "spark-api.xf-yun.com"
141142
)
142-
val urlBuilder = "https://spark-api.xf-yun.com/v${apiVersion.value}.1/chat".toHttpUrl().newBuilder()
143+
val urlBuilder = "https://spark-api.xf-yun.com/v${apiVersion.value}/chat".toHttpUrl().newBuilder()
143144
params.forEach {
144145
urlBuilder.addQueryParameter(it.key, it.value)
145146
}

src/main/kotlin/cc/unitmesh/devti/settings/Constants.kt

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -9,14 +9,15 @@ enum class AIEngines {
99

1010
val GIT_TYPE = arrayOf("Github" , "Gitlab")
1111
val DEFAULT_GIT_TYPE = GIT_TYPE[0]
12-
enum class XingHuoApiVersion(val value: Int) {
13-
V1(1), V2(2), V3(3);
12+
enum class XingHuoApiVersion(val value: Double) {
13+
V1(1.1), V2(2.1), V3(3.1), V3_5(3.5);
1414

1515
companion object {
1616
fun of(str: String): XingHuoApiVersion = when (str) {
1717
"V1" -> V1
1818
"V2" -> V2
1919
"V3" -> V3
20+
"V3_5" -> V3_5
2021
else -> V3
2122
}
2223
}

0 commit comments

Comments
 (0)