This file provides context, build instructions, and coding standards for the RAGFlow project. It is structured to follow GitHub Copilot's customization guidelines.
RAGFlow is an open-source RAG (Retrieval-Augmented Generation) engine based on deep document understanding. It is a full-stack application with a Python backend and a React/TypeScript frontend.
- Backend: Python 3.10+ (Flask/Quart)
- Frontend: TypeScript, React, UmiJS
- Architecture: Microservices based on Docker.
api/: Backend API server.rag/: Core RAG logic (indexing, retrieval).deepdoc/: Document parsing and OCR.web/: Frontend application.
api/: Backend API server (Flask/Quart).apps/: API Blueprints (Knowledge Base, Chat, etc.).db/: Database models and services.
rag/: Core RAG logic.llm/: LLM, Embedding, and Rerank model abstractions.
deepdoc/: Document parsing and OCR modules.agent/: Agentic reasoning components.web/: Frontend application (React + UmiJS).docker/: Docker deployment configurations.sdk/: Python SDK.test/: Backend tests.
The project uses uv for dependency management.
-
Setup Environment:
uv sync --python 3.12 --all-extras uv run download_deps.py
-
Run Server:
- Pre-requisite: Start dependent services (MySQL, ES/Infinity, Redis, MinIO).
docker compose -f docker/docker-compose-base.yml up -d
- Launch:
source .venv/bin/activate export PYTHONPATH=$(pwd) bash docker/launch_backend_service.sh
- Pre-requisite: Start dependent services (MySQL, ES/Infinity, Redis, MinIO).
Located in web/.
-
Install Dependencies:
cd web npm install -
Run Dev Server:
npm run dev
Runs on port 8000 by default.
To run the full stack using Docker:
cd docker
docker compose -f docker-compose.yml up -d- Run All Tests:
uv run pytest
- Run Specific Test:
uv run pytest test/test_api.py
- Run Tests:
cd web npm run test
- Python Formatting: Use
rufffor linting and formatting.ruff check ruff format
- Frontend Linting:
cd web npm run lint - Pre-commit: Ensure pre-commit hooks are installed.
pre-commit install pre-commit run --all-files