RAG 服务临时禁用说明 ======================== 日期: 2026-04-08 修改内容: ---------- 应需求,RAG 向量检索功能已临时禁用,具体如下: 1. 修改文件: backend/app/services/rag_service.py 2. 关键变更: - 在 RAGService.__init__ 中添加 self._disabled = True 标志 - index_field() - 添加 _disabled 检查,跳过实际索引操作并记录日志 - index_document_content() - 添加 _disabled 检查,跳过实际索引操作并记录日志 - retrieve() - 添加 _disabled 检查,返回空列表并记录日志 - get_vector_count() - 添加 _disabled 检查,返回 0 并记录日志 - clear() - 添加 _disabled 检查,跳过实际清空操作并记录日志 3. 行为变更: - 所有 RAG 索引构建操作会被记录到日志 ([RAG DISABLED] 前缀) - 所有 RAG 检索操作返回空结果 - 向量计数始终返回 0 - 实际向量数据库操作被跳过 4. 恢复方式: - 将 RAGService.__init__ 中的 self._disabled = True 改为 self._disabled = False - 重新启动服务即可恢复 RAG 功能 目的: ------ 保留 RAG 索引构建功能的前端界面和代码结构,暂不实际调用向量数据库 API, 待后续需要时再启用。 影响范围: --------- - /api/v1/rag/search - RAG 搜索接口 (返回空结果) - /api/v1/rag/status - RAG 状态接口 (返回 vector_count=0) - /api/v1/rag/rebuild - RAG 重建接口 (仅记录日志) - Excel/文档上传时的 RAG 索引构建 (仅记录日志) ======================== 后续补充 (2026-04-08): ======================== 修改文件: backend/app/services/table_rag_service.py 关键变更: - 在 TableRAGService.__init__ 中添加 self._disabled = True 标志 - build_table_rag_index() - RAG 索引部分被跳过,仅记录日志 - index_document_table() - RAG 索引部分被跳过,仅记录日志 行为变更: - Excel 上传时,MySQL 存储仍然正常进行 - AI 字段描述仍然正常生成(调用 LLM) - 只有向量数据库索引操作被跳过 恢复方式: - 将 TableRAGService.__init__ 中的 self._disabled = True 改为 self._disabled = False - 或将 rag_service.py 中的 self._disabled = True 改为 self._disabled = False - 两者需同时改为 False 才能完全恢复 RAG 功能