-
Notifications
You must be signed in to change notification settings - Fork 1k
feat: Add bundled React webview CLI for local file visualization [wip] #2107
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: main
Are you sure you want to change the base?
Conversation
Problem Statement What we're trying to solve: - Python project generates local output files that need visual inspection - Users need a simple CLI command (load-webview) to instantly view these files in a web interface - Want to ship React frontend + Python backend as a single pip-installable package - Need both development mode (separate servers) and production mode (bundled React served by Python) The Architecture: pip install my-project ↓ my-project generates local files ↓ load-webview # Single CLI command ↓ Launches: Python API server + React frontend ↓ User opens browser → Views local files via web interface How we're solving it: 1. Bundled Distribution Strategy: - Development: React dev server (port 3000) + Python API (port 8000) running separately - Production: React app pre-built into static files, served by Python server - Single pip package contains both frontend bundle and Python backend 2. CLI Workflow: # User installs package pip install my-project # User generates files with main project my-project --input data.json --output results/ # User views results in browser load-webview --data-dir results/ # → Opens http://localhost:8000 with React app 3. Build Pipeline: - scripts/build.py: Builds React app → js-bundle/ directory - scripts/dev.py: Runs both servers for development - Package includes pre-built React bundle for production - CLI automatically serves bundled frontend if available 4. Technical Implementation: - Frontend: React + TypeScript for file visualization (tables, charts, etc.) - Backend: FastAPI with file reading APIs (/api/datasets, /api/files) - Development: Auto-reload on code changes, CORS configured - Production: Static file serving, SPA routing, single server
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Greptile Summary
This PR introduces a new feature to add a web-based visualization interface for Ragas evaluation results through a bundled React webview CLI. The implementation allows users to view local evaluation files through a browser with a simple CLI command.
The changes introduce:
- A Python FastAPI backend that serves both API endpoints and static files
- A React frontend with TypeScript and TailwindCSS for visualization
- Development mode with separate servers and hot-reload
- Production mode where React is pre-built and served by Python
However, there are several critical issues that need addressing:
- The package.json specifies non-existent future versions of dependencies (React 19.1.0, TailwindCSS 4.0.0)
- The datasets.py service has hardcoded paths and ignores the data_dir parameter
- Bundle validation in bundle.py could be more robust
Confidence score: 2/5
- This PR will likely cause immediate dependency and runtime issues if merged
- The dependency versions and hardcoded paths make this PR unstable and potentially broken
- Files needing attention:
- webview-poc/ragas-webview/package.json (invalid dependency versions)
- webview-poc/ragas_webview_cli/services/datasets.py (hardcoded paths)
- webview-poc/ragas_webview_cli/services/bundle.py (validation logic)
30 files reviewed, 19 comments
Edit PR Review Bot Settings | Greptile
Problem Statement
What we're trying to solve:
The Architecture:
pip install my-project
↓
my-project generates local files
↓
load-webview # Single CLI command
↓
Launches: Python API server + React frontend
↓
User opens browser → Views local files via web interface
How we're solving it:
- Development: React dev server (port 3000) + Python API (port 8000) running separately
- Production: React app pre-built into static files, served by Python server
- Single pip package contains both frontend bundle and Python backend
User generates files with main project
my-project --input data.json --output results/
User views results in browser
load-webview --data-dir results/
→ Opens http://localhost:8000 with React app
- scripts/build.py: Builds React app → js-bundle/ directory
- scripts/dev.py: Runs both servers for development
- Package includes pre-built React bundle for production
- CLI automatically serves bundled frontend if available
- Frontend: React + TypeScript for file visualization (tables, charts, etc.)
- Backend: FastAPI with file reading APIs (/api/datasets, /api/files)
- Development: Auto-reload on code changes, CORS configured
- Production: Static file serving, SPA routing, single server