mirror of
https://github.com/openclaw/openclaw.git
synced 2026-05-08 06:51:23 +00:00
Thinking: gate xhigh by model
This commit is contained in:
committed by
Peter Steinberger
parent
f50e06a1b6
commit
a3641526ab
@@ -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>",
|
||||
|
||||
Reference in New Issue
Block a user