import type { FC } from 'react' import { memo } from 'react' import { useTranslation } from 'react-i18next' import cn from 'classnames' import { useStore } from '../store' import { useIsChatMode, useWorkflowRun, useWorkflowStartRun, } from '../hooks' import { WorkflowRunningStatus } from '../types' import ViewHistory from './view-history' import { Play, StopCircle, } from '@/app/components/base/icons/src/vender/line/mediaAndDevices' import { Loading02 } from '@/app/components/base/icons/src/vender/line/general' import { MessagePlay } from '@/app/components/base/icons/src/vender/line/communication' const RunMode = memo(() => { const { t } = useTranslation() const { handleWorkflowStartRunInWorkflow } = useWorkflowStartRun() const { handleStopRun } = useWorkflowRun() const workflowRunningData = useStore(s => s.workflowRunningData) const isRunning = workflowRunningData?.result.status === WorkflowRunningStatus.Running return ( <>
handleWorkflowStartRunInWorkflow()} > { isRunning ? ( <> {t('workflow.common.running')} ) : ( <> {t('workflow.common.run')} ) }
{ isRunning && (
handleStopRun(workflowRunningData?.task_id || '')} >
) } ) }) RunMode.displayName = 'RunMode' const PreviewMode = memo(() => { const { t } = useTranslation() const { handleWorkflowStartRunInChatflow } = useWorkflowStartRun() return (
handleWorkflowStartRunInChatflow()} > {t('workflow.common.debugAndPreview')}
) }) PreviewMode.displayName = 'PreviewMode' const RunAndHistory: FC = () => { const isChatMode = useIsChatMode() return (
{ !isChatMode && } { isChatMode && }
) } export default memo(RunAndHistory)