diff --git a/src/lib/components/chat/MessageInput/Commands.svelte b/src/lib/components/chat/MessageInput/Commands.svelte
index f8b0d5b6db..c6feea1d1d 100644
--- a/src/lib/components/chat/MessageInput/Commands.svelte
+++ b/src/lib/components/chat/MessageInput/Commands.svelte
@@ -25,13 +25,13 @@
};
let command = '';
- $: command = (prompt?.trim() ?? '').split(' ')?.at(-1) ?? '';
+ $: command = prompt.split(' ')?.at(-1) ?? '';
{#if ['/', '#', '@'].includes(command?.charAt(0)) || '\\#' === command.slice(0, 2)}
{#if command?.charAt(0) === '/'}
- {:else if command?.charAt(0) === '#' || '\\#' === command.slice(0, 2)}
+ {:else if (command?.charAt(0) === '#' && command.startsWith('#') && !command.includes('# ')) || ('\\#' === command.slice(0, 2) && command.startsWith('#') && !command.includes('# '))}