[GH-ISSUE #2244] [BUG]: Incorrect Matching of Presets in Anything LLM #1466

Closed
opened 2026-02-22 18:24:57 -05:00 by yindo · 0 comments
Owner

Originally created by @MrSimonC on GitHub (Sep 8, 2024).
Original GitHub issue: https://github.com/Mintplex-Labs/anything-llm/issues/2244

Originally assigned to: @timothycarambat on GitHub.

How are you running AnythingLLM?

All versions

What happened?

I have noticed an issue with the preset matching functionality in Anything LLM. Currently, when a user adds their own presets, the matching criteria are too lax. For example, if I have two presets defined as /my-preset and /my-preset-specific, when I use /my-preset-specific, the system incorrectly matches /my-preset as well.

Expected Behavior:
The system should only match the exact preset being called, without incorrectly matching substrings.

Proposed Solution:
I have implemented a code update to improve the matching criteria. The new checks ensure that a match occurs only if it is at the start or end of the string, or if it is separated by a word boundary or whitespace. This change should help match more specifically and avoid unintended matches of substrings.

Are there known steps to reproduce?

Steps to Reproduce:

  1. Define two presets: /my-preset and /my-preset-specific.
  2. Initiate a chat and use the command /my-preset-specific.
  3. Observe that the system also matches /my-preset, which is incorrect.
Originally created by @MrSimonC on GitHub (Sep 8, 2024). Original GitHub issue: https://github.com/Mintplex-Labs/anything-llm/issues/2244 Originally assigned to: @timothycarambat on GitHub. ### How are you running AnythingLLM? All versions ### What happened? I have noticed an issue with the preset matching functionality in Anything LLM. Currently, when a user adds their own presets, the matching criteria are too lax. For example, if I have two presets defined as `/my-preset` and `/my-preset-specific`, when I use `/my-preset-specific`, the system incorrectly matches `/my-preset` as well. **Expected Behavior:** The system should only match the exact preset being called, without incorrectly matching substrings. **Proposed Solution:** I have implemented a code update to improve the matching criteria. The new checks ensure that a match occurs only if it is at the start or end of the string, or if it is separated by a word boundary or whitespace. This change should help match more specifically and avoid unintended matches of substrings. ### Are there known steps to reproduce? **Steps to Reproduce:** 1. Define two presets: `/my-preset` and `/my-preset-specific`. 2. Initiate a chat and use the command `/my-preset-specific`. 3. Observe that the system also matches `/my-preset`, which is incorrect.
yindo added the possible bug label 2026-02-22 18:24:57 -05:00
yindo closed this issue 2026-02-22 18:24:57 -05:00
yindo changed title from [BUG]: Incorrect Matching of Presets in Anything LLM to [GH-ISSUE #2244] [BUG]: Incorrect Matching of Presets in Anything LLM 2026-06-05 14:40:54 -04:00
Sign in to join this conversation.
1 Participants
Notifications
Due Date
No due date set.
Dependencies

No dependencies set.

Reference: Mintplex-Labs/anything-llm#1466