feat: add zai/glm-4.6v image understanding support (#10267)
Fixes #10265. Thanks @liuy.
This commit is contained in:
@@ -22,6 +22,8 @@ describe("image tool implicit imageModel config", () => {
|
||||
vi.stubEnv("ANTHROPIC_API_KEY", "");
|
||||
vi.stubEnv("ANTHROPIC_OAUTH_TOKEN", "");
|
||||
vi.stubEnv("MINIMAX_API_KEY", "");
|
||||
vi.stubEnv("ZAI_API_KEY", "");
|
||||
vi.stubEnv("Z_AI_API_KEY", "");
|
||||
// Avoid implicit Copilot provider discovery hitting the network in tests.
|
||||
vi.stubEnv("COPILOT_GITHUB_TOKEN", "");
|
||||
vi.stubEnv("GH_TOKEN", "");
|
||||
@@ -58,6 +60,21 @@ describe("image tool implicit imageModel config", () => {
|
||||
expect(createImageTool({ config: cfg, agentDir })).not.toBeNull();
|
||||
});
|
||||
|
||||
it("pairs zai primary with glm-4.6v (and fallbacks) when auth exists", async () => {
|
||||
const agentDir = await fs.mkdtemp(path.join(os.tmpdir(), "openclaw-image-"));
|
||||
vi.stubEnv("ZAI_API_KEY", "zai-test");
|
||||
vi.stubEnv("OPENAI_API_KEY", "openai-test");
|
||||
vi.stubEnv("ANTHROPIC_API_KEY", "anthropic-test");
|
||||
const cfg: OpenClawConfig = {
|
||||
agents: { defaults: { model: { primary: "zai/glm-4.7" } } },
|
||||
};
|
||||
expect(resolveImageModelConfigForTool({ cfg, agentDir })).toEqual({
|
||||
primary: "zai/glm-4.6v",
|
||||
fallbacks: ["openai/gpt-5-mini", "anthropic/claude-opus-4-5"],
|
||||
});
|
||||
expect(createImageTool({ config: cfg, agentDir })).not.toBeNull();
|
||||
});
|
||||
|
||||
it("pairs a custom provider when it declares an image-capable model", async () => {
|
||||
const agentDir = await fs.mkdtemp(path.join(os.tmpdir(), "openclaw-image-"));
|
||||
await writeAuthProfiles(agentDir, {
|
||||
|
||||
@@ -116,6 +116,8 @@ export function resolveImageModelConfigForTool(params: {
|
||||
preferred = "minimax/MiniMax-VL-01";
|
||||
} else if (providerOk && providerVisionFromConfig) {
|
||||
preferred = providerVisionFromConfig;
|
||||
} else if (primary.provider === "zai" && providerOk) {
|
||||
preferred = "zai/glm-4.6v";
|
||||
} else if (primary.provider === "openai" && openaiOk) {
|
||||
preferred = "openai/gpt-5-mini";
|
||||
} else if (primary.provider === "anthropic" && anthropicOk) {
|
||||
|
||||
Reference in New Issue
Block a user