mirror of
https://github.com/openclaw/openclaw.git
synced 2026-05-07 20:21:23 +00:00
test: tighten mistral media and onboarding coverage
This commit is contained in:
@@ -109,47 +109,69 @@ describe("runCapability auto audio entries", () => {
|
||||
});
|
||||
|
||||
it("uses mistral when only mistral key is configured", async () => {
|
||||
const priorEnv: Record<string, string | undefined> = {
|
||||
OPENAI_API_KEY: process.env.OPENAI_API_KEY,
|
||||
GROQ_API_KEY: process.env.GROQ_API_KEY,
|
||||
DEEPGRAM_API_KEY: process.env.DEEPGRAM_API_KEY,
|
||||
GEMINI_API_KEY: process.env.GEMINI_API_KEY,
|
||||
MISTRAL_API_KEY: process.env.MISTRAL_API_KEY,
|
||||
};
|
||||
delete process.env.OPENAI_API_KEY;
|
||||
delete process.env.GROQ_API_KEY;
|
||||
delete process.env.DEEPGRAM_API_KEY;
|
||||
delete process.env.GEMINI_API_KEY;
|
||||
process.env.MISTRAL_API_KEY = "mistral-test-key";
|
||||
let runResult: Awaited<ReturnType<typeof runCapability>> | undefined;
|
||||
await withAudioFixture("openclaw-auto-audio-mistral", async ({ ctx, media, cache }) => {
|
||||
const providerRegistry = buildProviderRegistry({
|
||||
openai: {
|
||||
id: "openai",
|
||||
capabilities: ["audio"],
|
||||
transcribeAudio: async () => ({ text: "openai", model: "gpt-4o-mini-transcribe" }),
|
||||
},
|
||||
mistral: {
|
||||
id: "mistral",
|
||||
capabilities: ["audio"],
|
||||
transcribeAudio: async (req) => ({ text: "mistral", model: req.model ?? "unknown" }),
|
||||
},
|
||||
});
|
||||
const cfg = {
|
||||
models: {
|
||||
providers: {
|
||||
mistral: {
|
||||
apiKey: "mistral-test-key",
|
||||
models: [],
|
||||
try {
|
||||
await withAudioFixture("openclaw-auto-audio-mistral", async ({ ctx, media, cache }) => {
|
||||
const providerRegistry = buildProviderRegistry({
|
||||
openai: {
|
||||
id: "openai",
|
||||
capabilities: ["audio"],
|
||||
transcribeAudio: async () => ({ text: "openai", model: "gpt-4o-mini-transcribe" }),
|
||||
},
|
||||
mistral: {
|
||||
id: "mistral",
|
||||
capabilities: ["audio"],
|
||||
transcribeAudio: async (req) => ({ text: "mistral", model: req.model ?? "unknown" }),
|
||||
},
|
||||
});
|
||||
const cfg = {
|
||||
models: {
|
||||
providers: {
|
||||
mistral: {
|
||||
apiKey: "mistral-test-key",
|
||||
models: [],
|
||||
},
|
||||
},
|
||||
},
|
||||
},
|
||||
tools: {
|
||||
media: {
|
||||
audio: {
|
||||
enabled: true,
|
||||
tools: {
|
||||
media: {
|
||||
audio: {
|
||||
enabled: true,
|
||||
},
|
||||
},
|
||||
},
|
||||
},
|
||||
} as unknown as OpenClawConfig;
|
||||
} as unknown as OpenClawConfig;
|
||||
|
||||
runResult = await runCapability({
|
||||
capability: "audio",
|
||||
cfg,
|
||||
ctx,
|
||||
attachments: cache,
|
||||
media,
|
||||
providerRegistry,
|
||||
runResult = await runCapability({
|
||||
capability: "audio",
|
||||
cfg,
|
||||
ctx,
|
||||
attachments: cache,
|
||||
media,
|
||||
providerRegistry,
|
||||
});
|
||||
});
|
||||
});
|
||||
} finally {
|
||||
for (const [key, value] of Object.entries(priorEnv)) {
|
||||
if (value === undefined) {
|
||||
delete process.env[key];
|
||||
} else {
|
||||
process.env[key] = value;
|
||||
}
|
||||
}
|
||||
}
|
||||
if (!runResult) {
|
||||
throw new Error("Expected auto audio mistral result");
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user