Python環境準備
1. 安裝pipx。如已經安裝,可跳過本步驟:
python -m pip install --user pipxpython -m pipx ensurepath## 驗證安裝pipx --version
2. 安裝 uv。如已經安裝,可跳過本步驟:
pipx install uv
## 設置為阿里云 PyPI 鏡像源
set UV_INDEX=https://mirrors.aliyun.com/pypi/simple
3. 克隆 RAGFlow
git clone https://github.com/infiniflow/ragflow.git
cd ragflow/
4.安裝 Python 依賴項:
slim:
# install RAGFlow dependent python modules
uv sync --python 3.11
slim不用full
full:
--all-extras # install RAGFlow dependent python modules
uv sync --python 3.11
注2:會存在無法安裝pyicu得問題,本地運行若只需要聊天/知識庫可以先忽略
pyicu (國際化依賴源包)版本 ==2.14 安裝可能會不成功,需要注釋pyproject.toml中的pyicu,對于現階段開發無影響,
注釋掉 docker/entrypoint.sh 中的這一行。nginx
# /usr/sbin/nginx
激活 Python 虛擬環境:
source .venv/bin/activate
export PYTHONPATH=$(pwd)
5.下載項目必備模型
找到目錄下得download_depts.py文件,開啟加速器運行,當前目錄下會下載這些文件
注:如果存在虛擬環境則需要把nltk_data文件夾移到虛擬環境文件目錄下
6. 修改配置文件(service_conf.yml)
編輯/conf/service_conf.yml
ragflow:host: 0.0.0.0http_port: 9380
mysql:# 需要先在數據庫創建該庫name: '庫名'user: 'xx'password: 'xxx'host: 'ip'port: portmax_connections: 100stale_timeout: 30
minio:user: 'access_key'password: 'secret_key'host: 'ip:port'
es:hosts: 'http://ip:port'username: 'xx'password: 'xxx'
infinity:uri: 'localhost:23817'db_name: 'default_db'
redis:db: 1password: 'x'host: 'ip:port'# postgres:
# name: 'rag_flow'
# user: 'rag_flow'
# password: 'infini_rag_flow'
# host: 'postgres'
# port: 5432
# max_connections: 100
# stale_timeout: 30
# s3:
# access_key: 'access_key'
# secret_key: 'secret_key'
# region: 'region'
# oss:
# access_key: 'access_key'
# secret_key: 'secret_key'
# endpoint_url: 'http://oss-cn-hangzhou.aliyuncs.com'
# region: 'cn-hangzhou'
# bucket: 'bucket_name'
# azure:
# auth_type: 'sas'
# container_url: 'container_url'
# sas_token: 'sas_token'
# azure:
# auth_type: 'spn'
# account_url: 'account_url'
# client_id: 'client_id'
# secret: 'secret'
# tenant_id: 'tenant_id'
# container_name: 'container_name'
# user_default_llm:
# factory: 'Tongyi-Qianwen'
# api_key: 'sk-xxxxxxxxxxxxx'
# base_url: ''
# oauth:
# github:
# client_id: xxxxxxxxxxxxxxxxxxxxxxxxx
# secret_key: xxxxxxxxxxxxxxxxxxxxxxxxxxxx
# url: https://github.com/login/oauth/access_token
# feishu:
# app_id: cli_xxxxxxxxxxxxxxxxxxx
# app_secret: xxxxxxxxxxxxxxxxxxxxxxxxxxxx
# app_access_token_url: https://open.feishu.cn/open-apis/auth/v3/app_access_token/internal
# user_access_token_url: https://open.feishu.cn/open-apis/authen/v1/oidc/access_token
# grant_type: 'authorization_code'
# authentication:
# client:
# switch: false
# http_app_key:
# http_secret_key:
# site:
# switch: false
# permission:
# switch: false
# component: false
# dataset: false
6.下載項目必備模型
用git bash進入D:\code\python\ragflow
export HF_ENDPOINT=https://hf-mirror.com
找到目錄下得download_depts.py文件,開啟加速器運行,當前目錄下會下載這些文件
7.啟動服務
接口服務python路徑:api/ragflow_server.py
python api/ragflow_server.py
任務服務python路徑:rag/svr/task_executor.py
python rag/svr/task_executor.py
8.前端
準備:安裝node>16
idea打開web的Terminal窗口執行:
依賴安裝
npm run install
程序啟動
npm run dev
9.pycharm配置虛擬環境
參考:
https://ragflow.io/docs/dev/launch_ragflow_from_source
https://blog.csdn.net/university96/article/details/146361237
https://blog.csdn.net/qq_33407429/article/details/146182253
https://blog.csdn.net/weixin_45535519/article/details/146199830
http://mp.weixin.qq.com/s?__biz=MjM5NzQxMTAyNw==&mid=2247486291&idx=1&sn=2b5cd4d0e884683b7597d9efa5faaac1&chksm=a7e28746e040f049c53b0cf8558f969cc1699ff35dc17a9a04726c1bc59d22f2741ddc59510a&mpshare=1&scene=1&srcid=0416xjiIyCzsKwumLEySgZw3&sharer_shareinfo=30a70149dc5a708922287838404bcf5a&sharer_shareinfo_first=30a70149dc5a708922287838404bcf5a#rd