优化智能填表功能:提升速度、完善数据提取精度
后端优化 (template_fill_service.py): 1. 速度优化: - 使用 asyncio.gather 实现字段并行提取 - 跳过 AI 审核步骤,减少 LLM 调用次数 - 新增 _extract_single_field_fast 方法 2. 数据提取优化: - 集成 RAG 服务进行智能内容检索 - 修复 Markdown 表格列匹配跳过空列 - 修复年份子表头行误识别问题 3. AI 表头生成优化: - 精简为 5-7 个代表性字段(原来 8-15 个) - 过滤非数据字段(source、备注、说明等) - 简化字段名,如"医院数量"而非"医院-公立医院数量" 4. AI 数据提取 prompt 优化: - 严格按表头提取,只返回相关数据 - 每个值必须带标注(年份/地区/分类) - 支持多种标注类型:2024年、北京、某省、公立医院、三级医院等 - 保留原始数值、单位和百分号格式 - 不返回大段来源说明 5. FillResult 新增 warning 字段: - 多值检测提示,如"检测到 2 个值" 前端优化 (TemplateFill.tsx): - 填写详情显示多值警告(黄色提示框) - 多值情况下直接显示所有值 Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
This commit is contained in:
@@ -766,6 +766,7 @@ const Documents: React.FC = () => {
|
||||
<div
|
||||
{...getRootProps()}
|
||||
className="flex items-center justify-center gap-2 p-3 border-2 border-dashed rounded-lg cursor-pointer hover:border-primary/50 hover:bg-primary/5 transition-colors"
|
||||
onClick={(e) => e.stopPropagation()}
|
||||
>
|
||||
<input {...getInputProps()} multiple={true} />
|
||||
<Plus size={16} className="text-muted-foreground" />
|
||||
|
||||
@@ -626,6 +626,16 @@ const TemplateFill: React.FC = () => {
|
||||
<div className="text-muted-foreground text-xs mt-1">
|
||||
来源: {detail.source} | 置信度: {detail.confidence ? (detail.confidence * 100).toFixed(0) + '%' : 'N/A'}
|
||||
</div>
|
||||
{detail.warning && (
|
||||
<div className="mt-2 p-2 bg-yellow-50 border border-yellow-200 rounded-lg text-yellow-700 text-xs">
|
||||
⚠️ {detail.warning}
|
||||
</div>
|
||||
)}
|
||||
{detail.values && detail.values.length > 1 && !detail.warning && (
|
||||
<div className="mt-2 text-xs text-muted-foreground">
|
||||
多值: {detail.values.join(', ')}
|
||||
</div>
|
||||
)}
|
||||
</div>
|
||||
</div>
|
||||
))}
|
||||
|
||||
Reference in New Issue
Block a user