This commit is contained in:
StyleZhang
2024-03-15 16:58:29 +08:00
parent 75b332695b
commit e98456b025
16 changed files with 209 additions and 176 deletions

View File

@ -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)

View File

@ -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>