fix(application-form-fill): 代理人字段暂用生产企业信息
This commit is contained in:
@@ -81,8 +81,30 @@ def merge_fields(regex_results: dict[str, Any], llm_results: dict[str, Any]) ->
|
||||
"handling": "说明书优先,模板内黄底红字高亮" if rank_source(merged_field.source_file, merged_field.source_file) == 1 else "按来源优先级采用最高优先级字段",
|
||||
}
|
||||
)
|
||||
_apply_agent_company_fallbacks(merged)
|
||||
return merged, conflicts
|
||||
|
||||
|
||||
def _distinct_values(candidates: list[dict[str, Any]]) -> set[str]:
|
||||
return {normalize_field_value(str(item.get("value") or "")) for item in candidates if item.get("value")}
|
||||
|
||||
|
||||
def _apply_agent_company_fallbacks(merged: dict[str, MergedField]) -> None:
|
||||
fallback_pairs = {
|
||||
"agent_name": ("applicant_name", "代理人名称"),
|
||||
"agent_address": ("applicant_address", "代理人住所"),
|
||||
}
|
||||
for target_key, (source_key, target_label) in fallback_pairs.items():
|
||||
if target_key in merged or source_key not in merged:
|
||||
continue
|
||||
source = merged[source_key]
|
||||
merged[target_key] = MergedField(
|
||||
key=target_key,
|
||||
label=target_label,
|
||||
value=source.value,
|
||||
source_file=source.source_file,
|
||||
evidence=source.evidence,
|
||||
confidence=source.confidence,
|
||||
has_conflict=source.has_conflict,
|
||||
conflict_values=source.conflict_values,
|
||||
)
|
||||
|
||||
Reference in New Issue
Block a user