mirror of
https://github.com/open-webui/open-webui.git
synced 2026-09-13 23:14:11 +00:00
fix: render mentions whose ID contains any non-whitespace character as chips (#29864)
* fix: render channel mentions whose ID contains spaces or parentheses, such as workspace model IDs * fix: accept any non-whitespace mention ID, matching the model ID rule on dev
This commit is contained in:
parent
540467b90a
commit
eb9b7b659f
2 changed files with 2 additions and 2 deletions
|
|
@ -499,7 +499,7 @@
|
|||
const escaped = line.replace(/&/g, '&').replace(/</g, '<').replace(/>/g, '>');
|
||||
// Now replace the escaped mention patterns back into real spans
|
||||
const withMentions = escaped.replace(
|
||||
/<([@#$])([\w.\-:/]+)(?:\|([^&]*?))?>|<\/([\w.\-:/]+)\|([^&]*?)>/g,
|
||||
/<([@#$])([^|&\s]+)(?:\|([^&]*?))?>|<\/([\w.\-:/]+)\|([^&]*?)>/g,
|
||||
(_, ch, id, label, slashSkillId, slashSkillLabel) => {
|
||||
const mentionChar = ch || '$';
|
||||
const mentionId = id || slashSkillId;
|
||||
|
|
|
|||
|
|
@ -40,7 +40,7 @@ export function mentionExtension(opts: MentionOptions = {}) {
|
|||
// Compile the regex once when the extension is created, not on every tokenizer call.
|
||||
// mentionStart fires on every '<' in the document, making the tokenizer a hot path.
|
||||
const trigger = opts.triggerChar ?? '@';
|
||||
const re = new RegExp(`^<\\${trigger}([\\w.\\-:/]+)(?:\\|([^>]*))?>`);
|
||||
const re = new RegExp(`^<\\${trigger}([^|>\\s]+)(?:\\|([^>]*))?>`);
|
||||
const snapshot: MentionOptions = {
|
||||
triggerChar: trigger,
|
||||
className: opts.className,
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue