feat: add /reasoning reasoning visibility

This commit is contained in:
Peter Steinberger
2026-01-07 06:16:38 +01:00
parent cb2a72f8a9
commit 1673a221f8
32 changed files with 370 additions and 23 deletions

View File

@@ -1,6 +1,7 @@
export type ThinkLevel = "off" | "minimal" | "low" | "medium" | "high";
export type VerboseLevel = "off" | "on";
export type ElevatedLevel = "off" | "on";
export type ReasoningLevel = "off" | "on";
// Normalize user-provided thinking level strings to the canonical enum.
export function normalizeThinkLevel(
@@ -55,3 +56,31 @@ export function normalizeElevatedLevel(
if (["on", "true", "yes", "1"].includes(key)) return "on";
return undefined;
}
// Normalize reasoning visibility flags used to toggle reasoning exposure.
export function normalizeReasoningLevel(
raw?: string | null,
): ReasoningLevel | undefined {
if (!raw) return undefined;
const key = raw.toLowerCase();
if (
[
"off",
"false",
"no",
"0",
"hide",
"hidden",
"disable",
"disabled",
].includes(key)
)
return "off";
if (
["on", "true", "yes", "1", "show", "visible", "enable", "enabled"].includes(
key,
)
)
return "on";
return undefined;
}