Skip to content

Commit d92501d

Browse files
committed
fix(pdf): move MiniMax PDF fallback policy to metadata
1 parent 4f95cc3 commit d92501d

12 files changed

Lines changed: 313 additions & 57 deletions

CHANGELOG.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -65,6 +65,7 @@ Docs: https://docs.openclaw.ai
6565
- Agents/compaction: skip agent-harness preflight for provider-owned CLI runtime sessions so over-threshold Claude CLI sessions continue through normal compaction instead of failing on a missing harness. Fixes #84857. (#84878) Thanks @zhangguiping-xydt.
6666
- Control UI/config: save form-mode edits from the source config snapshot so runtime-only provider defaults like empty `models.providers.<id>.baseUrl` are not written back and rejected. Fixes #85831. Thanks @garyd9.
6767
- Telegram: normalize legacy durable group retry targets before retry sends, polls, and pins so group retries keep using the real chat id. (#85656) Thanks @luoyanglang.
68+
- Agents/PDF: route MiniMax PDF fallback policy through plugin metadata so MiniMax uses text extraction instead of VLM image fallback. (#85590, fixes #85575) Thanks @neeravmakwana.
6869
- WebChat: summarize internal message-tool source replies so tool cards no longer duplicate the visible reply body. (#84773) Thanks @jason-allen-oneal.
6970
- WebChat: scope the visible attachment button to its own composer file input so clicking Upload reliably opens the file picker. (#83952, fixes #47983) Thanks @jason-allen-oneal.
7071
- Gateway: preserve deferred lifecycle-error cleanup across later non-terminal events so provider timeouts can persist failed session state instead of leaving sessions stuck running. (#85256, fixes #63819) Thanks @samzong.

extensions/minimax/media-understanding-provider.ts

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,7 @@ export const minimaxMediaUnderstandingProvider: MediaUnderstandingProvider = {
88
id: "minimax",
99
capabilities: ["image"],
1010
defaultModels: { image: "MiniMax-VL-01" },
11+
documentModels: { pdf: { textExtraction: "MiniMax-M2.7", image: false } },
1112
autoPriority: { image: 40 },
1213
describeImage: describeImageWithModel,
1314
describeImages: describeImagesWithModel,
@@ -17,6 +18,7 @@ export const minimaxPortalMediaUnderstandingProvider: MediaUnderstandingProvider
1718
id: "minimax-portal",
1819
capabilities: ["image"],
1920
defaultModels: { image: "MiniMax-VL-01" },
21+
documentModels: { pdf: { textExtraction: "MiniMax-M2.7", image: false } },
2022
autoPriority: { image: 50 },
2123
describeImage: describeImageWithModel,
2224
describeImages: describeImagesWithModel,

extensions/minimax/openclaw.plugin.json

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -85,6 +85,12 @@
8585
"defaultModels": {
8686
"image": "MiniMax-VL-01"
8787
},
88+
"documentModels": {
89+
"pdf": {
90+
"textExtraction": "MiniMax-M2.7",
91+
"image": false
92+
}
93+
},
8894
"autoPriority": {
8995
"image": 40
9096
}
@@ -94,6 +100,12 @@
94100
"defaultModels": {
95101
"image": "MiniMax-VL-01"
96102
},
103+
"documentModels": {
104+
"pdf": {
105+
"textExtraction": "MiniMax-M2.7",
106+
"image": false
107+
}
108+
},
97109
"autoPriority": {
98110
"image": 50
99111
}

src/agents/tools/pdf-tool.model-config.test.ts

Lines changed: 73 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -144,6 +144,7 @@ describe("resolvePdfModelConfigForTool", () => {
144144

145145
expect(resolvePdfModelConfigForTool({ cfg, agentDir: TEST_AGENT_DIR })).toEqual({
146146
primary: "minimax/MiniMax-M2.7",
147+
fallbacks: ["minimax-portal/MiniMax-M2.7"],
147148
});
148149
});
149150

@@ -174,7 +175,77 @@ describe("resolvePdfModelConfigForTool", () => {
174175

175176
expect(resolvePdfModelConfigForTool({ cfg, agentDir: TEST_AGENT_DIR })).toEqual({
176177
primary: "openai/gpt-5.4-mini",
177-
fallbacks: ["minimax/MiniMax-M2.7"],
178+
fallbacks: ["minimax/MiniMax-M2.7", "minimax-portal/MiniMax-M2.7"],
179+
});
180+
});
181+
182+
it("preserves explicit MiniMax text models for PDF text extraction fallback", () => {
183+
vi.stubEnv("MINIMAX_API_KEY", "minimax-test");
184+
const cfg = {
185+
...withDefaultModel("minimax/MiniMax-M2.7-highspeed"),
186+
models: {
187+
providers: {
188+
minimax: {
189+
baseUrl: "https://api.minimax.io/anthropic",
190+
models: [
191+
{
192+
id: "MiniMax-M2.7-highspeed",
193+
name: "MiniMax M2.7 Highspeed",
194+
reasoning: false,
195+
input: ["text"],
196+
cost: { input: 0, output: 0, cacheRead: 0, cacheWrite: 0 },
197+
contextWindow: 128_000,
198+
maxTokens: 8_192,
199+
},
200+
],
201+
},
202+
},
203+
},
204+
} as OpenClawConfig;
205+
206+
expect(resolvePdfModelConfigForTool({ cfg, agentDir: TEST_AGENT_DIR })).toEqual({
207+
primary: "minimax/MiniMax-M2.7-highspeed",
208+
fallbacks: ["minimax-portal/MiniMax-M2.7"],
209+
});
210+
});
211+
212+
it("preserves explicit MiniMax text models from normalized provider keys", () => {
213+
vi.stubEnv("MINIMAX_API_KEY", "minimax-test");
214+
const cfg = {
215+
...withDefaultModel("openai/gpt-5.4"),
216+
models: {
217+
providers: {
218+
Minimax: {
219+
baseUrl: "https://api.minimax.io/anthropic",
220+
models: [
221+
{
222+
id: "MiniMax-M2.7-highspeed",
223+
name: "MiniMax M2.7 Highspeed",
224+
reasoning: false,
225+
input: ["text"],
226+
cost: { input: 0, output: 0, cacheRead: 0, cacheWrite: 0 },
227+
contextWindow: 128_000,
228+
maxTokens: 8_192,
229+
},
230+
],
231+
},
232+
},
233+
},
234+
} as OpenClawConfig;
235+
236+
expect(resolvePdfModelConfigForTool({ cfg, agentDir: TEST_AGENT_DIR })).toEqual({
237+
primary: "minimax/MiniMax-M2.7-highspeed",
238+
fallbacks: ["minimax-portal/MiniMax-M2.7"],
239+
});
240+
});
241+
242+
it("does not use MiniMax VLM primaries for PDF text extraction fallback", () => {
243+
vi.stubEnv("MINIMAX_API_KEY", "minimax-test");
244+
const cfg = withDefaultModel("minimax/MiniMax-VL-01");
245+
246+
expect(resolvePdfModelConfigForTool({ cfg, agentDir: TEST_AGENT_DIR })).toEqual({
247+
primary: "minimax/MiniMax-M2.7",
248+
fallbacks: ["minimax-portal/MiniMax-M2.7"],
178249
});
179250
});
180251

@@ -195,6 +266,7 @@ describe("resolvePdfModelConfigForTool", () => {
195266

196267
expect(resolvePdfModelConfigForTool({ cfg, agentDir: TEST_AGENT_DIR })).toEqual({
197268
primary: "minimax-portal/MiniMax-M2.7",
269+
fallbacks: ["minimax/MiniMax-M2.7"],
198270
});
199271
});
200272

0 commit comments

Comments
 (0)