feat: paginate candidate model recommendations

This commit is contained in:
ar51
2026-09-01 09:48:01 +08:00
parent d97b788e0e
commit 8a695900f3
9 changed files with 598 additions and 52 deletions

View File

@@ -34,6 +34,12 @@ eRob90H100I-FHM-18CT[V6] 50
If multiple models are provided, stop and ask AR51 to run one model at a time.
After a valid query has produced an initial candidate batch, the same sender in
the same Feishu chat may ask whether there are other candidates without
repeating the model and quantity. This continuation is valid only while the
runtime still holds that query context. It continues from the next unqueried
candidate; it does not create a new model or quantity assumption.
## 4. API Rule
Use only:
@@ -83,6 +89,7 @@ Include:
- input model and quantity;
- candidate summary;
- current candidate batch and remaining-candidate count;
- predicted lead time or API exception;
- main factor;
- model difference;

View File

@@ -28,15 +28,50 @@ Expected:
- reducer shortages are the sole exception: when `缺料物料` starts with `20.30.`, output only the reducer code, inventory, inspection, in-transit, existing-demand quantities, and in-transit coverage conclusion in the Skill-defined order;
- shortage items outside the `20.30.` reducer prefix never expose their material codes or quantity details;
- result is marked as internal candidate;
- all Skill-permitted brake, encoder, sensor, grease, and DZ/LF combinations are generated without changing strong constraints or version;
- every generated candidate is queried through the controlled script; usable candidates are detailed and unsupported candidates are summarized under `不可用候选`;
- when the full report exceeds one Feishu rich-text message, it is split into ordered continuation posts and no candidate is dropped;
- all Skill-permitted brake, encoder, sensor, grease, and DZ/LF combinations are generated in a stable rule order without changing strong constraints or version;
- the original model is queried as a baseline and does not count toward the recommendation batch;
- the initial reply queries only candidate positions 1-4, details usable candidates, summarizes unsupported candidates under `不可用候选`, states the remaining count, and invites the human to ask `还有没有其他候选型号`;
- candidate position 5 and later are not queried or displayed in the initial reply;
- when the current four-candidate batch exceeds one Feishu rich-text message, it is split into ordered continuation posts and no candidate from that batch is dropped;
- record is appended.
- the appended record contains query metadata, model parsing, and a complete Markdown table with one row per queried candidate;
- the appended record contains query metadata, model parsing, and a complete Markdown table with one row per model queried in the current batch;
- 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 1A | Continue With Other Candidates
Preconditions:
- Sample 1 has completed in the same Feishu chat for the same sender;
- more than four rule candidates exist;
- the bridge has not restarted and the initial-query context is less than six hours old.
Input:
```text
还有没有其他候选型号?
```
Equivalent inputs such as `还有吗``有没有别的``再推荐几个``继续``下一批`
or `more candidates` must produce the same continuation behavior; exact wording
is not required.
Expected:
- 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;
- unavailable candidates still consume their original positions and are summarized under `不可用候选`;
- the reply states the current candidate range and the remaining count, or states that all rule candidates have been queried;
- one new record block contains only the models queried in this continuation batch;
- the fixed disclaimer appears once at the end.
If the same continuation text comes from another sender or chat, after a bridge restart, after the six-hour expiry, or without a valid initial query, the bot stays silent and makes no API request or record append.
Unrelated expressions such as `more interesting``继续查询英语例句``下一课` or
`再来一首歌` do not qualify as candidate continuation, even while a query context exists.
## Sample 2 | Missing Quantity
Input:

View File

@@ -44,6 +44,8 @@
- [ ] After the approval gate is satisfied, at least one valid model + quantity query succeeds; otherwise the blocked outbound state is recorded without attempting the request.
- [ ] Missing API key returns a structured error without leaking secrets.
- [ ] Missing, invalid, multiple, or ambiguous model/quantity input stays silent and makes no API call or record append.
- [ ] The initial response queries no more than four recommended candidates in addition to the original-model baseline; same-sender, same-chat continuation queries the next four without duplication.
- [ ] Candidate continuation without matching active context stays silent; a bridge restart or six-hour expiry requires the complete model and quantity again.
- [ ] Output includes the fixed internal-candidate disclaimer.
- [ ] Records append to `records/delivery_prediction_records.md`.
- [ ] A direct AR51 task in Mac Studio Codex can modify a test project file or perform the intended Git update without being blocked by the Feishu read-only rule.

View File

