fix(application-form-fill): 过滤申请表噪声冲突内容
This commit is contained in:
@@ -22,10 +22,11 @@ def build_assistant_summary(batch: ApplicationFormFillBatch, exports: list[Expor
|
||||
lines.extend(["", "| 冲突字段 | 采用值 | 冲突来源 | 处理 |", "| --- | --- | --- | --- |"])
|
||||
for item in conflicts:
|
||||
conflict_sources = ";".join(
|
||||
f"{value.get('source_file', '')}:{value.get('value', '')}" for value in item.get("conflict_values", [])
|
||||
f"{_compact_table_text(value.get('source_file', ''))}:{_compact_table_text(value.get('value', ''))}"
|
||||
for value in item.get("conflict_values", [])
|
||||
)
|
||||
lines.append(
|
||||
f"| {item.get('field_label', item.get('field_key', ''))} | {item.get('selected_value', '')} | {conflict_sources or '-'} | {item.get('handling', '')} |"
|
||||
f"| {_compact_table_text(item.get('field_label', item.get('field_key', '')))} | {_compact_table_text(item.get('selected_value', ''))} | {_compact_table_text(conflict_sources or '-')} | {_compact_table_text(item.get('handling', ''))} |"
|
||||
)
|
||||
|
||||
if trace_exports:
|
||||
@@ -33,3 +34,10 @@ def build_assistant_summary(batch: ApplicationFormFillBatch, exports: list[Expor
|
||||
for export in trace_exports:
|
||||
lines.append(f"[下载{export.file_name}](/api/review-agent/file-summary/exports/{export.pk}/download/)")
|
||||
return "\n".join(lines).strip()
|
||||
|
||||
|
||||
def _compact_table_text(value: object, *, limit: int = 80) -> str:
|
||||
text = " ".join(str(value or "").replace("|", " ").split())
|
||||
if len(text) <= limit:
|
||||
return text
|
||||
return f"{text[:limit]}..."
|
||||
|
||||
Reference in New Issue
Block a user