BI Assistant
The BI Assistant at frontend/bi-workbench/src/components/BIAssistant/ provides an AI-powered chat interface for natural language data exploration, chart suggestions, and query generation within the BI Workbench context.
BIAssistant
File: frontend/bi-workbench/src/components/BIAssistant/index.tsx
An AI chat interface integrated with the AI Service that understands the current dashboard context, semantic model, and data sources.
Features:
- Natural language query to SQL generation
- Chart type suggestions based on data shape
- Dashboard modification suggestions
- Contextual awareness of active filters and selected entities
- Message history with SQL preview
- Integration with
AIApiClientfor chat sessions - Streaming responses via SSE
Integration with AI Service
The BI Assistant uses the AIApiClient to:
- Create a chat session scoped to the current dashboard context
- Send messages with context about active filters, selected entities, and visible widgets
- Receive responses that may include:
- Natural language explanations
- Generated SQL queries
- Visualization recommendations
- Dashboard modification suggestions
const response = await clients.ai.chat({
conversationId: sessionId,
message: userMessage,
context: {
dashboardId: currentDashboard.id,
activeFilters: filterState,
selectedEntity: crossWorkbenchStore.selectedEntity,
},
});