A web application for viewing and browsing chat conversations stored in JSONL format. The app provides a clean interface to navigate through competitions, challenges, models, and individual chat sessions with support for special <think></think>
tags.
- πͺ Windows Users: See WINDOWS.md for a simplified setup guide
- π§ Linux/macOS Users: Continue reading below
- Hierarchical Navigation: Browse by competition β challenge β model β session
- Session Sorting: Sort sessions by date or token count
- Think Tag Support: Special rendering for
<think></think>
tags as quoted regions - Image Support: View and download images from chat conversations
- Local Storage: Remembers your selections between sessions
- Responsive Design: Clean, dark-themed interface
- Python 3.7+
- Modern web browser
.
βββ backend/
β βββ app.py # Flask backend server
β βββ requirements.txt # Python dependencies
βββ frontend/
β βββ index.html # Main HTML file
β βββ script.js # Frontend JavaScript
β βββ styles.css # Custom CSS styles
βββ data/ # Your JSONL data files go here
βββ run-dev.sh # Development script (Linux/macOS)
βββ run-dev.bat # Development script (Windows)
βββ run-dev.ps1 # Development script (PowerShell)
βββ setup-windows.bat # Windows setup script
βββ run-prod.sh # Production script
βββ install-webserver.sh # Web server installation helper
βββ README.md # This file
cd backend
pip install -r requirements.txt
Use the included script to download the Pliny HackAPrompt dataset:
# Make sure all dependencies are installed (includes 'datasets' package)
cd backend
pip install -r requirements.txt
cd ..
# Download and convert the dataset
python download_dataset.py
This will create data/challenge_data_pliny_hackaprompt.jsonl
with winning submissions from the Pliny HackAPrompt competition.
Place your JSONL files in the data/
directory. Each JSONL file should contain chat session data with the following structure:
{
"competition": "competition_name",
"challenge": "challenge_name",
"model_id": "model_name",
"session_id": "unique_session_id",
"messages": [
{
"role": "user|assistant|system",
"content": "message content",
"created_at": "2024-01-01T12:00:00Z",
"token_count": 100
}
]
}
Option 1: Automated Setup (Recommended)
setup-windows.bat
This will install dependencies and start the development servers automatically.
Option 2: Quick Start
# Batch file (opens two command windows)
run-dev.bat
# PowerShell (runs as background jobs)
powershell -ExecutionPolicy Bypass -File run-dev.ps1
Option 3: Manual Start
# Terminal 1 - Start backend
cd backend
python app.py --port 5001
# Terminal 2 - Start frontend server
cd frontend
python -m http.server 8000
Option 1: Use the development script
./run-dev.sh
Option 2: Manual start
# Terminal 1 - Start backend
cd backend
python app.py
# Terminal 2 - Start frontend server
cd frontend
python -m http.server 8000
The application will be available at:
- Frontend: http://localhost:8000
- Backend API: http://localhost:5001
Easy Installation (Recommended)
# Run the automated installer
./install-webserver.sh
Manual Installation
For optimal performance, install one of these web servers:
Nginx (Recommended)
# Ubuntu/Debian
sudo apt update && sudo apt install nginx
# macOS
brew install nginx
# CentOS/RHEL
sudo yum install nginx
Caddy (Alternative - simpler setup)
# Ubuntu/Debian
curl -1sLf 'https://dl.cloudsmith.io/public/caddy/stable/gpg.key' | sudo gpg --dearmor -o /usr/share/keyrings/caddy-stable-archive-keyring.gpg
curl -1sLf 'https://dl.cloudsmith.io/public/caddy/stable/debian.deb.txt' | sudo tee /etc/apt/sources.list.d/caddy-stable.list
sudo apt update && sudo apt install caddy
# macOS
brew install caddy
# Or download binary from https://caddyserver.com/download
./run-prod.sh
The script automatically uses:
- Nginx (if available) - High performance, includes API proxying
- Caddy (if available) - Modern server with auto-HTTPS
- Python HTTP server (fallback) - Not recommended for production
Benefits of proper web servers:
- β‘ Performance: 10-100x faster than Python's HTTP server
- π Security: Built-in security features and SSL/TLS support
- π Reverse Proxy: Unified frontend + API on single port
- π Monitoring: Access logs, error handling, and metrics
- π Production Ready: Designed for high-traffic applications
# Terminal 1 - Start backend with gunicorn
cd backend
gunicorn -w 4 -b 0.0.0.0:5001 app:app
# Terminal 2 - Start frontend server with Nginx
nginx -c $(pwd)/nginx_config.conf -p $(pwd)
The frontend automatically detects the API URL based on the environment:
- Automatically uses
http://localhost:5001/api
Option A: Same-domain deployment (Recommended)
- Frontend and backend served from same server
- Uses relative URL
/api
- Configure your web server to proxy
/api
to the backend - The production script automatically sets this up when using Nginx or Caddy
Option B: Custom API URL
Add this to your HTML <head>
section before loading the script:
<script>
window.HACKAPROMPT_CONFIG = {
API_BASE_URL: 'https://your-api-domain.com/api'
};
</script>
Option C: Environment variable (if using build tools)
export REACT_APP_API_URL=https://your-api-domain.com/api
For same-domain deployment, configure Nginx to serve frontend and proxy API:
server {
listen 80;
server_name your-domain.com;
# Serve frontend static files
location / {
root /path/to/frontend;
try_files $uri $uri/ /index.html;
}
# Proxy API requests to backend
location /api/ {
proxy_pass http://localhost:5001/api/;
proxy_set_header Host $host;
proxy_set_header X-Real-IP $remote_addr;
}
}
For permanent deployment on Ubuntu 24.04 servers, you can set up the application as a systemd service that automatically starts on boot.
# Run the automated setup (requires sudo)
sudo ./setup-ubuntu-service.sh
This will:
- β Install all dependencies (Python, Caddy, etc.)
- β
Create a dedicated
hackaprompt
user - β
Set up the application in
/opt/hackaprompt-chat-viewer
- β Install and enable the systemd service
- β Configure automatic startup on boot
- β Set up automatic HTTPS with SSL certificates
- β Set up log rotation and monitoring
- β Download sample data if none exists
After installation, use these commands to manage the service:
# Check service status
sudo systemctl status hackaprompt-chat-viewer
# Start/stop/restart service
sudo systemctl start hackaprompt-chat-viewer
sudo systemctl stop hackaprompt-chat-viewer
sudo systemctl restart hackaprompt-chat-viewer
# View real-time logs
sudo journalctl -u hackaprompt-chat-viewer -f
# Disable auto-start on boot
sudo systemctl disable hackaprompt-chat-viewer
- Auto-start: Automatically starts on system boot
- Production-ready: Uses Gunicorn + Caddy for high performance
- Automatic HTTPS: SSL certificates via Let's Encrypt (when domain is configured)
- Security: Runs as dedicated user with minimal privileges
- Monitoring: Comprehensive logging and health checks
- Reliability: Automatic restart on failure
- Log rotation: Automatic cleanup of old log files
- Application:
/opt/hackaprompt-chat-viewer/
- Logs:
/opt/hackaprompt-chat-viewer/logs/
- Data:
/opt/hackaprompt-chat-viewer/data/
- SSL Certs: Automatically managed by Caddy
- Service:
/etc/systemd/system/hackaprompt-chat-viewer.service
To completely remove the service:
sudo ./uninstall-ubuntu-service.sh
See UBUNTU_SERVICE.md
for detailed setup instructions, troubleshooting, and manual configuration options.
For containerized deployment, create a Dockerfile
:
FROM python:3.9-slim
# Install dependencies
WORKDIR /app
COPY backend/requirements.txt .
RUN pip install -r requirements.txt
# Copy application
COPY backend/ ./backend/
COPY frontend/ ./frontend/
COPY data/ ./data/
# Install nginx for serving frontend and proxying API
RUN apt-get update && apt-get install -y nginx
# Configure nginx
COPY nginx.conf /etc/nginx/sites-available/default
EXPOSE 80
CMD ["sh", "-c", "gunicorn -w 4 -b 127.0.0.1:5001 backend.app:app & nginx -g 'daemon off;'"]
This approach serves both frontend and backend from a single container with proper API proxying.
- Open the application in your browser at http://localhost:8000
- Select a competition from the dropdown
- Choose a challenge and model
- Browse sessions in the sidebar - sessions show date/time and token count
- Click on a session to view the full chat conversation
- Sort sessions by date or token count using the radio buttons
- Share URLs - the URL automatically updates with your selections, so you can:
- Bookmark specific prompts
- Share direct links to interesting sessions
- Navigate with browser back/forward buttons
- Think Tags: Content within
<think></think>
tags will be displayed as purple-bordered quoted regions with italic text - Zoomable Images: Click on images to view them in full size with zoom controls:
- Zoom In/Out buttons or mouse wheel
- Drag to pan when zoomed in
- Reset to fit view
- Touch gestures on mobile (pinch to zoom, drag to pan)
- Download images directly
- Navigation Memory: Your selections are saved and restored when you return
- URL Sharing: Share specific prompts/sessions with others - the URL updates as you make selections and can be bookmarked or shared
GET /api/structure
- Returns the hierarchical structure of all dataGET /api/session/<session_id>
- Returns the full content of a specific session
- "Error loading data structure": Make sure the Flask backend is running on port 5001
- Empty structure: Check that JSONL files are in the
data/
directory and properly formatted - Import errors: Ensure all Python dependencies are installed with
pip install -r backend/requirements.txt
- CORS errors: Make sure both frontend and backend servers are running
- Missing styles: Verify the frontend server is serving files correctly
- Images not loading: Check that image files exist in the
frontend/images/
directory if referenced - Slow performance: Install nginx or caddy for production - Python's HTTP server is only for development
- Port conflicts: If port 8000 is busy, the production script will show an error
- Ensure JSONL files have
.jsonl
extension - Verify each line is valid JSON
- Check that required fields (
competition
,challenge
,model_id
,session_id
) are present
- "Python is not recognized": Install Python from python.org and check "Add to PATH" during installation
- "PowerShell execution policy": Run
Set-ExecutionPolicy -ExecutionPolicy RemoteSigned -Scope CurrentUser
as Administrator - Port conflicts: Check Task Manager for existing
python.exe
processes and terminate them - Antivirus blocking: Add project folder to antivirus exclusions if files are being blocked
- File permissions: Run Command Prompt or PowerShell as Administrator if you get permission errors
- Backend (
backend/app.py
): Flask server that reads JSONL files and provides REST API - Frontend (
frontend/
): Static HTML/CSS/JS files served by Python's HTTP server - Data (
data/
): Directory containing JSONL conversation files
- Backend changes: Modify
backend/app.py
- Frontend changes: Edit
frontend/script.js
,frontend/styles.css
, orfrontend/index.html
- Styling: The app uses Tailwind CSS via CDN plus custom styles
This project is open source. Feel free to modify and distribute as needed.