Download frontend/src/state/command-slice.ts from ar08/zzz: direct link, hf CLI and curl.
- Browser
- Download file 756 Bytes
-
https://huggingface.co/spaces/ar08/zzz/resolve/main/frontend/src/state/command-slice.ts
- Command line
-
hf download hf://spaces/ar08/zzz/frontend/src/state/command-slice.ts
-
curl -L -o command-slice.ts https://huggingface.co/spaces/ar08/zzz/resolve/main/frontend/src/state/command-slice.ts
756 Bytes
| import { createSlice } from "@reduxjs/toolkit"; | |
| export type Command = { | |
| content: string; | |
| type: "input" | "output"; | |
| }; | |
| const initialCommands: Command[] = []; | |
| export const commandSlice = createSlice({ | |
| name: "command", | |
| initialState: { | |
| commands: initialCommands, | |
| }, | |
| reducers: { | |
| appendInput: (state, action) => { | |
| state.commands.push({ content: action.payload, type: "input" }); | |
| }, | |
| appendOutput: (state, action) => { | |
| state.commands.push({ content: action.payload, type: "output" }); | |
| }, | |
| clearTerminal: (state) => { | |
| state.commands = []; | |
| }, | |
| }, | |
| }); | |
| export const { appendInput, appendOutput, clearTerminal } = | |
| commandSlice.actions; | |
| export default commandSlice.reducer; | |