Tool mentions (#239)

* disable click for invalid tools

* handle variables as mentions in the editor

* delete tools persist immediately

* deleting tools in live view shows the same warning and option to switch to draft
This commit is contained in:
arkml 2025-09-11 20:50:47 +05:30 committed by GitHub
parent 158777b045
commit 5efdee18eb
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
3 changed files with 51 additions and 9 deletions

View file

@ -105,8 +105,6 @@ export default function MarkdownContent({
return (
<span
className="inline-block bg-[#e0f2fe] text-[red] px-1.5 py-0.5 rounded whitespace-nowrap cursor-pointer"
onClick={handleMentionClick}
title={onMentionNavigate ? 'Click to open' : undefined}
>
{displayLabel} (!)
</span>

View file

@ -29,7 +29,7 @@ Quill.register('modules/mention', Mention);
function markdownToParts(markdown: string, atValues: Match[]): (string | Match)[] {
// Regex match for pattern [@type:name](#type:something) where type is tool/prompt/agent
const mentionRegex = /\[@(tool|prompt|agent):([^\]]+)\]\(#mention\)/g;
const mentionRegex = /\[@(tool|prompt|agent|variable):([^\]]+)\]\(#mention\)/g;
const parts: (string | Match)[] = [];
let lastIndex = 0;