feat: 完成全量功能开发,包括前端管理后台与后端服务优化
此提交实现了完整的知识库管理系统: 1. 新增Vue3 + Antd Vue前端管理后台,包含登录、文档管理、检索、类目设置等完整页面 2. 重构后端LLM调用抽象层,支持Ollama与OpenAI兼容服务动态切换 3. 调整默认嵌入模型配置为本地bge-m3模式 4. 优化入库任务去重逻辑与缓存清理机制 5. 完善Docker镜像构建与docker-compose部署配置 6. 修复多项测试用例与兼容性问题 7. 新增运行时配置API,支持动态调整系统参数
This commit is contained in:
@@ -1,6 +1,7 @@
|
||||
"""文档三级总结模块
|
||||
|
||||
通过 Ollama 本地小模型对文档进行分级总结:
|
||||
通过 LLM(Ollama 或 OpenAI 兼容服务,由 runtime_settings.models.summarize 决定)
|
||||
对文档进行分级总结:
|
||||
- L1: 总结(一句话高度概括)
|
||||
- L2: 大纲(主要章节和关键主题)
|
||||
- L3: 内容大纲(每个章节的详细内容摘要)
|
||||
@@ -12,7 +13,7 @@ import structlog
|
||||
|
||||
from app.core.headings import parse_headings, render_outline
|
||||
from app.models.document import DocumentSummary, SummaryLevel
|
||||
from app.services.ollama import OllamaClient
|
||||
from app.services.llm import LLMClient, create_llm_client
|
||||
|
||||
logger = structlog.get_logger()
|
||||
|
||||
@@ -23,8 +24,10 @@ MIN_TEXT_LENGTH_FOR_L3 = 500
|
||||
class Summarizer:
|
||||
"""文档三级总结器"""
|
||||
|
||||
def __init__(self, ollama: OllamaClient | None = None) -> None:
|
||||
self.ollama = ollama or OllamaClient()
|
||||
def __init__(self, ollama: LLMClient | None = None) -> None:
|
||||
# 默认按 runtime_settings 选择 LLM 实现(Ollama 或 OpenAI 兼容);
|
||||
# 测试可通过 ollama 参数注入替身。
|
||||
self.ollama = ollama or create_llm_client("summarize")
|
||||
|
||||
async def summarize(self, text: str, *, title: str = "") -> DocumentSummary:
|
||||
"""对文档文本进行三级总结
|
||||
|
||||
Reference in New Issue
Block a user