Format: align thinking helpers

This commit is contained in:
Peter Steinberger
2025-12-03 01:02:10 +00:00
parent 38b18202fc
commit c4b0155cc2
2 changed files with 49 additions and 16 deletions

View File

@@ -40,10 +40,13 @@ function normalizeThinkLevel(raw?: string | null): ThinkLevel | undefined {
const key = raw.toLowerCase();
if (["off"].includes(key)) return "off";
if (["min", "minimal"].includes(key)) return "minimal";
if (["low"].includes(key)) return "low";
if (["med", "medium", "thinkhard", "think-harder", "thinkharder"].includes(key))
if (["low", "thinkhard", "think-hard", "think_hard"].includes(key))
return "low";
if (["med", "medium", "thinkharder", "think-harder", "harder"].includes(key))
return "medium";
if (["high", "ultra", "ultrathink", "think-hard", "thinkhardest"].includes(key))
if (
["high", "ultra", "ultrathink", "think-hard", "thinkhardest"].includes(key)
)
return "high";
if (["think"].includes(key)) return "minimal";
return undefined;
@@ -61,17 +64,6 @@ function extractThinkDirective(body?: string): {
return { cleaned, thinkLevel };
}
function appendThinkingCue(body: string, level?: ThinkLevel): string {
if (!level || level === "off") return body;
const cue =
level === "high"
? "ultrathink"
: level === "medium"
? "think harder"
: "think";
return [body.trim(), cue].filter(Boolean).join(" ");
}
function isAbortTrigger(text?: string): boolean {
if (!text) return false;
const normalized = text.trim().toLowerCase();