@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 (17 loc) • 722 B
text/typescript
'use client';
import { StoreApiWithSelector } from '@lobechat/types';
import { createContext } from 'zustand-utils';
import { subscribeWithSelector } from 'zustand/middleware';
import { shallow } from 'zustand/shallow';
import { createWithEqualityFn } from 'zustand/traditional';
import { Store, store } from './action';
import { State } from './initialState';
export type { PublicState, State } from './initialState';
export const createStore = (initState?: Partial<State>) =>
createWithEqualityFn(subscribeWithSelector(store(initState)), shallow);
export const {
useStore: useChatInputStore,
useStoreApi,
Provider,
} = createContext<StoreApiWithSelector<Store>>();
export { selectors } from './selectors';