Files
hack/tools/scripts/llm-key-hunter/results/_cache/content/boombaybay12334_lawreader.json
T

1 line
9.1 KiB
JSON

{"repo": "boombaybay12334/lawreader", "files": {"QUICKSTART.md": {"6654911e242a2166c4e4a0b52d3a56acdcf1d95c": {"t": 1785674342.5932915, "n": 8645, "h": "586d322d3d308c7c", "c": "# LAWREADER - Quick Start Guide\n\nGet LAWREADER up and running in under 10 minutes! 🚀\n\n## Prerequisites Checklist\n\nBefore starting, ensure you have:\n- [ ] Python 3.8 or higher installed (`python --version`)\n- [ ] Node.js 16 or higher installed (`node --version`)\n- [ ] Git installed (`git --version`)\n- [ ] OpenRouter API key (get from [openrouter.ai](https://openrouter.ai))\n- [ ] 8GB+ RAM available\n- [ ] 5GB+ free disk space\n\n## Installation (5 Minutes)\n\n### Step 1: Clone Repository\n```bash\ngit clone https://github.com/Boombaybay12334/LAWREADER.git\ncd LAWREADER\n```\n\n### Step 2: Backend Setup (2 minutes)\n```bash\n# Navigate to backend\ncd backend\n\n# Create virtual environment\npython -m venv venv\n\n# Activate virtual environment\n# Windows PowerShell:\nvenv\\Scripts\\activate\n# Windows CMD:\nvenv\\Scripts\\activate.bat\n# Linux/Mac:\nsource venv/bin/activate\n\n# Install dependencies\npip install -r requirements.txt\n\n# Create required directories\nmkdir uploads processed\n```\n\n### Step 3: Tool 1 Setup (1 minute)\n```bash\n# Navigate to tool1\ncd ../tool1\n\n# Create virtual environment\npython -m venv venv\n\n# Activate virtual environment\nvenv\\Scripts\\activate # Windows\n# source venv/bin/activate # Linux/Mac\n\n# Install dependencies\npip install -r requirements.txt\n\n# Create .env file\n# Windows:\necho OPENROUTER_API_KEY=your_api_key_here > .env\necho MISTRAL_MODEL=mistralai/mistral-7b-instruct >> .env\n\n# Linux/Mac:\ncat > .env << EOF\nOPENROUTER_API_KEY=your_api_key_here\nMISTRAL_MODEL=mistralai/mistral-7b-instruct\nEOF\n```\n\n**Important:** Replace `your_api_key_here` with your actual OpenRouter API key!\n\n### Step 4: Tool 2 Setup (1 minute)\n```bash\n# Navigate to tool2\ncd ../tool2\n\n# Create virtual environment\npython -m venv venv\n\n# Activate virtual environment\nvenv\\Scripts\\activate # Windows\n# source venv/bin/activate # Linux/Mac\n\n# Install dependencies\npip install -r requirements.txt\n\n# Create .env file\n# Windows:\necho LLM_API_KEY=your_api_key_here > .env\necho GRAPH_PATH=law_graphTest.gpickle >> .env\n\n# Linux/Mac:\ncat > .env << EOF\nLLM_API_KEY=your_api_key_here\nGRAPH_PATH=law_graphTest.gpickle\nEOF\n```\n\n### Step 5: Frontend Setup (1 minute)\n```bash\n# Navigate to root\ncd ..\n\n# Install Node.js dependencies\nnpm install\n```\n\n## Running the Application (2 Terminals Required)\n\n### Terminal 1: Start Backend\n```bash\ncd backend\nvenv\\Scripts\\activate # Windows\n# source venv/bin/activate # Linux/Mac\npython main.py\n```\n\n**Expected Output:**\n```\nINFO: Started server process\nINFO: Waiting for application startup.\nINFO: Application startup complete.\nINFO: Uvicorn running on http://0.0.0.0:8000\n```\n\n✅ Backend is ready when you see `Uvicorn running on http://0.0.0.0:8000`\n\n### Terminal 2: Start Frontend\n```bash\nnpm run dev\n```\n\n**Expected Output:**\n```\n VITE v5.4.2 ready in 500 ms\n\n ➜ Local: http://localhost:5173/\n ➜ Network: use --host to expose\n```\n\n✅ Frontend is ready when you see `http://localhost:5173/`\n\n## Testing the Application\n\n### 1. Open Your Browser\nNavigate to: `http://localhost:5173`\n\n### 2. Test Legal Query\n1. Click \"Legal Query\" in navigation\n2. Enter test query:\n ```\n Can police arrest me without a warrant?\n ```\n3. Click \"Submit Query\"\n4. Wait ~30 seconds for response\n\n**Expected Result:** You should see a formatted answer with legal principles and articles.\n\n### 3. Test PDF Analyzer\n1. Click \"PDF Analyzer\" in navigation\n2. Upload a PDF legal document (or create a test PDF)\n3. Click \"Upload and Analyze\"\n4. Wait ~2 minutes for processing\n5. Click \"Download Processed File\"\n\n**Expected Result:** You should receive a PDF with analysis results.\n\n## Troubleshooting\n\n### Issue: \"Port already in use\"\n**Backend (8000):**\n```bash\n# Windows\nnetstat -ano | findstr :8000\ntaskkill /PID <PID> /F\n\n# Linux/Mac\nlsof -ti:8000 | xargs kill -9\n```\n\n**Frontend (5173):**\n```bash\n# Windows\nnetstat -ano | findstr :5173\ntaskkill /PID <PID> /F\n\n# Linux/Mac\nlsof -ti:5173 | xargs kill -9\n```\n\n### Issue: \"Module not found\"\n```bash\n# Ensure virtual environment is activated\n# You should see (venv) in your terminal prompt\n\n# Reinstall dependencies\npip install -r requirements.txt\n```\n\n### Issue: \"API Key not found\"\n```bash\n# Verify .env file exists and contains API key\n# Windows\ntype tool1\\.env\ntype tool2\\.env\n\n# Linux/Mac\ncat tool1/.env\ncat tool2/.env\n\n# Should show:\n# OPENROUTER_API_KEY=sk-or-v1-...\n# LLM_API_KEY=sk-or-v1-...\n```\n\n### Issue: \"CORS error in browser console\"\n**Solution:** Check that backend is running on port 8000 and frontend on 5173.\n\nUpdate `backend/main.py` if needed:\n```python\nallow_origins=[\"http://localhost:5173\"]\n```\n\n### Issue: \"Request timeout\"\n**Cause:** Processing large PDFs or complex queries takes time.\n\n**Solution:** This is normal! Wait patiently:\n- PDF Analysis: 1-3 minutes\n- Legal Queries: 20-60 seconds\n\n## Quick Commands Reference\n\n### Start Backend\n```bash\ncd backend\nvenv\\Scripts\\activate\npython main.py\n```\n\n### Start Frontend\n```bash\nnpm run dev\n```\n\n### Stop All\n- Press `Ctrl+C` in each terminal\n\n### Reinstall Everything\n```bash\n# Backend\ncd backend\npip install -r requirements.txt\n\n# Tool 1\ncd tool1\npip install -r requirements.txt\n\n# Tool 2\ncd tool2\npip install -r requirements.txt\n\n# Frontend\ncd ..\nnpm install\n```\n\n## Environment Variables Reference\n\n### tool1/.env\n```env\nOPENROUTER_API_KEY=sk-or-v1-xxxxxxxxxxxxx\nMISTRAL_MODEL=mistralai/mistral-7b-instruct\nMAX_TEXT_LENGTH=1000\nCHUNK_SIZE=2000\nMAX_RETRIES=3\n```\n\n### tool2/.env\n```env\nLLM_API_KEY=sk-or-v1-xxxxxxxxxxxxx\nLLM_ENDPOINT=https://openrouter.ai/api/v1\nGRAPH_PATH=law_graphTest.gpickle\nSIMILARITY_THRESHOLD=0.65\n```\n\n## API Endpoints (Backend)\n\n| Endpoint | Method | Purpose |\n|----------|--------|---------|\n| `/health` | GET | Health check |\n| `/upload-pdf` | POST | Upload & analyze PDF |\n| `/legal-query` | POST | Process legal query |\n| `/download/{file_id}` | GET | Download processed PDF |\n\n**Test with cURL:**\n```bash\n# Health check\ncurl http://localhost:8000/health\n\n# Legal query\ncurl -X POST http://localhost:8000/legal-query \\\n -H \"Content-Type: application/json\" \\\n -d '{\"question\":\"Can police search without warrant?\"}'\n```\n\n## Performance Tips\n\n### Speed Up Development\n1. **Use smaller test PDFs** (< 5 pages) during development\n2. **Cache API responses** by asking similar questions\n3. **Keep backend running** between frontend restarts\n4. **Use browser DevTools** to monitor API calls\n\n### Reduce Costs\n- **OpenRouter API** charges per token\n- Test queries cost ~$0.01-0.05 each\n- Large PDFs cost ~$0.10-0.50 each\n- Consider using **lower-cost models** for testing\n\n## Next Steps\n\nOnce everything is working:\n1. ✅ Read [CONTRIBUTING.md](./CONTRIBUTING.md) to contribute\n2. ✅ Check [DEPLOYMENT.md](./DEPLOYMENT.md) for production setup\n3. ✅ Review [CODEBASE_ANALYSIS_REPORT.md](./CODEBASE_ANALYSIS_REPORT.md) for architecture\n4. ✅ Explore API docs at `http://localhost:8000/docs`\n\n## Getting Help\n\n- **Documentation:** See [README.md](./README.md)\n- **Issues:** Open issue on [GitHub](https://github.com/Boombaybay12334/LAWREADER/issues)\n- **Discussions:** Join [GitHub Discussions](https://github.com/Boombaybay12334/LAWREADER/discussions)\n\n## Development Workflow\n\n```bash\n# 1. Start backend (Terminal 1)\ncd backend && venv\\Scripts\\activate && python main.py\n\n# 2. Start frontend (Terminal 2)\nnpm run dev\n\n# 3. Make changes to code\n\n# 4. Frontend auto-reloads on save\n\n# 5. Backend requires restart for changes:\n# Press Ctrl+C in Terminal 1, then:\npython main.py\n```\n\n## Common Development Tasks\n\n### Add a New Frontend Page\n1. Create `src/pages/NewPage.tsx`\n2. Add route in `src/App.tsx`\n3. Add navigation link in `src/components/Layout.tsx`\n\n### Add a New Backend Endpoint\n1. Add function in `backend/main.py`\n2. Use FastAPI decorators: `@app.get()`, `@app.post()`\n3. Test at `http://localhost:8000/docs`\n\n### Modify Tool 1 (PDF Analyzer)\n1. Edit `tool1/pipeline/*.py`\n2. Restart backend for changes to take effect\n\n### Modify Tool 2 (Query Resolver)\n1. Edit `tool2/*.py`\n2. Restart backend for changes to take effect\n\n## Success Checklist\n\nAfter setup, you should be able to:\n- [ ] Access frontend at `http://localhost:5173`\n- [ ] Access backend API docs at `http://localhost:8000/docs`\n- [ ] Submit a legal query and receive an answer\n- [ ] Upload a PDF and download processed result\n- [ ] See no errors in browser console\n- [ ] See no errors in backend terminal\n\n## Congratulations! 🎉\n\nYou've successfully set up LAWREADER for development!\n\n**What's next?**\n- Try different legal queries\n- Upload various PDF documents\n- Explore the codebase\n- Make your first contribution\n\n---\n\n**Need help?** Open an issue or discussion on GitHub!\n\n**Happy coding!** 💻⚖️\n"}}}}