feat(shipping-notice): 新增通用解析能力,优化性能并清理遗留废弃代码
This commit is contained in:
1 parent
935bf26fa6
commit
7cfd5d167e
230 files changed
+9337
-10989
No files matched your search
@@ -172,6 +172,7 @@ def serialize_intake(
|
||||
*,
|
||||
asset: FileAsset | None = None,
|
||||
include_parse_texts: bool = False,
|
||||
include_candidate_details: bool = True,
|
||||
) -> dict[str, Any]:
|
||||
"""
|
||||
对外序列化接入记录(含业务摘要、Document/Candidate 与重复检测)。
|
||||
@@ -179,6 +180,8 @@ def serialize_intake(
|
||||
Args:
|
||||
include_parse_texts: True 时返回 structured 中的附件全文/正文(详情接口),
|
||||
并附带 documents 全文;False 时返回瘦身 parse_summary 与精简 documents/candidates。
|
||||
include_candidate_details: False 时仅返回恢复输入状态所需的 Candidate 字段,
|
||||
避免活跃列表传输 evidence / field_adjudication 等重型审核数据。
|
||||
"""
|
||||
from app.services.shipping_notice.document_candidate_persist import (
|
||||
list_intake_candidates,
|
||||
@@ -198,7 +201,10 @@ def serialize_intake(
|
||||
}
|
||||
parse_summary = structured if include_parse_texts else _lean_parse_summary(structured)
|
||||
documents = list_intake_documents(int(intake.id), include_text=include_parse_texts)
|
||||
candidates = list_intake_candidates(int(intake.id))
|
||||
candidates = list_intake_candidates(
|
||||
int(intake.id),
|
||||
include_details=include_candidate_details,
|
||||
)
|
||||
layout_summary = _serialize_intake_layout_summary(int(intake.id))
|
||||
payload: dict[str, Any] = {
|
||||
'intake_no': intake.intake_no,
|
||||
@@ -571,7 +577,14 @@ def list_active_intakes_for_conversation(*, user_id: int, conversation_id: str |
|
||||
if conv:
|
||||
query = query.filter(ShippingOrderIntake.conversation_id == conv)
|
||||
rows = query.order_by(ShippingOrderIntake.created_at.desc()).limit(50).all()
|
||||
return [serialize_intake(intake, asset=asset) for intake, asset in rows]
|
||||
return [
|
||||
serialize_intake(
|
||||
intake,
|
||||
asset=asset,
|
||||
include_candidate_details=False,
|
||||
)
|
||||
for intake, asset in rows
|
||||
]
|
||||
|
||||
|
||||
def get_intake_statuses(*, user_id: int, intake_nos: list[str]) -> list[dict[str, Any]]:
|
||||
@@ -588,7 +601,14 @@ def get_intake_statuses(*, user_id: int, intake_nos: list[str]) -> list[dict[str
|
||||
)
|
||||
.all()
|
||||
)
|
||||
return [serialize_intake(intake, asset=asset) for intake, asset in rows]
|
||||
return [
|
||||
serialize_intake(
|
||||
intake,
|
||||
asset=asset,
|
||||
include_candidate_details=False,
|
||||
)
|
||||
for intake, asset in rows
|
||||
]
|
||||
|
||||
|
||||
def retry_intake_parse(*, user_id: int, intake_no: str) -> dict[str, Any]:
|
||||
|
||||
Reference in new issue
Block a user