Skip to content

Commit 80a0b5c

Browse files
committed
fix(zai): inline ZAI line configs to avoid runtime/type export issues
1 parent 0cfbedc commit 80a0b5c

File tree

1 file changed

+15
-3
lines changed

1 file changed

+15
-3
lines changed

src/api/providers/zai.ts

Lines changed: 15 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,6 @@ import {
44
internationalZAiDefaultModelId,
55
mainlandZAiDefaultModelId,
66
ZAI_DEFAULT_TEMPERATURE,
7-
zaiApiLineConfigs,
87
} from "@roo-code/types"
98

109
import type { ApiHandlerOptions } from "../../shared/api"
@@ -14,10 +13,23 @@ import { BaseOpenAiCompatibleProvider } from "./base-openai-compatible-provider"
1413

1514
type ZAiModelId = InternationalZAiModelId | MainlandZAiModelId
1615

16+
// Local mapping to avoid cross-package runtime dependency issues in CI
17+
type ZaiApiLineLocal = "international_coding" | "international" | "china_coding" | "china"
18+
const ZAI_LINE_CONFIGS: Record<ZaiApiLineLocal, { name: string; baseUrl: string; isChina: boolean }> = {
19+
international_coding: {
20+
name: "International Coding Plan",
21+
baseUrl: "https://api.z.ai/api/coding/paas/v4",
22+
isChina: false,
23+
},
24+
international: { name: "International Standard", baseUrl: "https://api.z.ai/api/paas/v4", isChina: false },
25+
china_coding: { name: "China Coding Plan", baseUrl: "https://open.bigmodel.cn/api/coding/paas/v4", isChina: true },
26+
china: { name: "China Standard", baseUrl: "https://open.bigmodel.cn/api/paas/v4", isChina: true },
27+
}
28+
1729
export class ZAiHandler extends BaseOpenAiCompatibleProvider<ZAiModelId> {
1830
constructor(options: ApiHandlerOptions) {
19-
const line = options.zaiApiLine ?? "international_coding"
20-
const { isChina, baseUrl } = zaiApiLineConfigs[line]
31+
const line = (options.zaiApiLine ?? "international_coding") as ZaiApiLineLocal
32+
const { isChina, baseUrl } = ZAI_LINE_CONFIGS[line]
2133

2234
const defaultModelId = isChina ? mainlandZAiDefaultModelId : internationalZAiDefaultModelId
2335
const providerModels = (isChina ? mainlandZAiModels : internationalZAiModels) as unknown as Record<

0 commit comments

Comments
 (0)