File size: 543 Bytes
5f40163
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
import { create } from "zustand";
import { AgentState } from "#/types/agent-state";

interface AgentStateData {
  curAgentState: AgentState;
}

interface AgentStore extends AgentStateData {
  setCurrentAgentState: (state: AgentState) => void;
  reset: () => void;
}

const initialState: AgentStateData = {
  curAgentState: AgentState.LOADING,
};

export const useAgentStore = create<AgentStore>((set) => ({
  ...initialState,
  setCurrentAgentState: (state: AgentState) => set({ curAgentState: state }),
  reset: () => set(initialState),
}));