Skip to content

Commit e1ccaa1

Browse files
committed
Merge branch 'main' of github.com:RooVetGit/Roo-Code into feat/reorder-profile
2 parents d47433f + 68c5be8 commit e1ccaa1

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

75 files changed

+1468
-455
lines changed

packages/types/src/provider-settings.ts

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -308,9 +308,13 @@ const sambaNovaSchema = apiModelIdProviderModelSchema.extend({
308308
sambaNovaApiKey: z.string().optional(),
309309
})
310310

311+
export const zaiApiLineSchema = z.enum(["international_coding", "international", "china_coding", "china"])
312+
313+
export type ZaiApiLine = z.infer<typeof zaiApiLineSchema>
314+
311315
const zaiSchema = apiModelIdProviderModelSchema.extend({
312316
zaiApiKey: z.string().optional(),
313-
zaiApiLine: z.union([z.literal("china"), z.literal("international")]).optional(),
317+
zaiApiLine: zaiApiLineSchema.optional(),
314318
})
315319

316320
const fireworksSchema = apiModelIdProviderModelSchema.extend({

packages/types/src/providers/zai.ts

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,5 @@
11
import type { ModelInfo } from "../model.js"
2+
import { ZaiApiLine } from "../provider-settings.js"
23

34
// Z AI
45
// https://docs.z.ai/guides/llm/glm-4.5
@@ -103,3 +104,14 @@ export const mainlandZAiModels = {
103104
} as const satisfies Record<string, ModelInfo>
104105

105106
export const ZAI_DEFAULT_TEMPERATURE = 0
107+
108+
export const zaiApiLineConfigs = {
109+
international_coding: {
110+
name: "International Coding Plan",
111+
baseUrl: "https://api.z.ai/api/coding/paas/v4",
112+
isChina: false,
113+
},
114+
international: { name: "International Standard", baseUrl: "https://api.z.ai/api/paas/v4", isChina: false },
115+
china_coding: { name: "China Coding Plan", baseUrl: "https://open.bigmodel.cn/api/coding/paas/v4", isChina: true },
116+
china: { name: "China Standard", baseUrl: "https://open.bigmodel.cn/api/paas/v4", isChina: true },
117+
} satisfies Record<ZaiApiLine, { name: string; baseUrl: string; isChina: boolean }>

pnpm-lock.yaml

Lines changed: 25 additions & 28 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

src/api/providers/__tests__/zai.spec.ts

Lines changed: 10 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -41,7 +41,11 @@ describe("ZAiHandler", () => {
4141

4242
it("should use the correct international Z AI base URL", () => {
4343
new ZAiHandler({ zaiApiKey: "test-zai-api-key", zaiApiLine: "international" })
44-
expect(OpenAI).toHaveBeenCalledWith(expect.objectContaining({ baseURL: "https://api.z.ai/api/paas/v4" }))
44+
expect(OpenAI).toHaveBeenCalledWith(
45+
expect.objectContaining({
46+
baseURL: "https://api.z.ai/api/paas/v4",
47+
}),
48+
)
4549
})
4650

4751
it("should use the provided API key for international", () => {
@@ -109,7 +113,11 @@ describe("ZAiHandler", () => {
109113
describe("Default behavior", () => {
110114
it("should default to international when no zaiApiLine is specified", () => {
111115
const handlerDefault = new ZAiHandler({ zaiApiKey: "test-zai-api-key" })
112-
expect(OpenAI).toHaveBeenCalledWith(expect.objectContaining({ baseURL: "https://api.z.ai/api/paas/v4" }))
116+
expect(OpenAI).toHaveBeenCalledWith(
117+
expect.objectContaining({
118+
baseURL: "https://api.z.ai/api/coding/paas/v4",
119+
}),
120+
)
113121

114122
const model = handlerDefault.getModel()
115123
expect(model.id).toBe(internationalZAiDefaultModelId)

src/api/providers/zai.ts

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,7 @@ import {
66
type InternationalZAiModelId,
77
type MainlandZAiModelId,
88
ZAI_DEFAULT_TEMPERATURE,
9+
zaiApiLineConfigs,
910
} from "@roo-code/types"
1011

1112
import type { ApiHandlerOptions } from "../../shared/api"
@@ -14,14 +15,14 @@ import { BaseOpenAiCompatibleProvider } from "./base-openai-compatible-provider"
1415

1516
export class ZAiHandler extends BaseOpenAiCompatibleProvider<InternationalZAiModelId | MainlandZAiModelId> {
1617
constructor(options: ApiHandlerOptions) {
17-
const isChina = options.zaiApiLine === "china"
18+
const isChina = zaiApiLineConfigs[options.zaiApiLine ?? "international_coding"].isChina
1819
const models = isChina ? mainlandZAiModels : internationalZAiModels
1920
const defaultModelId = isChina ? mainlandZAiDefaultModelId : internationalZAiDefaultModelId
2021

2122
super({
2223
...options,
2324
providerName: "Z AI",
24-
baseURL: isChina ? "https://open.bigmodel.cn/api/paas/v4" : "https://api.z.ai/api/paas/v4",
25+
baseURL: zaiApiLineConfigs[options.zaiApiLine ?? "international_coding"].baseUrl,
2526
apiKey: options.zaiApiKey ?? "not-provided",
2627
defaultProviderModelId: defaultModelId,
2728
providerModels: models,

src/core/webview/webviewMessageHandler.ts

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2818,7 +2818,12 @@ export const webviewMessageHandler = async (
28182818
TelemetryService.instance.captureTabShown(message.tab)
28192819
}
28202820

2821-
await provider.postMessageToWebview({ type: "action", action: "switchTab", tab: message.tab })
2821+
await provider.postMessageToWebview({
2822+
type: "action",
2823+
action: "switchTab",
2824+
tab: message.tab,
2825+
values: message.values,
2826+
})
28222827
}
28232828
break
28242829
}

src/i18n/locales/ca/common.json

Lines changed: 4 additions & 0 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

src/i18n/locales/de/common.json

Lines changed: 4 additions & 0 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

src/i18n/locales/en/common.json

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -215,5 +215,9 @@
215215
"preventCompletionWithOpenTodos": {
216216
"description": "Prevent task completion when there are incomplete todos in the todo list"
217217
}
218+
},
219+
"docsLink": {
220+
"label": "Docs",
221+
"url": "https://docs.roocode.com"
218222
}
219223
}

src/i18n/locales/es/common.json

Lines changed: 4 additions & 0 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

0 commit comments

Comments
 (0)