mirror of
https://github.com/openclaw/openclaw.git
synced 2026-06-26 04:59:30 +00:00
refactor(zai): reuse canonical endpoint fallback
This commit is contained in:
@@ -189,8 +189,6 @@ describe("zai provider plugin", () => {
|
||||
).toEqual(registered);
|
||||
});
|
||||
|
||||
// FIX #94269: synthesized model must include baseUrl even when the template model
|
||||
// is not in the registry and no provider config is set.
|
||||
it("falls back to manifest baseUrl when both providerConfig and template model are unavailable", async () => {
|
||||
const provider = await registerSingleProviderPlugin(plugin);
|
||||
|
||||
|
||||
@@ -34,7 +34,7 @@ import { fetchZaiUsage } from "openclaw/plugin-sdk/provider-usage";
|
||||
import { normalizeLowercaseStringOrEmpty } from "openclaw/plugin-sdk/string-coerce-runtime";
|
||||
import { detectZaiEndpoint, type ZaiEndpointId } from "./detect.js";
|
||||
import { zaiMediaUnderstandingProvider } from "./media-understanding-provider.js";
|
||||
import { buildZaiModelDefinition, ZAI_MANIFEST_BASE_URL } from "./model-definitions.js";
|
||||
import { buildZaiModelDefinition, resolveZaiBaseUrl } from "./model-definitions.js";
|
||||
import { applyZaiConfig, applyZaiProviderConfig, resolveZaiModelId } from "./onboard.js";
|
||||
|
||||
const PROVIDER_ID = "zai";
|
||||
@@ -104,9 +104,8 @@ function resolveGlm5ForwardCompatModel(
|
||||
...template,
|
||||
id: def.id,
|
||||
name: def.name,
|
||||
// FIX #94269: fall back to manifest provider-level baseUrl when neither
|
||||
// provider config nor template model in registry has one.
|
||||
baseUrl: ctx.providerConfig?.baseUrl ?? template?.baseUrl ?? ZAI_MANIFEST_BASE_URL,
|
||||
// Native models must never fall through to the OpenAI SDK's default host.
|
||||
baseUrl: ctx.providerConfig?.baseUrl ?? template?.baseUrl ?? resolveZaiBaseUrl(),
|
||||
api: "openai-completions",
|
||||
provider: PROVIDER_ID,
|
||||
reasoning: def.reasoning,
|
||||
|
||||
@@ -11,8 +11,6 @@ export const ZAI_DEFAULT_MODEL_ID = "glm-5.1";
|
||||
export const ZAI_CODING_DEFAULT_MODEL_ID = "glm-5.2";
|
||||
|
||||
const ZAI_MANIFEST_CATALOG = manifest.modelCatalog.providers.zai;
|
||||
/** Provider-level default baseUrl from the bundled manifest. Used as runtime fallback. */
|
||||
export const ZAI_MANIFEST_BASE_URL = ZAI_MANIFEST_CATALOG.baseUrl;
|
||||
const ZAI_MANIFEST_PROVIDER = buildManifestModelProviderConfig({
|
||||
providerId: "zai",
|
||||
catalog: ZAI_MANIFEST_CATALOG,
|
||||
|
||||
Reference in New Issue
Block a user