feat(channels): 管理面板消息日志——chat_messages 加 adapter_id + 配置级/平台/总览三粒度端点
后端: - 迁移 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 绿。
This commit is contained in:
1 parent
c1bd740f7c
commit
2e044d1d19
15 files changed
+560
-41
No files matched your search
@@ -1,5 +1,6 @@
|
||||
import type {
|
||||
AdminAutomationRecord,
|
||||
AdminChannelMessage,
|
||||
AdminChannelRecord,
|
||||
AdminIoTDevice,
|
||||
AdminLlmConfig,
|
||||
@@ -546,6 +547,18 @@ export function adminChannelTest(req: {
|
||||
}): Promise<ChannelTestResult> {
|
||||
return request<ChannelTestResult>("/admin/channels/test", { method: "POST", body: JSON.stringify(req) });
|
||||
}
|
||||
/** GET /api/v1/admin/channels/messages?adapter=<composite> — one adapter config's
|
||||
* (platform:account) send/receive message log, newest first. */
|
||||
export function adminChannelMessages(adapter: string, limit?: number): Promise<AdminChannelMessage[]> {
|
||||
const q = new URLSearchParams({ adapter });
|
||||
if (limit && limit > 0) q.set("limit", String(limit));
|
||||
return request<AdminChannelMessage[]>(`/admin/channels/messages?${q.toString()}`);
|
||||
}
|
||||
/** GET /api/v1/admin/channels/messages — adapter overview log across all adapters. */
|
||||
export function adminChannelLogOverview(limit?: number): Promise<AdminChannelMessage[]> {
|
||||
const q = limit && limit > 0 ? `?limit=${limit}` : "";
|
||||
return request<AdminChannelMessage[]>(`/admin/channels/messages${q}`);
|
||||
}
|
||||
/** PUT /api/v1/admin/channels/{platform}/config — save an account config + hot-reload. */
|
||||
export function adminSaveChannelConfig(
|
||||
platform: string,
|
||||
|
||||
@@ -275,6 +275,23 @@ export interface AdminChannelAccount {
|
||||
botNickname?: string;
|
||||
}
|
||||
|
||||
/** One message in the platform (IM channel) send/receive log. Mirrors the
|
||||
* historyMessage wire shape from GET /api/v1/admin/channels/{platform}/messages. */
|
||||
export interface AdminChannelMessage {
|
||||
id: string;
|
||||
sessionId: string;
|
||||
role: string; // "user" | "assistant"
|
||||
content: string;
|
||||
mode?: string;
|
||||
platform?: string;
|
||||
deviceId?: string;
|
||||
/** Adapter (platform:account) that produced the message; blank for Web. */
|
||||
adapterId?: string;
|
||||
/** Human sender display name for group/stranger messages; blank = owner. */
|
||||
senderName?: string;
|
||||
createdAt: number;
|
||||
}
|
||||
|
||||
/** An IoT device as returned by GET /api/v1/admin/iot. */
|
||||
export interface AdminIoTDevice {
|
||||
id: string;
|
||||
|
||||
Reference in new issue
Block a user