From 68089d065f828cb13db5dbc4f6d8bbfbf02004d2 Mon Sep 17 00:00:00 2001 From: liangxu Date: Wed, 6 May 2026 12:56:54 +0800 Subject: [PATCH] refactor(desktop): show authorized AI platforms count on shell The shell badge and the AI Platforms overview now report platforms whose binding is locally authorized (authState=active) instead of the total bound platforms, so the number reflects how many monitoring sources are actually usable. Co-Authored-By: Claude Opus 4.7 (1M context) --- .../src/renderer/components/DesktopShell.vue | 8 ++++--- .../src/renderer/views/AiPlatformsView.vue | 24 +++++++++---------- 2 files changed, 17 insertions(+), 15 deletions(-) diff --git a/apps/desktop-client/src/renderer/components/DesktopShell.vue b/apps/desktop-client/src/renderer/components/DesktopShell.vue index 0ac61e3..2d2e00a 100644 --- a/apps/desktop-client/src/renderer/components/DesktopShell.vue +++ b/apps/desktop-client/src/renderer/components/DesktopShell.vue @@ -30,7 +30,9 @@ const navItems = computed(() => { const data = snapshot.value const accounts = data?.accounts ?? [] const publishIDs = new Set(desktopPublishMediaCatalog.map((item) => item.id)) - const monitoringIDs = new Set(desktopMonitoringMediaCatalog.map((item) => item.id)) + const authorizedMonitoringCount = desktopMonitoringMediaCatalog.filter((platform) => + accounts.find((account) => account.platform === platform.id)?.authState === 'active', + ).length return [ { @@ -57,8 +59,8 @@ const navItems = computed(() => { { to: '/ai-platforms', title: 'AI 平台', - description: 'AI 平台一平台一绑定,按卡片查看状态与归属', - count: accounts.filter((item) => monitoringIDs.has(item.platform)).length, + description: 'AI 平台一平台一授权,按卡片查看状态与归属', + count: authorizedMonitoringCount, icon: RobotOutlined, }, ] diff --git a/apps/desktop-client/src/renderer/views/AiPlatformsView.vue b/apps/desktop-client/src/renderer/views/AiPlatformsView.vue index f63b84a..89521a8 100644 --- a/apps/desktop-client/src/renderer/views/AiPlatformsView.vue +++ b/apps/desktop-client/src/renderer/views/AiPlatformsView.vue @@ -29,13 +29,6 @@ const aiAccounts = computed(() => ), ) -const overview = computed(() => ({ - configuredPlatforms: desktopMonitoringMediaCatalog.length, - bound: aiAccounts.value.length, - live: aiAccounts.value.filter((item) => item.health === 'live').length, - onlineClients: snapshot.value?.summary.onlineClients ?? 0, -})) - const platformCards = computed(() => desktopMonitoringMediaCatalog.map((platform) => { const matched = aiAccounts.value.filter((account) => account.platform === platform.id) @@ -47,6 +40,17 @@ const platformCards = computed(() => }), ) +function isLocallyAuthorized(account: AccountRow | null): boolean { + return account?.authState === 'active' +} + +const overview = computed(() => ({ + configuredPlatforms: desktopMonitoringMediaCatalog.length, + authorized: platformCards.value.filter((platform) => isLocallyAuthorized(platform.account)) + .length, + onlineClients: snapshot.value?.summary.onlineClients ?? 0, +})) + function authLabel(account: AccountRow | null) { if (!account) { return '未绑定' @@ -258,13 +262,9 @@ async function unbindPlatform(account: AccountRow) {
支持平台
{{ overview.configuredPlatforms }}
-
-
已绑定
-
{{ overview.bound }}
-
授权正常
-
{{ overview.live }}
+
{{ overview.authorized }}
在线客户端