fix: stabilize API routing and simplify delivery reports

This commit is contained in:
zeroerr.th51
2026-10-16 11:02:03 +08:00
parent bc3dda55ff
commit d5eef9de57
9 changed files with 215 additions and 14 deletions

View File

@@ -837,7 +837,6 @@ def candidate_report_lines(candidate: dict[str, Any], quantity: int) -> list[str
return [
f"{candidate['index']}. {candidate['model']}({candidate['type']})",
f"- 需求数量:{quantity}台",
f"- API查询数量:{details['api_quantity']}台",
f"- {details['prediction']}",
f"- 可用库存/覆盖情况:{details['inventory']}",
f"- 主导因素:{details['main_factor']}",
@@ -1114,8 +1113,6 @@ def build_report(request: RequestInput, candidate_offset: int = 0) -> str:
),
"",
f"输入需求:{request.model},{request.quantity}台",
"数量传递规则:原始需求原样传入API,库存及交期测算由API处理",
"库存覆盖口径:按原始需求数量展示API返回的库存覆盖情况",
f"数据时间戳:{data_timestamp}",
"状态:试运行版输出 / 内部候选",
"判断等级:AM516算法预测参考,需人工复核",
@@ -1157,6 +1154,19 @@ def message_text(data: lark.im.v1.P2ImMessageReceiveV1) -> str | None:
def post_paragraph(line: str) -> list[dict[str, Any]]:
lead_time = re.fullmatch(
r"(- (?:最快候选交期|AM516预测交期):)(\d+个工作日)"
r"(,最终交货日期:)(\d{4}-\d{2}-\d{2})",
line,
)
if lead_time:
label, workdays, date_label, delivery_date = lead_time.groups()
return [
{"tag": "text", "text": label},
{"tag": "text", "text": workdays, "style": ["bold"]},
{"tag": "text", "text": date_label},
{"tag": "text", "text": delivery_date, "style": ["bold"]},
]
element: dict[str, Any] = {"tag": "text", "text": line or " "}
if (
line in {"总体判断:", "本批次判断:", "不可用候选:"}