diff --git a/src/app/(dashboard)/dashboard/usage/components/ProviderLimits/index.tsx b/src/app/(dashboard)/dashboard/usage/components/ProviderLimits/index.tsx index a0a450c127..9560014370 100644 --- a/src/app/(dashboard)/dashboard/usage/components/ProviderLimits/index.tsx +++ b/src/app/(dashboard)/dashboard/usage/components/ProviderLimits/index.tsx @@ -88,7 +88,7 @@ export default function ProviderLimits() { if (typeof window === "undefined") return false; return localStorage.getItem(LS_AUTO_REFRESH) === "true"; }); - const [lastUpdated, setLastUpdated] = useState(null); + const [lastRefreshedAt, setLastRefreshedAt] = useState>({}); const [refreshingAll, setRefreshingAll] = useState(false); const [countdown, setCountdown] = useState(120); const [initialLoading, setInitialLoading] = useState(true); @@ -181,6 +181,10 @@ export default function ProviderLimits() { raw: data, }, })); + setLastRefreshedAt((prev) => ({ + ...prev, + [connectionId]: new Date().toISOString(), + })); } catch (error) { setErrors((prev) => ({ ...prev, @@ -195,8 +199,7 @@ export default function ProviderLimits() { const refreshProvider = useCallback( async (connectionId, provider) => { - await fetchQuota(connectionId, provider); - setLastUpdated(new Date()); + await fetchQuota(connectionId, provider, { force: true }); }, [fetchQuota] ); @@ -216,9 +219,8 @@ export default function ProviderLimits() { const chunkSize = 5; for (let i = 0; i < usageConnections.length; i += chunkSize) { const chunk = usageConnections.slice(i, i + chunkSize); - await Promise.all(chunk.map((conn) => fetchQuota(conn.id, conn.provider))); + await Promise.all(chunk.map((conn) => fetchQuota(conn.id, conn.provider, { force: true }))); } - setLastUpdated(new Date()); } catch (error) { console.error("Error refreshing all:", error); } finally { @@ -520,7 +522,7 @@ export default function ProviderLimits() { {/* Table header */}
{t("account")}
{t("modelQuotas")}
@@ -539,6 +541,7 @@ export default function ProviderLimits() { }; const tierMeta = tierByConnection[conn.id] || normalizePlanTier(null); const resolvedPlan = resolvedPlanByConnection[conn.id]; + const refreshedAt = lastRefreshedAt[conn.id]; return (
@@ -670,11 +673,16 @@ export default function ProviderLimits() { )}
- {/* Last Used */} + {/* Last Refreshed */}
- {lastUpdated ? ( + {refreshedAt ? ( - {lastUpdated.toLocaleTimeString([], { hour: "2-digit", minute: "2-digit" })} + {new Date(refreshedAt).toLocaleTimeString([], { + hour: "2-digit", + minute: "2-digit", + second: "2-digit", + hour12: false, + })} ) : ( "-" diff --git a/src/i18n/messages/en.json b/src/i18n/messages/en.json index 4eac924275..957fc7f893 100644 --- a/src/i18n/messages/en.json +++ b/src/i18n/messages/en.json @@ -2382,7 +2382,7 @@ "loadingQuotas": "Loading...", "account": "Account", "modelQuotas": "Model Quotas", - "lastUsed": "Last Used", + "lastUsed": "Last Refreshed", "actions": "Actions", "refreshQuota": "Refresh quota", "today": "Today", diff --git a/src/i18n/messages/zh-CN.json b/src/i18n/messages/zh-CN.json index 35bf6a4bbb..bf1c537fb0 100644 --- a/src/i18n/messages/zh-CN.json +++ b/src/i18n/messages/zh-CN.json @@ -2376,7 +2376,7 @@ "loadingQuotas": "正在加载...", "account": "账户", "modelQuotas": "模型配额", - "lastUsed": "最后使用", + "lastUsed": "最后刷新", "actions": "操作", "refreshQuota": "刷新配额", "today": "今天",