fix: extract and send @mentions from chat messages
This commit is contained in:
parent
b150f25949
commit
9e6cc84965
@ -146,9 +146,14 @@ export default function ChatPanel({ chatId, projectSlug }: Props) {
|
|||||||
setPendingFiles([]);
|
setPendingFiles([]);
|
||||||
setSending(true);
|
setSending(true);
|
||||||
try {
|
try {
|
||||||
|
// Extract @mentions from text
|
||||||
|
const mentionMatches = text.match(/@(\w+)/g);
|
||||||
|
const mentions = mentionMatches ? [...new Set(mentionMatches.map(m => m.slice(1)))] : [];
|
||||||
|
|
||||||
const msg = await sendMessage({
|
const msg = await sendMessage({
|
||||||
chat_id: chatId,
|
chat_id: chatId,
|
||||||
content: text,
|
content: text,
|
||||||
|
mentions: mentions.length > 0 ? mentions : undefined,
|
||||||
attachments: attachments.length > 0 ? attachments : undefined,
|
attachments: attachments.length > 0 ? attachments : undefined,
|
||||||
});
|
});
|
||||||
setMessages((prev) => {
|
setMessages((prev) => {
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user