Skip to content

AiMention

Based on the Mention component, specifically designed for AI assistants. Supports common interactions in AI scenarios such as calling Agents (intelligence), referencing Context (documents, tables, knowledge bases) through @ and other triggers.

Basic Usage

Displays the standard style of the AiMention component, including icon differentiation for different types, description info, and type tags.

Basic Usage

Type Filtering

Through the types attribute, you can implement type filtering under different trigger prefixes, such as @ for waking up agents and # for referencing knowledge base files.

Only Agent (@ Call...)

Only Context (# Ref...)

Type Filtering & Custom Prefix

Use in Nuxt

This component perfectly supports Nuxt 3/4 SSR. In Nuxt projects, the component is automatically registered and does not need to be imported manually.

For detailed configuration, please refer to the Nuxt Integration Document.

SSR Friendly

AiMention has passed full SSR testing and supports server-side rendering to ensure first-screen loading performance.

API

Props

PropertyDescriptionTypeDefault
v-modelBinding valuestring''
optionsMention options listAiMentionOption[][]
typesAllowed types list('agent'|'document'|'table'|'knowledge'|'file')[]['agent', 'document', 'table', 'knowledge', 'file']
triggersTrigger charactersstring[]['@']
typeInput type'input' | 'textarea''textarea'
placeholderPlaceholderstring''
disabledWhether disabledbooleanfalse
sizeSize'large' | 'default' | 'small'default
max-lengthMaximum lengthnumber
rowsTextarea rowsnumber3
loadingWhether in loading statebooleanfalse
theme-overridesComponent theme overridesComponentThemeVars{}
filter-optionCustom option filter / disable built-in one(keyword: string, option: MentionOption) => boolean | falseundefined
enable-file-treeEnable file tree selectorbooleantrue
file-loaderFile tree data loaderAiMentionFileLoaderundefined
file-rootFile tree root pathstring'/'
file-tree-expanded-levelDefault expanded level of file treenumber2
show-file-iconWhether to show file iconbooleantrue
show-file-sizeWhether to show file sizebooleantrue
show-modified-timeWhether to show last modified timebooleantrue
format-file-sizeFile size formatter(size: number) => stringBuilt-in formatter
search-debounceSearch debounce delay (ms)number300

AiMentionOption

PropertyDescriptionTypeDefault
labelDisplay textstring
valueSelected valuestring
typeAI type'agent' | 'document' | 'table' | 'knowledge' | 'file'
iconCustom iconstring
descriptionDescription textstring
pathFile/document pathstring
sizeFile size (bytes)number
modifiedAtLast modified timestampnumber
childrenChildren (for tree)AiMentionOption[]
isFolderWhether is folderboolean
expandedWhether expandedboolean

Slots

Slot NameDescriptionParameters
labelCustom option content{ option: AiMentionOption }
emptyContent when no matches
loadingLoading content

Theme Variables

VariableDescriptionDefault
--yh-ai-mention-option-heightOption height56px
--yh-ai-mention-agent-colorAgent type theme colorvar(--yh-color-primary)
--yh-ai-mention-doc-colorDocument type theme color#47c2ff
--yh-ai-mention-table-colorTable type theme color#10b981
--yh-ai-mention-knowledge-colorKnowledge base type theme color#f59e0b

Released under the MIT License.