fix: clarify telegram model picker scope

This commit is contained in:
Peter Steinberger
2026-05-02 08:40:11 +01:00
parent bd511be53d
commit 09d193c592
5 changed files with 14 additions and 3 deletions

View File

@@ -1745,8 +1745,11 @@ export const registerTelegramHandlers = ({
const actionText = isDefaultSelection
? "reset to default"
: `changed to <b>${escapeHtml(selection.provider)}/${escapeHtml(selection.model)}</b>`;
const scopeText = isDefaultSelection
? "Session selection cleared. New replies use the agent's configured default."
: "Session-only selection. The agent default in openclaw.json is unchanged; /reset or a new session may return to that default.";
await editMessageWithButtons(
`✅ Model ${actionText}\n\nThis model will be used for your next message.`,
`✅ Model ${actionText}\n\n${scopeText}`,
[], // Empty buttons = remove inline keyboard
{ parse_mode: "HTML" },
);

View File

@@ -3739,7 +3739,7 @@ describe("createTelegramBot", () => {
expect(editMessageTextSpy).toHaveBeenCalledTimes(1);
expect(String(editMessageTextSpy.mock.calls.at(-1)?.[2] ?? "")).toContain(
"This model will be used for your next message.",
"Session-only selection. The agent default in openclaw.json is unchanged",
);
expect(
editMessageTextSpy.mock.calls.some((call) =>

View File

@@ -1061,6 +1061,9 @@ describe("createTelegramBot", () => {
expect(editMessageTextSpy.mock.calls[0]?.[2]).toContain(
`${CHECK_MARK_EMOJI} Model reset to default`,
);
expect(editMessageTextSpy.mock.calls[0]?.[2]).toContain(
"Session selection cleared. New replies use the agent's configured default.",
);
const entry = Object.values(loadSessionStore(storePath, { skipCache: true }))[0];
expect(entry?.providerOverride).toBeUndefined();
@@ -1205,6 +1208,9 @@ describe("createTelegramBot", () => {
expect(editMessageTextSpy.mock.calls[0]?.[2]).toContain(
`${CHECK_MARK_EMOJI} Model reset to default`,
);
expect(editMessageTextSpy.mock.calls[0]?.[2]).toContain(
"Session selection cleared. New replies use the agent's configured default.",
);
const entry = Object.values(loadSessionStore(storePath, { skipCache: true }))[0];
expect(entry?.providerOverride).toBeUndefined();
@@ -1275,7 +1281,7 @@ describe("createTelegramBot", () => {
expect(editMessageTextSpy).toHaveBeenCalledWith(
1234,
17,
`${CHECK_MARK_EMOJI} Model changed to <b>openai/gpt-5.4</b>\n\nThis model will be used for your next message.`,
`${CHECK_MARK_EMOJI} Model changed to <b>openai/gpt-5.4</b>\n\nSession-only selection. The agent default in openclaw.json is unchanged; /reset or a new session may return to that default.`,
expect.objectContaining({ parse_mode: "HTML" }),
);