chore: Fix types in tests 31/N.

This commit is contained in:
cpojer
2026-02-17 14:33:26 +09:00
parent f2f17bafbc
commit 116f5afea3
12 changed files with 185 additions and 85 deletions

View File

@@ -3,6 +3,7 @@ import os from "node:os";
import path from "node:path";
import { afterEach, beforeEach, describe, expect, it, vi } from "vitest";
import type { OpenClawConfig } from "../../config/config.js";
import type { ModelDefinitionConfig } from "../../config/types.models.js";
import { createOpenClawCodingTools } from "../pi-tools.js";
import { createHostSandboxFsBridge } from "../test-helpers/host-sandbox-fs-bridge.js";
import { __testing, createImageTool, resolveImageModelConfigForTool } from "./image-tool.js";
@@ -62,6 +63,18 @@ function createMinimaxImageConfig(): OpenClawConfig {
};
}
function makeModelDefinition(id: string, input: Array<"text" | "image">): ModelDefinitionConfig {
return {
id,
name: id,
reasoning: false,
input,
cost: { input: 0, output: 0, cacheRead: 0, cacheWrite: 0 },
contextWindow: 128_000,
maxTokens: 8_192,
};
}
async function expectImageToolExecOk(
tool: {
execute: (toolCallId: string, input: { prompt: string; image: string }) => Promise<unknown>;
@@ -171,8 +184,8 @@ describe("image tool implicit imageModel config", () => {
providers: {
acme: {
models: [
{ id: "text-1", input: ["text"] },
{ id: "vision-1", input: ["text", "image"] },
makeModelDefinition("text-1", ["text"]),
makeModelDefinition("vision-1", ["text", "image"]),
],
},
},
@@ -215,7 +228,7 @@ describe("image tool implicit imageModel config", () => {
models: {
providers: {
acme: {
models: [{ id: "vision-1", input: ["text", "image"] }],
models: [makeModelDefinition("vision-1", ["text", "image"])],
},
},
},