fix: use common.Marshal/Unmarshal per Rule 1 + telegram null safety
- model/user.go: replace json.Unmarshal/Marshal with common.* wrapper functions as required by project Rule 1 (3 occurrences) - relay/channel/claude/relay-claude.go: replace 3 json.* calls with common.* (tool call args unmarshal, response marshal) - relay/channel/gemini/relay-gemini.go: replace 5 json.* calls with common.* (content parsing, function args, response marshal) - adapters/telegram/index.ts: add optional chaining on callback query message.chat.id and null coalescing on message.text to prevent crash when callback message is undefined Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
This commit is contained in:
@@ -718,7 +718,7 @@ bot.on('callback_query:data', async (ctx) => {
|
||||
|
||||
const requestId = parts[1]!
|
||||
const allowed = parts[2] === 'yes'
|
||||
const chatId = String(ctx.callbackQuery.message?.chat.id)
|
||||
const chatId = String(ctx.callbackQuery.message?.chat?.id)
|
||||
|
||||
bridge.sendPermissionResponse(chatId, requestId, allowed)
|
||||
const runtime = getRuntimeState(chatId)
|
||||
@@ -727,7 +727,7 @@ bot.on('callback_query:data', async (ctx) => {
|
||||
const statusText = allowed ? '✅ 已允许' : '❌ 已拒绝'
|
||||
try {
|
||||
await ctx.editMessageText(
|
||||
ctx.callbackQuery.message?.text + `\n\n${statusText}`,
|
||||
(ctx.callbackQuery.message?.text ?? '') + `\n\n${statusText}`,
|
||||
)
|
||||
} catch { /* ignore */ }
|
||||
|
||||
|
||||
Reference in New Issue
Block a user