feat: slash command autocomplete in chat input
Type '/' to see available OpenClaw commands (/status, /reasoning, /verbose, /model, /compact, /reset, /help) with descriptions. Navigate with arrow keys, select with Tab/Enter. Supports EN/FR i18n.
This commit is contained in:
@@ -151,6 +151,14 @@ const en = {
|
||||
'chat.bookmarks': 'Bookmarks',
|
||||
'chat.export': 'Export conversation',
|
||||
'chat.contextCompacted': 'Context compacted — older messages cached locally',
|
||||
'slash.commands': 'Commands',
|
||||
'slash.status': 'Show session status & usage',
|
||||
'slash.reasoning': 'Toggle reasoning mode',
|
||||
'slash.verbose': 'Toggle verbose output',
|
||||
'slash.model': 'Switch model for this session',
|
||||
'slash.compact': 'Compact conversation context',
|
||||
'slash.reset': 'Reset the session',
|
||||
'slash.help': 'Show available commands',
|
||||
} as const;
|
||||
|
||||
const fr: Record<keyof typeof en, string> = {
|
||||
@@ -281,6 +289,14 @@ const fr: Record<keyof typeof en, string> = {
|
||||
'chat.bookmarks': 'Marque-pages',
|
||||
'chat.export': 'Exporter la conversation',
|
||||
'chat.contextCompacted': 'Contexte compacté — anciens messages en cache local',
|
||||
'slash.commands': 'Commandes',
|
||||
'slash.status': 'Afficher le statut et l\'utilisation',
|
||||
'slash.reasoning': 'Activer/désactiver le raisonnement',
|
||||
'slash.verbose': 'Activer/désactiver le mode verbeux',
|
||||
'slash.model': 'Changer de modèle pour cette session',
|
||||
'slash.compact': 'Compacter le contexte',
|
||||
'slash.reset': 'Réinitialiser la session',
|
||||
'slash.help': 'Afficher les commandes disponibles',
|
||||
};
|
||||
|
||||
export type TranslationKey = keyof typeof en;
|
||||
|
||||
5
src/lib/slashUtils.ts
Normal file
5
src/lib/slashUtils.ts
Normal file
@@ -0,0 +1,5 @@
|
||||
/** Check if slash command menu should be shown */
|
||||
export function shouldShowSlashMenu(text: string): boolean {
|
||||
const trimmed = text.trimStart();
|
||||
return trimmed.startsWith('/') && !trimmed.includes('\n');
|
||||
}
|
||||
Reference in New Issue
Block a user