feat: add record time to delivery prediction records
This commit is contained in:
@@ -33,7 +33,8 @@ Expected:
|
||||
- when the full report exceeds one Feishu rich-text message, it is split into ordered continuation posts and no candidate is dropped;
|
||||
- record is appended.
|
||||
- the appended record contains query metadata, model parsing, and a complete Markdown table with one row per queried candidate;
|
||||
- record-table columns follow this order: 序号、型号、推荐类型、差异项、API状态、AM516预测交期、可用库存、主导因素;
|
||||
- each future appended candidate row records the same query-completion time in `YYYY-MM-DD HH:mm:ss +0800` form (with the actual local UTC offset), without rewriting or backfilling historical records;
|
||||
- record-table columns follow this order: 序号、记录时间、型号、推荐类型、差异项、API状态、AM516预测交期、可用库存、主导因素;
|
||||
- unavailable candidates remain in their original rule order and are recorded as `❌ 不存在` with unavailable result fields shown as `—`;
|
||||
|
||||
## Sample 2 | Missing Quantity
|
||||
|
||||
@@ -60,6 +60,13 @@ python3 capabilities/am516-delivery-prediction/scripts/delivery_prediction_query
|
||||
|
||||
Do not use temporary curl, WebFetch, or any API method outside the controlled script.
|
||||
|
||||
## Record Rule
|
||||
|
||||
- Do not rewrite or backfill the existing `delivery_prediction_records.md` content when the record format changes.
|
||||
- For every future appended record block, add a `记录时间` column to the candidate-result Markdown table.
|
||||
- Use the report generation time after the query completes as the record time. Every candidate row in the same query uses the same value in `YYYY-MM-DD HH:mm:ss +0800` form (with the actual local UTC offset).
|
||||
- Record-table columns follow this order: `序号`、`记录时间`、`型号`、`推荐类型`、`差异项`、`API状态`、`AM516预测交期`、`可用库存`、`主导因素`.
|
||||
|
||||
## Output Selection
|
||||
|
||||
- Prefer `data.交期汇总.AM516预测交期` when the API returns it and AR51 confirms it is usable.
|
||||
|
||||
@@ -573,6 +573,7 @@ def render_record(
|
||||
generation_time: datetime,
|
||||
) -> str:
|
||||
all_count = len(candidates) + len(unavailable)
|
||||
record_time = generation_time.strftime("%Y-%m-%d %H:%M:%S %z")
|
||||
lines = [
|
||||
f"\n## {generation_time:%Y-%m-%d %H:%M:%S %z} | {request.model} | {request.quantity}台",
|
||||
"",
|
||||
@@ -589,8 +590,8 @@ def render_record(
|
||||
"",
|
||||
f"### 候选型号清单及 API 结果(共{all_count}项)",
|
||||
"",
|
||||
"| 序号 | 型号 | 推荐类型 | 差异项 | API状态 | AM516预测交期 | 可用库存 | 主导因素 |",
|
||||
"|---:|---|---|---|---|---|---:|---|",
|
||||
"| 序号 | 记录时间 | 型号 | 推荐类型 | 差异项 | API状态 | AM516预测交期 | 可用库存 | 主导因素 |",
|
||||
"|---:|---|---|---|---|---|---|---:|---|",
|
||||
]
|
||||
record_rows = [
|
||||
(candidate["record_order"], True, candidate) for candidate in candidates
|
||||
@@ -605,6 +606,7 @@ def render_record(
|
||||
api_status = "✅ 现货" if details.get("full_coverage") is True else "✅ 返回"
|
||||
row = [
|
||||
record_order,
|
||||
record_time,
|
||||
candidate["model"],
|
||||
candidate["type"],
|
||||
candidate["difference"],
|
||||
@@ -616,6 +618,7 @@ def render_record(
|
||||
else:
|
||||
row = [
|
||||
record_order,
|
||||
record_time,
|
||||
candidate["model"],
|
||||
candidate["type"],
|
||||
candidate["difference"],
|
||||
|
||||
Reference in New Issue
Block a user