mirror of
https://github.com/openclaw/openclaw.git
synced 2026-05-10 18:14:58 +00:00
feat(commands): add /commands slash list
This commit is contained in:
@@ -6,6 +6,7 @@ export type ChatCommandDefinition = {
|
||||
description: string;
|
||||
textAliases: string[];
|
||||
acceptsArgs?: boolean;
|
||||
supportsNative?: boolean;
|
||||
};
|
||||
|
||||
export type NativeCommandSpec = {
|
||||
@@ -21,6 +22,12 @@ const CHAT_COMMANDS: ChatCommandDefinition[] = [
|
||||
description: "Show available commands.",
|
||||
textAliases: ["/help"],
|
||||
},
|
||||
{
|
||||
key: "commands",
|
||||
nativeName: "commands",
|
||||
description: "List all slash commands.",
|
||||
textAliases: ["/commands"],
|
||||
},
|
||||
{
|
||||
key: "status",
|
||||
nativeName: "status",
|
||||
@@ -65,6 +72,14 @@ const CHAT_COMMANDS: ChatCommandDefinition[] = [
|
||||
description: "Start a new session.",
|
||||
textAliases: ["/new"],
|
||||
},
|
||||
{
|
||||
key: "compact",
|
||||
nativeName: "compact",
|
||||
description: "Compact the current session context.",
|
||||
textAliases: ["/compact"],
|
||||
acceptsArgs: true,
|
||||
supportsNative: false,
|
||||
},
|
||||
{
|
||||
key: "think",
|
||||
nativeName: "think",
|
||||
@@ -127,7 +142,9 @@ export function listChatCommands(): ChatCommandDefinition[] {
|
||||
}
|
||||
|
||||
export function listNativeCommandSpecs(): NativeCommandSpec[] {
|
||||
return CHAT_COMMANDS.map((command) => ({
|
||||
return CHAT_COMMANDS.filter(
|
||||
(command) => command.supportsNative !== false,
|
||||
).map((command) => ({
|
||||
name: command.nativeName,
|
||||
description: command.description,
|
||||
acceptsArgs: Boolean(command.acceptsArgs),
|
||||
|
||||
Reference in New Issue
Block a user