A React-based frontend for comparing and intelligently merging documents using AI assistance.
- Document Management: Upload, view, and organize text documents
- Visual Diff Analysis: Compare documents with side-by-side or unified views
- AI-Powered Summaries: Get intelligent summaries of document differences
- Smart Merge: Merge documents with AI-assisted conflict resolution
- Custom Merge Strategies: Choose from multiple merge strategies or create custom rules
- Asynchronous Processing: Handle large documents via background processing
- Progress Tracking: Real-time progress updates for long-running operations
- Change Highlighting: Color-coded visualization of document changes
- Node.js 16.x or higher
- npm 7.x or higher
- Backend API running (see backend README)
-
Clone the repository:
git clone <repository-url> cd diffai-frontend
-
Install dependencies:
npm install
-
Create a
.envfile in the project root with the following contents:REACT_APP_API_BASE_URL=http://localhost:8000
Run the development server:
npm startThe application will be available at http://localhost:3000.
Create a production build:
npm run buildThe build output will be in the build directory.
src/
├── components/
│ ├── DiffViewer/ # Document comparison visualization
│ ├── DocumentUpload/ # File upload handling
│ ├── EnhancedDocumentPreview/ # Rich document preview with highlighting
│ ├── GoalSetting/ # Merge strategy configuration
│ ├── LoadingOverlay/ # Progress indicator for async operations
│ └── Review/ # Final review and editing of merged content
├── pages/
│ └── HomePage.tsx # Main application page
├── services/
│ └── api.ts # API communication layer
├── utils/
│ └── documentHighlighter.ts # Utilities for highlighting changes
└── App.tsx # Application entry point
- React: UI library for building component-based interfaces
- TypeScript: Static typing for better developer experience and code quality
- Material UI: Component library for consistent, responsive design
- Axios: HTTP client for API communication
- React Hooks: For state management and side effects
- Set Merge Goals: Define merge strategy and custom rules
- Upload Documents: Select files to compare and merge
- View Differences: Visualize changes between documents
- Review and Adjust: Preview merged result with highlighted changes
- Finalize: Save the final merged document
The frontend communicates with the backend API for:
- Document upload and management
- Diff computation and visualization
- AI-powered analysis and summaries
- Asynchronous merge processing
For large documents, the application uses background processing:
- Submit merge request to backend
- Receive task ID for tracking
- Poll task status with progress updates
- Retrieve and display final result when complete
API Connection Problems:
- Verify the backend is running
- Check that
REACT_APP_API_BASE_URLis correctly set - Confirm network connectivity
Long Processing Times:
- Large documents may take longer to process
- The progress indicator shows real-time status
- Background processing prevents browser timeouts
- Fork the repository
- Create a feature branch:
git checkout -b feature/my-feature - Commit changes:
git commit -am 'Add new feature' - Push to branch:
git push origin feature/my-feature - Submit a pull request