Files
OpenClaw-bot-review/__tests__/minimax-integration.test.ts
T
PR Bot 1babaa2fe2 feat: add MiniMax provider support with model metadata enrichment
- Add MiniMax temperature clamping in model-probe (temperature > 0 required)
- Add known-providers metadata database for MiniMax-M2.7 and M2.7-highspeed
- Enrich provider model details from built-in presets when config is incomplete
- Add vitest test framework with 21 unit tests and 3 integration tests
- Document MiniMax provider setup in README (English and Chinese)
2026-03-26 11:41:51 +08:00

64 lines
2.0 KiB
TypeScript

import { describe, it, expect } from "vitest";
const API_KEY = process.env.MINIMAX_API_KEY;
const BASE_URL = "https://api.minimax.io/v1";
describe.skipIf(!API_KEY)("MiniMax API E2E", () => {
it("completes basic chat with MiniMax-M2.7", async () => {
const response = await fetch(`${BASE_URL}/chat/completions`, {
method: "POST",
headers: {
"Content-Type": "application/json",
Authorization: `Bearer ${API_KEY}`,
},
body: JSON.stringify({
model: "MiniMax-M2.7",
messages: [{ role: "user", content: 'Say "test passed"' }],
max_tokens: 20,
temperature: 1,
}),
});
expect(response.ok).toBe(true);
const data = await response.json();
expect(data.choices[0].message.content).toBeTruthy();
}, 30000);
it("completes chat with temperature=1 (recommended for MiniMax)", async () => {
const response = await fetch(`${BASE_URL}/chat/completions`, {
method: "POST",
headers: {
"Content-Type": "application/json",
Authorization: `Bearer ${API_KEY}`,
},
body: JSON.stringify({
model: "MiniMax-M2.7",
messages: [{ role: "user", content: "Reply with one word" }],
max_tokens: 8,
temperature: 1,
}),
});
expect(response.ok).toBe(true);
const data = await response.json();
expect(data.choices[0].message.content).toBeTruthy();
}, 30000);
it("completes chat with MiniMax-M2.7-highspeed", async () => {
const response = await fetch(`${BASE_URL}/chat/completions`, {
method: "POST",
headers: {
"Content-Type": "application/json",
Authorization: `Bearer ${API_KEY}`,
},
body: JSON.stringify({
model: "MiniMax-M2.7-highspeed",
messages: [{ role: "user", content: 'Reply with "ok"' }],
max_tokens: 10,
temperature: 1,
}),
});
expect(response.ok).toBe(true);
const data = await response.json();
expect(data.choices[0].message.content).toBeTruthy();
}, 30000);
});