mirror of
https://github.com/langgenius/dify.git
synced 2026-05-04 01:18:05 +08:00
store
This commit is contained in:
@ -4,7 +4,10 @@ import {
|
||||
useCallback,
|
||||
} from 'react'
|
||||
import { useTranslation } from 'react-i18next'
|
||||
import { useStore } from '../store'
|
||||
import {
|
||||
useStore,
|
||||
useWorkflowStore,
|
||||
} from '../store'
|
||||
import {
|
||||
useIsChatMode,
|
||||
useWorkflowRun,
|
||||
@ -20,6 +23,7 @@ import { useStore as useAppStore } from '@/app/components/app/store'
|
||||
|
||||
const Header: FC = () => {
|
||||
const { t } = useTranslation()
|
||||
const workflowStore = useWorkflowStore()
|
||||
const appDetail = useAppStore(s => s.appDetail)
|
||||
const appSidebarExpand = useAppStore(s => s.appSidebarExpand)
|
||||
const isChatMode = useIsChatMode()
|
||||
@ -30,8 +34,8 @@ const Header: FC = () => {
|
||||
if (runningStatus)
|
||||
return
|
||||
|
||||
useStore.setState({ showFeaturesPanel: true })
|
||||
}, [runningStatus])
|
||||
workflowStore.setState({ showFeaturesPanel: true })
|
||||
}, [runningStatus, workflowStore])
|
||||
|
||||
const handleGoBackToEdit = useCallback(() => {
|
||||
handleRunSetting(true)
|
||||
|
||||
@ -1,7 +1,10 @@
|
||||
import type { FC } from 'react'
|
||||
import { memo } from 'react'
|
||||
import { useTranslation } from 'react-i18next'
|
||||
import { useStore } from '../store'
|
||||
import {
|
||||
useStore,
|
||||
useWorkflowStore,
|
||||
} from '../store'
|
||||
import {
|
||||
useIsChatMode,
|
||||
useWorkflowRun,
|
||||
@ -14,12 +17,13 @@ import { Loading02 } from '@/app/components/base/icons/src/vender/line/general'
|
||||
|
||||
const RunMode = memo(() => {
|
||||
const { t } = useTranslation()
|
||||
const workflowStore = useWorkflowStore()
|
||||
const runningStatus = useStore(s => s.runningStatus)
|
||||
const showInputsPanel = useStore(s => s.showInputsPanel)
|
||||
const isRunning = runningStatus === WorkflowRunningStatus.Running
|
||||
|
||||
const handleClick = () => {
|
||||
useStore.setState({ showInputsPanel: true })
|
||||
workflowStore.setState({ showInputsPanel: true })
|
||||
}
|
||||
|
||||
return (
|
||||
@ -91,6 +95,7 @@ PreviewMode.displayName = 'PreviewMode'
|
||||
|
||||
const RunAndHistory: FC = () => {
|
||||
const { t } = useTranslation()
|
||||
const workflowStore = useWorkflowStore()
|
||||
const isChatMode = useIsChatMode()
|
||||
const showRunHistory = useStore(state => state.showRunHistory)
|
||||
|
||||
@ -111,7 +116,7 @@ const RunAndHistory: FC = () => {
|
||||
flex items-center justify-center w-7 h-7 rounded-md hover:bg-black/5 cursor-pointer
|
||||
${showRunHistory && 'bg-primary-50'}
|
||||
`}
|
||||
onClick={() => useStore.setState({ showRunHistory: true })}
|
||||
onClick={() => workflowStore.setState({ showRunHistory: true })}
|
||||
>
|
||||
<ClockPlay className={`w-4 h-4 ${showRunHistory ? 'text-primary-600' : 'text-gray-500'}`} />
|
||||
</div>
|
||||
|
||||
Reference in New Issue
Block a user