mirror of
https://github.com/langgenius/dify.git
synced 2026-05-02 15:17:39 +08:00
Co-authored-by: Joel <iamjoel007@gmail.com> Co-authored-by: Yeuoly <admin@srmxy.cn> Co-authored-by: JzoNg <jzongcode@gmail.com> Co-authored-by: StyleZhang <jasonapring2015@outlook.com> Co-authored-by: jyong <jyong@dify.ai> Co-authored-by: nite-knite <nkCoding@gmail.com> Co-authored-by: jyong <718720800@qq.com>
33 lines
1.1 KiB
TypeScript
33 lines
1.1 KiB
TypeScript
import { create } from 'zustand'
|
|
import type { App } from '@/types/app'
|
|
import type { IChatItem } from '@/app/components/app/chat/type'
|
|
|
|
type State = {
|
|
appDetail?: App
|
|
appSidebarExpand: string
|
|
currentLogItem?: IChatItem
|
|
showPromptLogModal: boolean
|
|
showMessageLogModal: boolean
|
|
}
|
|
|
|
type Action = {
|
|
setAppDetail: (appDetail?: App) => void
|
|
setAppSiderbarExpand: (state: string) => void
|
|
setCurrentLogItem: (item?: IChatItem) => void
|
|
setShowPromptLogModal: (showPromptLogModal: boolean) => void
|
|
setShowMessageLogModal: (showMessageLogModal: boolean) => void
|
|
}
|
|
|
|
export const useStore = create<State & Action>(set => ({
|
|
appDetail: undefined,
|
|
setAppDetail: appDetail => set(() => ({ appDetail })),
|
|
appSidebarExpand: '',
|
|
setAppSiderbarExpand: appSidebarExpand => set(() => ({ appSidebarExpand })),
|
|
currentLogItem: undefined,
|
|
setCurrentLogItem: currentLogItem => set(() => ({ currentLogItem })),
|
|
showPromptLogModal: false,
|
|
setShowPromptLogModal: showPromptLogModal => set(() => ({ showPromptLogModal })),
|
|
showMessageLogModal: false,
|
|
setShowMessageLogModal: showMessageLogModal => set(() => ({ showMessageLogModal })),
|
|
}))
|