This page demonstrates how to embed the AI Chat component on any website.
Add a container with data attributes and the script will automatically initialize:
<div
id="ai-chat-1"
data-aichat-container
data-aichat-theme-color="#0070f3"
data-aichat-welcome-message="Hello! How can I help you today?"
></div>
<script src="${process.env.NEXT_PUBLIC_BASE_URL}/embed.js"></script>
Initialize the chat component programmatically with custom configuration:
<div id="ai-chat-2"></div>
<script src="${process.env.NEXT_PUBLIC_BASE_URL}/embed.js"></script>
<script>
document.addEventListener('DOMContentLoaded', function() {
if (window.AIChat) {
window.AIChat.init('ai-chat-2', {
themeColor: '#6d28d9',
welcomeMessage: 'Hello! I was initialized via JavaScript API.',
maxHeight: '400px'
});
}
});
</script>
The following configuration options are available:
systemPrompt: Instructions for the AI assistantwelcomeMessage: Initial message from the assistantthemeColor: Primary color for the chat interfaceassistantAvatarUrl: URL for the assistant's avataruserAvatarUrl: URL for the user's avatarinputPlaceholder: Placeholder text for the input fieldmaxHeight: Maximum height for the chat containerwidth: Width of the chat containerapiEndpoint: Custom API endpoint (must be on same domain or set up with CORS)showTimestamps: Whether to show message timestamps