feat(services): add pagination and enhanced filtering for request logs

Usage stats service:
- Change get_request_logs() from limit/offset to page/page_size pagination
- Return PaginatedLogs with total count, page, and page_size
- Add appType and providerName filters with LIKE search
- Add is_streaming, first_token_ms, duration_ms to RequestLogDetail
- Join with providers table for provider name lookup

Commands:
- Update get_request_logs command signature for pagination params

Module exports:
- Export PaginatedLogs struct
This commit is contained in:
YoVinchen
2025-12-03 21:53:12 +08:00
parent b496e250dd
commit 72412e7abd
3 changed files with 202 additions and 77 deletions
+4 -4
View File
@@ -41,10 +41,10 @@ pub fn get_model_stats(state: State<'_, AppState>) -> Result<Vec<ModelStats>, Ap
pub fn get_request_logs(
state: State<'_, AppState>,
filters: LogFilters,
limit: u32,
offset: u32,
) -> Result<Vec<RequestLogDetail>, AppError> {
state.db.get_request_logs(&filters, limit, offset)
page: u32,
page_size: u32,
) -> Result<PaginatedLogs, AppError> {
state.db.get_request_logs(&filters, page, page_size)
}
/// 获取单个请求详情