Skip to content
GitLab
Menu
Projects
Groups
Snippets
Loading...
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Sign in / Register
Toggle navigation
Menu
Open sidebar
陈曦
sub2api
Commits
11bfc807
Commit
11bfc807
authored
Jan 09, 2026
by
song
Browse files
merge upstream/main
parents
c2a6ca8d
62dc0b95
Changes
101
Show whitespace changes
Inline
Side-by-side
frontend/src/views/user/UsageView.vue
View file @
11bfc807
...
...
@@ -308,6 +308,11 @@
}}
</span>
</
template
>
<
template
#cell-user_agent=
"{ row }"
>
<span
v-if=
"row.user_agent"
class=
"text-sm text-gray-600 dark:text-gray-400 max-w-[150px] truncate block"
:title=
"row.user_agent"
>
{{
formatUserAgent
(
row
.
user_agent
)
}}
</span>
<span
v-else
class=
"text-sm text-gray-400 dark:text-gray-500"
>
-
</span>
</
template
>
<
template
#empty
>
<EmptyState
:message=
"t('usage.noRecords')"
/>
</
template
>
...
...
@@ -480,7 +485,8 @@ const columns = computed<Column[]>(() => [
{
key
:
'
billing_type
'
,
label
:
t
(
'
usage.billingType
'
),
sortable
:
false
},
{
key
:
'
first_token
'
,
label
:
t
(
'
usage.firstToken
'
),
sortable
:
false
},
{
key
:
'
duration
'
,
label
:
t
(
'
usage.duration
'
),
sortable
:
false
},
{
key
:
'
created_at
'
,
label
:
t
(
'
usage.time
'
),
sortable
:
true
}
{
key
:
'
created_at
'
,
label
:
t
(
'
usage.time
'
),
sortable
:
true
},
{
key
:
'
user_agent
'
,
label
:
t
(
'
usage.userAgent
'
),
sortable
:
false
}
])
const
usageLogs
=
ref
<
UsageLog
[]
>
([])
...
...
@@ -545,6 +551,19 @@ const formatDuration = (ms: number): string => {
return
`
${(
ms
/
1000
).
toFixed
(
2
)}
s`
}
const
formatUserAgent
=
(
ua
:
string
):
string
=>
{
// 提取主要客户端标识
if
(
ua
.
includes
(
'
claude-cli
'
))
return
ua
.
match
(
/claude-cli
\/[\d
.
]
+/
)?.[
0
]
||
'
Claude CLI
'
if
(
ua
.
includes
(
'
Cursor
'
))
return
'
Cursor
'
if
(
ua
.
includes
(
'
VSCode
'
)
||
ua
.
includes
(
'
vscode
'
))
return
'
VS Code
'
if
(
ua
.
includes
(
'
Continue
'
))
return
'
Continue
'
if
(
ua
.
includes
(
'
Cline
'
))
return
'
Cline
'
if
(
ua
.
includes
(
'
OpenAI
'
))
return
'
OpenAI SDK
'
if
(
ua
.
includes
(
'
anthropic
'
))
return
'
Anthropic SDK
'
// 截断过长的 UA
return
ua
.
length
>
30
?
ua
.
substring
(
0
,
30
)
+
'
...
'
:
ua
}
const
formatTokens
=
(
value
:
number
):
string
=>
{
if
(
value
>=
1
_000_000_000
)
{
return
`
${(
value
/
1
_000_000_000
).
toFixed
(
2
)}
B`
...
...
Prev
1
2
3
4
5
6
Next
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
.
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment