From 3af09fbbfba0c3550beaa79d41e2e87f00e2a243 Mon Sep 17 00:00:00 2001 From: xmanrui <841206367@qq.com> Date: Tue, 17 Mar 2026 02:03:59 +0800 Subject: [PATCH] Generalize DM session platform discovery --- app/api/test-dm-sessions/route.ts | 12 +++++++++--- 1 file changed, 9 insertions(+), 3 deletions(-) diff --git a/app/api/test-dm-sessions/route.ts b/app/api/test-dm-sessions/route.ts index de39215..5e59cf3 100644 --- a/app/api/test-dm-sessions/route.ts +++ b/app/api/test-dm-sessions/route.ts @@ -108,14 +108,20 @@ export async function POST() { } const results: DmSessionResult[] = []; - const platformsToTest = ["feishu", "discord", "telegram", "whatsapp", "qqbot"]; + const platformsToTest = Array.from(new Set([ + ...Object.entries(channels) + .filter(([, cfg]) => cfg && typeof cfg === "object" && (cfg as any).enabled !== false) + .map(([name]) => name), + ...bindings + .map((b: any) => b?.match?.channel) + .filter((name: unknown): name is string => typeof name === "string" && name.length > 0), + ])); for (const agent of agentList) { const id = agent.id; for (const platform of platformsToTest) { - // Check if this agent has this platform configured const ch = channels[platform]; - if (!ch || ch.enabled === false) continue; + if (ch && ch.enabled === false) continue; const isMain = id === "main"; const hasBinding = bindings.some(