( selectedProjectId: string, startDate: string | null | undefined, endDate: string | null | undefined, )
| 267 | }; |
| 268 | |
| 269 | export const useStats = ( |
| 270 | selectedProjectId: string, |
| 271 | startDate: string | null | undefined, |
| 272 | endDate: string | null | undefined, |
| 273 | ) => { |
| 274 | const startDateUTC = startDate |
| 275 | ? toUTC(new Date(startDate)).startOf("day").toDate() |
| 276 | : toUTC(new Date()).startOf("month").toDate(); |
| 277 | |
| 278 | const endDateUTC = endDate |
| 279 | ? toUTC(new Date(endDate)).endOf("day").toDate() |
| 280 | : toUTC(new Date()).endOf("month").toDate(); |
| 281 | |
| 282 | return api.usage.stats.useQuery( |
| 283 | { |
| 284 | projectId: selectedProjectId, |
| 285 | startDate: startDateUTC, |
| 286 | endDate: endDateUTC, |
| 287 | }, |
| 288 | { enabled: !!selectedProjectId }, |
| 289 | ); |
| 290 | }; |
| 291 | |
| 292 | export const useModelTestingStats = ( |
| 293 | datasetId?: string, |
no test coverage detected