Telegram: add inline button model selection for /models and /model commands

This commit is contained in:
Ermenegildo Fiorito
2026-02-03 19:03:00 +01:00
committed by Ayaan Zaidi
parent efb4a34be4
commit 16349b6e93
8 changed files with 757 additions and 86 deletions

View File

@@ -9,6 +9,7 @@ import {
resolveConfiguredModelRef,
resolveModelRefFromString,
} from "../../agents/model-selection.js";
import { buildBrowseProvidersButton } from "../../telegram/model-buttons.js";
import { shortenHomePath } from "../../utils.js";
import { resolveModelsCommandReply } from "./commands-models.js";
import {
@@ -177,6 +178,7 @@ export async function maybeHandleModelDirectiveInfo(params: {
aliasIndex: ModelAliasIndex;
allowedModelCatalog: Array<{ provider: string; id?: string; name?: string }>;
resetModelOverride: boolean;
surface?: string;
}): Promise<ReplyPayload | undefined> {
if (!params.directives.hasModelDirective) {
return undefined;
@@ -213,6 +215,22 @@ export async function maybeHandleModelDirectiveInfo(params: {
if (wantsSummary) {
const current = `${params.provider}/${params.model}`;
const isTelegram = params.surface === "telegram";
if (isTelegram) {
const buttons = buildBrowseProvidersButton();
return {
text: [
`Current: ${current}`,
"",
"Tap below to browse models, or use:",
"/model <provider/model> to switch",
"/model status for details",
].join("\n"),
channelData: { telegram: { buttons } },
};
}
return {
text: [
`Current: ${current}`,