fix: dsl check plugin

This commit is contained in:
StyleZhang 2024-11-15 14:54:01 +08:00
parent bc927868f4
commit 984e4564f8
4 changed files with 18 additions and 16 deletions

View File

@ -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}
/>
)}
<PluginDependency />
</>
</FeaturesProvider>
</ConfigContext.Provider>

View File

@ -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()

View File

@ -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 (
<div>a</div>
<div>
<InstallBundle
fromDSLPayload={dependencies}
onClose={handleCancelInstallBundle}
/>
</div>
)
}

View File

@ -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: {