@srajvenkat/aichat-widget
v0.2.1
Published
Production-grade embeddable chat UI widget with Shadow DOM isolation, supporting EventSource SSE, POST fetch-based SSE, and WebSocket protocols.
Downloads
64
Readme
AI Chat Widget
Production-grade embeddable chat UI widget with Shadow DOM isolation, supporting EventSource SSE, POST fetch-based SSE, and WebSocket protocols.
Features
- 🔒 Shadow DOM isolation
- ⚡ EventSource SSE, fetch-SSE, and WebSocket support
- 🎨 Fully customizable
- 📦 < 100KB gzipped
- ♿ WCAG 2.1 AA accessible
- 🚀 Production ready
Quick Start
CDN
<script src="https://cdn.example.com/ai-chat-widget.js"></script>
<script>
AIChatWidget.init({
apiKey: 'your-api-key',
connection: {
protocol: 'sse',
baseUrl: 'https://api.example.com'
}
});
</script>NPM
pnpm add @srajvenkat/aichat-widgetimport { init } from '@srajvenkat/aichat-widget';
init({
apiKey: 'your-api-key',
connection: {
protocol: 'websocket',
baseUrl: 'https://api.example.com'
}
});Documentation
Example protocol values:
ssefor EventSource GET streamsfetch-ssefor POST +fetch()streamingwebsocketfor WS connections
See full documentation for complete API reference, configuration options, and examples.
License
MIT
