Telegram: fix model button review issues

- Add currentModel to callback handler for checkmark display
- Add 64-byte callback_data limit protection (skip long model IDs)
- Add tests for large model lists and callback_data limits
This commit is contained in:
Ermenegildo Fiorito
2026-02-03 19:15:22 +01:00
committed by Ayaan Zaidi
parent 16349b6e93
commit 202c554d09
3 changed files with 107 additions and 4 deletions

View File

@@ -474,9 +474,14 @@ export const registerTelegramHandlers = ({
const totalPages = calculateTotalPages(models.length, pageSize);
const safePage = Math.max(1, Math.min(page, totalPages));
// Get current model from config for checkmark display
const modelCfg = cfg.agents?.defaults?.model;
const currentModel = typeof modelCfg === "string" ? modelCfg : modelCfg?.primary;
const buttons = buildModelsKeyboard({
provider,
models,
currentModel,
currentPage: safePage,
totalPages,
pageSize,