From 44c209cd1b7fd58bcc8d1d1960f8f0edf7a358d7 Mon Sep 17 00:00:00 2001 From: jiangchen <1703935164@qq.com> Date: Tue, 1 Sep 2026 21:13:30 +0800 Subject: [PATCH] feat: handle server status/event in bridge to show balance/usage/model --- src/pages/index/index.ux | 12 +++++++++++- 1 file changed, 11 insertions(+), 1 deletion(-) diff --git a/src/pages/index/index.ux b/src/pages/index/index.ux index 590a2aa..ab7274c 100644 --- a/src/pages/index/index.ux +++ b/src/pages/index/index.ux @@ -186,7 +186,17 @@ export default { onTokenChange(e) { this.settings.token = e && e.value || '' }, handleBridgeMessage(msg) { - // 空壳:后续按 PROTOCOL.md 处理 status/event + if (!msg) return + if (msg.type === 'status' && msg.payload) { + const pl = msg.payload + if (typeof pl.balance !== 'undefined') this.balance = pl.balance + if (typeof pl.todayCost !== 'undefined') this.todayCost = pl.todayCost + if (pl.model) this.statusText = '在线 · ' + pl.model + if (typeof pl.running !== 'undefined') this.statusText = pl.running ? '执行中' : '空闲' + this.connText = pl.model ? ('在线 · ' + pl.model) : '已连接' + } else if (msg.type === 'event' && msg.payload) { + // 后续可更新会话/事件列表 + } } }