Spaces:
Runtime error
Runtime error
Download next/src/stores/agentInputStore.ts from dia-gov/AgentGPT-Web-GUI: direct link, hf CLI and curl.
- Browser
- Download file 953 Bytes
-
https://huggingface.co/spaces/dia-gov/AgentGPT-Web-GUI/resolve/main/next/src/stores/agentInputStore.ts
- Command line
-
hf download hf://spaces/dia-gov/AgentGPT-Web-GUI/next/src/stores/agentInputStore.ts
-
curl -L -o agentInputStore.ts https://huggingface.co/spaces/dia-gov/AgentGPT-Web-GUI/resolve/main/next/src/stores/agentInputStore.ts
953 Bytes
| import type { StateCreator } from "zustand"; | |
| import { create } from "zustand"; | |
| import { createSelectors } from "./helpers"; | |
| const resetters: (() => void)[] = []; | |
| interface AgentInputSlice { | |
| nameInput: string; | |
| goalInput: string; | |
| setNameInput: (nameInput: string) => void; | |
| setGoalInput: (goalInput: string) => void; | |
| resetInputs: () => void; | |
| } | |
| const initialInputState = { | |
| nameInput: "", | |
| goalInput: "", | |
| }; | |
| const createAgentInputSlice: StateCreator<AgentInputSlice> = (set) => { | |
| resetters.push(() => set(initialInputState)); | |
| return { | |
| ...initialInputState, | |
| setNameInput: (nameInput: string) => { | |
| set(() => ({ nameInput })); | |
| }, | |
| setGoalInput: (goalInput: string) => { | |
| set(() => ({ goalInput })); | |
| }, | |
| resetInputs: () => { | |
| set(initialInputState); | |
| }, | |
| }; | |
| }; | |
| export const useAgentInputStore = createSelectors( | |
| create<AgentInputSlice>()((...a) => ({ | |
| ...createAgentInputSlice(...a), | |
| })) | |
| ); | |