Thinking: gate xhigh by model

This commit is contained in:
George Pickett
2026-01-07 17:17:38 -08:00
committed by Peter Steinberger
parent f50e06a1b6
commit a3641526ab
21 changed files with 503 additions and 150 deletions

View File

@@ -1,6 +1,9 @@
import type { SlashCommand } from "@mariozechner/pi-tui";
import {
formatThinkingLevels,
listThinkingLevels,
} from "../auto-reply/thinking.js";
const THINK_LEVELS = ["off", "minimal", "low", "medium", "high"];
const VERBOSE_LEVELS = ["on", "off"];
const REASONING_LEVELS = ["on", "off"];
const ELEVATED_LEVELS = ["on", "off"];
@@ -12,6 +15,11 @@ export type ParsedCommand = {
args: string;
};
export type SlashCommandOptions = {
provider?: string;
model?: string;
};
const COMMAND_ALIASES: Record<string, string> = {
elev: "elevated",
};
@@ -27,7 +35,10 @@ export function parseCommand(input: string): ParsedCommand {
};
}
export function getSlashCommands(): SlashCommand[] {
export function getSlashCommands(
options: SlashCommandOptions = {},
): SlashCommand[] {
const thinkLevels = listThinkingLevels(options.provider, options.model);
return [
{ name: "help", description: "Show slash command help" },
{ name: "status", description: "Show gateway status summary" },
@@ -44,9 +55,9 @@ export function getSlashCommands(): SlashCommand[] {
name: "think",
description: "Set thinking level",
getArgumentCompletions: (prefix) =>
THINK_LEVELS.filter((v) => v.startsWith(prefix.toLowerCase())).map(
(value) => ({ value, label: value }),
),
thinkLevels
.filter((v) => v.startsWith(prefix.toLowerCase()))
.map((value) => ({ value, label: value })),
},
{
name: "verbose",
@@ -105,7 +116,12 @@ export function getSlashCommands(): SlashCommand[] {
];
}
export function helpText(): string {
export function helpText(options: SlashCommandOptions = {}): string {
const thinkLevels = formatThinkingLevels(
options.provider,
options.model,
"|",
);
return [
"Slash commands:",
"/help",
@@ -113,7 +129,7 @@ export function helpText(): string {
"/agent <id> (or /agents)",
"/session <key> (or /sessions)",
"/model <provider/model> (or /models)",
"/think <off|minimal|low|medium|high>",
`/think <${thinkLevels}>`,
"/verbose <on|off>",
"/reasoning <on|off>",
"/cost <on|off>",