feat(model): add MiniMax provider prefix for cross-platform model normalization (#463)
This commit is contained in:
@@ -34,6 +34,7 @@ export function resolveClaudeFamilyAlias(model: string): string {
|
||||
* "claude-sonnet-4-6" -> "anthropic/claude-sonnet-4-6"
|
||||
* "gpt-5.4" -> "openai/gpt-5.4"
|
||||
* "gemini-2.0" -> "google/gemini-2.0"
|
||||
* "minimax-m2.7" -> "minimax/minimax-m2.7"
|
||||
* "anthropic/foo" -> "anthropic/foo" (unchanged)
|
||||
*/
|
||||
export function addProviderPrefix(model: string): string {
|
||||
@@ -42,6 +43,7 @@ export function addProviderPrefix(model: string): string {
|
||||
if (/^(gpt-|o1-|o3-)/.test(model)) return `openai/${model}`
|
||||
if (/^gemini-/.test(model)) return `google/${model}`
|
||||
if (/^qwen-/.test(model)) return `qwen/${model}`
|
||||
if (/^minimax-/i.test(model)) return `minimax/${model}`
|
||||
return `anthropic/${model}`
|
||||
}
|
||||
|
||||
|
||||
@@ -40,6 +40,12 @@ describe("addProviderPrefix", () => {
|
||||
expect(addProviderPrefix("qwen-3.5-plus")).toBe("qwen/qwen-3.5-plus")
|
||||
})
|
||||
|
||||
test("prefixes MiniMax models with minimax/", () => {
|
||||
expect(addProviderPrefix("minimax-m2.7")).toBe("minimax/minimax-m2.7")
|
||||
expect(addProviderPrefix("minimax-m2.5-highspeed")).toBe("minimax/minimax-m2.5-highspeed")
|
||||
expect(addProviderPrefix("MiniMax-M2.7")).toBe("minimax/MiniMax-M2.7")
|
||||
})
|
||||
|
||||
test("defaults unknown models to anthropic/ prefix", () => {
|
||||
expect(addProviderPrefix("some-model")).toBe("anthropic/some-model")
|
||||
})
|
||||
|
||||
@@ -91,6 +91,26 @@ describe("convertClaudeToOpenClaw", () => {
|
||||
expect(parsed.data.model).toBe("anthropic/claude-sonnet-4-6")
|
||||
})
|
||||
|
||||
test("prefixes minimax models with minimax/ provider", () => {
|
||||
const plugin: ClaudePlugin = {
|
||||
...fixturePlugin,
|
||||
agents: [
|
||||
{
|
||||
name: "minimax-agent",
|
||||
description: "MiniMax agent",
|
||||
model: "minimax-m2.7",
|
||||
body: "Use MiniMax model.",
|
||||
sourcePath: "/tmp/plugin/agents/minimax.md",
|
||||
},
|
||||
],
|
||||
}
|
||||
|
||||
const bundle = convertClaudeToOpenClaw(plugin, defaultOptions)
|
||||
const skill = bundle.skills.find((s) => s.name === "minimax-agent")
|
||||
const parsed = parseFrontmatter(skill!.content)
|
||||
expect(parsed.data.model).toBe("minimax/minimax-m2.7")
|
||||
})
|
||||
|
||||
test("converts commands to skill files (excluding disableModelInvocation)", () => {
|
||||
const bundle = convertClaudeToOpenClaw(fixturePlugin, defaultOptions)
|
||||
|
||||
|
||||
@@ -246,6 +246,16 @@ describe("convertClaudeToQwen", () => {
|
||||
expect(parsed.data.model).toBe("qwen/qwen-max")
|
||||
})
|
||||
|
||||
test("prefixes minimax models with minimax/ provider", () => {
|
||||
const plugin: ClaudePlugin = {
|
||||
...fixturePlugin,
|
||||
agents: [{ name: "a", description: "d", model: "minimax-m2.7", body: "b", sourcePath: "/tmp/a.md" }],
|
||||
}
|
||||
const bundle = convertClaudeToQwen(plugin, defaultOptions)
|
||||
const parsed = parseFrontmatter(bundle.agents[0].content)
|
||||
expect(parsed.data.model).toBe("minimax/minimax-m2.7")
|
||||
})
|
||||
|
||||
test("passes through already-namespaced models unchanged", () => {
|
||||
const plugin: ClaudePlugin = {
|
||||
...fixturePlugin,
|
||||
|
||||
Reference in New Issue
Block a user