Files
ragflow/AGENTS.md
Zhichang Yu 4c54cefd29 Port 14 upstream agent security / correctness fixes to Go canvas (#16455)
Mirrors 14 merged upstream PRs into the Go agent port.

PRs ported:
  - #15609 ExeSQL SSRF guard + DNS pin
  - #15436 HTTP timeout on external API tools
  - #16363 be_output restore + DeepL error path
  - #15644 switch no longer matches empty condition
  - #15374 session_id bind to path agent_id (DAO idor guard)
  - #16169 sandbox artifact ownership gate
  - #15457 tenant ownership on agentbots
  - #15145 rerun agent document access check
- #15446 thinking switch (component portion; provider policy lives in
internal/llm)
  - #15426 Invoke URL/proxy SSRF + DNS pin + no-redirects
  - #15238 agentbot thinking-logs beta endpoint
  - #14589 UserFillUp SSE event propagation
  - #14890 anonymous webhook opt-in
- #15068 PipelineChunker new component (text/file_ref/parser_id
dispatch; file-format extraction is a follow-up)

40 files, +2355 / -58 lines. 33 new tests, all targeted package suites
pass (1721 + 4 skipped); 1 pre-existing flaky test unrelated.
2026-06-30 16:28:48 +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.13 --all-extras
    uv run python3 ragflow_deps/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
    
  • Git Hooks: Run this once after the first clone to enable local Git hooks.
    lefthook install
    lefthook run pre-commit --all-files