You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

README_tzh.md 16KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412
  1. <div align="center">
  2. <a href="https://demo.ragflow.io/">
  3. <img src="web/src/assets/logo-with-text.png" width="350" alt="ragflow logo">
  4. </a>
  5. </div>
  6. <p align="center">
  7. <a href="./README.md"><img alt="README in English" src="https://img.shields.io/badge/English-DFE0E5"></a>
  8. <a href="./README_zh.md"><img alt="简体中文版自述文件" src="https://img.shields.io/badge/简体中文-DFE0E5"></a>
  9. <a href="./README_tzh.md"><img alt="繁體版中文自述文件" src="https://img.shields.io/badge/繁體中文-DBEDFA"></a>
  10. <a href="./README_ja.md"><img alt="日本語のREADME" src="https://img.shields.io/badge/日本語-DFE0E5"></a>
  11. <a href="./README_ko.md"><img alt="한국어" src="https://img.shields.io/badge/한국어-DFE0E5"></a>
  12. <a href="./README_id.md"><img alt="Bahasa Indonesia" src="https://img.shields.io/badge/Bahasa Indonesia-DFE0E5"></a>
  13. <a href="./README_pt_br.md"><img alt="Português(Brasil)" src="https://img.shields.io/badge/Português(Brasil)-DFE0E5"></a>
  14. </p>
  15. <p align="center">
  16. <a href="https://x.com/intent/follow?screen_name=infiniflowai" target="_blank">
  17. <img src="https://img.shields.io/twitter/follow/infiniflow?logo=X&color=%20%23f5f5f5" alt="follow on X(Twitter)">
  18. </a>
  19. <a href="https://demo.ragflow.io" target="_blank">
  20. <img alt="Static Badge" src="https://img.shields.io/badge/Online-Demo-4e6b99">
  21. </a>
  22. <a href="https://hub.docker.com/r/infiniflow/ragflow" target="_blank">
  23. <img src="https://img.shields.io/docker/pulls/infiniflow/ragflow?label=Docker%20Pulls&color=0db7ed&logo=docker&logoColor=white&style=flat-square" alt="docker pull infiniflow/ragflow:v0.19.1">
  24. </a>
  25. <a href="https://github.com/infiniflow/ragflow/releases/latest">
  26. <img src="https://img.shields.io/github/v/release/infiniflow/ragflow?color=blue&label=Latest%20Release" alt="Latest Release">
  27. </a>
  28. <a href="https://github.com/infiniflow/ragflow/blob/main/LICENSE">
  29. <img height="21" src="https://img.shields.io/badge/License-Apache--2.0-ffffff?labelColor=d4eaf7&color=2e6cc4" alt="license">
  30. </a>
  31. <a href="https://deepwiki.com/infiniflow/ragflow">
  32. <img alt="Ask DeepWiki" src="https://deepwiki.com/badge.svg">
  33. </a>
  34. </p>
  35. <h4 align="center">
  36. <a href="https://ragflow.io/docs/dev/">Document</a> |
  37. <a href="https://github.com/infiniflow/ragflow/issues/4214">Roadmap</a> |
  38. <a href="https://twitter.com/infiniflowai">Twitter</a> |
  39. <a href="https://discord.gg/NjYzJD3GM3">Discord</a> |
  40. <a href="https://demo.ragflow.io">Demo</a>
  41. </h4>
  42. #
  43. <div align="center">
  44. <a href="https://trendshift.io/repositories/9064" target="_blank"><img src="https://trendshift.io/api/badge/repositories/9064" alt="infiniflow%2Fragflow | Trendshift" style="width: 250px; height: 55px;" width="250" height="55"/></a>
  45. </div>
  46. <details open>
  47. <summary><b>📕 目錄</b></summary>
  48. - 💡 [RAGFlow 是什麼?](#-RAGFlow-是什麼)
  49. - 🎮 [Demo-試用](#-demo-試用)
  50. - 📌 [近期更新](#-近期更新)
  51. - 🌟 [主要功能](#-主要功能)
  52. - 🔎 [系統架構](#-系統架構)
  53. - 🎬 [快速開始](#-快速開始)
  54. - 🔧 [系統配置](#-系統配置)
  55. - 🔨 [以原始碼啟動服務](#-以原始碼啟動服務)
  56. - 📚 [技術文檔](#-技術文檔)
  57. - 📜 [路線圖](#-路線圖)
  58. - 🏄 [貢獻指南](#-貢獻指南)
  59. - 🙌 [加入社區](#-加入社區)
  60. - 🤝 [商務合作](#-商務合作)
  61. </details>
  62. ## 💡 RAGFlow 是什麼?
  63. [RAGFlow](https://ragflow.io/) 是一款基於深度文件理解所建構的開源 RAG(Retrieval-Augmented Generation)引擎。 RAGFlow 可以為各種規模的企業及個人提供一套精簡的 RAG 工作流程,結合大語言模型(LLM)針對用戶各類不同的複雜格式數據提供可靠的問答以及有理有據的引用。
  64. ## 🎮 Demo 試用
  65. 請登入網址 [https://demo.ragflow.io](https://demo.ragflow.io) 試用 demo。
  66. <div align="center" style="margin-top:20px;margin-bottom:20px;">
  67. <img src="https://github.com/infiniflow/ragflow/assets/7248/2f6baa3e-1092-4f11-866d-36f6a9d075e5" width="1200"/>
  68. <img src="https://github.com/user-attachments/assets/504bbbf1-c9f7-4d83-8cc5-e9cb63c26db6" width="1200"/>
  69. </div>
  70. ## 🔥 近期更新
  71. - 2025-05-23 為 Agent 新增 Python/JS 程式碼執行器元件。
  72. - 2025-05-05 支援跨語言查詢。
  73. - 2025-03-19 PDF和DOCX中的圖支持用多模態大模型去解析得到描述.
  74. - 2025-02-28 結合網路搜尋(Tavily),對於任意大模型實現類似 Deep Research 的推理功能.
  75. - 2024-12-18 升級了 DeepDoc 的文檔佈局分析模型。
  76. - 2024-08-22 支援用 RAG 技術實現從自然語言到 SQL 語句的轉換。
  77. ## 🎉 關注項目
  78. ⭐️ 點擊右上角的 Star 追蹤 RAGFlow,可以取得最新發布的即時通知 !🌟
  79. <div align="center" style="margin-top:20px;margin-bottom:20px;">
  80. <img src="https://github.com/user-attachments/assets/18c9707e-b8aa-4caf-a154-037089c105ba" width="1200"/>
  81. </div>
  82. ## 🌟 主要功能
  83. ### 🍭 **"Quality in, quality out"**
  84. - 基於[深度文件理解](./deepdoc/README.md),能夠從各類複雜格式的非結構化資料中提取真知灼見。
  85. - 真正在無限上下文(token)的場景下快速完成大海撈針測試。
  86. ### 🍱 **基於模板的文字切片**
  87. - 不只是智能,更重要的是可控可解釋。
  88. - 多種文字範本可供選擇
  89. ### 🌱 **有理有據、最大程度降低幻覺(hallucination)**
  90. - 文字切片過程視覺化,支援手動調整。
  91. - 有理有據:答案提供關鍵引用的快照並支持追根溯源。
  92. ### 🍔 **相容各類異質資料來源**
  93. - 支援豐富的文件類型,包括 Word 文件、PPT、excel 表格、txt 檔案、圖片、PDF、影印件、影印件、結構化資料、網頁等。
  94. ### 🛀 **全程無憂、自動化的 RAG 工作流程**
  95. - 全面優化的 RAG 工作流程可以支援從個人應用乃至超大型企業的各類生態系統。
  96. - 大語言模型 LLM 以及向量模型皆支援配置。
  97. - 基於多路召回、融合重排序。
  98. - 提供易用的 API,可輕鬆整合到各類企業系統。
  99. ## 🔎 系統架構
  100. <div align="center" style="margin-top:20px;margin-bottom:20px;">
  101. <img src="https://github.com/infiniflow/ragflow/assets/12318111/d6ac5664-c237-4200-a7c2-a4a00691b485" width="1000"/>
  102. </div>
  103. ## 🎬 快速開始
  104. ### 📝 前提條件
  105. - CPU >= 4 核
  106. - RAM >= 16 GB
  107. - Disk >= 50 GB
  108. - Docker >= 24.0.0 & Docker Compose >= v2.26.1
  109. - [gVisor](https://gvisor.dev/docs/user_guide/install/): 僅在您打算使用 RAGFlow 的代碼執行器(沙箱)功能時才需要安裝。
  110. > [!TIP]
  111. > 如果你並沒有在本機安裝 Docker(Windows、Mac,或 Linux), 可以參考文件 [Install Docker Engine](https://docs.docker.com/engine/install/) 自行安裝。
  112. ### 🚀 啟動伺服器
  113. 1. 確保 `vm.max_map_count` 不小於 262144:
  114. > 如需確認 `vm.max_map_count` 的大小:
  115. >
  116. > ```bash
  117. > $ sysctl vm.max_map_count
  118. > ```
  119. >
  120. > 如果 `vm.max_map_count` 的值小於 262144,可以進行重設:
  121. >
  122. > ```bash
  123. > # 這裡我們設為 262144:
  124. > $ sudo sysctl -w vm.max_map_count=262144
  125. > ```
  126. >
  127. > 你的改動會在下次系統重新啟動時被重置。如果希望做永久改動,還需要在 **/etc/sysctl.conf** 檔案裡把 `vm.max_map_count` 的值再相應更新一遍:
  128. >
  129. > ```bash
  130. > vm.max_map_count=262144
  131. > ```
  132. 2. 克隆倉庫:
  133. ```bash
  134. $ git clone https://github.com/infiniflow/ragflow.git
  135. ```
  136. 3. 進入 **docker** 資料夾,利用事先編譯好的 Docker 映像啟動伺服器:
  137. > [!CAUTION]
  138. > 所有 Docker 映像檔都是為 x86 平台建置的。目前,我們不提供 ARM64 平台的 Docker 映像檔。
  139. > 如果您使用的是 ARM64 平台,請使用 [這份指南](https://ragflow.io/docs/dev/build_docker_image) 來建置適合您系統的 Docker 映像檔。
  140. > 執行以下指令會自動下載 RAGFlow slim Docker 映像 `v0.19.1-slim`。請參考下表查看不同 Docker 發行版的說明。如需下載不同於 `v0.19.1-slim` 的 Docker 映像,請在執行 `docker compose` 啟動服務之前先更新 **docker/.env** 檔案內的 `RAGFLOW_IMAGE` 變數。例如,你可以透過設定 `RAGFLOW_IMAGE=infiniflow/ragflow:v0.19.1` 來下載 RAGFlow 鏡像的 `v0.19.1` 完整發行版。
  141. ```bash
  142. $ cd ragflow/docker
  143. # Use CPU for embedding and DeepDoc tasks:
  144. $ docker compose -f docker-compose.yml up -d
  145. # To use GPU to accelerate embedding and DeepDoc tasks:
  146. # docker compose -f docker-compose-gpu.yml up -d
  147. ```
  148. | RAGFlow image tag | Image size (GB) | Has embedding models? | Stable? |
  149. | ----------------- | --------------- | --------------------- | ------------------------ |
  150. | v0.19.1 | &approx;9 | :heavy_check_mark: | Stable release |
  151. | v0.19.1-slim | &approx;2 | ❌ | Stable release |
  152. | nightly | &approx;9 | :heavy_check_mark: | _Unstable_ nightly build |
  153. | nightly-slim | &approx;2 | ❌ | _Unstable_ nightly build |
  154. > [!TIP]
  155. > 如果你遇到 Docker 映像檔拉不下來的問題,可以在 **docker/.env** 檔案內根據變數 `RAGFLOW_IMAGE` 的註解提示選擇華為雲或阿里雲的對應映像。
  156. >
  157. > - 華為雲鏡像名:`swr.cn-north-4.myhuaweicloud.com/infiniflow/ragflow`
  158. > - 阿里雲鏡像名:`registry.cn-hangzhou.aliyuncs.com/infiniflow/ragflow`
  159. 4. 伺服器啟動成功後再次確認伺服器狀態:
  160. ```bash
  161. $ docker logs -f ragflow-server
  162. ```
  163. _出現以下介面提示說明伺服器啟動成功:_
  164. ```bash
  165. ____ ___ ______ ______ __
  166. / __ \ / | / ____// ____// /____ _ __
  167. / /_/ // /| | / / __ / /_ / // __ \| | /| / /
  168. / _, _// ___ |/ /_/ // __/ / // /_/ /| |/ |/ /
  169. /_/ |_|/_/ |_|\____//_/ /_/ \____/ |__/|__/
  170. * Running on all addresses (0.0.0.0)
  171. ```
  172. > 如果您跳過這一步驟系統確認步驟就登入 RAGFlow,你的瀏覽器有可能會提示 `network anormal` 或 `網路異常`,因為 RAGFlow 可能並未完全啟動成功。
  173. 5. 在你的瀏覽器中輸入你的伺服器對應的 IP 位址並登入 RAGFlow。
  174. > 上面這個範例中,您只需輸入 http://IP_OF_YOUR_MACHINE 即可:未改動過設定則無需輸入連接埠(預設的 HTTP 服務連接埠 80)。
  175. 6. 在 [service_conf.yaml.template](./docker/service_conf.yaml.template) 檔案的 `user_default_llm` 欄位設定 LLM factory,並在 `API_KEY` 欄填入和你選擇的大模型相對應的 API key。
  176. > 詳見 [llm_api_key_setup](https://ragflow.io/docs/dev/llm_api_key_setup)。
  177. _好戲開始,接著奏樂接著舞! _
  178. ## 🔧 系統配置
  179. 系統配置涉及以下三份文件:
  180. - [.env](./docker/.env):存放一些系統環境變量,例如 `SVR_HTTP_PORT`、`MYSQL_PASSWORD`、`MINIO_PASSWORD` 等。
  181. - [service_conf.yaml.template](./docker/service_conf.yaml.template):設定各類別後台服務。
  182. - [docker-compose.yml](./docker/docker-compose.yml): 系統依賴該檔案完成啟動。
  183. 請務必確保 [.env](./docker/.env) 檔案中的變數設定與 [service_conf.yaml.template](./docker/service_conf.yaml.template) 檔案中的設定保持一致!
  184. 如果無法存取映像網站 hub.docker.com 或模型網站 huggingface.co,請依照 [.env](./docker/.env) 註解修改 `RAGFLOW_IMAGE` 和 `HF_ENDPOINT`。
  185. > [./docker/README](./docker/README.md) 解釋了 [service_conf.yaml.template](./docker/service_conf.yaml.template) 用到的環境變數設定和服務配置。
  186. 如需更新預設的 HTTP 服務連接埠(80), 可以在[docker-compose.yml](./docker/docker-compose.yml) 檔案中將配置`80:80` 改為`<YOUR_SERVING_PORT>:80` 。
  187. > 所有系統配置都需要透過系統重新啟動生效:
  188. >
  189. > ```bash
  190. > $ docker compose -f docker-compose.yml up -d
  191. > ```
  192. ###把文檔引擎從 Elasticsearch 切換成為 Infinity
  193. RAGFlow 預設使用 Elasticsearch 儲存文字和向量資料. 如果要切換為 [Infinity](https://github.com/infiniflow/infinity/), 可以按照下面步驟進行:
  194. 1. 停止所有容器運作:
  195. ```bash
  196. $ docker compose -f docker/docker-compose.yml down -v
  197. ```
  198. Note: `-v` 將會刪除 docker 容器的 volumes,已有的資料會被清空。
  199. 2. 設定 **docker/.env** 目錄中的 `DOC_ENGINE` 為 `infinity`.
  200. 3. 啟動容器:
  201. ```bash
  202. $ docker compose -f docker-compose.yml up -d
  203. ```
  204. > [!WARNING]
  205. > Infinity 目前官方並未正式支援在 Linux/arm64 架構下的機器上運行.
  206. ## 🔧 原始碼編譯 Docker 映像(不含 embedding 模型)
  207. 本 Docker 映像大小約 2 GB 左右並且依賴外部的大模型和 embedding 服務。
  208. ```bash
  209. git clone https://github.com/infiniflow/ragflow.git
  210. cd ragflow/
  211. docker build --platform linux/amd64 --build-arg LIGHTEN=1 --build-arg NEED_MIRROR=1 -f Dockerfile -t infiniflow/ragflow:nightly-slim .
  212. ```
  213. ## 🔧 原始碼編譯 Docker 映像(包含 embedding 模型)
  214. 本 Docker 大小約 9 GB 左右。由於已包含 embedding 模型,所以只需依賴外部的大模型服務即可。
  215. ```bash
  216. git clone https://github.com/infiniflow/ragflow.git
  217. cd ragflow/
  218. docker build --platform linux/amd64 --build-arg NEED_MIRROR=1 -f Dockerfile -t infiniflow/ragflow:nightly .
  219. ```
  220. ## 🔨 以原始碼啟動服務
  221. 1. 安裝 uv。如已安裝,可跳過此步驟:
  222. ```bash
  223. pipx install uv pre-commit
  224. export UV_INDEX=https://mirrors.aliyun.com/pypi/simple
  225. ```
  226. 2. 下載原始碼並安裝 Python 依賴:
  227. ```bash
  228. git clone https://github.com/infiniflow/ragflow.git
  229. cd ragflow/
  230. uv sync --python 3.10 --all-extras # install RAGFlow dependent python modules
  231. uv run download_deps.py
  232. pre-commit install
  233. ```
  234. 3. 透過 Docker Compose 啟動依賴的服務(MinIO, Elasticsearch, Redis, and MySQL):
  235. ```bash
  236. docker compose -f docker/docker-compose-base.yml up -d
  237. ```
  238. 在 `/etc/hosts` 中加入以下程式碼,將 **conf/service_conf.yaml** 檔案中的所有 host 位址都解析為 `127.0.0.1`:
  239. ```
  240. 127.0.0.1 es01 infinity mysql minio redis sandbox-executor-manager
  241. ```
  242. 4. 如果無法存取 HuggingFace,可以把環境變數 `HF_ENDPOINT` 設為對應的鏡像網站:
  243. ```bash
  244. export HF_ENDPOINT=https://hf-mirror.com
  245. ```
  246. 5. 如果你的操作系统没有 jemalloc,请按照如下方式安装:
  247. ```bash
  248. # ubuntu
  249. sudo apt-get install libjemalloc-dev
  250. # centos
  251. sudo yum install jemalloc
  252. ```
  253. 6. 啟動後端服務:
  254. ```bash
  255. source .venv/bin/activate
  256. export PYTHONPATH=$(pwd)
  257. bash docker/launch_backend_service.sh
  258. ```
  259. 7. 安裝前端依賴:
  260. ```bash
  261. cd web
  262. npm install
  263. ```
  264. 8. 啟動前端服務:
  265. ```bash
  266. npm run dev
  267. ```
  268. 以下界面說明系統已成功啟動:_
  269. ![](https://github.com/user-attachments/assets/0daf462c-a24d-4496-a66f-92533534e187)
  270. ```
  271. 9. 開發完成後停止 RAGFlow 前端和後端服務:
  272. ```bash
  273. pkill -f "ragflow_server.py|task_executor.py"
  274. ```
  275. ## 📚 技術文檔
  276. - [Quickstart](https://ragflow.io/docs/dev/)
  277. - [Configuration](https://ragflow.io/docs/dev/configurations)
  278. - [Release notes](https://ragflow.io/docs/dev/release_notes)
  279. - [User guides](https://ragflow.io/docs/dev/category/guides)
  280. - [Developer guides](https://ragflow.io/docs/dev/category/developers)
  281. - [References](https://ragflow.io/docs/dev/category/references)
  282. - [FAQs](https://ragflow.io/docs/dev/faq)
  283. ## 📜 路線圖
  284. 詳見 [RAGFlow Roadmap 2025](https://github.com/infiniflow/ragflow/issues/4214) 。
  285. ## 🏄 開源社群
  286. - [Discord](https://discord.gg/zd4qPW6t)
  287. - [Twitter](https://twitter.com/infiniflowai)
  288. - [GitHub Discussions](https://github.com/orgs/infiniflow/discussions)
  289. ## 🙌 貢獻指南
  290. RAGFlow 只有透過開源協作才能蓬勃發展。秉持這項精神,我們歡迎來自社區的各種貢獻。如果您有意參與其中,請查閱我們的 [貢獻者指南](https://ragflow.io/docs/dev/contributing) 。
  291. ## 🤝 商務合作
  292. - [預約諮詢](https://aao615odquw.feishu.cn/share/base/form/shrcnjw7QleretCLqh1nuPo1xxh)
  293. ## 👥 加入社區
  294. 掃二維碼加入 RAGFlow 小助手,進 RAGFlow 交流群。
  295. <p align="center">
  296. <img src="https://github.com/infiniflow/ragflow/assets/7248/bccf284f-46f2-4445-9809-8f1030fb7585" width=50% height=50%>
  297. </p>