Skip to content

Commit 247604b

Browse files
committed
Refine monitoring fields and add visual account details for v0.7.0
1 parent 18d8ad5 commit 247604b

15 files changed

Lines changed: 907 additions & 434 deletions

‎README.md‎

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -10,8 +10,8 @@
1010
- 窗口使用率、重置倒计时、请求数、Token、标准/账号/用户成本和采样状态
1111
- 今日请求、Token、成本以及按需加载的 30 天汇总、每日历史、模型和接口统计
1212
- 并发、RPM、活跃会话、窗口费用和日/周/总容量
13-
- 调度分、优先级、分组、代理、影子账号、配额策略和生命周期
14-
- Grok 账单/额度、Antigravity 模型能力/AI Credits、Ollama Cloud 套餐/余额等平台数据
13+
- 调度状态、优先级、分组、代理关系、冷却原因和上游健康告警
14+
- Grok 配额/账单、Antigravity AI Credits、Ollama Cloud 套餐/余额等可操作的平台数据
1515
- 异常、封禁、验证、重新授权、暂停、限流、过载和临时不可调度状态
1616
- 平台/状态筛选、账号搜索、告警优先排序
1717
- 每个账号可打开独立透明浮窗,并单独保存位置、尺寸、透明度和置顶状态
@@ -21,11 +21,11 @@
2121

2222
## 自定义显示内容
2323

24-
看板设置提供 36 个显示项,按“实时额度、今日统计、30 天统计、容量与限制、账号与调度、平台详情”分组。可使用“默认 / 全选 / 清空”,也可以逐项选择;只有实际有值的数据才占用界面空间。
24+
看板设置提供 29 个经过筛选的监控项,按“额度与容量、实时负载、今日消耗、趋势与归因、调度与账号、健康与平台”分组。令牌配置状态、TLS/缓存开关、原始账号 ID、通用扩展字段等实现细节不进入看板。可使用“默认 / 全选 / 清空”,也可以逐项选择;只有实际有值的数据才占用界面空间。
2525

26-
主看板保存一套全局选择,每个账号浮窗单独保存自己的选择。历史、模型、接口和调度分等开销较高的数据只在对应显示项启用后读取,30 天统计会缓存 5 分钟。Sub2API 版本不支持某项接口时会自动降级,不影响其他数据刷新。
26+
主看板和每个账号浮窗都提供“极简 / 日常 / 成本 / 调度 / 分析”快捷预设。详情数据使用指标单元、状态徽标、配额进度、消耗排行、分组标签和备注块呈现,避免把复杂统计压成纯文字列表。
2727

28-
“扩展字段”会显示 Sub2API 返回的其他安全字段,并过滤 Token、API Key、Cookie、密码、私钥等敏感值;后端返回的 `credentials_status` 仅用于显示某类凭据是否已经配置。
28+
主看板保存一套全局选择,每个账号浮窗单独保存自己的选择。历史、模型、接口和调度分等开销较高的数据只在对应显示项启用后读取,30 天统计会缓存 5 分钟。Sub2API 版本不支持某项接口时会自动降级,不影响其他数据刷新。
2929

3030
## 账号独立浮窗
3131

‎package-lock.json‎

Lines changed: 2 additions & 2 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

‎package.json‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"name": "sub2api-usage-float",
3-
"version": "0.6.0",
3+
"version": "0.7.0",
44
"private": true,
55
"description": "Sub2API account usage desktop floating dashboard",
66
"main": "./out/main/index.js",

