Revert "Merge remote-tracking branch 'origin/pr/592'"

This reverts commit 3504875922, reversing
changes made to 5c3a1aecbe.
This commit is contained in:
fawney19
2026-05-28 17:10:27 +08:00
parent ef2a96bcc4
commit ffd8d273c4
26 changed files with 92 additions and 1034 deletions
+3 -30
View File
@@ -100,7 +100,6 @@
:total-records="effectiveTotalRecords"
:page-size-options="pageSizeOptions"
:auto-refresh="globalAutoRefresh"
:display-now-ms="calibratedDisplayNowMs"
@update:time-range="handleTimeRangeChange"
@update:filter-search="handleFilterSearchChange"
@update:filter-user="handleFilterUserChange"
@@ -149,7 +148,6 @@ import {
IntervalTimelineCard
} from '@/features/usage/components'
import {
useActiveElapsedDisplayClock,
useUsageData,
getDateRangeFromPeriod
} from '@/features/usage/composables'
@@ -248,10 +246,7 @@ const {
availableModels,
availableProviders,
loadStats,
loadRecords,
serverClockOffsetMs,
hasServerClockOffset,
updateServerClockOffset
loadRecords
} = useUsageData({ isAdminPage })
// 热力图状态
@@ -439,7 +434,6 @@ const AUTO_REFRESH_INTERVAL = 1000 // 1秒刷新一次(用于活跃请求)
const ACTIVE_DISCOVERY_HOT_INTERVAL = 1000 // 有活跃请求时 1 秒扫描一次
const ACTIVE_DISCOVERY_IDLE_INTERVAL = 5000 // 空闲时降频,避免后台持续刷日志
const GLOBAL_AUTO_REFRESH_INTERVAL = 3000 // 3秒刷新一次(全局自动刷新)
const ACTIVE_ELAPSED_DISPLAY_INTERVAL = 250 // 共享显示时钟,避免每行单独动画
const globalAutoRefresh = ref(false) // 全局自动刷新开关(默认关闭)
const isPageVisible = ref(typeof document === 'undefined' ? true : !document.hidden)
@@ -451,14 +445,10 @@ const discoveredActiveRequestIds = new Set<string>()
async function loadActiveRequestUpdates(ids?: string[]) {
if (isAdminPage.value) {
const result = await usageApi.getActiveRequests(ids, timeRange.value)
updateServerClockOffset(result.server_timing)
return result
return usageApi.getActiveRequests(ids, timeRange.value)
}
const idsParam = ids?.length ? ids.join(',') : undefined
const result = await meApi.getActiveRequests(idsParam)
updateServerClockOffset(result.server_timing)
return result
return meApi.getActiveRequests(idsParam)
}
async function pollActiveRequests() {
@@ -724,10 +714,8 @@ function handleVisibilityChange() {
stopAutoRefresh()
stopActiveDiscovery()
stopGlobalAutoRefresh()
stopActiveElapsedDisplayTimer()
return
}
syncActiveElapsedDisplayTimer()
if (hasActiveRequests.value) {
startAutoRefresh()
}
@@ -744,7 +732,6 @@ onUnmounted(() => {
stopAutoRefresh()
stopActiveDiscovery()
stopGlobalAutoRefresh()
stopActiveElapsedDisplayClock()
})
// 用户页面的前端分页(后端一次性返回所有记录,前端分页+筛选)
@@ -768,20 +755,6 @@ const effectiveTotalRecords = computed(() => {
// 显示的记录
const displayRecords = computed(() => paginatedRecords.value)
const {
calibratedDisplayNowMs,
stopActiveElapsedDisplayTimer,
syncActiveElapsedDisplayTimer,
stopActiveElapsedDisplayClock,
} = useActiveElapsedDisplayClock({
records: displayRecords,
isPageVisible,
serverClockOffsetMs,
hasServerClockOffset,
resolveStatus: resolveDisplayRequestStatus,
intervalMs: ACTIVE_ELAPSED_DISPLAY_INTERVAL,
})
const availableClientFamilies = computed(() => {
const families = new Set<string>()
currentRecords.value.forEach((record) => {