Skip to content

sylvanding/omelette

Repository files navigation

Omelette Banner

A full-stack Scientific Literature Lifecycle Management System

CI License Python 3.12 Node.js 22+ FastAPI React 18 Docs

δΈ­ζ–‡ Β· Documentation Β· Quick Start Β· Report Bug


Omelette automates the full research literature pipeline β€” from keyword management and multi-source search, through deduplication and PDF crawling, to OCR processing, RAG-powered knowledge base, and AI writing assistance. V2 adds a chat-centric UX, multi-provider LLM support, LangGraph pipeline orchestration, and MCP integration for AI IDE clients.

Om (Omni-) + Lit (Literature) = Omlit β‰ˆ Omelette 🍳

✨ Features

πŸ”‘ Keyword Management Three-level hierarchy with LLM-powered expansion and search formula generation for WOS, Scopus, PubMed.

πŸ” Multi-Source Search Federated search across Semantic Scholar, OpenAlex, arXiv, and Crossref with standardized metadata.

🧹 Smart Deduplication Three-stage pipeline: DOI hard dedup β†’ title similarity β†’ LLM verification.

πŸ“‘ Incremental Subscription RSS feeds and API-based scheduled updates to track new publications automatically.

πŸ’¬ Chat Playground ChatGPT-style conversational interface for RAG queries and writing assistance.

πŸ”Œ Multi-LLM Support LangChain integration for OpenAI, Anthropic, Aliyun, Volcengine, and Ollama providers.

πŸ“₯ PDF Crawler Multi-channel download via Unpaywall, arXiv, and direct URL fallback strategies.

πŸ“ OCR Processing Native text extraction via MinerU (auto-managed subprocess) or PaddleOCR GPU fallback.

🧠 RAG Knowledge Base LlamaIndex engine with ChromaDB, GPU-aware embeddings, hybrid retrieval, and cited answers.

✍️ Writing Assistant Summarization, citation generation (GB/T 7714, APA, MLA), review outlines, and gap analysis.

πŸ”„ LangGraph Pipeline Pipeline orchestration with HITL interrupt/resume and persistent checkpointing.

⚑ GPU Resource Management TTL-based auto-unload for GPU models, MinerU subprocess auto-management, monitoring API, and exit cleanup watchdog.

πŸ”— MCP Integration Model Context Protocol server for AI IDE clients (Cursor, Claude Code, etc.).

🌐 i18n Bilingual UI (zh/en) with shadcn/ui and Radix primitives.

πŸ—οΈ Architecture

Keywords ─→ Search ─→ Dedup ─→ Crawler ─→ OCR ─→ RAG ─→ Writing
   β”‚          β”‚         β”‚         β”‚        β”‚       β”‚        β”‚
   β–Ό          β–Ό         β–Ό         β–Ό        β–Ό       β–Ό        β–Ό
[LangChain] [Sources] [SQLite]  [PDFs]  [Paddle] [LlamaIndex] [LLM]
   β”‚                                                      β”‚
   └────────────────── LangGraph β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”˜
   β”‚
   └── MCP (Model Context Protocol) ──→ AI IDE clients
Layer Technology
Backend FastAPI, SQLAlchemy 2 (async), Pydantic v2, Python 3.12
Frontend React 18, Vite, TypeScript, TailwindCSS v4, shadcn/ui, Radix, TanStack Query
Database SQLite + aiosqlite, Alembic migrations
Vector Store ChromaDB
RAG LlamaIndex with GPU-aware embeddings
LLM LangChain (OpenAI, Anthropic, Aliyun, Volcengine, Ollama)
Orchestration LangGraph with HITL interrupt/resume
OCR MinerU (auto-managed) + pdfplumber (native) + PaddleOCR (scanned)
MCP Model Context Protocol server
Docs VitePress (bilingual EN/ZH)

πŸš€ Quick Start

