Consider it done. The open-source AI agent that works out of the box · 想到,就能做到。开源、开箱即用的 AI Agent。
TypeScript agentai-agentai-assistantandroidclaude-codecodexelectroniosllmmacosreact-nativetypescriptwindows
fix(telegram): 保留引用表格首尾空列分隔符
Dash452a7d7744e8
diff --git a/packages/lizi-im/src/telegram/__tests__/inbound.test.ts b/packages/lizi-im/src/telegram/__tests__/inbound.test.tsindex c2a8f1a105..d0cc860f32 100644--- a/packages/lizi-im/src/telegram/__tests__/inbound.test.ts+++ b/packages/lizi-im/src/telegram/__tests__/inbound.test.ts@@ -218,6 +218,29 @@ describe('replyContextOf', () => {expect(groupWindowEntryOf(rich).text).toBe(expected);});+ it('preserves leading and trailing empty table cells in replies and history', () => {+ const rich = msg({+ text: undefined,+ rich_message: {+ blocks: [+ {+ type: 'table',+ cells: [+ [{}, { text: 'B1' }],+ [{ text: 'A2' }, {}],+ ],+ },+ ],+ },+ });+ const expected = '\tB1\nA2\t';+ expect(groupWindowEntryOf(rich).text).toBe(expected);+ const m = msg({ reply_to_message: rich });+ expect(replyContextOf(m)?.text).toBe(expected);+ m.quote = { text: expected };+ expect(replyContextOf(m)?.text).toBe(expected);+ });+it('uses an explicit quote and still respects protection of the original', () => {const m = msg({quote: { text: '选中的片段' },diff --git a/packages/lizi-im/src/telegram/messageText.ts b/packages/lizi-im/src/telegram/messageText.tsindex 628e8df252..027a6fe229 100644--- a/packages/lizi-im/src/telegram/messageText.ts+++ b/packages/lizi-im/src/telegram/messageText.ts@@ -65,7 +65,8 @@ export function telegramMessageText(message: TelegramTextContent): string {}return parts.join('\n');}- return visit(message.rich_message?.blocks, 0, '\n').slice(0, MAX_TEXT).trim();+ const text = visit(message.rich_message?.blocks, 0, '\n').slice(0, MAX_TEXT);+ return text.trim() ? text : '';}/** The selected quote is more specific than the full parent. Protection is@@ -75,7 +76,7 @@ export function telegramReplyText(message: {quote?: { text?: unknown };}): string {const quote = message.quote?.text;- if (typeof quote === 'string' && quote.trim()) return quote.slice(0, MAX_TEXT).trim();+ if (typeof quote === 'string' && quote.trim()) return quote.slice(0, MAX_TEXT);const reply = message.reply_to_message;if (!reply) return '';return telegramMessageText(reply);