Spaces:
Sleeping
Sleeping
Commit
Β·
9513bb7
1
Parent(s):
182af62
update the readme file
Browse files- README.md +91 -3
- backend/README.md +17 -0
- frontend/README.md +34 -2
README.md
CHANGED
|
@@ -102,6 +102,7 @@ Then access:
|
|
| 102 |
- Per-tenant query volume and active users
|
| 103 |
- Red-flag violations with timestamps and confidence scores
|
| 104 |
- LLM token logs and latency metrics
|
|
|
|
| 105 |
- π **Live Web Search** β Google Programmable Search (Custom Search API) with tenant-aware MCP tooling
|
| 106 |
- π’ **Multi-Tenant Isolation** β Complete tenant isolation with centralized tenant ID management; backend enforces strict isolation for chat, ingestion, and admin ops
|
| 107 |
- π **Fine-Grained Role-Based Access Control (RBAC)** β Four-tier role system (viewer, editor, admin, owner) with dynamic UI visibility and backend permission enforcement; frontend automatically shows/hides features based on role
|
|
@@ -121,6 +122,10 @@ Then access:
|
|
| 121 |
- π§ **Agent Debug & Planning** β `/agent/debug` and `/agent/plan` endpoints for observability and tool selection inspection
|
| 122 |
- πΎ **Persistent Analytics Storage** β Supabase-backed analytics store (with automatic SQLite fallback) for fast, multi-tenant queries
|
| 123 |
- ποΈ **Supabase Integration** β Production-ready Supabase support for admin rules with automatic table creation
|
|
|
|
|
|
|
|
|
|
|
|
|
| 124 |
|
| 125 |
### Conversation Memory System
|
| 126 |
|
|
@@ -189,7 +194,7 @@ The system supports four roles with increasing privileges:
|
|
| 189 |
| Chat Bot | β
| β
| β
| β
|
|
| 190 |
| Ingest Documents | β | β
| β
| β
|
|
| 191 |
| Delete Documents | β | β | β
| β
|
|
| 192 |
-
| View Analytics |
|
| 193 |
| Manage Rules | β | β | β
| β
|
|
| 194 |
|
| 195 |
### Backend RBAC
|
|
@@ -210,7 +215,7 @@ PERMISSIONS = {
|
|
| 210 |
- `/admin/rules` - Requires `admin` or `owner` role
|
| 211 |
- `/rag/ingest*` - Requires `editor`, `admin`, or `owner` role
|
| 212 |
- `/rag/delete*` - Requires `admin` or `owner` role
|
| 213 |
-
- `/analytics/*` -
|
| 214 |
|
| 215 |
**Example Request:**
|
| 216 |
```bash
|
|
@@ -241,7 +246,7 @@ The frontend UI dynamically shows/hides features based on the selected role:
|
|
| 241 |
|
| 242 |
**Protected Routes:**
|
| 243 |
- `/ingestion` - Editor, Admin, Owner only
|
| 244 |
-
- `/analytics` -
|
| 245 |
- `/admin-rules` - Admin, Owner only
|
| 246 |
|
| 247 |
**Implementation:**
|
|
@@ -260,6 +265,50 @@ The frontend UI dynamically shows/hides features based on the selected role:
|
|
| 260 |
|
| 261 |
---
|
| 262 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 263 |
## Installation & Setup
|
| 264 |
|
| 265 |
### Prerequisites
|
|
@@ -477,6 +526,45 @@ All endpoints are served by the FastAPI backend at `http://localhost:8000`. Most
|
|
| 477 |
| `GET` | `/analytics/activity?days=30` | Tenant activity summary: queries, active users, last query timestamp |
|
| 478 |
| `GET` | `/analytics/rag-quality?days=30` | RAG quality metrics: avg hits, scores, latency (recall/precision indicators) |
|
| 479 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 480 |
### Request Headers
|
| 481 |
|
| 482 |
Most endpoints require:
|
|
|
|
| 102 |
- Per-tenant query volume and active users
|
| 103 |
- Red-flag violations with timestamps and confidence scores
|
| 104 |
- LLM token logs and latency metrics
|
| 105 |
+
- **Real-Time Visualizations**: Reasoning path visualizer, tool invocation timeline, and tenant activity heatmap
|
| 106 |
- π **Live Web Search** β Google Programmable Search (Custom Search API) with tenant-aware MCP tooling
|
| 107 |
- π’ **Multi-Tenant Isolation** β Complete tenant isolation with centralized tenant ID management; backend enforces strict isolation for chat, ingestion, and admin ops
|
| 108 |
- π **Fine-Grained Role-Based Access Control (RBAC)** β Four-tier role system (viewer, editor, admin, owner) with dynamic UI visibility and backend permission enforcement; frontend automatically shows/hides features based on role
|
|
|
|
| 122 |
- π§ **Agent Debug & Planning** β `/agent/debug` and `/agent/plan` endpoints for observability and tool selection inspection
|
| 123 |
- πΎ **Persistent Analytics Storage** β Supabase-backed analytics store (with automatic SQLite fallback) for fast, multi-tenant queries
|
| 124 |
- ποΈ **Supabase Integration** β Production-ready Supabase support for admin rules with automatic table creation
|
| 125 |
+
- π **Real-Time Visualization Components** β Interactive visualizations for agent reasoning, tool execution, and tenant activity:
|
| 126 |
+
- **Reasoning Path Visualizer**: Step-by-step visualization of agent decision-making with animated progression
|
| 127 |
+
- **Tool Invocation Timeline**: Visual timeline showing tool execution order, latency, and result counts
|
| 128 |
+
- **Tenant Activity Heatmap**: Query activity heatmap and per-tool usage trends over time
|
| 129 |
|
| 130 |
### Conversation Memory System
|
| 131 |
|
|
|
|
| 194 |
| Chat Bot | β
| β
| β
| β
|
|
| 195 |
| Ingest Documents | β | β
| β
| β
|
|
| 196 |
| Delete Documents | β | β | β
| β
|
|
| 197 |
+
| View Analytics | β
| β
| β
| β
|
|
| 198 |
| Manage Rules | β | β | β
| β
|
|
| 199 |
|
| 200 |
### Backend RBAC
|
|
|
|
| 215 |
- `/admin/rules` - Requires `admin` or `owner` role
|
| 216 |
- `/rag/ingest*` - Requires `editor`, `admin`, or `owner` role
|
| 217 |
- `/rag/delete*` - Requires `admin` or `owner` role
|
| 218 |
+
- `/analytics/*` - All roles can view (viewer, editor, admin, owner)
|
| 219 |
|
| 220 |
**Example Request:**
|
| 221 |
```bash
|
|
|
|
| 246 |
|
| 247 |
**Protected Routes:**
|
| 248 |
- `/ingestion` - Editor, Admin, Owner only
|
| 249 |
+
- `/analytics` - All roles can view (viewer, editor, admin, owner)
|
| 250 |
- `/admin-rules` - Admin, Owner only
|
| 251 |
|
| 252 |
**Implementation:**
|
|
|
|
| 265 |
|
| 266 |
---
|
| 267 |
|
| 268 |
+
## Real-Time Visualization Features
|
| 269 |
+
|
| 270 |
+
IntegraChat includes three powerful visualization components that provide real-time insights into agent behavior and system activity:
|
| 271 |
+
|
| 272 |
+
### 1. Reasoning Path Visualizer
|
| 273 |
+
- **What it shows**: Step-by-step visualization of how the agent makes decisions
|
| 274 |
+
- **Features**:
|
| 275 |
+
- Animated progression through reasoning steps
|
| 276 |
+
- Status indicators (pending, running, completed, error)
|
| 277 |
+
- Detailed metrics per step (latency, hit counts, token estimates)
|
| 278 |
+
- Visual icons for each step type
|
| 279 |
+
- **Where to find it**:
|
| 280 |
+
- Next.js frontend: Chat panel (expand "Visualizations" section)
|
| 281 |
+
- Gradio app: Debug & Reasoning tab
|
| 282 |
+
- **Data source**: `reasoning_trace` from agent responses
|
| 283 |
+
|
| 284 |
+
### 2. Tool Invocation Timeline
|
| 285 |
+
- **What it shows**: Visual timeline of all tool executions during an agent interaction
|
| 286 |
+
- **Features**:
|
| 287 |
+
- Color-coded bars showing tool status (success/error)
|
| 288 |
+
- Latency visualization per tool
|
| 289 |
+
- Result count badges
|
| 290 |
+
- Summary statistics (total tools, total time, average latency)
|
| 291 |
+
- **Where to find it**:
|
| 292 |
+
- Next.js frontend: Chat panel (expand "Visualizations" section)
|
| 293 |
+
- Gradio app: Debug & Reasoning tab
|
| 294 |
+
- **Data source**: `tool_traces` from agent responses
|
| 295 |
+
|
| 296 |
+
### 3. Tenant Activity Heatmap
|
| 297 |
+
- **What it shows**: Query activity patterns and tool usage trends over time
|
| 298 |
+
- **Features**:
|
| 299 |
+
- Hour-by-hour, day-by-day activity heatmap
|
| 300 |
+
- Color intensity based on activity level
|
| 301 |
+
- Per-tool usage trends with bar charts
|
| 302 |
+
- Trend indicators (up/down/stable)
|
| 303 |
+
- **Where to find it**:
|
| 304 |
+
- Next.js frontend: Analytics page (`/analytics`)
|
| 305 |
+
- Configurable time window (default: 7 days)
|
| 306 |
+
- **Data source**: `/analytics/activity` and `/analytics/tool-usage` endpoints
|
| 307 |
+
|
| 308 |
+
**Access**: All visualization features are available to all roles (viewer, editor, admin, owner).
|
| 309 |
+
|
| 310 |
+
---
|
| 311 |
+
|
| 312 |
## Installation & Setup
|
| 313 |
|
| 314 |
### Prerequisites
|
|
|
|
| 526 |
| `GET` | `/analytics/activity?days=30` | Tenant activity summary: queries, active users, last query timestamp |
|
| 527 |
| `GET` | `/analytics/rag-quality?days=30` | RAG quality metrics: avg hits, scores, latency (recall/precision indicators) |
|
| 528 |
|
| 529 |
+
### Visualization Features
|
| 530 |
+
|
| 531 |
+
IntegraChat includes three powerful visualization components that provide real-time insights into agent behavior and system activity:
|
| 532 |
+
|
| 533 |
+
#### 1. Real-Time Reasoning Visualizer
|
| 534 |
+
- **Location**: Chat panel (Next.js frontend) and Debug tab (Gradio app)
|
| 535 |
+
- **Features**:
|
| 536 |
+
- Step-by-step visualization of agent reasoning path
|
| 537 |
+
- Animated progression through reasoning steps
|
| 538 |
+
- Status indicators (pending, running, completed, error)
|
| 539 |
+
- Detailed metrics per step (latency, hit counts, token estimates)
|
| 540 |
+
- Visual icons for each step type (admin rules check, RAG prefetch, tool selection, etc.)
|
| 541 |
+
- **Data Source**: `reasoning_trace` from `/agent/message` or `/agent/debug` endpoints
|
| 542 |
+
- **Usage**: Automatically appears in chat panel when agent responses include reasoning traces
|
| 543 |
+
|
| 544 |
+
#### 2. Tool Invocation Timeline
|
| 545 |
+
- **Location**: Chat panel (Next.js frontend) and Debug tab (Gradio app)
|
| 546 |
+
- **Features**:
|
| 547 |
+
- Visual timeline showing tool execution order
|
| 548 |
+
- Color-coded bars indicating tool status (success/error)
|
| 549 |
+
- Latency visualization per tool
|
| 550 |
+
- Result count badges
|
| 551 |
+
- Summary statistics (total tools, total time, average latency)
|
| 552 |
+
- **Data Source**: `tool_traces` from `/agent/message` or `/agent/debug` endpoints
|
| 553 |
+
- **Usage**: Automatically appears in chat panel when agent responses include tool traces
|
| 554 |
+
|
| 555 |
+
#### 3. Live Tenant Heatmap
|
| 556 |
+
- **Location**: Analytics page (`/analytics`)
|
| 557 |
+
- **Features**:
|
| 558 |
+
- Query activity heatmap (hour-by-hour, day-by-day visualization)
|
| 559 |
+
- Color intensity based on activity level
|
| 560 |
+
- Per-tool usage trends with bar charts
|
| 561 |
+
- Trend indicators (up/down/stable)
|
| 562 |
+
- Configurable time window (default: 7 days)
|
| 563 |
+
- **Data Source**: `/analytics/activity` and `/analytics/tool-usage` endpoints
|
| 564 |
+
- **Usage**: Navigate to Analytics page to view tenant activity patterns
|
| 565 |
+
|
| 566 |
+
**Access**: All visualization features are available to all roles (viewer, editor, admin, owner).
|
| 567 |
+
|
| 568 |
### Request Headers
|
| 569 |
|
| 570 |
Most endpoints require:
|
backend/README.md
CHANGED
|
@@ -147,6 +147,13 @@ Use the helper scripts in the repo root when validating backend changes:
|
|
| 147 |
- Detailed tool usage table with performance metrics
|
| 148 |
- Formatted summary with dark theme styling
|
| 149 |
- Real-time data fetching and visualization
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 150 |
|
| 151 |
- **Modern UI/UX**:
|
| 152 |
- Dark theme with white text for better readability
|
|
@@ -154,6 +161,16 @@ Use the helper scripts in the repo root when validating backend changes:
|
|
| 154 |
- Improved error handling and status messages
|
| 155 |
- Responsive layout with proper component scaling
|
| 156 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 157 |
## Environment Variables (excerpt)
|
| 158 |
|
| 159 |
Defined in `env.example`:
|
|
|
|
| 147 |
- Detailed tool usage table with performance metrics
|
| 148 |
- Formatted summary with dark theme styling
|
| 149 |
- Real-time data fetching and visualization
|
| 150 |
+
- **Access**: All roles can view analytics (viewer, editor, admin, owner)
|
| 151 |
+
|
| 152 |
+
- **Debug & Reasoning Tab**:
|
| 153 |
+
- Reasoning trace analyzer showing step-by-step agent decision-making
|
| 154 |
+
- Tool invocation timeline with latency visualization
|
| 155 |
+
- Formatted markdown output with detailed metrics
|
| 156 |
+
- Uses `/agent/debug` endpoint for comprehensive insights
|
| 157 |
|
| 158 |
- **Modern UI/UX**:
|
| 159 |
- Dark theme with white text for better readability
|
|
|
|
| 161 |
- Improved error handling and status messages
|
| 162 |
- Responsive layout with proper component scaling
|
| 163 |
|
| 164 |
+
### Real-Time Visualization Components (Next.js Frontend)
|
| 165 |
+
|
| 166 |
+
The Next.js frontend includes three powerful visualization components:
|
| 167 |
+
|
| 168 |
+
- **Reasoning Path Visualizer**: Step-by-step visualization of agent reasoning with animated progression, status indicators, and detailed metrics. Integrated into chat panel.
|
| 169 |
+
- **Tool Invocation Timeline**: Visual timeline showing tool execution order, latency, and result counts. Integrated into chat panel.
|
| 170 |
+
- **Tenant Activity Heatmap**: Query activity heatmap and per-tool usage trends. Integrated into analytics page.
|
| 171 |
+
|
| 172 |
+
All visualizations are accessible to all roles and automatically populate when agent responses include `reasoning_trace` and `tool_traces` data.
|
| 173 |
+
|
| 174 |
## Environment Variables (excerpt)
|
| 175 |
|
| 176 |
Defined in `env.example`:
|
frontend/README.md
CHANGED
|
@@ -36,16 +36,38 @@ NEXT_PUBLIC_API_URL=http://localhost:8000
|
|
| 36 |
- The navbar widget now stores both the tenant ID and the MCP role (Viewer, Editor, Admin, Owner) in `localStorage`.
|
| 37 |
- Every API call automatically includes `x-tenant-id` and `x-user-role` headers so the backend RBAC layer can authorize ingestion, admin rule uploads, analytics, and delete operations.
|
| 38 |
- If you see a 403 "insufficient permissions" error, switch the role dropdown to a higher privilege (e.g., Admin) before retrying the action.
|
|
|
|
| 39 |
|
| 40 |
## Features
|
| 41 |
|
| 42 |
### Main Landing Page (`/`)
|
| 43 |
- **Hero section** with platform introduction
|
| 44 |
- **Feature grid** showcasing key capabilities
|
| 45 |
-
- **Chat panel** for real-time AI conversations
|
| 46 |
- **Analytics panel** with query metrics and tool usage statistics
|
| 47 |
- **Ingestion card** for quick document uploads
|
| 48 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 49 |
### Knowledge Base Page (`/knowledge-base`)
|
| 50 |
- **Document listing** with pagination and filtering by type (text, PDF, FAQ, link)
|
| 51 |
- **Search interface** for semantic search across documents
|
|
@@ -61,15 +83,25 @@ NEXT_PUBLIC_API_URL=http://localhost:8000
|
|
| 61 |
- Real-time document list updates after operations
|
| 62 |
- Error handling with clear user feedback
|
| 63 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 64 |
### Components
|
| 65 |
|
| 66 |
-
- `chat-panel.tsx` - Real-time chat interface with streaming responses
|
| 67 |
- `analytics-panel.tsx` - Analytics dashboard with metrics visualization
|
| 68 |
- `knowledge-base-panel.tsx` - Document search and ingestion component
|
| 69 |
- `ingestion-card.tsx` - Quick document upload card
|
| 70 |
- `hero.tsx` - Landing page hero section
|
| 71 |
- `feature-grid.tsx` - Feature showcase grid
|
| 72 |
- `footer.tsx` - Footer component
|
|
|
|
|
|
|
|
|
|
| 73 |
|
| 74 |
## Deploy
|
| 75 |
|
|
|
|
| 36 |
- The navbar widget now stores both the tenant ID and the MCP role (Viewer, Editor, Admin, Owner) in `localStorage`.
|
| 37 |
- Every API call automatically includes `x-tenant-id` and `x-user-role` headers so the backend RBAC layer can authorize ingestion, admin rule uploads, analytics, and delete operations.
|
| 38 |
- If you see a 403 "insufficient permissions" error, switch the role dropdown to a higher privilege (e.g., Admin) before retrying the action.
|
| 39 |
+
- **Note**: Analytics is now accessible to all roles (viewer, editor, admin, owner) for improved transparency.
|
| 40 |
|
| 41 |
## Features
|
| 42 |
|
| 43 |
### Main Landing Page (`/`)
|
| 44 |
- **Hero section** with platform introduction
|
| 45 |
- **Feature grid** showcasing key capabilities
|
| 46 |
+
- **Chat panel** for real-time AI conversations with reasoning visualizations
|
| 47 |
- **Analytics panel** with query metrics and tool usage statistics
|
| 48 |
- **Ingestion card** for quick document uploads
|
| 49 |
|
| 50 |
+
### Real-Time Visualizations
|
| 51 |
+
|
| 52 |
+
The frontend includes three powerful visualization components:
|
| 53 |
+
|
| 54 |
+
#### 1. Reasoning Path Visualizer (`reasoning-visualizer.tsx`)
|
| 55 |
+
- Step-by-step visualization of agent decision-making
|
| 56 |
+
- Animated progression through reasoning steps
|
| 57 |
+
- Status indicators and detailed metrics
|
| 58 |
+
- Integrated into chat panel with collapsible section
|
| 59 |
+
|
| 60 |
+
#### 2. Tool Invocation Timeline (`tool-timeline.tsx`)
|
| 61 |
+
- Visual timeline of tool executions
|
| 62 |
+
- Latency and result count visualization
|
| 63 |
+
- Summary statistics
|
| 64 |
+
- Integrated into chat panel
|
| 65 |
+
|
| 66 |
+
#### 3. Tenant Activity Heatmap (`tenant-heatmap.tsx`)
|
| 67 |
+
- Query activity heatmap (hour-by-hour, day-by-day)
|
| 68 |
+
- Per-tool usage trends
|
| 69 |
+
- Integrated into analytics page
|
| 70 |
+
|
| 71 |
### Knowledge Base Page (`/knowledge-base`)
|
| 72 |
- **Document listing** with pagination and filtering by type (text, PDF, FAQ, link)
|
| 73 |
- **Search interface** for semantic search across documents
|
|
|
|
| 83 |
- Real-time document list updates after operations
|
| 84 |
- Error handling with clear user feedback
|
| 85 |
|
| 86 |
+
### Analytics Page (`/analytics`)
|
| 87 |
+
- **Analytics overview** with key metrics (queries, users, red flags)
|
| 88 |
+
- **Tool usage statistics** with detailed breakdowns
|
| 89 |
+
- **Tenant activity heatmap** showing query patterns over time
|
| 90 |
+
- **Per-tool usage trends** with visual bar charts
|
| 91 |
+
- **Access**: All roles can view analytics (viewer, editor, admin, owner)
|
| 92 |
+
|
| 93 |
### Components
|
| 94 |
|
| 95 |
+
- `chat-panel.tsx` - Real-time chat interface with streaming responses and visualization integration
|
| 96 |
- `analytics-panel.tsx` - Analytics dashboard with metrics visualization
|
| 97 |
- `knowledge-base-panel.tsx` - Document search and ingestion component
|
| 98 |
- `ingestion-card.tsx` - Quick document upload card
|
| 99 |
- `hero.tsx` - Landing page hero section
|
| 100 |
- `feature-grid.tsx` - Feature showcase grid
|
| 101 |
- `footer.tsx` - Footer component
|
| 102 |
+
- `reasoning-visualizer.tsx` - Real-time reasoning path visualizer component
|
| 103 |
+
- `tool-timeline.tsx` - Tool invocation timeline component
|
| 104 |
+
- `tenant-heatmap.tsx` - Tenant activity heatmap component
|
| 105 |
|
| 106 |
## Deploy
|
| 107 |
|