feat: convert AM516 lead times to workdays

This commit is contained in:
ar51
2026-09-03 17:34:42 +08:00
parent fa8aee91b9
commit c7c5c3259c
6 changed files with 332 additions and 27 deletions

View File

@@ -5,6 +5,8 @@
**日期**2026-09-02
**目的**:将 AM516 交期预测输出的自然日转换为工作日,并据此得到最终交货日期。
**当前临时处理**:因 AR836 排期较晚AM516 飞书机器人先在 API 返回后的输出层执行同一换算;不修改 AR836 API 原始数据。待 API 正式提供工作日口径后,应移除本地临时换算,避免重复转换。
## 一、需求背景
AM516 当前输出的是自然日交期。销售希望得到工作日口径的交期,即:

View File

@@ -14,6 +14,7 @@ Expected:
- model parses successfully;
- quantity is accepted;
- the bot immediately replies with `👀` after the valid trigger is accepted and before the API query starts;
- the controlled script uses the macOS system trust store and keeps TLS verification enabled;
- no temporary TLS-bypass parameter is required for the normal happy path;
- API script runs;
@@ -39,6 +40,18 @@ Expected:
- 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 1B | Natural Days To Workdays
Rules and expected results:
- treat `AM516总交期`, or numeric `总交期` when the AM516 field is absent, as the original natural-day lead time `N`;
- convert `N` with the approved quotient-and-remainder rule, including `r = 4` as one rest day and `r = 0` as no remainder workday;
- exclude the local query date itself, then count the converted workdays using the configured China statutory workday calendar;
- statutory holidays are excluded and official makeup weekend workdays are included;
- for a query date of `2026-09-02`, `31` natural days convert to `22` workdays and produce `2026-10-09`;
- output `2026-10-09原始31个自然日折算22个工作日` instead of adding a separate National Day exception;
- when counting reaches an unconfigured calendar year, do not silently fall back to a Monday-Friday estimate.
## Sample 1A | Continue With Other Candidates
Preconditions:
@@ -59,6 +72,7 @@ is not required.
Expected:
- the bot immediately replies with `👀` after the continuation and active-context gates pass;
- the bot reuses the active model and quantity only for that same sender and chat;
- the bot queries candidate positions 5-8 in the unchanged rule order;
- the original model and candidate positions 1-4 are not queried or displayed again;
@@ -83,6 +97,7 @@ eRob110H160I-FHM-18ET[V6]
Expected:
- bot stays silent;
- no acknowledgement emoji is sent;
- no API call is made;
- no record is appended.

View File

@@ -8,20 +8,22 @@
4. Confirm a separate trusted AR51 approval record explicitly covers `api.zeroerr-agent.com`, the AM516 use case, and API-key use.
5. If that domain-and-permission record is absent, stop before any outbound request; a general functional-test approval is insufficient by itself.
6. Use model recommendation rules to generate the complete ordered internal candidate pool.
7. Run the controlled script for the original model baseline and only the first four candidate models.
8. Summarize the current batch, state how many candidates remain, and invite the same sender to ask naturally for more when candidates remain; exact wording is not required.
9. Append a non-secret record.
10. Return Feishu-friendly text with the fixed disclaimer.
7. Immediately reply with `👀` to acknowledge the valid request.
8. Run the controlled script for the original model baseline and only the first four candidate models.
9. Convert each numeric natural-day lead time to workdays with the approved quotient-and-remainder rule, then count those workdays from the local query date through the configured China statutory workday calendar. The query date itself is excluded.
10. Summarize the current batch, including the original natural days, converted workdays, and calculated delivery date; state how many candidates remain and invite the same sender to ask naturally for more when candidates remain.
11. Append a non-secret record.
12. Return Feishu-friendly text with the fixed disclaimer.
## Candidate Continuation
1. Accept a clear request for more candidates only from the same sender in the same Feishu chat as the active initial query. Equivalent expressions such as `还有吗``有没有别的``再推荐几个``继续``下一批` or `more candidates` are valid; no exact phrase is required.
2. The in-memory continuation context expires after six hours and is cleared by a bridge restart. If no matching context exists, stay silent and require a new complete model-and-quantity query.
3. Query the next four unqueried rule candidates; do not re-query the original baseline or any earlier candidate.
3. Immediately reply with `👀`, then query the next four unqueried rule candidates; do not re-query the original baseline or any earlier candidate.
4. Missing or unsupported candidates still consume their rule-order positions and remain under `不可用候选`.
5. Append one record block for the models queried in this continuation batch, then state whether more candidates remain.
6. A new complete model-and-quantity request replaces the earlier continuation context for that sender and chat.
7. Keep the dual gate of continuation intent plus valid context: unrelated text such as `more interesting` or `继续查询英语例句` must not trigger the old query.
7. Keep the dual gate of continuation intent plus valid context: unrelated text such as `more interesting` or `继续查询英语例句` must not trigger the old query or acknowledgement.
## Approved Script