feat: add structured message failure reporting

This commit is contained in:
xmanrui 2026-08-25 13:42:43 +08:00
parent b42fc411c2
commit ad3c08ace3
59 changed files with 2405 additions and 607 deletions

View file

@ -1,4 +1,5 @@
import { normalizeAgentPresetCatalog, normalizeAgentPresetId, SET_AGENT_PRESET_ENDPOINT } from '../../agent-preset.js';
import { normalizeLastMessageError } from '../../last-message-error.js';
export const WHATSAPP_RPC_CHANNEL = '/whatsapp';
@ -106,6 +107,7 @@ function normalizeBot(value) {
? 'WhatsApp Web 关联设备运行正常' : 'WhatsApp 连接尚未就绪'),
lastCheckedAt: timestamp(value.health?.lastCheckedAt),
},
lastMessageError: normalizeLastMessageError(value.lastMessageError),
error: isRecord(value.error) ? {
code: text(value.error.code, 'WHATSAPP_ACCOUNT_ERROR', 80),
message: text(value.error.message, 'WhatsApp 连接尚未就绪'),

View file

@ -10,7 +10,11 @@ import {
EMPTY_AGENT_PRESET_CATALOG,
} from '../../agent-preset.js';
import { useWorkspaceSnapshotFence } from '../../workspace-snapshot-fence.js';
import { BotStatusMeta, ChannelListHeading } from '../../channel-card-meta.js';
import {
BotStatusMeta,
ChannelListHeading,
LastMessageErrorSummary,
} from '../../channel-card-meta.js';
import { installDingtalkStyles } from '../dingtalk/styles.js';
import {
WHATSAPP_ENDPOINTS,
@ -345,6 +349,10 @@ export function WhatsappAccountCard({
className: 'dim-cardAction', kind: 'danger', onClick: onRequestRemove, disabled: Boolean(busy),
}, '移除接入')),
summary ? h('div', { className: 'ddt-summary dim-cardSummary' }, summary) : null,
account.lastMessageError ? h(LastMessageErrorSummary, {
className: 'ddt-summary',
error: account.lastMessageError,
}) : null,
testNotice ? h('div', {
className: 'ddt-summary dim-cardFeedback',
role: 'status',