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

@@ -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: