feat: handle server status/event in bridge to show balance/usage/model
This commit is contained in:
@@ -186,7 +186,17 @@ export default {
|
|||||||
onTokenChange(e) { this.settings.token = e && e.value || '' },
|
onTokenChange(e) { this.settings.token = e && e.value || '' },
|
||||||
|
|
||||||
handleBridgeMessage(msg) {
|
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>
|
</script>
|
||||||
|
|||||||
Reference in New Issue
Block a user