mirror of
https://github.com/fawney19/Aether.git
synced 2026-09-01 17:00:21 +08:00
fix(usage): 修复多天统计 NUMERIC→f64 解码失败导致记录清空
- 多天统计从日聚合表 SUM numeric 字段后返回 NUMERIC,代码按 f64 解码失败 - 显式添加 ::DOUBLE PRECISION 类型转换 - 管理员统计加载失败时不再清空已加载的记录列表
This commit is contained in:
@@ -1244,10 +1244,10 @@ SELECT
|
|||||||
COALESCE(SUM(cache_creation_tokens), 0)::BIGINT AS cache_creation_tokens,
|
COALESCE(SUM(cache_creation_tokens), 0)::BIGINT AS cache_creation_tokens,
|
||||||
COALESCE(SUM(cache_read_tokens), 0)::BIGINT AS cache_read_tokens,
|
COALESCE(SUM(cache_read_tokens), 0)::BIGINT AS cache_read_tokens,
|
||||||
COALESCE(SUM(total_input_context), 0)::BIGINT AS total_input_context,
|
COALESCE(SUM(total_input_context), 0)::BIGINT AS total_input_context,
|
||||||
COALESCE(SUM(cache_creation_cost), 0) AS cache_creation_cost_usd,
|
COALESCE(SUM(cache_creation_cost), 0)::DOUBLE PRECISION AS cache_creation_cost_usd,
|
||||||
COALESCE(SUM(cache_read_cost), 0) AS cache_read_cost_usd,
|
COALESCE(SUM(cache_read_cost), 0)::DOUBLE PRECISION AS cache_read_cost_usd,
|
||||||
COALESCE(SUM(total_cost), 0) AS total_cost_usd,
|
COALESCE(SUM(total_cost), 0)::DOUBLE PRECISION AS total_cost_usd,
|
||||||
COALESCE(SUM(actual_total_cost), 0) AS actual_total_cost_usd,
|
COALESCE(SUM(actual_total_cost), 0)::DOUBLE PRECISION AS actual_total_cost_usd,
|
||||||
COALESCE(SUM(error_requests), 0)::BIGINT AS error_requests,
|
COALESCE(SUM(error_requests), 0)::BIGINT AS error_requests,
|
||||||
COALESCE(SUM(response_time_sum_ms), 0) AS response_time_sum_ms,
|
COALESCE(SUM(response_time_sum_ms), 0) AS response_time_sum_ms,
|
||||||
COALESCE(SUM(response_time_samples), 0)::BIGINT AS response_time_samples
|
COALESCE(SUM(response_time_samples), 0)::BIGINT AS response_time_samples
|
||||||
@@ -1275,10 +1275,10 @@ SELECT
|
|||||||
COALESCE(SUM(cache_creation_tokens), 0)::BIGINT AS cache_creation_tokens,
|
COALESCE(SUM(cache_creation_tokens), 0)::BIGINT AS cache_creation_tokens,
|
||||||
COALESCE(SUM(cache_read_tokens), 0)::BIGINT AS cache_read_tokens,
|
COALESCE(SUM(cache_read_tokens), 0)::BIGINT AS cache_read_tokens,
|
||||||
COALESCE(SUM(total_input_context), 0)::BIGINT AS total_input_context,
|
COALESCE(SUM(total_input_context), 0)::BIGINT AS total_input_context,
|
||||||
COALESCE(SUM(cache_creation_cost), 0) AS cache_creation_cost_usd,
|
COALESCE(SUM(cache_creation_cost), 0)::DOUBLE PRECISION AS cache_creation_cost_usd,
|
||||||
COALESCE(SUM(cache_read_cost), 0) AS cache_read_cost_usd,
|
COALESCE(SUM(cache_read_cost), 0)::DOUBLE PRECISION AS cache_read_cost_usd,
|
||||||
COALESCE(SUM(total_cost), 0) AS total_cost_usd,
|
COALESCE(SUM(total_cost), 0)::DOUBLE PRECISION AS total_cost_usd,
|
||||||
COALESCE(SUM(actual_total_cost), 0) AS actual_total_cost_usd,
|
COALESCE(SUM(actual_total_cost), 0)::DOUBLE PRECISION AS actual_total_cost_usd,
|
||||||
COALESCE(SUM(error_requests), 0)::BIGINT AS error_requests,
|
COALESCE(SUM(error_requests), 0)::BIGINT AS error_requests,
|
||||||
COALESCE(SUM(response_time_sum_ms), 0) AS response_time_sum_ms,
|
COALESCE(SUM(response_time_sum_ms), 0) AS response_time_sum_ms,
|
||||||
COALESCE(SUM(response_time_samples), 0)::BIGINT AS response_time_samples
|
COALESCE(SUM(response_time_samples), 0)::BIGINT AS response_time_samples
|
||||||
@@ -2274,10 +2274,10 @@ SELECT
|
|||||||
COALESCE(SUM(cache_creation_ephemeral_1h_tokens), 0)::BIGINT
|
COALESCE(SUM(cache_creation_ephemeral_1h_tokens), 0)::BIGINT
|
||||||
AS cache_creation_ephemeral_1h_tokens,
|
AS cache_creation_ephemeral_1h_tokens,
|
||||||
COALESCE(SUM(cache_read_tokens), 0)::BIGINT AS cache_read_tokens,
|
COALESCE(SUM(cache_read_tokens), 0)::BIGINT AS cache_read_tokens,
|
||||||
COALESCE(SUM(total_cost), 0) AS total_cost_usd,
|
COALESCE(SUM(total_cost), 0)::DOUBLE PRECISION AS total_cost_usd,
|
||||||
COALESCE(SUM(actual_total_cost), 0) AS actual_total_cost_usd,
|
COALESCE(SUM(actual_total_cost), 0)::DOUBLE PRECISION AS actual_total_cost_usd,
|
||||||
COALESCE(SUM(cache_creation_cost), 0) AS cache_creation_cost_usd,
|
COALESCE(SUM(cache_creation_cost), 0)::DOUBLE PRECISION AS cache_creation_cost_usd,
|
||||||
COALESCE(SUM(cache_read_cost), 0) AS cache_read_cost_usd,
|
COALESCE(SUM(cache_read_cost), 0)::DOUBLE PRECISION AS cache_read_cost_usd,
|
||||||
COALESCE(SUM(response_time_sum_ms), 0) AS total_response_time_ms,
|
COALESCE(SUM(response_time_sum_ms), 0) AS total_response_time_ms,
|
||||||
COALESCE(SUM(error_requests), 0)::BIGINT AS error_requests
|
COALESCE(SUM(error_requests), 0)::BIGINT AS error_requests
|
||||||
FROM stats_user_daily
|
FROM stats_user_daily
|
||||||
@@ -2306,10 +2306,10 @@ SELECT
|
|||||||
COALESCE(SUM(cache_creation_ephemeral_1h_tokens), 0)::BIGINT
|
COALESCE(SUM(cache_creation_ephemeral_1h_tokens), 0)::BIGINT
|
||||||
AS cache_creation_ephemeral_1h_tokens,
|
AS cache_creation_ephemeral_1h_tokens,
|
||||||
COALESCE(SUM(cache_read_tokens), 0)::BIGINT AS cache_read_tokens,
|
COALESCE(SUM(cache_read_tokens), 0)::BIGINT AS cache_read_tokens,
|
||||||
COALESCE(SUM(total_cost), 0) AS total_cost_usd,
|
COALESCE(SUM(total_cost), 0)::DOUBLE PRECISION AS total_cost_usd,
|
||||||
COALESCE(SUM(actual_total_cost), 0) AS actual_total_cost_usd,
|
COALESCE(SUM(actual_total_cost), 0)::DOUBLE PRECISION AS actual_total_cost_usd,
|
||||||
COALESCE(SUM(cache_creation_cost), 0) AS cache_creation_cost_usd,
|
COALESCE(SUM(cache_creation_cost), 0)::DOUBLE PRECISION AS cache_creation_cost_usd,
|
||||||
COALESCE(SUM(cache_read_cost), 0) AS cache_read_cost_usd,
|
COALESCE(SUM(cache_read_cost), 0)::DOUBLE PRECISION AS cache_read_cost_usd,
|
||||||
COALESCE(SUM(response_time_sum_ms), 0) AS total_response_time_ms,
|
COALESCE(SUM(response_time_sum_ms), 0) AS total_response_time_ms,
|
||||||
COALESCE(SUM(error_requests), 0)::BIGINT AS error_requests
|
COALESCE(SUM(error_requests), 0)::BIGINT AS error_requests
|
||||||
FROM stats_daily
|
FROM stats_daily
|
||||||
|
|||||||
@@ -260,7 +260,10 @@ export function useUsageData(options: UseUsageDataOptions) {
|
|||||||
}
|
}
|
||||||
stats.value = createDefaultStats()
|
stats.value = createDefaultStats()
|
||||||
modelStats.value = []
|
modelStats.value = []
|
||||||
currentRecords.value = []
|
if (!isAdminPage.value) {
|
||||||
|
currentRecords.value = []
|
||||||
|
totalRecords.value = 0
|
||||||
|
}
|
||||||
} finally {
|
} finally {
|
||||||
if (requestId === loadStatsRequestId) {
|
if (requestId === loadStatsRequestId) {
|
||||||
isLoadingStats.value = false
|
isLoadingStats.value = false
|
||||||
|
|||||||
Reference in New Issue
Block a user