init: RAG 知识库服务初始提交

- 后端 API(Flask + Gunicorn)
- RAG 引擎(混合检索 + 云端 Reranker + 引用溯源)
- 文档解析(MinerU + 多格式支持)
- Docker 生产部署配置
- 排除前端项目、敏感配置、模型文件
This commit is contained in:
lacerate551
2026-06-04 17:35:27 +08:00
commit 100d1a06eb
158 changed files with 64534 additions and 0 deletions

26
core/query_classifier.py Normal file
View File

@@ -0,0 +1,26 @@
"""
查询分类工具
当前仅保留枚举查询检测函数(被生产管线使用)。
原有的 QueryClassifier 类和 classify() 方法未被生产路径调用,已清理。
使用方式:
from core.query_classifier import is_enumeration_query
if is_enumeration_query(query):
# 枚举类查询需要连续上下文
...
"""
import re
def is_enumeration_query(query: str) -> bool:
"""Return True for list/numbered-clause questions that need contiguous context."""
if not query:
return False
strong_markers = ("哪些", "有哪些", "列出", "严禁", "禁止", "不得", "包括", "要求")
if any(marker in query for marker in strong_markers):
return True
return bool(re.search(r"(哪几|几类|几种|多少项|第[一二三四五六七八九十\d]+条)", query))