mirror of
https://github.com/openclaw/openclaw.git
synced 2026-05-06 08:20:43 +00:00
fix(minimax): share provider hook bundle
This commit is contained in:
@@ -147,6 +147,20 @@ describe("minimax provider hooks", () => {
|
||||
expect(resolvedPortalModelId).toBe("MiniMax-M2.7-highspeed");
|
||||
});
|
||||
|
||||
it("shares the provider hook bundle across MiniMax variants", async () => {
|
||||
const { providers } = await registerProviderPlugin({
|
||||
plugin: minimaxProviderPlugin,
|
||||
id: "minimax",
|
||||
name: "MiniMax Provider",
|
||||
});
|
||||
const apiProvider = requireRegisteredProvider(providers, "minimax");
|
||||
const portalProvider = requireRegisteredProvider(providers, "minimax-portal");
|
||||
|
||||
expect(apiProvider.buildReplayPolicy).toBe(portalProvider.buildReplayPolicy);
|
||||
expect(apiProvider.wrapStreamFn).toBe(portalProvider.wrapStreamFn);
|
||||
expect(apiProvider.resolveReasoningOutputMode).toBe(portalProvider.resolveReasoningOutputMode);
|
||||
});
|
||||
|
||||
it("registers the bundled MiniMax web search provider", () => {
|
||||
const webSearchProviders: unknown[] = [];
|
||||
|
||||
|
||||
@@ -38,10 +38,11 @@ const HYBRID_ANTHROPIC_OPENAI_REPLAY_HOOKS = buildProviderReplayFamilyHooks({
|
||||
anthropicModelDropThinkingBlocks: true,
|
||||
});
|
||||
const MINIMAX_FAST_MODE_STREAM_HOOKS = buildProviderStreamFamilyHooks("minimax-fast-mode");
|
||||
|
||||
function resolveMinimaxReasoningOutputMode(): "native" {
|
||||
return "native";
|
||||
}
|
||||
const MINIMAX_PROVIDER_HOOKS = {
|
||||
...HYBRID_ANTHROPIC_OPENAI_REPLAY_HOOKS,
|
||||
...MINIMAX_FAST_MODE_STREAM_HOOKS,
|
||||
resolveReasoningOutputMode: () => "native" as const,
|
||||
};
|
||||
|
||||
function getDefaultBaseUrl(region: MiniMaxRegion): string {
|
||||
return region === "cn" ? DEFAULT_BASE_URL_CN : DEFAULT_BASE_URL_GLOBAL;
|
||||
@@ -240,9 +241,7 @@ export function registerMinimaxProviders(api: OpenClawPluginApi) {
|
||||
});
|
||||
return apiKey ? { token: apiKey } : null;
|
||||
},
|
||||
...HYBRID_ANTHROPIC_OPENAI_REPLAY_HOOKS,
|
||||
...MINIMAX_FAST_MODE_STREAM_HOOKS,
|
||||
resolveReasoningOutputMode: () => resolveMinimaxReasoningOutputMode(),
|
||||
...MINIMAX_PROVIDER_HOOKS,
|
||||
isModernModelRef: ({ modelId }) => isMiniMaxModernModelId(modelId),
|
||||
fetchUsageSnapshot: async (ctx) =>
|
||||
await fetchMinimaxUsage(ctx.token, ctx.timeoutMs, ctx.fetchFn),
|
||||
@@ -289,9 +288,7 @@ export function registerMinimaxProviders(api: OpenClawPluginApi) {
|
||||
run: createOAuthHandler("cn"),
|
||||
},
|
||||
],
|
||||
...HYBRID_ANTHROPIC_OPENAI_REPLAY_HOOKS,
|
||||
...MINIMAX_FAST_MODE_STREAM_HOOKS,
|
||||
resolveReasoningOutputMode: () => resolveMinimaxReasoningOutputMode(),
|
||||
...MINIMAX_PROVIDER_HOOKS,
|
||||
isModernModelRef: ({ modelId }) => isMiniMaxModernModelId(modelId),
|
||||
});
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user