Spaces:
Configuration error
Configuration error
Download frontend/src/state/initial-query-slice.ts from flyingdarkdev/README: direct link, hf CLI and curl.
- Browser
- Download file 1.48 kB
-
https://huggingface.co/spaces/flyingdarkdev/README/resolve/main/frontend/src/state/initial-query-slice.ts
- Command line
-
hf download hf://spaces/flyingdarkdev/README/frontend/src/state/initial-query-slice.ts
-
curl -L -o initial-query-slice.ts https://huggingface.co/spaces/flyingdarkdev/README/resolve/main/frontend/src/state/initial-query-slice.ts
1.48 kB
| import { createSlice, PayloadAction } from "@reduxjs/toolkit"; | |
| type SliceState = { | |
| files: string[]; // base64 encoded images | |
| initialPrompt: string | null; | |
| selectedRepository: string | null; | |
| replayJson: string | null; | |
| }; | |
| const initialState: SliceState = { | |
| files: [], | |
| initialPrompt: null, | |
| selectedRepository: null, | |
| replayJson: null, | |
| }; | |
| export const selectedFilesSlice = createSlice({ | |
| name: "initialQuery", | |
| initialState, | |
| reducers: { | |
| addFile(state, action: PayloadAction<string>) { | |
| state.files.push(action.payload); | |
| }, | |
| removeFile(state, action: PayloadAction<number>) { | |
| state.files.splice(action.payload, 1); | |
| }, | |
| clearFiles(state) { | |
| state.files = []; | |
| }, | |
| setInitialPrompt(state, action: PayloadAction<string>) { | |
| state.initialPrompt = action.payload; | |
| }, | |
| clearInitialPrompt(state) { | |
| state.initialPrompt = null; | |
| }, | |
| setSelectedRepository(state, action: PayloadAction<string | null>) { | |
| state.selectedRepository = action.payload; | |
| }, | |
| clearSelectedRepository(state) { | |
| state.selectedRepository = null; | |
| }, | |
| setReplayJson(state, action: PayloadAction<string | null>) { | |
| state.replayJson = action.payload; | |
| }, | |
| }, | |
| }); | |
| export const { | |
| addFile, | |
| removeFile, | |
| clearFiles, | |
| setInitialPrompt, | |
| clearInitialPrompt, | |
| setSelectedRepository, | |
| clearSelectedRepository, | |
| setReplayJson, | |
| } = selectedFilesSlice.actions; | |
| export default selectedFilesSlice.reducer; | |