mirror of
https://github.com/openclaw/openclaw.git
synced 2026-06-28 13:13:39 +00:00
36 lines
1.0 KiB
TypeScript
36 lines
1.0 KiB
TypeScript
// Openrouter plugin module implements thinking policy behavior.
|
|
import type { ProviderThinkingProfile } from "openclaw/plugin-sdk/plugin-entry";
|
|
import { isOpenRouterDeepSeekV4ModelId } from "./models.js";
|
|
|
|
const OPENROUTER_DEEPSEEK_V4_THINKING_LEVEL_IDS = [
|
|
"off",
|
|
"minimal",
|
|
"low",
|
|
"medium",
|
|
"high",
|
|
"xhigh",
|
|
] as const;
|
|
|
|
function buildOpenRouterDeepSeekV4ThinkingLevel(
|
|
id: (typeof OPENROUTER_DEEPSEEK_V4_THINKING_LEVEL_IDS)[number],
|
|
) {
|
|
return { id };
|
|
}
|
|
|
|
const OPENROUTER_DEEPSEEK_V4_THINKING_PROFILE = {
|
|
levels: OPENROUTER_DEEPSEEK_V4_THINKING_LEVEL_IDS.map(buildOpenRouterDeepSeekV4ThinkingLevel),
|
|
defaultLevel: "high",
|
|
} satisfies ProviderThinkingProfile;
|
|
|
|
export function supportsOpenRouterXHighThinking(modelId: string): boolean {
|
|
return isOpenRouterDeepSeekV4ModelId(modelId);
|
|
}
|
|
|
|
export function resolveOpenRouterThinkingProfile(
|
|
modelId: string,
|
|
): ProviderThinkingProfile | undefined {
|
|
return isOpenRouterDeepSeekV4ModelId(modelId)
|
|
? OPENROUTER_DEEPSEEK_V4_THINKING_PROFILE
|
|
: undefined;
|
|
}
|