Vue Frontend Integration
This guide describes three frontend cases. Choose exactly one case for each instance.
Beginner's overview
There are three different things involved:
- TYPO3/Fluid renders the initial HTML and provides secure configuration values such as endpoints, tokens, labels and JSON settings;
- the existing Vue application owns the browser-side component tree;
- the Assistant composable owns requests, streaming, messages, consent and language handling.
In Integration mode, TYPO3 does not render the Chat itself. It renders a plain
div containing data-* attributes. The existing Vue application reads
these attributes and renders the Vue component in its own template.
There is no additional Vue application for each Chat or Summary. There is one
Vue root for the site, normally created once in main. with
create.
JavaScript imports are not Fluid paths
Paths beginning with EXT: are TYPO3/Fluid paths. They are valid in Fluid
templates and documentation, but they are not valid JavaScript imports.
The site bundler needs an alias. Add this resolve. section to the
existing configure object in vue.:
const path = require('path');
module.exports = {
configureWebpack: {
resolve: {
alias: {
'@ai-assistant': path.resolve(
__dirname,
'../../../../../vendor/madj2k/t3-ai-assistant/Resources/Private/Frontend/Vue/Src',
),
'@ai-assistant-premium': path.resolve(
__dirname,
'../../../../../vendor/madj2k/t3-ai-assistant-premium/Resources/Private/Frontend/Vue/Src',
),
},
},
},
};
// If module.exports/configureWebpack already exists, merge only the
// `resolve.alias` block into that existing configuration.
The relative paths above are for a site package whose Vue project is located at
packages/. Other projects must adjust
the filesystem path to their Composer vendor directory.
After adding the aliases, imports are simple and stable:
import {
ChatInput,
ChatMessageList,
ChatStatus,
LanguageSelector,
chatProps,
useAiAssistantChat,
} from '@ai-assistant/index.js';
import {
AiAssistantSearchSummary,
summaryProps,
} from '@ai-assistant-premium/index.js';
Do not write imports such as EXT:... or PATH_ in JavaScript.
The extension is ai_. ai- is a separate underlying library
and is not the frontend integration package.
Case 1: Standalone Chat
Use this when no existing Vue application should own the Chat.
-
Set the site setting:
aiAssistant: useVueIntegration: falseCopied! - Add the AI Assistant Chat content element.
- Do not import Vue source files and do not add a Vue mount.
- Optionally enable
includein the Chat FlexForm.Default Styles
TYPO3 uses:
EXT:
The template loads the transport and Custom Element bundles and renders the
complete <ai- element.
Case 2: Chat in an existing Vue App
Use this when an existing Vue application should render the Chat or a custom Chat layout.
- Set
ai.Assistant. use Vue Integration: true - Add the AI Assistant Chat content element.
- Set the Chat FlexForm field
settings.to a stable ID, for exampleelement Id example-. Keep the same value in all translations.ai- chat -
TYPO3 selects:
EXT:ai_ assistant/ Resources/ Private/ Frontend/ Vue/ Integration/ Templates/ Index/ Index. html - The template creates a data bridge with
data-and the server-generated Chat props. The bridge remains in the DOM; it is not a second Vue mount.ai- assistant- chat- mount - Add the Chat component to an existing Vue component template. Read the
bridge by its configured ID and expose its attributes as reactive props. Then
render either the standard
Aior a site-ownedAssistant Chat CustomerwithChat v-andif v-. The complete code pattern is shown in the Chat component in an existing Vue app section below.bind - Do not load
ai-and do not callassistant- chat. js createfor the bridge element.App
The shared Chat API is maintained in the source:
Resources/;Private/ Frontend/ Vue/ Src/ chat Props. js Resources/;Private/ Frontend/ Vue/ Src/ composables/ use Ai Assistant Chat. js Resources/;Private/ Frontend/ Vue/ Src/ components/ Ai Assistant Chat. vue Resources/;Private/ Frontend/ Vue/ Src/ components/ Chat Input. vue Resources/;Private/ Frontend/ Vue/ Src/ components/ Chat Message List. vue Resources/;Private/ Frontend/ Vue/ Src/ components/ Chat Status. vue Resources/.Private/ Frontend/ Vue/ Src/ components/ Language Selector. vue
### Create the custom Chat component
If the standard markup is sufficient, render the existing
Ai component. If the markup must be customized, create a
site component such as Customer.
The standard implementation to use as the structural reference is:
EXT:
Use its template structure and the reusable child components as a reference for
Customer. The site component may change the markup and styles, but
must keep the shared prop and composable contract.
The custom component must follow this structure:
-
Import
chatandProps usefrom the configuredAi Assistant Chat @ai-alias: .. code-block:: jsassistant import { chatProps, useAiAssistantChat } from '@ai-assistant/index.js';
-
Define the shared props and error event:
const props = defineProps(chatProps); const emitEvent = defineEmits(['error']);Copied! -
Call the composable and expose its state to the template:
const { messages, loading, consentGiven, requireConsent, showLanguageSelector, effectiveResponseLanguage, effectiveLanguageCode, labels, numberOfLoadingDots, loadingHtml, loadingMessages, loadingMessagesTimeout, statusMessage, send, acceptConsent, confirmLanguage, handleComponentClick, } = useAiAssistantChat(props, { emit: emitEvent });Copied! -
Render the returned values with the reusable child components:
<section class="aiassistant-chat" @click="handleComponentClick"> <ChatMessageList :messages="messages" :user-label="labels.userLabel" :assistant-name="labels.assistantName" :number-of-loading-dots="numberOfLoadingDots" :loading-html="loadingHtml" :loading-messages="loadingMessages" :loading-messages-timeout="loadingMessagesTimeout" /> <ChatStatus :status="statusMessage" /> <ChatInput :placeholder="labels.inputPlaceholder" :submit-label="labels.submitLabel" :disabled="loading" @submit="send" /> </section>Copied! - Add consent and language markup when those features are enabled. Use
AiandAssistant Chat. vue Languageas the references for the required bindings and focus callbacks.Selector. vue
Do not copy the request, streaming, JSON, consent or message-state
implementation. Only the presentation belongs in Customer.
Default Styles
Default styles are maintained centrally in:
@ai-
The file imports the component-specific partials:
_chat.;scss _chat-;input. scss _chat-;message- list. scss _language-.selector. scss
The Standalone Vite entry imports chat- and produces the Public
CSS asset. Integration component imports do not load this stylesheet
automatically. Load it only when default styling is wanted; otherwise provide
site-owned styles.
Payload and Lifecycle Order
For Case 3, the correct order is:
- SearchApp receives result rows.
- Premium payload builder creates
captured.Results - SearchApp sets Summary props, including
captured.Results - Vue renders
Search.Ai Summary AipassesAssistant Search Summary chatto the custom Chat.Component - The custom Chat receives
auto.Query usesends the POST/SSE request.Ai Assistant Chat - The assistant message changes from
typing: truetotyping: false.
Do not use a changing :key on the running Chat. A remount destroys the
reactive message list and loading state. Do not process the same payload through
both direct captured and the global event in the same Summary.
Browser Verification
Check these points in browser developer tools:
- The configured bridge ID exists in the DOM.
- The bridge contains endpoint, settings, labels and Chat options.
capturedis not empty.Results. results autois not empty in the custom Chat.Query - The Chat message list receives a message with
typing: true. - The POST/SSE request completes.
- The same Chat instance receives rendered HTML and changes to
typing: false.
If the backend request succeeds but the DOM does not update, check component remounts, duplicate payload processing and Vue-runtime resolution before adding another request path.