feat: Add slash command system with skill acknowledgments

- Reset conversational.py to pr-58 working AVE integration
- Added TOOL_REGISTRY with all available slash commands
- Added _handle_slash_command for skill activation
- Slash commands show brief acknowledgment when used alone
- Slash commands with args are passed to AI for handling
- Added dropdown menu in ChatInterface for skill discovery
- Menu positions above textarea
- Menu shows filtered tools as user types
This commit is contained in:
shokollm
2026-04-13 16:21:57 +00:00
parent 61b9da295b
commit 39a27caf05
2 changed files with 238 additions and 46 deletions

View File

@@ -57,9 +57,11 @@
let expandedThinking: Record<string, boolean> = $state({});
let showSlashMenu = $state(false);
let slashMenuPosition = $state({ top: 0, left: 0 });
let filteredTools = $state<ToolItem[]>([]);
let selectedIndex = $state(0);
// Use $derived for filteredTools
let filteredTools = $derived(messageInput.startsWith('/') ? TOOLS.flatMap(t => t.tools).filter(tool => tool.name.toLowerCase().startsWith(messageInput.slice(1).toLowerCase()) || tool.command.toLowerCase().startsWith(messageInput.slice(1).toLowerCase())) : []);
function handleSend() {
if (!messageInput.trim()) return;
showSlashMenu = false;
@@ -95,18 +97,15 @@
messageInput = value;
if (value.startsWith('/')) {
const query = value.slice(1).toLowerCase();
filteredTools = TOOLS.flatMap(t => t.tools).filter(tool =>
tool.name.toLowerCase().startsWith(query) ||
tool.command.toLowerCase().startsWith(query)
);
selectedIndex = 0;
showSlashMenu = filteredTools.length > 0;
if (showSlashMenu) {
// Position menu above the textarea
const rect = target.getBoundingClientRect();
const menuHeight = 300;
slashMenuPosition = {
top: rect.top - 10,
top: Math.max(10, rect.top - menuHeight),
left: rect.left
};
}
@@ -330,7 +329,7 @@
</div>
{/if}
<textarea
bind:value={messageInput}
value={messageInput}
oninput={handleInput}
onkeydown={handleKeydown}
placeholder="Describe your trading strategy... (or type / for commands)"