Components
AieraChat Component
Embed the AieraChat component to interact with our AI assistant
The AieraChat component provides an AI-powered chat interface with real-time messaging, source management, and source viewing capabilities for financial analysis.
Overview
AieraChat is a self-contained React component that enables users to interact with Aiera's AI assistant. It supports real-time streaming responses, citation tracking with source navigation, and integrated source viewing.
Installation
import { AieraChat } from '@aiera/client-sdk/modules/AieraChat';
Basic Usage
React Component
import { AieraChat } from '@aiera/client-sdk/modules/AieraChat';
import { Provider } from '@aiera/client-sdk/components/Provider';
function App() {
return (
<Provider config={{ tracking: { userId: '12345' } }}>
<AieraChat />
</Provider>
);
}
Web Embedding
<script src="https://public.aiera.com/aiera-sdk/0.0.80/embed.js"></script>
<script>
const chat = new Aiera.Module(
'https://public.aiera.com/aiera-sdk/0.0.80/modules/AieraChat/index.html',
'YOUR-IFRAME-ID'
);
chat.load().then(() => {
chat.authenticateApiKey('your-public-api-key');
});
chat.on('authenticated', () => {
chat.configure({
options: {
darkMode: false
},
tracking: { userId: '12345' }
});
});
</script>
Configuration Options
Configure AieraChat through the options object in your configuration:
| Option | Type | Default | Description |
|---|---|---|---|
| darkMode | boolean | false | Enable dark mode styling |
| isMobile | boolean | false | Enable mobile-optimized UI |
| aieraChatCollectInternalFeedback | boolean | false | Enable feedback collection on responses |
| aieraChatDisableSourceNav | boolean | false | Disable built-in source navigation |
| aieraChatDisableWebSearch | boolean | false | Disable web search capabilities |
Configuration Example
chat.configure({
options: {
darkMode: true,
aieraChatDisableSourceNav: true,
aieraChatCollectInternalFeedback: true
},
tracking: {
userId: '12345'
}
});
Features
Chat Sessions
- Create new chats: Start conversations with optional source context
- Session management: Switch between existing chat sessions
- Title editing: Rename chat sessions in real-time
- Session deletion: Remove chat sessions with confirmation
Real-time Messaging
- Streaming responses: AI responses stream in real-time
- Thinking states: Visual feedback during processing
Sources & Citations
Supported source types:
| Type | Description | Citation Format |
|---|---|---|
event | Financial events | E1, E2 |
transcript | Earnings call transcripts | T1, T2 |
company | Company information | Co1, Co2 |
filing | SEC/regulatory filings | F1, F2 |
news | News articles | N1, N2 |
research | Research reports | R1, R2 |
attachment | User attachments | A1, A2 |
Web Search
When enabled, users can toggle web search to include external sources in AI responses.
Transcript Viewer
Click on transcript citations to view full earnings call transcripts with:
- Animated transitions
- Back navigation
- Source highlighting
Events
Emitted Events
| Event | Payload | Description |
|---|---|---|
| chat-source | { targetId: string, targetType: string } | Emitted when a source is clicked |
Listening for Events
chat.on('chat-source', (data) => {
const { targetId, targetType } = data;
// Handle source navigation externally
navigateTo(`/event/${targetId}`);
});
State Management
AieraChat uses Zustand for internal state management. The store tracks:
- Current chat session ID and status
- Active sources and citation markers
- Web search toggle state
- Selected transcript for viewing
Requirements
Authentication
AieraChat requires:
- A valid API key or user authentication
tracking.userIdin configuration for authentication and session filtering
Styling
Dark Mode
Apply dark mode via configuration:
configure({
options: { darkMode: true }
});
CSS Classes
Key CSS classes for custom styling:
.aiera-chat- Main container.aiera-chat__header- Header section.aiera-chat__messages- Message list container.aiera-chat__prompt- Input area.aiera-chat__sources- Sources panel.aiera-chat__menu- Chat session menu
Performance Considerations
- Citation normalization: Processed client-side for performance
- Token refresh: Streaming tokens include TTL and refresh automatically
Example: Complete Integration
import { AieraChat } from '@aiera/client-sdk/modules/AieraChat';
import { Provider } from '@aiera/client-sdk/components/Provider';
import { useMessageBus } from '@aiera/client-sdk/lib/msg';
function ChatContainer() {
const bus = useMessageBus();
useEffect(() => {
// Handle external source navigation
const unsubscribe = bus.on('chat-source', (data) => {
console.log('Navigate to source:', data);
// Open transcript viewer, etc.
});
return unsubscribe;
}, [bus]);
return <AieraChat />;
}
function App() {
return (
<Provider
config={{
tracking: { userId: '12345' },
options: {
darkMode: false,
aieraChatDisableSourceNav: true
}
}}
>
<ChatContainer />
</Provider>
);
}
Troubleshooting
Messages not appearing
- Verify
tracking.userIdis set in configuration
Sources not loading
- Verify API authentication is successful
- Check network requests for errors
Dark mode not applying
- Confirm
darkMode: trueis in theoptionsobject - Verify CSS is properly loaded
- Check for CSS specificity conflicts