From 005fe504ad4bb9368f7a5a590c5f8942e1fab9cb Mon Sep 17 00:00:00 2001 From: plf1996 Date: Thu, 18 Jun 2026 17:10:05 +0800 Subject: [PATCH] =?UTF-8?q?fix:=20=E4=BF=AE=E5=A4=8D=20txt=20=E7=B4=A2?= =?UTF-8?q?=E5=BC=95=20content=5Flist=20=E5=8F=98=E9=87=8F=E6=9C=AA?= =?UTF-8?q?=E5=AE=9A=E4=B9=89=20+=20=E7=AE=80=E5=8C=96=E7=A4=BA=E4=BE=8B?= =?UTF-8?q?=E5=AF=B9=E9=BD=90?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit - txt 流程中 content_list 不存在导致 stats 阶段崩溃 - Few-shot 示例简化,使用短句精确匹配避免对齐失败 --- backend/pipeline/entity_extractor.py | 28 ++++------------------------ backend/services/indexing_service.py | 2 +- 2 files changed, 5 insertions(+), 25 deletions(-) diff --git a/backend/pipeline/entity_extractor.py b/backend/pipeline/entity_extractor.py index 253dcbc..33d74e8 100644 --- a/backend/pipeline/entity_extractor.py +++ b/backend/pipeline/entity_extractor.py @@ -33,45 +33,25 @@ PROMPT_DESCRIPTION = ( EXAMPLES = [ lx.data.ExampleData( - text=( - "建筑高度大于100m的公共建筑应设置避难层。避难层应采用耐火极限不低于3.00h的防火墙和甲级防火门进行分隔。" - "建筑内的消防控制室应采用耐火极限不低于2.00h的防火隔墙与乙级防火门与其他部位分隔。" - "疏散走道两侧的隔墙应采用不燃材料,其耐火极限不应低于1.00h。" - ), + text="公共建筑应设置防火墙。甲级防火门耐火极限为2.0h。消防控制室采用不燃材料。", extractions=[ lx.data.Extraction(extraction_class="场所", extraction_text="公共建筑"), - lx.data.Extraction(extraction_class="构件", extraction_text="避难层"), - lx.data.Extraction(extraction_class="指标", extraction_text="耐火极限不低于3.00h"), lx.data.Extraction(extraction_class="构件", extraction_text="防火墙"), lx.data.Extraction(extraction_class="构件", extraction_text="甲级防火门"), + lx.data.Extraction(extraction_class="指标", extraction_text="2.0h"), lx.data.Extraction(extraction_class="设施", extraction_text="消防控制室"), - lx.data.Extraction(extraction_class="指标", extraction_text="耐火极限不低于2.00h"), - lx.data.Extraction(extraction_class="构件", extraction_text="防火隔墙"), - lx.data.Extraction(extraction_class="构件", extraction_text="乙级防火门"), - lx.data.Extraction(extraction_class="构件", extraction_text="疏散走道"), - lx.data.Extraction(extraction_class="构件", extraction_text="隔墙"), lx.data.Extraction(extraction_class="材料", extraction_text="不燃材料"), - lx.data.Extraction(extraction_class="指标", extraction_text="耐火极限不应低于1.00h"), ], ), lx.data.ExampleData( - text=( - "住宅建筑室内消火栓设计流量不应小于5L/s。高位消防水箱有效容积不应小于18m3," - "且应设置在建筑最高部位。消防电梯前室应设置室内消火栓。" - "公共建筑内每个防火分区的安全出口不应少于2个。" - ), + text="住宅建筑应设室内消火栓。高位消防水箱容积为18m3。消防电梯前室设安全出口。", extractions=[ lx.data.Extraction(extraction_class="场所", extraction_text="住宅建筑"), lx.data.Extraction(extraction_class="设备", extraction_text="室内消火栓"), - lx.data.Extraction(extraction_class="指标", extraction_text="不应小于5L/s"), lx.data.Extraction(extraction_class="设备", extraction_text="高位消防水箱"), - lx.data.Extraction(extraction_class="指标", extraction_text="不应小于18m3"), + lx.data.Extraction(extraction_class="指标", extraction_text="18m3"), lx.data.Extraction(extraction_class="构件", extraction_text="消防电梯前室"), - lx.data.Extraction(extraction_class="设备", extraction_text="室内消火栓"), - lx.data.Extraction(extraction_class="场所", extraction_text="公共建筑"), - lx.data.Extraction(extraction_class="构件", extraction_text="防火分区"), lx.data.Extraction(extraction_class="构件", extraction_text="安全出口"), - lx.data.Extraction(extraction_class="指标", extraction_text="不应少于2个"), ], ), ] diff --git a/backend/services/indexing_service.py b/backend/services/indexing_service.py index d489974..c6fb7f5 100644 --- a/backend/services/indexing_service.py +++ b/backend/services/indexing_service.py @@ -218,7 +218,7 @@ def _run_pipeline(job_id: str) -> None: elapsed = round(time.time() - start_time, 1) stats = { - "blocks": len(content_list), + "blocks": total_pages if ext in ("txt",) else len(content_list), "block_types": block_types, "pages": total_pages, "raw_extractions": len(records),