AI Prompt Management @mentions type functionality

Created on 18 May 2025, 1 day ago

Problem/Motivation

Follow-up from Exploring AI Prompt management within AI core Active . Would be great to have mentions working

Steps to reproduce

Variables are validated but manually input at the moment:

And with tokens:

Proposed resolution

I have tried so many different tools, sadly feels like no community has rallied around a single one:

  1. Even tried including becoming a co-maintainer of CK Editor 5 Mentions in Drupal; however, CKE is heavily tied to the text format and not the instance of the text area, so having the available prompt types differ per text area would ultimately result in a high number of text formats which means overriding a number of places in core to suppress that elsewhere + many contrib extend it. Essentially too risk IMO.
  2. Generic JS functionalities like Tribute.js but it seems its rare for this to have been successfully achieved as its very opinionated on how it should be built, and most tend towards mentioning users of course like https://css-tricks.com/so-you-want-to-build-an-mention-autocomplete-feat.... Many also only support a single tag type, but we have both variables and tokens.
  3. Tribute.js itself seems to not be actively maintained so too high risk.

Most maintained seems to be https://github.com/signavio/react-mentions which does allow multiple tag types. Given XB is using React, it seems fair to use a React component to extend the textarea in src/Form/AiPromptSubform.php and I believe this will even sync back to the textarea for us.

Remaining tasks

  1. Decide what to do
  2. Implement

User interface changes

Suggestions appear when adding variables to prompts

API changes

N/A

Data model changes

N/A

Feature request
Status

Postponed

Version

1.1

Component

AI Core module

Created by

🇬🇧United Kingdom scott_euser

Live updates comments and jobs are added and updated live.
Sign in to follow issues

Comments & Activities

Production build 0.71.5 2024