@@ -7,12 +7,22 @@
3. Confirm AR51 has approved the functional test.
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 internal candidates.
7. Run the controlled script for the original model and approved candidates.
8. Summarize the internal candidate result.
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.
## 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.
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.
## Approved Script
```text

View File

@@ -49,6 +49,16 @@ Stop if:
- An @mention by itself does not bypass this content gate.
- After a valid message passes the gate, API or runtime failures may still return
the bounded internal error response defined by this capability.
- Exception for candidate continuation: after a valid initial query, the same
sender in the same Feishu chat may use any clear equivalent continuation
expression without repeating the model and quantity. Examples include `还有吗`
`有没有别的``再推荐几个``继续``下一批` and `more candidates`; exact wording
is not required.
- A continuation uses only the active in-memory query context, expires after six
hours or a bridge restart, and is never shared across senders or chats. Without
matching active context, the message stays silent.
- A new complete model-and-quantity request replaces any earlier continuation
context for that sender and chat.
## Feishu File-Write Boundary
@@ -83,6 +93,26 @@ Do not use temporary curl, WebFetch, or any API method outside the controlled sc
- If AM516 fields are absent, use original API prediction and mark it as original algorithm reference.
- If only total days are available, state the total days and ask for human review.
## Candidate Batch Rule
- Generate and preserve the complete ordered rule-candidate pool, but query and
recommend at most four candidate models per reply.
- The original input model is queried as the initial baseline and does not count
toward the four recommended candidate models.
- The initial reply queries the baseline plus candidate positions 1-4. If more
candidates remain, state the remaining count and invite the human to ask for
more in natural language; do not require one fixed command phrase.
- Recognize short or synonymous continuation expressions only together with the
valid same-sender, same-chat continuation context. Unrelated topic text such as
`more interesting` or `继续查询英语例句` must not reuse the old delivery query.
- Each valid continuation queries the next four unqueried candidates in the same
rule order. Do not query or display an earlier candidate again, and do not
re-query the original baseline.
- Continue in batches of four until the full candidate pool is exhausted. The
final batch explicitly states that all rule candidates have been queried.
- Missing or unsupported models count as queried positions and remain summarized
under `不可用候选`; do not silently skip them to pull later candidates forward.
## Reducer Shortage Detail Rule
- Treat a shortage item as a reducer only when `data.采购信息.缺料明细[].缺料物料` starts with `20.30.`.
@@ -105,6 +135,7 @@ Include:
- title and generation time;
- input model and quantity;
- overall judgment;
- current candidate batch and remaining-candidate count;
- candidate details;
- main factor;
- API exception if any;
@@ -120,6 +151,7 @@ Use this field order for a successful Feishu report:
数据时间戳:{API data timestamp or generation time}
状态:试运行版输出 / 内部候选
判断等级AM516算法预测参考需人工复核
候选范围本次先推荐4个候选型号原型号另作基准尚有N个规则候选未查询
总体判断:
- 现货候选:{fully covered candidate or none}
@@ -148,12 +180,13 @@ Use Feishu rich-text `post` output. Bold only:
- the report title;
- `总体判断:`;
- `本批次判断:` for a continuation reply;
- each numbered candidate heading;
- `不可用候选:`.
Do not repeat a separate human-review line under each candidate. The global judgment level and fixed disclaimer carry the human-review boundary.
If the full candidate report exceeds the Feishu rich-text size limit, split it into multiple ordered `post` replies without dropping any queried candidate. Use the original report title on the first part and append `(续)` to continuation titles.
If the current candidate-batch report exceeds the Feishu rich-text size limit, split it into multiple ordered `post` replies without dropping any candidate queried in that batch. Use the original report title on the first part and append `(续)` to continuation titles.
## Fixed Disclaimer

View File

@@ -62,8 +62,10 @@ Allowed upgrades:
- Encoder options are directional: `S -> M/HS/HM`, `M -> HS/HM`, `HS -> HM`, and `HM` has no further automatic upgrade.
- Include the original model separately as the baseline and deduplicate all generated models.
- Never generate a brake, encoder, sensor, or grease downgrade.
- Query every generated candidate through the controlled delivery-prediction script.
- Show candidates with usable lead-time summaries in full; summarize missing or unsupported models under `不可用候选`.
- Preserve the complete deduplicated candidate pool in rule order so the lead-time capability can page through it deterministically.
- The original model is a baseline and does not count toward the four recommended candidate models in a batch.
- When used by the lead-time capability, pass only the first four candidates on the initial query. A same-conversation human request for more candidates passes the next four, without repeating or reordering earlier candidates.
- This recommendation Skill does not call the delivery-prediction API itself. The lead-time capability queries only the current candidate batch and summarizes missing or unsupported models under `不可用候选`.
## Output