惯性聚合 高效追踪和阅读你感兴趣的博客、新闻、科技资讯
阅读原文 在惯性聚合中打开

推荐订阅源

F
Fortinet All Blogs
WordPress大学
WordPress大学
The Cloudflare Blog
云风的 BLOG
云风的 BLOG
博客园 - Franky
D
Docker
小众软件
小众软件
阮一峰的网络日志
阮一峰的网络日志
H
Hackread – Cybersecurity News, Data Breaches, AI and More
Engineering at Meta
Engineering at Meta
MongoDB | Blog
MongoDB | Blog
U
Unit 42
M
MIT News - Artificial intelligence
B
Blog
GbyAI
GbyAI
C
Check Point Blog
P
Proofpoint News Feed
博客园 - 司徒正美
Hugging Face - Blog
Hugging Face - Blog
雷峰网
雷峰网
IT之家
IT之家
Google DeepMind News
Google DeepMind News
V
V2EX
Stack Overflow Blog
Stack Overflow Blog

Recent Commits to openclaw:main

test: merge chat side-result checks · openclaw/openclaw@ddd2c2a test: merge cron history checks · openclaw/openclaw@f7eb746 test: merge responsive navigation shell checks · openclaw/openclaw@c2e4b47 docs(changelog): add codex oauth fixes · openclaw/openclaw@628e6cd test: merge navigation routing cases · openclaw/openclaw@5d8cecb Tests: mock channel registry bundled fallback · openclaw/openclaw@2b08233 Secrets: avoid broad web search discovery for single plugin config · openclaw/openclaw@a464f59 test: merge config view browser checks · openclaw/openclaw@20cf511 fix(status): align oauth health with runtime · openclaw/openclaw@eed7116 feat: add macOS screen snapshots for monitor preview (#67954) thanks … · openclaw/openclaw@f377db1 fix: report shared auth scopes in hello-ok (#67810) thanks @BunsDev · openclaw/openclaw@0b6c39b Auto-reply: avoid eager bundled route fallback · openclaw/openclaw@3ea1bf4 Tests: narrow session binding contract setup · openclaw/openclaw@54e4e16 fix(macOS): enable undo/redo in webchat composer text input (#34962) · openclaw/openclaw@00951dc Tests: speed up channel setup promotion · openclaw/openclaw@82b529a Docs: refresh agent instructions · openclaw/openclaw@5775fe2 fix(auth): serialize OAuth refresh across agents to fix #26322 (#67876) · openclaw/openclaw@8e79080 test: allow ollama public surface boundary test · openclaw/openclaw@7d4f1a6 Docs: add test performance guardrails · openclaw/openclaw@89706d3 Tests: restore context-engine usage proof · openclaw/openclaw@e4c4f95 Tests: slim context engine runtime coverage · openclaw/openclaw@74c198f ci: retry failed custom checkouts · openclaw/openclaw@0ee5baf test: trim duplicate provider auth onboarding cases · openclaw/openclaw@1ffc02e matrix: fix sessions_spawn --thread subagent session spawning (#67643) · openclaw/openclaw@1ce2596 test: reduce auth choice fixture churn · openclaw/openclaw@857b9cd test: mock health status config boundaries · openclaw/openclaw@9d5ab4a test: mock onboard config io boundary · openclaw/openclaw@299694d test: mock legacy state plugin boundaries · openclaw/openclaw@2713089 test: mock channel install boundaries · openclaw/openclaw@b945248 test: mock doctor preview channel boundaries · openclaw/openclaw@b1a3ad4
fix: show current think level in Telegram picker (#78278)...
obviyus · 2026-05-06 · via Recent Commits to openclaw:main

@@ -1,7 +1,12 @@

11

import { randomUUID } from "node:crypto";

22

import path from "node:path";

33

import type { Bot, Context } from "grammy";

4-

import { resolveDefaultModelForAgent } from "openclaw/plugin-sdk/agent-runtime";

4+

import {

5+

buildConfiguredModelCatalog,

6+

resolveAgentConfig,

7+

resolveDefaultModelForAgent,

8+

resolveThinkingDefault,

9+

} from "openclaw/plugin-sdk/agent-runtime";

510

import { resolveChannelStreamingBlockEnabled } from "openclaw/plugin-sdk/channel-streaming";

611

import {

712

resolveCommandAuthorization,

@@ -203,7 +208,7 @@ function resolveTelegramCommandMenuModelContext(params: {

203208

cfg: OpenClawConfig;

204209

agentId: string;

205210

sessionKey: string;

206-

}): { provider?: string; model?: string } {

211+

}): { provider?: string; model?: string; thinkingLevel?: string } {

207212

if (!params.sessionKey.trim()) {

208213

return {};

209214

}

@@ -215,8 +220,13 @@ function resolveTelegramCommandMenuModelContext(params: {

215220

});

216221

const store = loadSessionStore(storePath);

217222

const entry = resolveSessionStoreEntry({ store, sessionKey: params.sessionKey }).existing;

223+

const thinkingLevel = normalizeOptionalString(entry?.thinkingLevel);

218224

if (entry?.modelOverrideSource === "auto" && normalizeOptionalString(entry.modelOverride)) {

219-

return { provider: defaultModel.provider, model: defaultModel.model };

225+

return {

226+

provider: defaultModel.provider,

227+

model: defaultModel.model,

228+

...(thinkingLevel ? { thinkingLevel } : {}),

229+

};

220230

}

221231

const override = resolveStoredModelOverride({

222232

sessionEntry: entry,

@@ -228,6 +238,7 @@ function resolveTelegramCommandMenuModelContext(params: {

228238

return {

229239

provider: override.provider || defaultModel.provider,

230240

model: override.model,

241+

...(thinkingLevel ? { thinkingLevel } : {}),

231242

};

232243

}

233244

const provider =

@@ -238,12 +249,54 @@ function resolveTelegramCommandMenuModelContext(params: {

238249

return {

239250

...(provider ? { provider } : {}),

240251

...(model ? { model } : {}),

252+

...(thinkingLevel ? { thinkingLevel } : {}),

241253

};

242254

} catch {

243255

return {};

244256

}

245257

}

246258259+

function resolveTelegramThinkMenuCurrentLevel(params: {

260+

cfg: OpenClawConfig;

261+

agentId: string;

262+

provider?: string;

263+

model?: string;

264+

thinkingLevel?: string;

265+

}): string {

266+

const explicit = normalizeOptionalString(params.thinkingLevel);

267+

if (explicit) {

268+

return explicit;

269+

}

270+

const agentThinkingDefault = normalizeOptionalString(

271+

resolveAgentConfig(params.cfg, params.agentId)?.thinkingDefault,

272+

);

273+

if (agentThinkingDefault) {

274+

return agentThinkingDefault;

275+

}

276+

const defaultModel = resolveDefaultModelForAgent({

277+

cfg: params.cfg,

278+

agentId: params.agentId,

279+

});

280+

return resolveThinkingDefault({

281+

cfg: params.cfg,

282+

provider: params.provider ?? defaultModel.provider,

283+

model: params.model ?? defaultModel.model,

284+

catalog: buildConfiguredModelCatalog({ cfg: params.cfg }),

285+

});

286+

}

287+288+

function formatTelegramCommandArgMenuTitle(params: {

289+

command: NonNullable<ReturnType<typeof findCommandByNativeName>>;

290+

menu: NonNullable<ReturnType<typeof resolveCommandArgMenu>>;

291+

currentThinkingLevel?: string;

292+

}): string {

293+

const title = formatCommandArgMenuTitle({ command: params.command, menu: params.menu });

294+

if (params.command.key !== "think" || !params.currentThinkingLevel) {

295+

return title;

296+

}

297+

return `Current thinking level: ${params.currentThinkingLevel}.\n${title}`;

298+

}

299+247300

function resolveTelegramNativeReplyChannelData(

248301

result: TelegramNativeReplyPayload,

249302

): TelegramNativeReplyChannelData | undefined {

@@ -1006,7 +1059,18 @@ export const registerTelegramNativeCommands = ({

10061059

})

10071060

: null;

10081061

if (menu && commandDefinition) {

1009-

const title = formatCommandArgMenuTitle({ command: commandDefinition, menu });

1062+

const title = formatTelegramCommandArgMenuTitle({

1063+

command: commandDefinition,

1064+

menu,

1065+

currentThinkingLevel:

1066+

commandDefinition.key === "think"

1067+

? resolveTelegramThinkMenuCurrentLevel({

1068+

cfg: runtimeCfg,

1069+

agentId: route.agentId,

1070+

...menuModelContext,

1071+

})

1072+

: undefined,

1073+

});

10101074

const rows: Array<Array<{ text: string; callback_data: string }>> = [];

10111075

for (let i = 0; i < menu.choices.length; i += 2) {

10121076

const slice = menu.choices.slice(i, i + 2);