From 984e4564f82ed51eb862268918848d122fadbbd1 Mon Sep 17 00:00:00 2001 From: StyleZhang Date: Fri, 15 Nov 2024 14:54:01 +0800 Subject: [PATCH] fix: dsl check plugin --- web/app/components/app/configuration/index.tsx | 2 ++ .../components/app/create-from-dsl-modal/index.tsx | 12 ++---------- .../workflow/plugin-dependency/index.tsx | 14 +++++++++++++- web/app/components/workflow/update-dsl-modal.tsx | 6 +----- 4 files changed, 18 insertions(+), 16 deletions(-) diff --git a/web/app/components/app/configuration/index.tsx b/web/app/components/app/configuration/index.tsx index b571ad8739..0474887f32 100644 --- a/web/app/components/app/configuration/index.tsx +++ b/web/app/components/app/configuration/index.tsx @@ -72,6 +72,7 @@ import { SupportUploadFileTypes } from '@/app/components/workflow/types' import NewFeaturePanel from '@/app/components/base/features/new-feature-panel' import { fetchFileUploadConfig } from '@/service/common' import { correctProvider } from '@/utils' +import PluginDependency from '@/app/components/workflow/plugin-dependency' type PublishConfig = { modelConfig: ModelConfig @@ -1031,6 +1032,7 @@ const Configuration: FC = () => { onAutoAddPromptVariable={handleAddPromptVariable} /> )} + diff --git a/web/app/components/app/create-from-dsl-modal/index.tsx b/web/app/components/app/create-from-dsl-modal/index.tsx index 45ef8dbde6..2064b92132 100644 --- a/web/app/components/app/create-from-dsl-modal/index.tsx +++ b/web/app/components/app/create-from-dsl-modal/index.tsx @@ -80,24 +80,16 @@ const CreateFromDSLModal = ({ show, onSuccess, onClose, activeTab = CreateFromDS let app if (currentTab === CreateFromDSLModalTab.FROM_FILE) { - const leakedData = await mutateAsync({ dslString: fileContent }) - if (leakedData?.leaked.length) { - isCreatingRef.current = false - return - } app = await importApp({ data: fileContent || '', }) + await mutateAsync({ dslString: fileContent }) } if (currentTab === CreateFromDSLModalTab.FROM_URL) { - const leakedData = await mutateAsync({ url: dslUrlValue }) - if (leakedData?.leaked.length) { - isCreatingRef.current = false - return - } app = await importAppFromUrl({ url: dslUrlValue || '', }) + await mutateAsync({ url: dslUrlValue }) } if (onSuccess) onSuccess() diff --git a/web/app/components/workflow/plugin-dependency/index.tsx b/web/app/components/workflow/plugin-dependency/index.tsx index c7f5b71c75..13f138114b 100644 --- a/web/app/components/workflow/plugin-dependency/index.tsx +++ b/web/app/components/workflow/plugin-dependency/index.tsx @@ -1,13 +1,25 @@ +import { useCallback } from 'react' import { useStore } from './store' +import InstallBundle from '@/app/components/plugins/install-plugin/install-bundle' const PluginDependency = () => { const dependencies = useStore(s => s.dependencies) + const handleCancelInstallBundle = useCallback(() => { + const { setDependencies } = useStore.getState() + setDependencies([]) + }, []) + if (!dependencies.length) return null return ( -
a
+
+ +
) } diff --git a/web/app/components/workflow/update-dsl-modal.tsx b/web/app/components/workflow/update-dsl-modal.tsx index 86a3648c4e..cc19b2790c 100644 --- a/web/app/components/workflow/update-dsl-modal.tsx +++ b/web/app/components/workflow/update-dsl-modal.tsx @@ -77,17 +77,13 @@ const UpdateDSLModal = ({ return try { if (appDetail && fileContent) { - const leakedData = await mutateAsync({ dslString: fileContent }) - if (leakedData?.leaked.length) { - isCreatingRef.current = false - return - } setLoading(true) const { graph, features, hash, } = await updateWorkflowDraftFromDSL(appDetail.id, fileContent) + await mutateAsync({ dslString: fileContent }) const { nodes, edges, viewport } = graph const newFeatures = { file: {