diff --git a/frontend/src/components/account/AccountUsageCell.vue b/frontend/src/components/account/AccountUsageCell.vue index 1c023fb3..2c04e673 100644 --- a/frontend/src/components/account/AccountUsageCell.vue +++ b/frontend/src/components/account/AccountUsageCell.vue @@ -332,6 +332,37 @@
+
+
+ + {{ formatKeyRequests }} req + + + {{ formatKeyTokens }} + + + A ${{ formatKeyCost }} + + + U ${{ formatKeyUserCost }} + +
+
+
+
+
+
+
@@ -512,6 +543,10 @@ const shouldFetchUsage = computed(() => { return false }) +const showGeminiTodayStats = computed(() => { + return props.account.platform === 'gemini' && props.account.type === 'service_account' +}) + const geminiUsageAvailable = computed(() => { return ( !!usageInfo.value?.gemini_shared_daily || diff --git a/frontend/src/components/account/__tests__/AccountUsageCell.spec.ts b/frontend/src/components/account/__tests__/AccountUsageCell.spec.ts index 9158da64..fa4104f6 100644 --- a/frontend/src/components/account/__tests__/AccountUsageCell.spec.ts +++ b/frontend/src/components/account/__tests__/AccountUsageCell.spec.ts @@ -57,6 +57,19 @@ function makeAccount(overrides: Partial): Account { describe('AccountUsageCell', () => { beforeEach(() => { getUsage.mockReset() + Object.defineProperty(window, 'matchMedia', { + writable: true, + value: vi.fn().mockImplementation(() => ({ + matches: true, + media: '(min-width: 768px)', + onchange: null, + addListener: vi.fn(), + removeListener: vi.fn(), + addEventListener: vi.fn(), + removeEventListener: vi.fn(), + dispatchEvent: vi.fn(), + })) + }) }) it('Antigravity 图片用量会聚合新旧 image 模型', async () => { @@ -603,4 +616,43 @@ describe('AccountUsageCell', () => { expect(wrapper.text().trim()).toBe('-') }) + + it('Vertex 账号会在 Gemini 用量窗口里展示 today stats 徽章', async () => { + const wrapper = mount(AccountUsageCell, { + props: { + account: makeAccount({ + id: 4001, + platform: 'gemini', + type: 'service_account', + credentials: { + tier_id: 'vertex', + project_id: 'vertex-proj', + client_email: 'svc@vertex-proj.iam.gserviceaccount.com', + location: 'global' + }, + extra: {} + }), + todayStats: { + requests: 0, + tokens: 0, + cost: 0, + standard_cost: 0, + user_cost: 0 + } + }, + global: { + stubs: { + UsageProgressBar: true, + AccountQuotaInfo: true + } + } + }) + + await flushPromises() + + expect(wrapper.text()).toContain('0 req') + expect(wrapper.text()).toContain('0') + expect(wrapper.text()).toContain('A $0.00') + expect(wrapper.text()).toContain('U $0.00') + }) })