AI scenarios
Commands and mentions
Bit.BlazorUI.AI Scripted transportType a slash for commands, or an at sign to reference a file, a person, or a data source.
Live demo
Start a message with / to pick a command, or type @ anywhere to reference something.
How it works
A BitAiSlashCommand with a Template inserts text into the composer, which suits
prompt shortcuts. One with a Handler runs application code instead, so /clear and
/regenerate never reach the model at all.
The handlers here are the session's own methods: /regenerate calls
BitAiChatSession.RegenerateAsync(), which discards the last answer and asks again, and
/clear stops any reply in flight (Stop()) and empties the conversation
(Conversation.Clear()).
Mentions are offered from a list the application supplies (BitAiMentionItem: an id, the label
inserted, a description and an icon). The composer inserts the label, so the transport receives plain text -
@roadmap.md - in the user message. Resolving it to content is the application's job, done by
identifier rather than by asking the model to guess which file or person was meant; this transport only reads
the mentions back out of the text and names them, and summarizes when the message starts with
"Summarize", which is what the /summarize template writes.
Arrow keys move through the menu, Enter or Tab accepts, and Escape closes it - claiming the key, so a dialog around the chat stays open.
Components used
BitAiPromptInput- the composer and its command and mention menus.BitAiChat- the chat that hands itsCommandsandMentionsto the composer.
Feedback
Found a mistake, a gap, or something that could be clearer? Every page and every component is one click from its source.