UNPKG

@lobehub/chat

Version:

Lobe Chat - an open-source, high-performance chatbot framework that supports speech synthesis, multimodal, and extensible Function Call plugin system. Supports one-click free deployment of your private ChatGPT/LLM web application.

24 lines (18 loc) 760 B
import { devtools, subscribeWithSelector } from 'zustand/middleware'; import { shallow } from 'zustand/shallow'; import { createWithEqualityFn } from 'zustand/traditional'; import { StateCreator } from 'zustand/vanilla'; import { chatGroupAction } from './action'; import { ChatGroupStore, initialChatGroupState } from './initialState'; const createStore: StateCreator<ChatGroupStore, [['zustand/devtools', never]]> = (...params) => { const actions = chatGroupAction(...params); return { ...initialChatGroupState, ...actions, }; }; export const useChatGroupStore = createWithEqualityFn<ChatGroupStore>()( subscribeWithSelector(devtools(createStore)), shallow, ); export const getChatGroupStoreState = () => useChatGroupStore.getState();