update
This commit is contained in:
parent
7520f64e8f
commit
ba9de3ed94
|
|
@ -3,15 +3,15 @@
|
|||
|
||||
处理流程对比:
|
||||
知识图谱 每块 1 次串行 LLM 抽关系 → 最严格,8 万字
|
||||
知识库 批量 embedding + 单次摘要 → 较宽松,30 万字
|
||||
知识库 批量 embedding + 单次摘要 → 较宽松,100 万字
|
||||
对话文件 批量 embedding + 单次摘要(临时会话上下文)→ 20 万字
|
||||
"""
|
||||
|
||||
# ---------- 知识库 ----------
|
||||
# chunk_size=4096、overlap=200 → 有效步长约 3896 字/块
|
||||
# 30 万字 ≈ 77 块向量化,通常 1-2 分钟可完成
|
||||
MAX_KB_INPUT_CHARS = 300_000
|
||||
MAX_KB_VECTOR_CHUNKS = 80
|
||||
# 100 万字 ≈ 250+ 块向量化(PDF 等格式分块更细,上限留足余量)
|
||||
MAX_KB_INPUT_CHARS = 1_000_000
|
||||
MAX_KB_VECTOR_CHUNKS = 1000
|
||||
|
||||
# ---------- 对话文件(聊天时上传) ----------
|
||||
# 对话文件是单次会话临时上下文,精度要求高于知识库;过长会稀释检索精度
|
||||
|
|
|
|||
|
|
@ -16,6 +16,9 @@ from logger.logging import get_logger
|
|||
|
||||
logger = get_logger(__name__)
|
||||
|
||||
# 摘要生成时送入 LLM 的正文上限(超长文档只取开头部分)
|
||||
MAX_SUMMARY_INPUT_CHARS = 10_000
|
||||
|
||||
|
||||
# 摘要生成 Prompt - 优化版:强调全面覆盖
|
||||
GENERATE_SUMMARY_PROMPT = """
|
||||
|
|
@ -104,6 +107,13 @@ class SummaryService:
|
|||
if not doc_content:
|
||||
return ""
|
||||
|
||||
if len(doc_content) > MAX_SUMMARY_INPUT_CHARS:
|
||||
logger.info(
|
||||
f"摘要输入过长({len(doc_content):,} 字),"
|
||||
f"仅使用前 {MAX_SUMMARY_INPUT_CHARS:,} 字生成摘要"
|
||||
)
|
||||
doc_content = doc_content[:MAX_SUMMARY_INPUT_CHARS]
|
||||
|
||||
# 生成摘要
|
||||
prompt = PromptTemplate(
|
||||
template=GENERATE_SUMMARY_PROMPT,
|
||||
|
|
|
|||
|
|
@ -216,7 +216,7 @@
|
|||
ref="fileInput"
|
||||
>
|
||||
</label>
|
||||
<small class="upload-hint">支持 PDF、DOCX、Excel(xlsx/xls)、CSV、TXT、图片(PNG、JPG、BMP)格式,单文件不超过 15MB,提取正文不超过 30 万字(过长请拆分)</small>
|
||||
<small class="upload-hint">支持 PDF、DOCX、Excel(xlsx/xls)、CSV、TXT、图片(PNG、JPG、BMP)格式,单文件不超过 15MB,提取正文不超过 100 万字(过长请拆分)</small>
|
||||
</div>
|
||||
|
||||
<!-- URL 上传 -->
|
||||
|
|
|
|||
Loading…
Reference in New Issue