mirror of
https://github.com/openclaw/openclaw.git
synced 2026-05-09 04:27:41 +00:00
feat(zai): auto-detect endpoint + default glm-5 (#14786)
* feat(zai): auto-detect endpoint + default glm-5 * test: fix Z.AI default endpoint expectation (#14786) * test: bump embedded runner beforeAll timeout * chore: update changelog for Z.AI GLM-5 autodetect (#14786) * chore: resolve changelog merge conflict with main (#14786) * chore: append changelog note for #14786 without merge conflict * chore: sync changelog with main to resolve merge conflict
This commit is contained in:
committed by
GitHub
parent
2b5df1dfea
commit
5e7842a41d
@@ -53,6 +53,7 @@ import {
|
||||
resolveCustomProviderId,
|
||||
} from "../../onboard-custom.js";
|
||||
import { applyOpenAIConfig } from "../../openai-model-default.js";
|
||||
import { detectZaiEndpoint } from "../../zai-endpoint-detect.js";
|
||||
import { resolveNonInteractiveApiKey } from "../api-keys.js";
|
||||
|
||||
export async function applyNonInteractiveAuthChoice(params: {
|
||||
@@ -214,8 +215,10 @@ export async function applyNonInteractiveAuthChoice(params: {
|
||||
mode: "api_key",
|
||||
});
|
||||
|
||||
// Determine endpoint from authChoice or opts
|
||||
// Determine endpoint from authChoice or detect from the API key.
|
||||
let endpoint: "global" | "cn" | "coding-global" | "coding-cn" | undefined;
|
||||
let modelIdOverride: string | undefined;
|
||||
|
||||
if (authChoice === "zai-coding-global") {
|
||||
endpoint = "coding-global";
|
||||
} else if (authChoice === "zai-coding-cn") {
|
||||
@@ -225,9 +228,19 @@ export async function applyNonInteractiveAuthChoice(params: {
|
||||
} else if (authChoice === "zai-cn") {
|
||||
endpoint = "cn";
|
||||
} else {
|
||||
endpoint = "coding-global";
|
||||
const detected = await detectZaiEndpoint({ apiKey: resolved.key });
|
||||
if (detected) {
|
||||
endpoint = detected.endpoint;
|
||||
modelIdOverride = detected.modelId;
|
||||
} else {
|
||||
endpoint = "global";
|
||||
}
|
||||
}
|
||||
return applyZaiConfig(nextConfig, { endpoint });
|
||||
|
||||
return applyZaiConfig(nextConfig, {
|
||||
endpoint,
|
||||
...(modelIdOverride ? { modelId: modelIdOverride } : {}),
|
||||
});
|
||||
}
|
||||
|
||||
if (authChoice === "xiaomi-api-key") {
|
||||
|
||||
Reference in New Issue
Block a user