From f47b32b26da3071253a11455bf590c4d126d0a17 Mon Sep 17 00:00:00 2001 From: StyleZhang Date: Tue, 26 Nov 2024 11:10:53 +0800 Subject: [PATCH] fix: dsl --- .../components/app/create-from-dsl-modal/index.tsx | 11 ++++++----- web/models/app.ts | 2 ++ 2 files changed, 8 insertions(+), 5 deletions(-) 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 07018838b4..08469715ed 100644 --- a/web/app/components/app/create-from-dsl-modal/index.tsx +++ b/web/app/components/app/create-from-dsl-modal/index.tsx @@ -25,7 +25,7 @@ import AppsFull from '@/app/components/billing/apps-full-in-dialog' import { NEED_REFRESH_APP_LIST_KEY } from '@/config' import { getRedirection } from '@/utils/app-redirection' import cn from '@/utils/classnames' -import { useMutationCheckDependenciesBeforeImportDSL } from '@/service/use-plugins' +import { useStore as usePluginDependencyStore } from '@/app/components/workflow/plugin-dependency/store' type CreateFromDSLModalProps = { show: boolean @@ -48,7 +48,6 @@ const CreateFromDSLModal = ({ show, onSuccess, onClose, activeTab = CreateFromDS const [fileContent, setFileContent] = useState() const [currentTab, setCurrentTab] = useState(activeTab) const [dslUrlValue, setDslUrlValue] = useState(dslUrl) - const { mutateAsync } = useMutationCheckDependenciesBeforeImportDSL() const [showErrorModal, setShowErrorModal] = useState(false) const [versions, setVersions] = useState<{ importedVersion: string; systemVersion: string }>() const [importId, setImportId] = useState() @@ -92,20 +91,22 @@ const CreateFromDSLModal = ({ show, onSuccess, onClose, activeTab = CreateFromDS mode: DSLImportMode.YAML_CONTENT, yaml_content: fileContent || '', }) - await mutateAsync({ dslString: fileContent }) } if (currentTab === CreateFromDSLModalTab.FROM_URL) { response = await importDSL({ mode: DSLImportMode.YAML_URL, yaml_url: dslUrlValue || '', }) - await mutateAsync({ url: dslUrlValue }) } if (!response) return - const { id, status, app_id, imported_dsl_version, current_dsl_version } = response + const { id, status, app_id, imported_dsl_version, current_dsl_version, leaked } = response + if (leaked?.length) { + const { setDependencies } = usePluginDependencyStore.getState() + setDependencies(leaked) + } if (status === DSLImportStatus.COMPLETED || status === DSLImportStatus.COMPLETED_WITH_WARNINGS) { if (onSuccess) onSuccess() diff --git a/web/models/app.ts b/web/models/app.ts index acb1c09622..5cf3f23e83 100644 --- a/web/models/app.ts +++ b/web/models/app.ts @@ -1,5 +1,6 @@ import type { LangFuseConfig, LangSmithConfig, TracingProvider } from '@/app/(commonLayout)/app/(appDetailLayout)/[appId]/overview/tracing/type' import type { App, AppSSO, AppTemplate, SiteConfig } from '@/types/app' +import type { Dependency } from '@/app/components/plugins/types' /* export type App = { id: string @@ -87,6 +88,7 @@ export type DSLImportResponse = { current_dsl_version?: string imported_dsl_version?: string error: string + leaked: Dependency[] } export type AppSSOResponse = { enabled: AppSSO['enable_sso'] }