# ragflow4j **Repository Path**: onehubcode/ragflow4j ## Basic Information - **Project Name**: ragflow4j - **Description**: No description available - **Primary Language**: Java - **License**: AGPL-3.0 - **Default Branch**: master - **Homepage**: None - **GVP Project**: No ## Statistics - **Stars**: 2 - **Forks**: 0 - **Created**: 2026-09-16 - **Last Updated**: 2026-09-21 ## Categories & Tags **Categories**: Uncategorized **Tags**: None ## README # Ragflow4J 智能知识库平台 一站式多模态知识管理、智能问答与 Agent 编排中心 —— Java 生态的开源 RAG 知识库平台。 **技术栈**:Spring Boot · Spring AI · LangChain4j · Neo4j (GraphRAG + 向量) · TiDB · Vue 3 **English Version**: [README_en.md](README_en.md) --- ## 系统概述 企业知识分散在文档、业务系统与邮件中,检索依赖人工、问答答非所问、结论无法溯源,敏感数据又不能交给公有云大模型——Ragflow4J 面向这一现实痛点,提供从知识接入、解析、治理到问答应用的一站式私有化方案。 平台覆盖知识库管理、多模态文档解析与分块、可溯源的智能问答(问题不明确时自动澄清追问)、GraphRAG 知识图谱、Agent 工作流编排、Live2D 数字人、多模态语音与完整的管理后台。技术上基于 Java/Spring 生态(Spring Boot 4、Spring AI、LangChain4j),以 Neo4j 向量与图双引擎、TiDB 分析库为底座,支持单体与微服务双形态部署,并完成国产化软硬件适配,可整体私有化交付。 ## 平台界面 ### 登录页 统一门户登录入口,左侧为品牌视觉区: ![登录页](docs/images/login.png) ### 仪表盘 ![仪表盘](docs/images/dashboard.png) ### 小知问答(智能对话) 支持流式输出、多轮对话、澄清追问、语音输入、答案导出 Word / PDF: ![小知问答](docs/images/chat.png) ### Live2D 数字人对话 TTS 语音播报、口型同步、角色切换: ![数字人对话](docs/images/digital-human.png) ### 数字人形象生成 一句话文生图或上传立绘,自动拆层并一键生成 Live2D 模型: ![数字人形象生成](docs/images/digital-human-chars.png) ## 核心功能 ### 知识库管理 - 知识库创建、编辑、删除,多知识库联合检索与语义路由 - 文档上传 / 批量上传、解析状态实时跟踪、分块预览与手工编辑 - 同义词管理,提升检索召回率 ### 文档解析与分块 - 支持 PDF / DOC / DOCX / PPT / PPTX / XLS / XLSX / TXT / MD / HTML / CSV / JPG / PNG / BMP - 解析器:Apache Tika + PDFBox + POI,图片提取与关联 - 分块模板:naive / book / paper / qa / table / resume / manual,支持父子分块与重叠设置 ### 智能问答(小知问答) - SSE 流式输出、多轮对话、会话记忆(自动提取、检索、上限 20 轮) - 澄清追问:问题不明确时自动追问,再问再答 - 问题 LLM 改写、向量检索 + 本地 Embedding Rerank - 语音输入(ASR)、答案导出 Word / PDF、答案点赞点踩反馈 ### GraphRAG 知识图谱 - Neo4j 实体 / 关系抽取、实体消歧、社区发现与社区报告(Leiden) - 四种检索模式:Local / Global / Hybrid / Auto - Text2Cypher:自然语言转 Cypher,只读校验 + Few-shot 示例库 - 图谱可视化(力导向图、路径探索、社区着色)、图谱质量面板 - 答案对比模式:传统 RAG vs GraphRAG ### Agent 与工作流 - 可视化编排画布(Vue Flow),Agent 市场与管理 - Agent 对话、提示词管理、术语映射、报告生成 Agent - MCP(Model Context Protocol)双向集成 ### 数据治理 - 数据源管理、连接器(同步外部数据源)、数据湖 - 分析库(TiDB / TiFlash 同步 + NL2SQL) ### 数字人 - Live2D 数字人对话:TTS 播报 + 口型同步 + 角色切换,支持嵌入第三方页面 - 形象生成:AI 文生图 → 抠图 → 五官拆层 → PSD2Live 自动建模,一键生成 Live2D 角色 - 形象库管理 ### 多模态语音 - ASR 6 种提供商(moss / openai / qwen3 / dashscope / ollama / 本地 sherpa-onnx),质量回退 - TTS 多种提供商(moss / openai / 讯飞 / 阿里 / 本地) ### 管理后台 - 独立仪表盘(用户 / 知识库 / 问答量 / 系统健康) - 用户 / 团队 / 租户管理、RBAC 权限 - 模型配置(多提供商)、菜单管理、审计日志、监控大盘、告警规则、消息中心、API 管理、系统设置 ## 模型接入 - 默认走 OpenAI 兼容接口(默认 DeepSeek 对话 + 硅基流动 BAAI/bge-m3 Embedding) - 支持 Ollama 本地兜底、XInference 大模型平台(GPU 模式) - 联网搜索:内置 Tavily / Bocha / SearXNG + Perplexica ## 技术架构 ### 后端模块(Maven 多模块) | 模块 | 职责 | |---|---| | `ragflow4j-common` | 公共工具、常量、异常、DTO | | `ragflow4j-security` | Spring Security、JWT、RBAC 权限 | | `ragflow4j-api` | 对外公共 API、DTO、Feign 接口(Cloud 模式) | | `ragflow4j-ai-core` | AI 抽象层:模型工厂、VectorStore 工厂 | | `ragflow4j-ai-spring` | Spring AI 集成(ChatClient / VectorStore / Advisors) | | `ragflow4j-ai-langchain4j` | LangChain4j 集成(AiServices / RAG / KG / Memory) | | `ragflow4j-document` | 文档解析、分块、图片提取(Tika / PDFBox / POI) | | `ragflow4j-file` | 文件上传、MinIO 操作 | | `ragflow4j-knowledgebase` | 知识库、文档、索引服务 | | `ragflow4j-knowledge-graph` | 知识图谱构建、GraphRAG 检索(Local / Global / Hybrid、Text2Cypher) | | `ragflow4j-chat` | 对话服务:多轮对话、RAG、澄清追问、会话记忆 | | `ragflow4j-admin` | 管理后台 API(用户 / 租户 / 团队 / 模型 / 审计 / 监控) | | `ragflow4j-agent` | Agent 与工作流(编排、工具调用) | | `ragflow4j-connector` | 数据源连接器(同步外部数据源) | | `ragflow4j-dataflow` | 数据流 Stub 控制器与 DTO | | `ragflow4j-digitalhuman` | AI 数字人交互引擎:形象管理 / 驱动 / 渲染 / 集成 | | `ragflow4j-voice` | 语音子工程:ASR / TTS | | `ragflow4j-boot` | Spring Boot 单体启动模块(聚合全部业务模块) | | `ragflow4j-cloud` | Spring Cloud 微服务版(Nacos),含 gateway / auth / kb / chat / admin 五个服务 | ### 独立子工程 | 目录 | 说明 | |---|---| | `ragflow4j-web` | Vue 3 前端 monorepo(portal 门户 + 共享包),Element Plus / Pinia / Vue Flow / Cytoscape / pixi-live2d-display | | `ragflow4j-ai-base` | Python 大模型本地化运行平台ragflow4j-ai-base,基于 XInference,国产化适配(麒麟 / 统信 / 欧拉 + 鲲鹏 / 飞腾 + 昇腾),含 LoRA / QLoRA 微调与网关 | | `ragflow4j-digitalhuman-live2d` | Live2D 数字人子工程(Python / Docker) | | `ragflow4j-digitalhuman-ai` | PSD2Live:分层 PSD 一键自动生成 Live2D 模型(.cmo3 / .moc3)的桌面应用 | | `ragflow4j-perplexica` | Perplexica 联网搜索服务源码 | ### 关键技术 - Spring Boot 4.x · JDK 17 · Spring AI 2.x · LangChain4j 1.20 - ORM:MyBatis-Flex;数据库:TiDB v8.1(MySQL 协议)+ Flyway 迁移 - 向量库:Neo4j(HNSW 向量索引) - 图存储:Neo4j 5.20(GraphRAG) - 缓存:Redis 7;对象存储:MinIO(支持本地文件回退) - 注册 / 配置中心:Nacos 3.x(Cloud 模式) - 文档解析:Apache Tika + PDFBox + POI - 安全:Spring Security + JWT;接口文档:Knife4j ## 快速开始(Docker 部署) 参考 [docker/README.md](docker/README.md),一键脚本: ```bash cd docker ./build-ragflow4j.sh up # 编译后端 + 前端,构建镜像并启动 ./build-ragflow4j.sh up --profile cpu # CPU 模式(Ollama 本地模型) ./build-ragflow4j.sh up --profile gpu # GPU 模式(XInference + vLLM) ``` 三种大模型后端模式: ![部署模式](docs/images/deploy-modes.png) ### 默认端口 | 服务 | 端口 | |---|---| | ragflow4j-web 统一门户 | 60000 | | ragflow4j-boot API | 60010 | | Ollama ai-models | 60011 | | Perplexica 主界面 / 测试页 | 60013 / 60014 | | Nacos | 60008 / 60009 | | Neo4j HTTP / Bolt | 60003 / 60004 | | MinIO | 60005 / 60006 | | Redis | 60007 | | TiDB | 60001 / 60002 | ## 文档 - [技术方案](docs/technical_proposal_spring.md) · [功能说明书](docs/functional_specification_spring.md) - [管理后台需求](docs/requirements_admin_user.md) · [实施路线图](docs/implementation_roadmap.md) ## 致谢 感谢以下开源项目,本站在它们的肩膀上构建: - [RAGFlow](https://github.com/infiniflow/ragflow) —— 产品理念与技术实现的重要参考 - [RAGFlowPlus](https://github.com/chuenwei0129/ragflow-plus) —— 知识库与权限管理的扩展思路 - [Spring Boot](https://spring.io/projects/spring-boot) / [Spring AI](https://spring.io/projects/spring-ai) —— 后端应用与 AI 集成框架 - [LangChain4j](https://github.com/langchain4j/langchain4j) —— Java 生态 LLM 应用开发框架 - [Vue.js](https://vuejs.org/) / [Vite](https://vitejs.dev/) / [Element Plus](https://element-plus.org/) —— 前端基础设施 - [Neo4j](https://neo4j.com/) —— 图数据库与向量检索 - [TiDB](https://github.com/pingcap/tidb) / TiFlash —— 分布式 SQL 与实时分析 - [XInference](https://github.com/xorbitsai/inference) —— 大模型推理平台 - [Ollama](https://ollama.com/) —— 本地大模型运行 - [MinIO](https://min.io/) —— 对象存储 - [Perplexica](https://github.com/ItzCrazyKns/Perplexica) —— 联网搜索实现参考 - awesome-digital-human-live2d —— 数字人子工程基础 - [pixi-live2d-display](https://github.com/guansss/pixi-live2d-display) —— Live2D 渲染 - [Cytoscape.js](https://js.cytoscape.org/) —— 图谱可视化 - [Apache Tika](https://tika.apache.org/) / PDFBox / POI —— 文档解析 ## 联系与社区 - Gitee 仓库:[https://gitee.com/onehubcode/ragflow4j](https://gitee.com/onehubcode/ragflow4j) - 问题反馈与功能建议请通过 [Issue](https://gitee.com/onehubcode/ragflow4j/issues) 提交,欢迎 [Pull Request](https://gitee.com/onehubcode/ragflow4j/pulls) 共建 - 如果这个项目对你有帮助,欢迎点个 Star 支持一下 ## 许可证 [AGPL-3.0](LICENSE)