Spaces:
Sleeping
Sleeping
File size: 3,689 Bytes
c2ea5ed |
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 |
# AgentGraph React
A modern React-based interface for AI agent pipeline analysis and knowledge graph management, built with Shadcn UI components.
## Features
- **Modern UI**: Built with React 18, TypeScript, and Shadcn UI components
- **Trace Management**: Upload, view, and manage AI agent execution traces
- **Pipeline Processing**: Run comprehensive analysis pipelines including:
- Prompt Reconstruction
- Perturbation Testing
- Causal Analysis
- **Knowledge Graphs**: Generate and visualize knowledge graphs from trace data
- **Real-time Updates**: Live progress tracking and status updates
- **Command Palette**: Quick access to all features via Cmd/Ctrl+K
- **Dark/Light Theme**: Automatic theme switching with system preference
## Tech Stack
- **React 18** with TypeScript
- **Vite** for fast development and building
- **Shadcn UI** for beautiful, accessible components
- **Tailwind CSS** for styling
- **Lucide React** for icons
- **React Query** for data fetching (planned)
## Development
### Prerequisites
- Node.js 16+
- npm or yarn
### Setup
```bash
# Install dependencies
npm install
# Start development server
npm run dev
# Build for production
npm run build
# Type checking
npm run type-check
# Linting
npm run lint
```
### Development Server
The development server runs on `http://localhost:3001` with hot reload enabled.
### Building
The build output goes to `../static/js/agentgraph/dist/` to integrate with the FastAPI backend.
## Integration
This React app integrates with the existing FastAPI backend:
- **Route**: `/agentgraph` - Main interface
- **API Proxy**: Development server proxies `/api/*` to `http://localhost:8000`
- **Static Assets**: Built files are served by FastAPI from `/static/js/agentgraph/dist/`
## Project Structure
```
src/
βββ components/
β βββ ui/ # Shadcn UI components
β βββ layout/ # Layout components (sidebar, workspace)
β βββ features/ # Feature-specific components
β β βββ upload/ # File upload functionality
β β βββ traces/ # Trace management
β β βββ pipeline/ # Pipeline processing
β β βββ command/ # Command palette
β β βββ workspace/ # Main workspace views
β βββ shared/ # Shared components
βββ context/ # React contexts for state management
βββ hooks/ # Custom React hooks
βββ lib/ # Utilities and API client
βββ types/ # TypeScript type definitions
βββ styles/ # Global styles
```
## API Integration
The app uses a centralized API client (`src/lib/api.ts`) that interfaces with the FastAPI backend:
- **Traces**: Upload, list, and process trace files
- **Knowledge Graphs**: Generate, enrich, and analyze knowledge graphs
- **Tasks**: Monitor background task progress
- **Pipeline**: Execute and monitor analysis stages
## State Management
Uses React Context for global state management:
- **AgentGraphContext**: Main application state (traces, pipeline stages, etc.)
- **ThemeContext**: Theme switching (light/dark)
- **NotificationContext**: Toast notifications and alerts
## Commands
- **Cmd/Ctrl+K**: Open command palette
- **Upload**: Drag & drop or click to upload trace files
- **Pipeline**: Start/stop analysis pipeline stages
- **Theme**: Toggle between light and dark themes
## Contributing
1. Follow the existing code structure and patterns
2. Use TypeScript for all new code
3. Follow the Shadcn UI component patterns
4. Add proper error handling and loading states
5. Update types when adding new features
|