From dc5010d83307d8a58da61a32b97a36ef8d17cca7 Mon Sep 17 00:00:00 2001 From: JzoNg Date: Tue, 24 Sep 2024 16:24:46 +0800 Subject: [PATCH] fix step run of file type --- .../base/features/new-feature-panel/index.tsx | 18 +++++++-------- .../share/text-generation/run-once/index.tsx | 1 + web/app/components/workflow/header/index.tsx | 23 ++++++++++++++++++- .../components/before-run-form/form-item.tsx | 20 ++++++++-------- .../_base/components/before-run-form/form.tsx | 1 + .../nodes/_base/hooks/use-one-step-run.ts | 2 +- 6 files changed, 45 insertions(+), 20 deletions(-) diff --git a/web/app/components/base/features/new-feature-panel/index.tsx b/web/app/components/base/features/new-feature-panel/index.tsx index 517364e7ae..22a1f5a69f 100644 --- a/web/app/components/base/features/new-feature-panel/index.tsx +++ b/web/app/components/base/features/new-feature-panel/index.tsx @@ -61,7 +61,7 @@ const NewFeaturePanel = ({ {/* list */}
- {!isChatMode && ( + {!isChatMode && !inWorkflow && ( )} {isChatMode && ( @@ -72,20 +72,20 @@ const NewFeaturePanel = ({ onAutoAddPromptVariable={onAutoAddPromptVariable} /> )} - - {isChatMode && speech2textDefaultModel && ( - - )} - {text2speechDefaultModel && ( - - )} - {showFileUpload && } {isChatMode && ( )} + {text2speechDefaultModel && (isChatMode || !inWorkflow) && ( + + )} + {isChatMode && speech2textDefaultModel && ( + + )} + {showFileUpload && isChatMode && } {isChatMode && ( )} + {(isChatMode || !inWorkflow) && } {!inWorkflow && isChatMode && ( )} diff --git a/web/app/components/share/text-generation/run-once/index.tsx b/web/app/components/share/text-generation/run-once/index.tsx index 89f235eee5..99aaf57a9f 100644 --- a/web/app/components/share/text-generation/run-once/index.tsx +++ b/web/app/components/share/text-generation/run-once/index.tsx @@ -14,6 +14,7 @@ import TextGenerationImageUploader from '@/app/components/base/image-uploader/te import type { VisionFile, VisionSettings } from '@/types/app' import { FileUploaderInAttachmentWrapper } from '@/app/components/base/file-uploader' import { getProcessedFiles } from '@/app/components/base/file-uploader/utils' +// import { InputVarType } from '@/app/components/workflow/types' export type IRunOnceProps = { siteInfo: SiteInfo diff --git a/web/app/components/workflow/header/index.tsx b/web/app/components/workflow/header/index.tsx index 6649e29421..010d9ca1cd 100644 --- a/web/app/components/workflow/header/index.tsx +++ b/web/app/components/workflow/header/index.tsx @@ -4,6 +4,7 @@ import { useCallback, useMemo, } from 'react' +import { RiApps2AddLine } from '@remixicon/react' import { useNodes } from 'reactflow' import { useTranslation } from 'react-i18next' import { useContext } from 'use-context-selector' @@ -46,7 +47,7 @@ const Header: FC = () => { const appSidebarExpand = useAppStore(s => s.appSidebarExpand) const appID = appDetail?.id const isChatMode = useIsChatMode() - const { nodesReadOnly } = useNodesReadOnly() + const { nodesReadOnly, getNodesReadOnly } = useNodesReadOnly() const publishedAt = useStore(s => s.publishedAt) const draftUpdatedAt = useStore(s => s.draftUpdatedAt) const toolPublished = useStore(s => s.toolPublished) @@ -85,6 +86,17 @@ const Header: FC = () => { viewHistory, } = useWorkflowMode() + const handleShowFeatures = useCallback(() => { + const { + showFeaturesPanel, + isRestoring, + setShowFeaturesPanel, + } = workflowStore.getState() + if (getNodesReadOnly() && !isRestoring) + return + setShowFeaturesPanel(!showFeaturesPanel) + }, [workflowStore, getNodesReadOnly]) + const handleCancelRestore = useCallback(() => { handleLoadBackupDraft() workflowStore.setState({ isRestoring: false }) @@ -161,6 +173,10 @@ const Header: FC = () => {
+ { { restoring && (
+ +