Co-authored-by: StyleZhang <jasonapring2015@outlook.com>tags/0.6.12
| import type { CommonNodeType, InputVar, ValueSelector, Var, Variable } from '@/app/components/workflow/types' | import type { CommonNodeType, InputVar, ValueSelector, Var, Variable } from '@/app/components/workflow/types' | ||||
| import { BlockEnum, InputVarType, NodeRunningStatus, VarType } from '@/app/components/workflow/types' | import { BlockEnum, InputVarType, NodeRunningStatus, VarType } from '@/app/components/workflow/types' | ||||
| import { useStore as useAppStore } from '@/app/components/app/store' | import { useStore as useAppStore } from '@/app/components/app/store' | ||||
| import { useWorkflowStore } from '@/app/components/workflow/store' | |||||
| import { getIterationSingleNodeRunUrl, singleNodeRun } from '@/service/workflow' | import { getIterationSingleNodeRunUrl, singleNodeRun } from '@/service/workflow' | ||||
| import Toast from '@/app/components/base/toast' | import Toast from '@/app/components/base/toast' | ||||
| import LLMDefault from '@/app/components/workflow/nodes/llm/default' | import LLMDefault from '@/app/components/workflow/nodes/llm/default' | ||||
| } | } | ||||
| // eslint-disable-next-line react-hooks/exhaustive-deps | // eslint-disable-next-line react-hooks/exhaustive-deps | ||||
| }, [data._isSingleRun]) | }, [data._isSingleRun]) | ||||
| const workflowStore = useWorkflowStore() | |||||
| useEffect(() => { | |||||
| workflowStore.getState().setShowSingleRunPanel(!!isShowSingleRun) | |||||
| }, [isShowSingleRun]) | |||||
| const hideSingleRun = () => { | const hideSingleRun = () => { | ||||
| handleNodeDataUpdate({ | handleNodeDataUpdate({ | ||||
| id, | id, |
| import TooltipPlus from '@/app/components/base/tooltip-plus' | import TooltipPlus from '@/app/components/base/tooltip-plus' | ||||
| import type { Node } from '@/app/components/workflow/types' | import type { Node } from '@/app/components/workflow/types' | ||||
| import { useStore as useAppStore } from '@/app/components/app/store' | import { useStore as useAppStore } from '@/app/components/app/store' | ||||
| import { useStore } from '@/app/components/workflow/store' | |||||
| type BasePanelProps = { | type BasePanelProps = { | ||||
| children: ReactElement | children: ReactElement | ||||
| const { showMessageLogModal } = useAppStore(useShallow(state => ({ | const { showMessageLogModal } = useAppStore(useShallow(state => ({ | ||||
| showMessageLogModal: state.showMessageLogModal, | showMessageLogModal: state.showMessageLogModal, | ||||
| }))) | }))) | ||||
| const showSingleRunPanel = useStore(s => s.showSingleRunPanel) | |||||
| const panelWidth = localStorage.getItem('workflow-node-panel-width') ? parseFloat(localStorage.getItem('workflow-node-panel-width')!) : 420 | const panelWidth = localStorage.getItem('workflow-node-panel-width') ? parseFloat(localStorage.getItem('workflow-node-panel-width')!) : 420 | ||||
| const { | const { | ||||
| setPanelWidth, | setPanelWidth, | ||||
| </div> | </div> | ||||
| <div | <div | ||||
| ref={containerRef} | ref={containerRef} | ||||
| className='relative h-full bg-white shadow-lg border-[0.5px] border-gray-200 rounded-2xl overflow-y-auto' | |||||
| className={cn('relative h-full bg-white shadow-lg border-[0.5px] border-gray-200 rounded-2xl', showSingleRunPanel ? 'overflow-hidden' : 'overflow-y-auto')} | |||||
| style={{ | style={{ | ||||
| width: `${panelWidth}px`, | width: `${panelWidth}px`, | ||||
| }} | }} |
| type Shape = { | type Shape = { | ||||
| appId: string | appId: string | ||||
| panelWidth: number | panelWidth: number | ||||
| showSingleRunPanel: boolean | |||||
| setShowSingleRunPanel: (showSingleRunPanel: boolean) => void | |||||
| workflowRunningData?: PreviewRunningData | workflowRunningData?: PreviewRunningData | ||||
| setWorkflowRunningData: (workflowData: PreviewRunningData) => void | setWorkflowRunningData: (workflowData: PreviewRunningData) => void | ||||
| historyWorkflowData?: HistoryWorkflowData | historyWorkflowData?: HistoryWorkflowData | ||||
| return createStore<Shape>(set => ({ | return createStore<Shape>(set => ({ | ||||
| appId: '', | appId: '', | ||||
| panelWidth: localStorage.getItem('workflow-node-panel-width') ? parseFloat(localStorage.getItem('workflow-node-panel-width')!) : 420, | panelWidth: localStorage.getItem('workflow-node-panel-width') ? parseFloat(localStorage.getItem('workflow-node-panel-width')!) : 420, | ||||
| showSingleRunPanel: false, | |||||
| setShowSingleRunPanel: showSingleRunPanel => set(() => ({ showSingleRunPanel })), | |||||
| workflowRunningData: undefined, | workflowRunningData: undefined, | ||||
| setWorkflowRunningData: workflowRunningData => set(() => ({ workflowRunningData })), | setWorkflowRunningData: workflowRunningData => set(() => ({ workflowRunningData })), | ||||
| historyWorkflowData: undefined, | historyWorkflowData: undefined, |