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
a2ae9f1f
Unverified
Commit
a2ae9f1f
authored
Mar 08, 2026
by
Wesley Liddick
Committed by
GitHub
Mar 08, 2026
Browse files
Merge pull request #866 from touwaeriol/pr/apikey-quota-usage-bars
feat(frontend): add API Key quota progress bars to usage window
parents
034b84b7
4cd6d864
Changes
1
Hide whitespace changes
Inline
Side-by-side
frontend/src/components/account/AccountUsageCell.vue
View file @
a2ae9f1f
...
@@ -333,6 +333,29 @@
...
@@ -333,6 +333,29 @@
<div
v-else
>
<div
v-else
>
<!-- Gemini API Key accounts: show quota info -->
<!-- Gemini API Key accounts: show quota info -->
<AccountQuotaInfo
v-if=
"account.platform === 'gemini'"
:account=
"account"
/>
<AccountQuotaInfo
v-if=
"account.platform === 'gemini'"
:account=
"account"
/>
<!-- API Key accounts with quota limits: show progress bars -->
<div
v-else-if=
"hasApiKeyQuota"
class=
"space-y-1"
>
<UsageProgressBar
v-if=
"quotaDailyBar"
label=
"1d"
:utilization=
"quotaDailyBar.utilization"
:resets-at=
"quotaDailyBar.resetsAt"
color=
"indigo"
/>
<UsageProgressBar
v-if=
"quotaWeeklyBar"
label=
"7d"
:utilization=
"quotaWeeklyBar.utilization"
:resets-at=
"quotaWeeklyBar.resetsAt"
color=
"emerald"
/>
<UsageProgressBar
v-if=
"quotaTotalBar"
label=
"total"
:utilization=
"quotaTotalBar.utilization"
color=
"purple"
/>
</div>
<div
v-else
class=
"text-xs text-gray-400"
>
-
</div>
<div
v-else
class=
"text-xs text-gray-400"
>
-
</div>
</div>
</div>
</template>
</template>
...
@@ -809,6 +832,59 @@ const loadUsage = async () => {
...
@@ -809,6 +832,59 @@ const loadUsage = async () => {
}
}
}
}
// ===== API Key quota progress bars =====
interface
QuotaBarInfo
{
utilization
:
number
resetsAt
:
string
|
null
}
const
makeQuotaBar
=
(
used
:
number
,
limit
:
number
,
startKey
?:
string
):
QuotaBarInfo
=>
{
const
utilization
=
limit
>
0
?
(
used
/
limit
)
*
100
:
0
let
resetsAt
:
string
|
null
=
null
if
(
startKey
)
{
const
extra
=
props
.
account
.
extra
as
Record
<
string
,
unknown
>
|
undefined
const
startStr
=
extra
?.[
startKey
]
as
string
|
undefined
if
(
startStr
)
{
const
startDate
=
new
Date
(
startStr
)
const
periodMs
=
startKey
.
includes
(
'
daily
'
)
?
24
*
60
*
60
*
1000
:
7
*
24
*
60
*
60
*
1000
resetsAt
=
new
Date
(
startDate
.
getTime
()
+
periodMs
).
toISOString
()
}
}
return
{
utilization
,
resetsAt
}
}
const
hasApiKeyQuota
=
computed
(()
=>
{
if
(
props
.
account
.
type
!==
'
apikey
'
)
return
false
return
(
(
props
.
account
.
quota_daily_limit
??
0
)
>
0
||
(
props
.
account
.
quota_weekly_limit
??
0
)
>
0
||
(
props
.
account
.
quota_limit
??
0
)
>
0
)
})
const
quotaDailyBar
=
computed
(():
QuotaBarInfo
|
null
=>
{
const
limit
=
props
.
account
.
quota_daily_limit
??
0
if
(
limit
<=
0
)
return
null
return
makeQuotaBar
(
props
.
account
.
quota_daily_used
??
0
,
limit
,
'
quota_daily_start
'
)
})
const
quotaWeeklyBar
=
computed
(():
QuotaBarInfo
|
null
=>
{
const
limit
=
props
.
account
.
quota_weekly_limit
??
0
if
(
limit
<=
0
)
return
null
return
makeQuotaBar
(
props
.
account
.
quota_weekly_used
??
0
,
limit
,
'
quota_weekly_start
'
)
})
const
quotaTotalBar
=
computed
(():
QuotaBarInfo
|
null
=>
{
const
limit
=
props
.
account
.
quota_limit
??
0
if
(
limit
<=
0
)
return
null
return
makeQuotaBar
(
props
.
account
.
quota_used
??
0
,
limit
)
})
onMounted
(()
=>
{
onMounted
(()
=>
{
if
(
!
shouldAutoLoadUsageOnMount
.
value
)
return
if
(
!
shouldAutoLoadUsageOnMount
.
value
)
return
loadUsage
()
loadUsage
()
...
...
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