diff --git a/cptr/frontend/src/lib/components/chat/ChatInput.svelte b/cptr/frontend/src/lib/components/chat/ChatInput.svelte index bb3bc9f..9fa9f03 100644 --- a/cptr/frontend/src/lib/components/chat/ChatInput.svelte +++ b/cptr/frontend/src/lib/components/chat/ChatInput.svelte @@ -939,7 +939,7 @@ } }); - const slashCommandQuery = $derived(inputText.trim().toLowerCase()); + const slashCommandQuery = $derived(inputText.trimStart().toLowerCase()); const slashCommandIds = $derived.by(() => { if (!slashCommandQuery.startsWith('/')) return []; const ids: string[] = []; @@ -979,7 +979,7 @@ $effect(() => { const query = slashCommandQuery; const requestId = ++slashSkillsRequestId; - if (!query.startsWith('/') || !workspace) { + if (!query.startsWith('/') || /\s/.test(query.slice(1)) || !workspace) { slashSkillSuggestions = []; return; } diff --git a/cptr/frontend/src/lib/components/chat/ChatPanel.svelte b/cptr/frontend/src/lib/components/chat/ChatPanel.svelte index 68e4a10..1d1d4a0 100644 --- a/cptr/frontend/src/lib/components/chat/ChatPanel.svelte +++ b/cptr/frontend/src/lib/components/chat/ChatPanel.svelte @@ -299,9 +299,7 @@ const streaming = $derived(allMessages.some((m) => m.role === 'assistant' && !m.done)); const isLanding = $derived(allMessages.length === 0 && !chatId); const hasChatContent = $derived( - activePath.some( - ({ msg }) => msg.role === 'user' && msg.content.trim() && !msg.content.trim().startsWith('/') - ) + activePath.some(({ msg }) => msg.role === 'user' && msg.content.trim()) ); const workspaceDisplayName = $derived(getPathDisplayName(workspace, 'workspace')); const displayChatTitle = $derived(chatTitle || firstUserMessageTitle() || workspaceDisplayName); @@ -722,10 +720,6 @@ let text = inputText.trim(); if (!text || !selectedModel) return; if (sending) return; - if (!hasChatContent && text.startsWith('/') && text !== '/plan') { - toast.error('Only /plan is available before this chat has content'); - return; - } if (hasChatContent && text === '/compact') { await handleManualCompact(); return; diff --git a/cptr/utils/chat_task.py b/cptr/utils/chat_task.py index ad19611..9d596ce 100644 --- a/cptr/utils/chat_task.py +++ b/cptr/utils/chat_task.py @@ -172,8 +172,6 @@ def _build_skill_create_prompt(user_request: str) -> str: def _message_has_real_content(message: dict) -> bool: text = _plain_message_text(message.get("content")).strip() - if message.get("role") == "user" and text.startswith("/"): - return False return bool( text or message.get("tool_calls") or message.get("reasoning_items") or message.get("output") )