后端: - 迁移 0007:chat_messages 加 adapter_id 列 + 索引 - history.Message 加 AdapterID;persistToMain/persistIsolated 传适配器名(a.Name()) - channelbridge: 4 个持久化点 + registerSilenced 传 a;light.go registerSilenced 签名加 a - Store 新增 ListAdapterLog(?adapter=, 不排除主会话)/ListAllLog(adapter_id!='', 总览);ListPlatformLog 保留 - 新端点 GET /api/v1/admin/channels/messages:?adapter= 配置级 / ?platform= 平台 / 无参=总览,historyMessage 加 adapterId - 测试:ListAdapterLog/ListAllLog 过滤用例 + 端点粒度用例 + 桥接持久化断言 前端:渠道管理每配置(账号)「消息日志」按钮 + 页顶「适配器总览日志」入口 + ChannelLogPanel 弹窗(总览/配置级),Miuix 风格,build 绿。
16 lines
1.1 KiB
SQL
16 lines
1.1 KiB
SQL
-- 0007_chat_adapter: tag every chat message with the adapter (platform + account)
|
|
-- that received it, e.g. "kook:3bef..." for a multi-account channels.json registration
|
|
-- or a bare platform name (e.g. "kook") when the account comes from env. It lets the
|
|
-- admin panel query the message send/receive log per independent adapter config, and
|
|
-- the full adapter overview (adapter_id != '').
|
|
--
|
|
-- IM adapter-originated messages carry this tag; Web main-session messages stay empty,
|
|
-- so only IM adapter sources are surfaced. The 0006 chat_messages table already exists
|
|
-- at this point, so ALTER ADD COLUMN is the correct, non-destructive step. The
|
|
-- canonical schema (including this column) is also re-issued idempotently by
|
|
-- internal/runtime/history.NewStore so a fresh in-memory store used by tests stays
|
|
-- self-contained; the migration is the authoritative path for an existing database.
|
|
|
|
ALTER TABLE chat_messages ADD COLUMN adapter_id TEXT NOT NULL DEFAULT '';
|
|
CREATE INDEX IF NOT EXISTS idx_chat_msgs_adapter_created ON chat_messages (adapter_id, created_at DESC);
|