File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change 11# CHANGELOG
22
3+ ## 2026-03-08
4+
5+ - 修复 Explore 页时间范围与主图末尾日期不一致的问题:
6+ - 后端探索明细查询移除默认 ` limit(50000) ` 截断,避免在高频数据下只返回时间范围前段记录、导致主图停在较早日期。
7+ - 保留 ` maxPoints ` 参数能力,仅在显式传入时才限制返回条数。
8+ - 前端在 Explore 明细点数超过 ` 20,000 ` 时默认关闭散点图开关,优先保证全量时间范围可见,同时降低大数据量下的 SVG 渲染压力。
9+
310## 2026-03-07
411
512- 修复每小时负载分布堆叠图中"输入"与"缓存"重复计数的问题:
Original file line number Diff line number Diff line change @@ -57,6 +57,7 @@ const TOKEN_COLORS = {
5757
5858const CHART_MARGIN = { top : 8 , right : 12 , left : 8 , bottom : 12 } ;
5959const CHART_TOP_INSET = 4 ;
60+ const AUTO_HIDE_SCATTER_THRESHOLD = 20_000 ;
6061
6162function clamp ( num : number , min : number , max : number ) {
6263 return Math . min ( Math . max ( num , min ) , max ) ;
@@ -1261,6 +1262,7 @@ export default function ExplorePage() {
12611262 const pointCount = json . points ?. length ?? 0 ;
12621263 // 点数超过 5000 自动启用过滤无效点
12631264 if ( pointCount > 5000 ) setFilterInvalidPoints ( true ) ;
1265+ setShowScatter ( pointCount <= AUTO_HIDE_SCATTER_THRESHOLD ) ;
12641266 setAppliedDays ( json . days ?? rangeDays ) ;
12651267 setRouteOptions ( Array . from ( new Set ( json . filters ?. routes ?? [ ] ) ) ) ;
12661268 setNameOptions ( Array . from ( new Set ( json . filters ?. names ?? [ ] ) ) ) ;
Original file line number Diff line number Diff line change @@ -40,8 +40,7 @@ function withDayEnd(date: Date) {
4040}
4141
4242function normalizeMaxPoints ( value ?: number | null ) {
43- const fallback = 50_000 ;
44- if ( value == null || Number . isNaN ( value ) ) return fallback ;
43+ if ( value == null || Number . isNaN ( value ) ) return null ;
4544 return Math . min ( Math . max ( Math . floor ( value ) , 1_000 ) , 100_000 ) ;
4645}
4746
@@ -138,7 +137,7 @@ export async function getExplorePoints(
138137
139138 // 直接按时间排序查询,不再使用 row_number() 抽样;默认在 SQL 层过滤 tokens=0 的无效点
140139 const pointsWhere = shouldFilterInvalid ? and ( ...whereParts , sql `${ usageRecords . totalTokens } != 0` ) : where ;
141- const points : Array < { ts : number ; tokens : number ; inputTokens : number ; outputTokens : number ; reasoningTokens : number ; cachedTokens : number ; model : string } > = await db
140+ let pointsQuery : any = db
142141 . select ( {
143142 ts : sql < number > `(extract(epoch from ${ usageRecords . occurredAt } ) * 1000)::bigint` ,
144143 tokens : sql < number > `${ usageRecords . totalTokens } ` ,
@@ -150,8 +149,13 @@ export async function getExplorePoints(
150149 } )
151150 . from ( usageRecords )
152151 . where ( pointsWhere )
153- . orderBy ( usageRecords . occurredAt )
154- . limit ( maxPoints ) ;
152+ . orderBy ( usageRecords . occurredAt ) ;
153+
154+ if ( maxPoints != null ) {
155+ pointsQuery = pointsQuery . limit ( maxPoints ) ;
156+ }
157+
158+ const points : Array < { ts : number ; tokens : number ; inputTokens : number ; outputTokens : number ; reasoningTokens : number ; cachedTokens : number ; model : string } > = await pointsQuery ;
155159
156160 return {
157161 days,
You can’t perform that action at this time.
0 commit comments