Skip to content

Commit ac12cf2

Browse files
committed
fix: Enter key sends message when slash input matches no registered command
the Enter guard in the message composer checked !showCommands, but showCommands is set to true whenever the input is a single word starting with /. this blocked Enter from sending even when the typed slash-word matched zero registered commands -- the dropdown was not visible, yet the key was swallowed. this is a bug because it prevents users from sending LLM-directed slash commands (e.g. /podcast, /admin) that are not registered as Chainlit UI commands. fix: only block Enter when the command dropdown is actually rendered, i.e. when showCommands is true AND filteredCommands is non-empty. no change in behavior when the slash-word matches a registered command -- the dropdown still captures Enter for selection as before.
1 parent 5effb66 commit ac12cf2

File tree

1 file changed

+2
-2
lines changed
  • frontend/src/components/chat/MessageComposer

1 file changed

+2
-2
lines changed

frontend/src/components/chat/MessageComposer/Input.tsx

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -154,13 +154,13 @@ const Input = forwardRef<InputMethods, Props>(
154154
}
155155
}
156156

157-
// Handle regular enter only if command menu is not showing
157+
// Handle regular enter only if command dropdown is actually visible
158158
if (
159159
e.key === 'Enter' &&
160160
!e.shiftKey &&
161161
onEnter &&
162162
!isComposing &&
163-
!showCommands
163+
!(showCommands && filteredCommands.length > 0)
164164
) {
165165
e.preventDefault();
166166
onEnter();

0 commit comments

Comments
 (0)