‎src/main/sub2api-client.ts‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -432,7 +432,7 @@ export class Sub2ApiClient {
432432
const headers: Record<string, string> = {
433433
Accept: 'application/json',
434434
'Accept-Language': 'zh-CN',
435-
'User-Agent': 'Sub2API-Usage-Float/0.6.0'
435+
'User-Agent': 'Sub2API-Usage-Float/0.7.0'
436436
}
437437
if (options.body !== undefined) headers['Content-Type'] = 'application/json'
438438
if (options.auth) {

‎src/renderer/src/App.vue‎

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -5,17 +5,17 @@ import {
55
AlertTriangle,
66
ChevronsDownUp,
77
ChevronsUpDown,
8+
ChartColumn,
89
CircleCheck,
910
CircleDollarSign,
1011
ExternalLink,
11-
Layers,
1212
LayoutDashboard,
13+
Network,
1314
Pin,
1415
RefreshCw,
1516
Search,
1617
Settings,
1718
SlidersHorizontal,
18-
Sparkles,
1919
Unplug,
2020
X,
2121
Zap
@@ -295,8 +295,8 @@ const presetIcons: Record<string, unknown> = {
295295
Zap,
296296
LayoutDashboard,
297297
CircleDollarSign,
298-
Sparkles,
299-
Layers
298+
Network,
299+
ChartColumn
300300
}
301301
302302
function getPresetIcon(name: string): unknown {

‎src/renderer/src/components/AccountCard.vue‎

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -17,6 +17,7 @@ import {
1717
PictureInPicture2,
1818
Radar,
1919
Sparkles,
20+
TriangleAlert,
2021
UsersRound,
2122
Zap
2223
} from '@lucide/vue'
@@ -245,6 +246,9 @@ function capacityTone(metric: CapacityMetric): string {
245246
</button>
246247
</footer>
247248

248-
<p v-if="cardMessage" class="account-card__message" :title="cardMessage">{{ cardMessage }}</p>
249+
<div v-if="cardMessage" class="account-card__message" role="alert" :title="cardMessage">
250+
<TriangleAlert :size="13" :stroke-width="2" />
251+
<span>{{ cardMessage }}</span>
252+
</div>
249253
</article>
250254
</template>
Lines changed: 95 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,95 @@
1+
<script setup lang="ts">
2+
import { computed } from 'vue'
3+
import {
4+
Activity,
5+
BadgeCheck,
6+
Binary,
7+
CalendarDays,
8+
CircleDollarSign,
9+
Clock3,
10+
Cpu,
11+
Gauge,
12+
ListChecks,
13+
Network,
14+
Route,
15+
ShieldCheck,
16+
StickyNote,
17+
TriangleAlert,
18+
UsersRound
19+
} from '@lucide/vue'
20+
import type { AccountDetailItem } from '@shared/types'
21+
22+
const props = withDefaults(defineProps<{
23+
entry: AccountDetailItem
24+
compact?: boolean
25+
}>(), {
26+
compact: false
27+
})
28+
29+
const icon = computed(() => {
30+
const id = props.entry.id
31+
if (props.entry.tone === 'danger' && /health|error|cooldown|status/.test(id)) return TriangleAlert
32+
if (/cost|balance|credit|bill|prepaid|demand|money/.test(id)) return CircleDollarSign
33+
if (/token/.test(id)) return Binary
34+
if (/endpoint/.test(id)) return Route
35+
if (/request/.test(id)) return ListChecks
36+
if (/model/.test(id)) return Cpu
37+
if (/history|highest/.test(id)) return CalendarDays
38+
if (/time|date|expiry|expires|reset|cooldown|period-days/.test(id)) return Clock3
39+
if (/health|verify|banned|reauth|status/.test(id)) return ShieldCheck
40+
if (/proxy|routing|fallback|parent/.test(id)) return Network
41+
if (/subscription|plan|tier/.test(id)) return BadgeCheck
42+
if (/group/.test(id)) return UsersRound
43+
if (/note|reason|error/.test(id)) return StickyNote
44+
if (/score|priority|load|rate|rpm|concurrency|session/.test(id)) return Gauge
45+
return Activity
46+
})
47+
48+
const progress = computed(() => Math.max(0, Math.min(100, props.entry.progress || 0)))
49+
const title = computed(() => [props.entry.label, props.entry.value, props.entry.meta].filter(Boolean).join(' · '))
50+
</script>
51+
52+
<template>
53+
<div
54+
class="account-detail-visual"
55+
:class="[
56+
`account-detail-visual--${entry.kind || 'metric'}`,
57+
entry.tone ? `is-${entry.tone}` : '',
58+
{ 'is-compact': compact }
59+
]"
60+
:title="title"
61+
>
62+
<span class="account-detail-visual__icon" aria-hidden="true">
63+
<component :is="icon" :size="compact ? 12 : 14" :stroke-width="1.9" />
64+
</span>
65+
66+
<div class="account-detail-visual__body">
67+
<div class="account-detail-visual__heading">
68+
<span>{{ entry.label }}</span>
69+
<strong v-if="entry.kind === 'status'" class="account-detail-visual__status">
70+
<i aria-hidden="true" />{{ entry.value }}
71+
</strong>
72+
<strong v-else-if="entry.kind !== 'note' && entry.kind !== 'tags'">{{ entry.value }}</strong>
73+
</div>
74+
75+
<p v-if="entry.kind === 'note'" class="account-detail-visual__note">{{ entry.value }}</p>
76+
77+
<div v-if="entry.kind === 'tags'" class="account-detail-visual__tags">
78+
<span v-for="tag in entry.tags || [entry.value]" :key="tag">{{ tag }}</span>
79+
</div>
80+
81+
<p v-if="entry.meta" class="account-detail-visual__meta">{{ entry.meta }}</p>
82+
83+
<div
84+
v-if="(entry.kind === 'progress' || entry.kind === 'ranking') && entry.progress !== undefined"
85+
class="account-detail-visual__track"
86+
role="meter"
87+
aria-valuemin="0"
88+
aria-valuemax="100"
89+
:aria-valuenow="Math.round(progress)"
90+
>
91+
<i :style="{ width: `${progress}%` }" />
92+
</div>
93+
</div>
94+
</div>
95+
</template>

‎src/renderer/src/components/AccountDetails.vue‎

Lines changed: 53 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -1,13 +1,52 @@
11
<script setup lang="ts">
2-
import { Database, ChevronDown } from '@lucide/vue'
2+
import {
3+
BadgeCheck,
4+
CalendarDays,
5+
ChartNoAxesCombined,
6+
ChevronDown,
7+
CircleDollarSign,
8+
Cloud,
9+
Cpu,
10+
Gauge,
11+
Network,
12+
PanelsTopLeft,
13+
Radar,
14+
Route,
15+
ShieldCheck,
16+
StickyNote,
17+
TimerReset,
18+
UsersRound
19+
} from '@lucide/vue'
320
import type { AccountDetailGroup } from '@shared/types'
21+
import AccountDetailVisual from './AccountDetailVisual.vue'
422
523
withDefaults(defineProps<{
624
groups: AccountDetailGroup[]
725
compact?: boolean
826
}>(), {
927
compact: false
1028
})
29+
30+
const groupIcons: Record<string, unknown> = {
31+
'period-summary': ChartNoAxesCombined,
32+
'period-history': CalendarDays,
33+
'period-models': Cpu,
34+
'period-endpoints': Route,
35+
'account-subscription': BadgeCheck,
36+
'account-scheduling': Gauge,
37+
'account-groups': UsersRound,
38+
'account-notes': StickyNote,
39+
'account-cooldowns': TimerReset,
40+
'account-routing': Network,
41+
'usage-health': ShieldCheck,
42+
'ai-credits': CircleDollarSign,
43+
'grok-details': Radar,
44+
'ollama-details': Cloud
45+
}
46+
47+
function groupIcon(id: string): unknown {
48+
return groupIcons[id] || PanelsTopLeft
49+
}
1150
</script>
1251

1352
<template>
@@ -16,24 +55,25 @@ withDefaults(defineProps<{
1655
v-for="(group, index) in groups"
1756
:key="group.id"
1857
class="account-details__group"
19-
:open="!compact || index === 0"
58+
:open="index === 0"
2059
>
2160
<summary>
22-
<span><Database :size="compact ? 10 : 12" />{{ group.label }}</span>
23-
<small>{{ group.items.length }}</small>
24-
<ChevronDown :size="compact ? 10 : 12" />
61+
<span class="account-details__group-icon" aria-hidden="true">
62+
<component :is="groupIcon(group.id)" :size="compact ? 12 : 14" :stroke-width="1.9" />
63+
</span>
64+
<span class="account-details__group-copy">
65+
<strong>{{ group.label }}</strong>
66+
<small>{{ group.items.length }} 项有效数据</small>
67+
</span>
68+
<ChevronDown :size="compact ? 12 : 14" class="account-details__chevron" />
2569
</summary>
2670
<div class="account-details__items">
27-
<div
71+
<AccountDetailVisual
2872
v-for="entry in group.items"
2973
:key="entry.id"
30-
class="account-details__item"
31-
:class="entry.tone ? `is-${entry.tone}` : ''"
32-
:title="`${entry.label}: ${entry.value}`"
33-
>
34-
<span>{{ entry.label }}</span>
35-
<strong>{{ entry.value }}</strong>
36-
</div>
74+
:entry="entry"
75+
:compact="compact"
76+
/>
3777
</div>
3878
</details>
3979
</div>

‎src/renderer/src/components/AccountFloatView.vue‎

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -14,6 +14,7 @@ import {
1414
RefreshCw,
1515
Settings2,
1616
Sparkles,
17+
TriangleAlert,
1718
X
1819
} from '@lucide/vue'
1920
import { DEFAULT_ACCOUNT_FLOAT } from '@shared/account-floats'
@@ -346,7 +347,10 @@ onBeforeUnmount(() => {
346347
<template v-else>
347348
<div v-if="loading" class="account-float__loading"><span class="spinner" /></div>
348349
<div v-else-if="account" class="account-float__content">
349-
<p v-if="accountMessage" class="account-float__message" :title="accountMessage">{{ accountMessage }}</p>
350+
<div v-if="accountMessage" class="account-float__message" role="alert" :title="accountMessage">
351+
<TriangleAlert :size="12" :stroke-width="2" />
352+
<span>{{ accountMessage }}</span>
353+
</div>
350354

351355
<div v-if="visibleWindows.length" class="account-float__usage">
352356
<UsageBar

‎src/renderer/src/components/DisplayFieldPicker.vue‎

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,12 +1,12 @@
11
<script setup lang="ts">
22
import { computed } from 'vue'
33
import {
4+
ChartColumn,
45
CheckCheck,
56
CircleDollarSign,
6-
Layers,
77
LayoutDashboard,
8+
Network,
89
RotateCcw,
9-
Sparkles,
1010
Square,
1111
Zap
1212
} from '@lucide/vue'
@@ -41,8 +41,8 @@ const presetIcons: Record<string, unknown> = {
4141
Zap,
4242
LayoutDashboard,
4343
CircleDollarSign,
44-
Sparkles,
45-
Layers
44+
Network,
45+
ChartColumn
4646
}
4747
4848
function getPresetIcon(name: string): unknown {

0 commit comments

Comments
 (0)