feat: handle server status/event in bridge to show balance/usage/model

This commit is contained in:
2026-09-01 21:13:30 +08:00
parent 3789270b6c
commit 44c209cd1b
+11 -1
View File
@@ -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) {
// 后续可更新会话/事件列表
}
}
}
</script>