Lay out settings model buttons in rows of two

The settings menu put every model button in a single row. Telegram
rejects rows with more than 8 inline buttons, which would break
/settings now that the model list is longer. Chunk the buttons into
rows of two.
This commit is contained in:
Father Bot
2026-03-19 15:52:08 +03:00
parent 2ace648aa9
commit f239b53086
+5 -2
View File
@@ -684,7 +684,8 @@ def get_settings_menu(user_id: int):
text += "\nSelect <b>model</b>:"
# buttons to choose models
# buttons to choose models (chunked into rows of 2 to stay within
# Telegram's per-row button limit as the model list grows)
buttons = []
for model_key in config.models["available_text_models"]:
title = config.models["info"][model_key]["name"]
@@ -694,7 +695,9 @@ def get_settings_menu(user_id: int):
buttons.append(
InlineKeyboardButton(title, callback_data=f"set_settings|{model_key}")
)
reply_markup = InlineKeyboardMarkup([buttons])
keyboard = [buttons[i:i + 2] for i in range(0, len(buttons), 2)]
reply_markup = InlineKeyboardMarkup(keyboard)
return text, reply_markup