mirror of
https://github.com/toeverything/AFFiNE.git
synced 2026-02-19 15:26:59 +08:00
feat: check quota correctly (#6561)
This commit is contained in:
@@ -70,7 +70,9 @@ export const AIUsagePanelNotSubscripted = () => {
|
||||
const { data: quota } = useQuery({
|
||||
query: getCopilotQuotaQuery,
|
||||
});
|
||||
const { limit = 10, used = 0 } = quota.currentUser?.copilot.quota || {};
|
||||
const { limit: nullableLimit, used = 0 } =
|
||||
quota.currentUser?.copilot.quota || {};
|
||||
const limit = nullableLimit || 10;
|
||||
const percent = Math.min(
|
||||
100,
|
||||
Math.max(0.5, Number(((used / limit) * 100).toFixed(4)))
|
||||
|
||||
Reference in New Issue
Block a user