mirror of
https://github.com/Mintplex-Labs/anything-llm.git
synced 2024-11-19 04:30:10 +01:00
match user prompts exactly not partially (#2245)
This commit is contained in:
parent
9aa77dfb8d
commit
cf6928fd5d
@ -25,7 +25,10 @@ async function grepCommand(message, user = null) {
|
||||
// Allows multiple commands in one message
|
||||
let updatedMessage = message;
|
||||
for (const preset of userPresets) {
|
||||
const regex = new RegExp(preset.command, "g");
|
||||
const regex = new RegExp(
|
||||
`(?:\\b\\s|^)(${preset.command})(?:\\b\\s|$)`,
|
||||
"g"
|
||||
);
|
||||
updatedMessage = updatedMessage.replace(regex, preset.prompt);
|
||||
}
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user