Add these two lines to your HTML:
<script src="https://your-domain.pages.dev/autorag-widget.min.js"></script>
<autorag-widget></autorag-widget>
Customize the widget with attributes:
<script src="https://your-domain.pages.dev/autorag-widget.min.js"></script>
<autorag-widget
language="de"
dignity="doctor"
product="product-a"
model="openai|gpt-4o-mini"
theme="dark"
position="bottom-left"
button-text="Hilfe benötigt?"
header-title="Support Chat"
></autorag-widget>
Configure via JavaScript before loading:
<script>
window.AutoRAGConfig = {
language: 'en',
dignity: 'nurse',
product: 'product-a',
provider: 'openai',
model: 'gpt-5-mini',
theme: 'light',
position: 'bottom-right',
buttonText: 'Need Help?',
headerTitle: 'Support Assistant',
autoInit: true
};
</script>
<script src="https://your-domain.pages.dev/autorag-widget.min.js"></script>
For complete isolation or legacy browser support:
<iframe
src="https://your-domain.pages.dev/iframe.html?language=en&dignity=general&product=product-a"
width="400"
height="600"
frameborder="0"
></iframe>
language
: en, de, fr, itdignity
: doctor, nurse, therapist, pharmacist, generalproduct
: product-a, product-bprovider
: workers-ai, openai, anthropicmodel
: Model identifiertheme
: light, darkposition
: bottom-right, bottom-left, top-right, top-leftbutton-text
: Custom button textheader-title
: Custom header titleapi-url
: Custom API endpoint (for self-hosted)Listen to widget events:
<script>
const widget = document.querySelector('autorag-widget');
widget.addEventListener('widget-opened', (e) => {
console.log('Chat opened', e.detail);
});
widget.addEventListener('widget-closed', (e) => {
console.log('Chat closed', e.detail);
});
widget.addEventListener('message-sent', (e) => {
console.log('Message sent', e.detail);
});
widget.addEventListener('widget-error', (e) => {
console.error('Error occurred', e.detail);
});
</script>