Files
ragflow/AGENTS.md
Zhichang Yu bb6022477e Bump infinity to v0.6.11. Requires python>=3.11 (#11814)
### What problem does this PR solve?

Bump infinity to v0.6.11. Requires python>=3.11

### Type of change

- [x] Refactoring
2025-12-09 16:23:37 +08:00

2.7 KiB

RAGFlow Project Instructions for GitHub Copilot

This file provides context, build instructions, and coding standards for the RAGFlow project. It is structured to follow GitHub Copilot's customization guidelines.

1. Project Overview

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.

2. Directory Structure

  • 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.

3. Build Instructions

Backend (Python)

The project uses uv for dependency management.

  1. Setup Environment:

    uv sync --python 3.11 --all-extras
    uv run download_deps.py
    
  2. 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
      

Frontend (TypeScript/React)

Located in web/.

  1. Install Dependencies:

    cd web
    npm install
    
  2. Run Dev Server:

    npm run dev
    

    Runs on port 8000 by default.

Docker Deployment

To run the full stack using Docker:

cd docker
docker compose -f docker-compose.yml up -d

4. Testing Instructions

Backend Tests

  • Run All Tests:
    uv run pytest
    
  • Run Specific Test:
    uv run pytest test/test_api.py
    

Frontend Tests

  • Run Tests:
    cd web
    npm run test
    

5. Coding Standards & Guidelines

  • Python Formatting: Use ruff for 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