Bug Report
Describe the bug
Messages that start with / cannot be sent to the model. Even adding a leading space (e.g., /hello) does not work — the message is still intercepted as a slash command.
To Reproduce
- Type
/hello in the composer input
- Press Enter to send
- The message is treated as a slash command instead of being sent to the model
Expected behavior
/hello should be treated as a slash command (current behavior is correct)
/hello (with a leading space) should be sent as a regular message to the model, not intercepted as a slash command
Root cause
In src/composer/composer.ts, the submit handler trims the input value before checking if it starts with /:
const message = elements.promptEl.value.trim(); // line 329
// ...
if (message.startsWith("/") && images.length === 0) { // line 333
The trim() removes leading whitespace, so /hello becomes /hello and is incorrectly treated as a slash command.
Suggested fix
Check the raw input value instead of the trimmed value:
if (elements.promptEl.value.startsWith("/") && images.length === 0) {
This way, a leading space indicates the user intends to send a regular message, not invoke a slash command.
Environment
- pi-web version: latest
- Browser: all
Bug Report
Describe the bug
Messages that start with
/cannot be sent to the model. Even adding a leading space (e.g.,/hello) does not work — the message is still intercepted as a slash command.To Reproduce
/helloin the composer inputExpected behavior
/helloshould be treated as a slash command (current behavior is correct)/hello(with a leading space) should be sent as a regular message to the model, not intercepted as a slash commandRoot cause
In
src/composer/composer.ts, the submit handler trims the input value before checking if it starts with/:The
trim()removes leading whitespace, so/hellobecomes/helloand is incorrectly treated as a slash command.Suggested fix
Check the raw input value instead of the trimmed value:
This way, a leading space indicates the user intends to send a regular message, not invoke a slash command.
Environment