Spaces:
Configuration error
Configuration error
Download frontend/src/state/metrics-slice.ts from flyingdarkdev/README: direct link, hf CLI and curl.
- Browser
- Download file 667 Bytes
-
https://huggingface.co/spaces/flyingdarkdev/README/resolve/main/frontend/src/state/metrics-slice.ts
- Command line
-
hf download hf://spaces/flyingdarkdev/README/frontend/src/state/metrics-slice.ts
-
curl -L -o metrics-slice.ts https://huggingface.co/spaces/flyingdarkdev/README/resolve/main/frontend/src/state/metrics-slice.ts
667 Bytes
| import { createSlice, PayloadAction } from "@reduxjs/toolkit"; | |
| interface MetricsState { | |
| cost: number | null; | |
| usage: { | |
| prompt_tokens: number; | |
| completion_tokens: number; | |
| cache_read_tokens: number; | |
| cache_write_tokens: number; | |
| } | null; | |
| } | |
| const initialState: MetricsState = { | |
| cost: null, | |
| usage: null, | |
| }; | |
| const metricsSlice = createSlice({ | |
| name: "metrics", | |
| initialState, | |
| reducers: { | |
| setMetrics: (state, action: PayloadAction<MetricsState>) => { | |
| state.cost = action.payload.cost; | |
| state.usage = action.payload.usage; | |
| }, | |
| }, | |
| }); | |
| export const { setMetrics } = metricsSlice.actions; | |
| export default metricsSlice.reducer; | |