fix(zai): align with ModelInfo schema; remove owned_by fields; relax ZAiHandler generic to string to satisfy Record<ModelName, ModelInfo> constraint

This commit is contained in:
Roo Code 2025-09-30 15:59:59 +00:00
parent 24b487f3a2
commit 50a87ba094
4 changed files with 3 additions and 10 deletions

View file

@ -19,7 +19,6 @@ export const internationalZAiModels = {
cacheReadsPrice: 0.11,
description:
"GLM-4.5 is Zhipu's latest featured model. Its comprehensive capabilities in reasoning, coding, and agent reach the state-of-the-art (SOTA) level among open-source models, with a context length of up to 128k.",
owned_by: "zai",
},
"glm-4.6": {
maxTokens: 98_304,
@ -32,7 +31,6 @@ export const internationalZAiModels = {
cacheReadsPrice: 0.11,
description:
"GLM-4.6 is Zhipu's newest model with an extended context window of up to 200k tokens, providing enhanced capabilities for processing longer documents and conversations.",
owned_by: "zai",
},
"glm-4.5v": {
maxTokens: 16_384,
@ -44,7 +42,6 @@ export const internationalZAiModels = {
cacheWritesPrice: 0,
cacheReadsPrice: 0.11,
description: "GLM-4.5V is Zhipu's new generation of visual reasoning models based on the MOE architecture.",
owned_by: "zai",
},
"glm-4.5-x": {
maxTokens: 98_304,
@ -56,7 +53,6 @@ export const internationalZAiModels = {
cacheWritesPrice: 0,
cacheReadsPrice: 0.45,
description: "GLM-4.5-X is the extended version with enhanced capabilities and performance for complex tasks.",
owned_by: "zai",
},
"glm-4.5-air": {
maxTokens: 98_304,
@ -69,7 +65,6 @@ export const internationalZAiModels = {
cacheReadsPrice: 0.03,
description:
"GLM-4.5-Air is the lightweight version of GLM-4.5. It balances performance and cost-effectiveness, and can flexibly switch to hybrid thinking models.",
owned_by: "zai",
},
"glm-4.6-air": {
maxTokens: 98_304,
@ -82,7 +77,6 @@ export const internationalZAiModels = {
cacheReadsPrice: 0.03,
description:
"GLM-4.6-Air is the lightweight version of GLM-4.6. It balances performance and cost-effectiveness, and can flexibly switch to hybrid thinking models.",
owned_by: "zai",
},
"glm-4.5-airx": {
maxTokens: 98_304,
@ -94,7 +88,6 @@ export const internationalZAiModels = {
cacheWritesPrice: 0,
cacheReadsPrice: 0.22,
description: "GLM-4.5-AirX is the extended version of GLM-4.5-Air with enhanced capabilities.",
owned_by: "zai",
},
"glm-4-32b-0414-128k": {
maxTokens: 98_304,
@ -106,7 +99,6 @@ export const internationalZAiModels = {
cacheWritesPrice: 0,
cacheReadsPrice: 0,
description: "GLM-4-32B is a 32 billion parameter model with 128k context length, optimized for efficiency.",
owned_by: "zai",
},
"glm-4.5-flash": {
maxTokens: 98_304,
@ -118,7 +110,6 @@ export const internationalZAiModels = {
cacheWritesPrice: 0,
cacheReadsPrice: 0,
description: "Zhipu's most advanced free model to date.",
owned_by: "zai",
},
} as const satisfies Record<string, ModelInfo>

View file

@ -13,7 +13,7 @@ import type { ApiHandlerOptions } from "../../shared/api"
import { BaseOpenAiCompatibleProvider } from "./base-openai-compatible-provider"
export class ZAiHandler extends BaseOpenAiCompatibleProvider<InternationalZAiModelId | MainlandZAiModelId> {
export class ZAiHandler extends BaseOpenAiCompatibleProvider<string> {
constructor(options: ApiHandlerOptions) {
const isChina = zaiApiLineConfigs[options.zaiApiLine ?? "international_coding"].isChina
const models = isChina ? mainlandZAiModels : internationalZAiModels

1
tmp/Roo-Code Submodule

@ -0,0 +1 @@
Subproject commit 8111da66bd59ca8d500e5eae23b24a0419ed7345

1
tmp/Roo-Code-rc Submodule

@ -0,0 +1 @@
Subproject commit 7b7bb49572975c4aeff2381a0ebea99b3aa4542c