Prerequisites

  • Conda or Miniconda
  • Node.js 22+
  • (Optional) CUDA for GPU-accelerated OCR and embeddings
  • (Optional) API keys: OpenAI, Anthropic, Aliyun Bailian, or Volcengine for LLM; Semantic Scholar for higher rate limits

1. Clone & setup

git clone git@github.com:sylvanding/omelette.git
cd omelette

# Create conda env and install all backend dependencies
conda env create -f environment.yml
conda activate omelette

2. Configure

cp .env.example .env
# Edit .env with your API keys and data paths
Key environment variables
Variable Description
DATABASE_URL SQLite path (default: sqlite:///./data/omelette.db)
DATA_DIR Base path for PDFs, OCR output, ChromaDB
LLM_PROVIDER openai, anthropic, aliyun, volcengine, ollama, or mock
OPENAI_API_KEY OpenAI API key
ANTHROPIC_API_KEY Anthropic API key
ALIYUN_API_KEY Aliyun Bailian API key
VOLCENGINE_API_KEY Volcengine Doubao API key
SEMANTIC_SCHOLAR_API_KEY Optional; increases Semantic Scholar rate limit
GPU_MODE GPU preset: conservative, balanced (default), aggressive
MODEL_TTL_SECONDS Auto-unload GPU models after N seconds idle (default: 300)
MINERU_AUTO_MANAGE Auto start/stop MinerU subprocess (default: true)
PDF_PARSER auto, mineru, or pdfplumber

See .env.example for the full list.

3. Start backend

cd backend

# Run database migrations
alembic upgrade head

# Start server
uvicorn app.main:app --reload --host 0.0.0.0 --port 8000

On startup, the backend automatically:

  • Writes a PID file to DATA_DIR/omelette.pid
  • Starts a GPU model TTL monitor (auto-unloads idle models)
  • If MINERU_AUTO_MANAGE=true, manages MinerU subprocess lifecycle
  • Registers cleanup handlers (atexit + SIGHUP) so GPU resources are released even if the process exits unexpectedly

4. (Optional) GPU watchdog

For extra safety against kill -9 or crashes, run the external watchdog:

python backend/scripts/gpu_watchdog.py --daemon

The watchdog monitors the Omelette process and cleans up GPU resources if it terminates abnormally.

5. Start frontend

cd frontend
npm install
npm run dev

Open http://localhost:3000 in your browser.

6. (Optional) MinerU setup

If using MinerU for PDF parsing (PDF_PARSER=mineru):

# Create a separate conda env for MinerU
conda create -n mineru python=3.10
conda activate mineru
pip install magic-pdf[full]

Set MINERU_CONDA_ENV=mineru in .env. Omelette will auto-start MinerU when needed.

Troubleshooting: If you get ModuleNotFoundError: No module named 'fastapi', ensure the conda environment is activated: conda activate omelette.

πŸ“‚ Project Layout

omelette/
β”œβ”€β”€ backend/              # FastAPI application
β”‚   β”œβ”€β”€ app/
β”‚   β”‚   β”œβ”€β”€ api/v1/       # REST endpoints
β”‚   β”‚   β”œβ”€β”€ models/       # SQLAlchemy ORM models
β”‚   β”‚   β”œβ”€β”€ schemas/      # Pydantic request/response schemas
β”‚   β”‚   β”œβ”€β”€ services/     # Business logic
β”‚   β”‚   β”œβ”€β”€ pipelines/    # LangGraph pipeline definitions
β”‚   β”‚   β”œβ”€β”€ config.py     # Settings from .env
β”‚   β”‚   β”œβ”€β”€ database.py   # Async engine and session
β”‚   β”‚   └── main.py       # App entry, lifespan, CORS
β”‚   β”œβ”€β”€ mcp_server.py     # MCP (Model Context Protocol) server
β”‚   β”œβ”€β”€ alembic/          # Database migrations
β”‚   β”œβ”€β”€ scripts/          # Utilities (gpu_watchdog.py)
β”‚   β”œβ”€β”€ tests/            # pytest-asyncio tests (526 tests)
β”‚   └── pyproject.toml    # Python dependencies
β”œβ”€β”€ frontend/             # React SPA
β”‚   └── src/
β”‚       β”œβ”€β”€ pages/        # Dashboard, ProjectDetail, Chat, modules
β”‚       β”œβ”€β”€ components/   # Layout, shared UI
β”‚       β”‚   └── ui/       # shadcn/ui components
β”‚       β”œβ”€β”€ services/     # Typed API client
β”‚       β”œβ”€β”€ hooks/        # Custom hooks (useToastMutation, etc.)
β”‚       β”œβ”€β”€ stores/       # Zustand state
β”‚       β”œβ”€β”€ i18n/         # Internationalization (zh/en)
β”‚       β”œβ”€β”€ test/         # Vitest setup, MSW mocks, fixtures
β”‚       └── lib/          # Axios client, utils
β”œβ”€β”€ e2e/                  # Playwright E2E tests
β”œβ”€β”€ docs/                 # VitePress documentation (EN/ZH)
β”œβ”€β”€ assets/               # Banner, logo, mascot images
β”œβ”€β”€ environment.yml       # Conda env (Python 3.12)
β”œβ”€β”€ Makefile              # Dev workflow shortcuts
β”œβ”€β”€ .env.example          # Configuration template
β”œβ”€β”€ playwright.config.ts  # Playwright E2E configuration
└── .github/workflows/    # CI (ruff, pytest, vitest, tsc, build, docs)

πŸ› οΈ Development

make pre-commit-install   # Install pre-commit hooks
make lint                 # Run linters
make format               # Auto-format code
make test                 # Run all tests
make dev                  # Start both backend and frontend

Running Tests

# Backend (526 tests)
cd backend && pytest tests/ -v

# Frontend unit tests (28 tests β€” Vitest + Testing Library + MSW)
cd frontend && npm test

# Frontend type check and build
cd frontend && npx tsc --noEmit && npm run build

# E2E tests (optional β€” requires running frontend dev server)
npx playwright test

πŸ“‘ API Overview

REST APIs under /api/v1/:

Endpoint Description
GET/POST /projects Project CRUD
GET/POST /projects/{id}/papers Paper management
GET/POST /projects/{id}/keywords Keyword management
GET /projects/{id}/keywords/search-formula Generate search formula
POST /projects/{id}/search Execute multi-source search
POST /projects/{id}/dedup/run Run deduplication
POST /projects/{id}/crawl/start Start PDF download
POST /projects/{id}/ocr/process Run OCR on papers
POST /projects/{id}/rag/index Build vector index
POST /projects/{id}/rag/query RAG retrieval
POST /projects/{id}/writing/assist Writing assistance
POST /projects/{id}/writing/review-draft/stream Streaming literature review (SSE)
POST /chat Chat messages (playground)
POST /chat/complete Smart autocomplete suggestions
GET /projects/{id}/papers/{paper_id}/citation-graph Citation graph (Semantic Scholar)
GET/POST /conversations Conversation CRUD
GET/POST /pipelines Pipeline management
GET/POST /subscriptions Subscription management
GET/POST /settings Settings and health
GET /settings/health Health check
GET /gpu/status GPU model and memory status
POST /gpu/unload Manually unload GPU models

MCP server: /mcp (WebSocket/SSE for AI IDE clients)

Full documentation: API Reference

🀝 Contributing

See CONTRIBUTING.md for guidelines.

πŸ“„ License

MIT License β€” Copyright Β© 2026 Sylvan Ding

About

🍳 Omelette: A full-stack Scientific Literature Lifecycle Management System built with FastAPI, React, and TypeScript.

Topics

Resources

License

Contributing

Stars

Watchers

Forks

Releases

No releases published

Packages

 
 
 

Contributors