实现Agent对话,合格自动提交,不合格补充材料的能力
This commit is contained in:
+2
-20
@@ -22,6 +22,7 @@ from . import get_logger
|
||||
from .config import load_config
|
||||
from .doc.extractor import extract_invoices
|
||||
from .doc.invoice import (
|
||||
classify_invoice_batch,
|
||||
save_application_json,
|
||||
save_invoice_csv,
|
||||
)
|
||||
@@ -35,25 +36,6 @@ from .doc.llm_extractor import (
|
||||
load_cache,
|
||||
)
|
||||
|
||||
|
||||
def _classify_invoice_batch(
|
||||
invoices: list[dict[str, str]],
|
||||
) -> dict[str, list[dict[str, str]]]:
|
||||
"""按发票类型分组"""
|
||||
travel: list[dict[str, str]] = []
|
||||
general: list[dict[str, str]] = []
|
||||
application: list[dict[str, str]] = []
|
||||
for inv in invoices:
|
||||
inv_type = inv.get("invoice_type", "general")
|
||||
if inv_type == "application":
|
||||
application.append(inv)
|
||||
elif inv_type in ("train", "hotel"):
|
||||
travel.append(inv)
|
||||
else:
|
||||
general.append(inv)
|
||||
return {"travel": travel, "general": general, "application": application}
|
||||
|
||||
|
||||
log = get_logger("pipeline")
|
||||
|
||||
|
||||
@@ -63,7 +45,7 @@ def _classify_from_cache(cache_path: Path) -> dict[str, list[dict[str, Any]]]:
|
||||
|
||||
cache_map = load_cache(cache_path)
|
||||
invoices = [data for data in cache_map.values() if data.get("invoice_type") not in ("application", "payment")]
|
||||
return _classify_invoice_batch(invoices)
|
||||
return classify_invoice_batch(invoices)
|
||||
|
||||
|
||||
def _extract_travel_info_if_needed(groups: dict[str, list[dict[str, Any]]], cache_path: Path) -> dict[str, Any] | None:
|
||||
|
||||
Reference in New Issue
Block a user