diff --git a/bot/bot.ts b/bot/bot.ts index e0ddb96..fdaabc2 100644 --- a/bot/bot.ts +++ b/bot/bot.ts @@ -684,31 +684,16 @@ async function selectModel(ctx: Context, modelId: string) { return; } kvSet("llm_model", modelId); - await ctx.answerCallbackQuery({ text: `model: ${modelId}` }); - // Re-render the picker so the ✅ moves to the new pick. + await ctx.answerCallbackQuery({ text: `model set: ${modelId}` }); + // Dismiss the keyboard and replace the picker body with a confirmation. + // editMessageText with no reply_markup clears the inline keyboard. try { - const models = await fetchOpenRouterModels(); - const usable = models.filter((m) => m.supported_parameters?.includes("tools")); - const ROUTER_RE = /^openrouter\/(free|auto)\b/; - const routers = usable.filter((m) => ROUTER_RE.test(m.id)); - const rest = usable.filter((m) => !ROUTER_RE.test(m.id)) - .sort((a, b) => { - const af = isFreeModel(a), bf = isFreeModel(b); - if (af !== bf) return af ? -1 : 1; - return (a.name || a.id).localeCompare(b.name || b.id); - }); - const list = [...routers, ...rest].slice(0, 20); - const kb = new InlineKeyboard(); - for (const m of list) { - kb.text(modelButtonLabel(m, m.id === modelId), `model:${m.id}`).row(); - } - const header = - `🧠 LLM model picker\n\n` + - `Active: ${escape(modelId)}\n\n` + - `🟢 free · 💰 paid · 🛠 tools · 🧠 thinking`; - await ctx.editMessageText(header, { parse_mode: "HTML", reply_markup: kb }); + await ctx.editMessageText( + `🧠 LLM model\n\nActive: ${escape(modelId)}\n\nSwitched. The new model takes effect on the next message.`, + { parse_mode: "HTML" }, + ); } catch { - /* leave keyboard as-is if refresh fails */ + /* edit can fail if the original message is too old; the toast already confirmed */ } }