Link

Ragflow 折腾记

目录

  1. Ragflow 折腾记
  2. 源代码启动
    1. 环境准备
  3. 编译镜像

源代码启动

为了测试公司的 API,想用 Ragflow 来做个 AI Demo,可是发现自带的 Agent 不能完全满足需求,于是想手写/改一个,改完后发现还需要编译或者源代码启动才行…于是开始折腾。

环境准备

Conda:

conda create -n prod
conda activate prod

依赖包:

yum install python3.11
curl -sSL https://install.python-poetry.org | python3 -

# 已经提前下好了无需再下载了
# git clone https://github.com/infiniflow/ragflow.git

cd ragflow/
export POETRY_VIRTUALENVS_CREATE=true POETRY_VIRTUALENVS_IN_PROJECT=true
~/.local/bin/poetry install --sync --no-root --with=full # install RAGFlow dependent python modules

cat <<EOF >>/etc/hosts
127.0.0.1       es01 infinity mysql minio redis
EOF

https://github.com/infiniflow/ragflow?tab=readme-ov-file#-launch-service-from-source-for-development

docker compose -f docker/docker-compose-base.yml up -d
pip3 install pycryptodomex pdfplumber
export HF_ENDPOINT=https://hf-mirror.com

source .venv/bin/activate
export PYTHONPATH=$(pwd)
bash docker/launch_backend_service.sh

cd web
npm install --force

Configure frontend to update proxy.target in .umirc.ts to http://127.0.0.1:9380

npm run dev 

编译镜像

# 已经提前下好了无需再下载了
# git clone https://github.com/infiniflow/ragflow.git
cd ragflow/
yum install python3 pip
pip3 install huggingface-hub nltk
python3 download_deps.py
docker build -f Dockerfile.slim -t infiniflow/ragflow:dev-slim .