Skip to content

Commit c64465f

Browse files
test(frontend): align admin usage typing with upstream model
Ultraworked with [Sisyphus](https://github.com/code-yeongyu/oh-my-openagent) Co-authored-by: Sisyphus <clio-agent@sisyphuslabs.ai>
1 parent 095200b commit c64465f

2 files changed

Lines changed: 41 additions & 1 deletion

File tree

frontend/src/components/admin/usage/__tests__/UsageTable.spec.ts

Lines changed: 39 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -39,6 +39,7 @@ const DataTableStub = {
3939
template: `
4040
<div>
4141
<div v-for="row in data" :key="row.request_id">
42+
<slot name="cell-model" :row="row" :value="row.model" />
4243
<slot name="cell-cost" :row="row" />
4344
</div>
4445
</div>
@@ -108,4 +109,42 @@ describe('admin UsageTable tooltip', () => {
108109
expect(text).toContain('$30.0000 / 1M tokens')
109110
expect(text).toContain('$0.069568')
110111
})
112+
113+
it('shows requested and upstream models separately for admin rows', () => {
114+
const row = {
115+
request_id: 'req-admin-model-1',
116+
model: 'claude-sonnet-4',
117+
upstream_model: 'claude-sonnet-4-20250514',
118+
actual_cost: 0,
119+
total_cost: 0,
120+
account_rate_multiplier: 1,
121+
rate_multiplier: 1,
122+
input_cost: 0,
123+
output_cost: 0,
124+
cache_creation_cost: 0,
125+
cache_read_cost: 0,
126+
input_tokens: 0,
127+
output_tokens: 0,
128+
}
129+
130+
const wrapper = mount(UsageTable, {
131+
props: {
132+
data: [row],
133+
loading: false,
134+
columns: [],
135+
},
136+
global: {
137+
stubs: {
138+
DataTable: DataTableStub,
139+
EmptyState: true,
140+
Icon: true,
141+
Teleport: true,
142+
},
143+
},
144+
})
145+
146+
const text = wrapper.text()
147+
expect(text).toContain('claude-sonnet-4')
148+
expect(text).toContain('claude-sonnet-4-20250514')
149+
})
111150
})

frontend/src/types/index.ts

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -978,7 +978,6 @@ export interface UsageLog {
978978
account_id: number | null
979979
request_id: string
980980
model: string
981-
upstream_model?: string | null
982981
service_tier?: string | null
983982
reasoning_effort?: string | null
984983
inbound_endpoint?: string | null
@@ -1033,6 +1032,8 @@ export interface UsageLogAccountSummary {
10331032
}
10341033

10351034
export interface AdminUsageLog extends UsageLog {
1035+
upstream_model?: string | null
1036+
10361037
// 账号计费倍率(仅管理员可见)
10371038
account_rate_multiplier?: number | null
10381039

0 commit comments

Comments
 (0)