fix(model): keep callback data short#179
Conversation
|
@fengjikui thanks for the fix. One issue before merging: Stale clicks on result buttons can select a wrong model. After the model-search interaction is cleared (e.g. by the next Same shape for Could you make the legacy fallbacks reject the new prefixes? E.g. in |
|
Thanks for catching that. I pushed
Added regression coverage for stale Validation:
|
c6f1b53 to
47214d7
Compare
|
Self-review found one more index-stability edge case: model:list callbacks were re-reading model.json at click time, so a favorites/recent reorder after the menu was rendered could retarget an existing button. f05fd04 now stores the rendered lists in the active inline-menu metadata and resolves short callback indices from that snapshot. Validation: targeted model/inline-menu tests (28 tests), full suite (122 files / 1096 tests), build, lint, Prettier, and git diff --check. |
|
@fengjikui thanks for contribution! |
Summary
/modelsfavorite/recent callbacks short by using list references instead of embedding provider/model IDsWhy
Telegram rejects inline keyboard
callback_datavalues longer than 64 bytes. Long provider/model IDs such as Fireworks deployment paths could make the model menu fail withBUTTON_DATA_INVALIDbefore the user could select anything.Fixes #178.
Validation
npx prettier --check src/bot/menus/model-selection-menu.ts src/bot/callbacks/model-selection-callback-handler.ts tests/bot/handlers/model.test.tsnpm test -- --run tests/bot/handlers/model.test.tsnpm run buildnpm run lintnpm testgit diff --check