mirror of
https://wget.la/https://github.com/leookun/cursor-byok
synced 2026-10-05 12:13:05 +08:00
- 主时间栏移除近4小时/近24小时,改为自定义弹层顶部的快捷范围 - 近4小时点击后弹出粒度菜单:1分钟/15分钟/30分钟/1小时 - overview API 新增 bucket_ms 参数,支持客户端指定分桶粒度 - 指定粒度时桶数上限放宽至 1440,未指定时维持原自动逻辑
37 lines
806 B
Rust
37 lines
806 B
Rust
//! Implements control dashboard overview endpoints.
|
|
//! HTTP handler for the desktop overview aggregates.
|
|
|
|
use axum::{
|
|
extract::{Query, State},
|
|
Json,
|
|
};
|
|
use serde::Deserialize;
|
|
|
|
use crate::{model::Overview, Result};
|
|
|
|
use super::ControlService;
|
|
|
|
#[derive(Debug, Default, Deserialize)]
|
|
pub struct OverviewRange {
|
|
start_ms: Option<i64>,
|
|
end_ms: Option<i64>,
|
|
model_hashes: Option<String>,
|
|
bucket_ms: Option<i64>,
|
|
}
|
|
|
|
pub async fn get(
|
|
State(service): State<ControlService>,
|
|
Query(range): Query<OverviewRange>,
|
|
) -> Result<Json<Overview>> {
|
|
Ok(Json(
|
|
service
|
|
.overview(
|
|
range.start_ms,
|
|
range.end_ms,
|
|
range.model_hashes.as_deref(),
|
|
range.bucket_ms,
|
|
)
|
|
.await?,
|
|
))
|
|
}
|