mirror of
https://github.com/langgenius/dify.git
synced 2025-11-16 19:33:57 +00:00
fix: create pipeline from customized
This commit is contained in:
parent
2414dbb5f8
commit
c31754e6cd
@ -18,7 +18,7 @@ import Details from './details'
|
|||||||
import Content from './content'
|
import Content from './content'
|
||||||
import Actions from './actions'
|
import Actions from './actions'
|
||||||
import type { CreateDatasetReq } from '@/models/datasets'
|
import type { CreateDatasetReq } from '@/models/datasets'
|
||||||
import { useCreatePipelineDataset } from '@/service/knowledge/use-create-dataset'
|
import { useCreatePipelineDatasetFromCustomized } from '@/service/knowledge/use-create-dataset'
|
||||||
import CreateModal from './create-modal'
|
import CreateModal from './create-modal'
|
||||||
import { useInvalid } from '@/service/use-base'
|
import { useInvalid } from '@/service/use-base'
|
||||||
import { useResetDatasetList } from '@/service/knowledge/use-dataset'
|
import { useResetDatasetList } from '@/service/knowledge/use-dataset'
|
||||||
@ -45,7 +45,7 @@ const TemplateCard = ({
|
|||||||
template_id: pipeline.id,
|
template_id: pipeline.id,
|
||||||
type,
|
type,
|
||||||
}, false)
|
}, false)
|
||||||
const { mutateAsync: createEmptyDataset } = useCreatePipelineDataset()
|
const { mutateAsync: createDataset } = useCreatePipelineDatasetFromCustomized()
|
||||||
const { handleCheckPluginDependencies } = usePluginDependencies()
|
const { handleCheckPluginDependencies } = usePluginDependencies()
|
||||||
const resetDatasetList = useResetDatasetList()
|
const resetDatasetList = useResetDatasetList()
|
||||||
|
|
||||||
@ -66,7 +66,7 @@ const TemplateCard = ({
|
|||||||
...payload,
|
...payload,
|
||||||
yaml_content: pipelineTemplateInfo.export_data,
|
yaml_content: pipelineTemplateInfo.export_data,
|
||||||
}
|
}
|
||||||
await createEmptyDataset(request, {
|
await createDataset(request, {
|
||||||
onSuccess: async (newDataset) => {
|
onSuccess: async (newDataset) => {
|
||||||
Toast.notify({
|
Toast.notify({
|
||||||
type: 'success',
|
type: 'success',
|
||||||
@ -76,7 +76,7 @@ const TemplateCard = ({
|
|||||||
if (newDataset.pipeline_id)
|
if (newDataset.pipeline_id)
|
||||||
await handleCheckPluginDependencies(newDataset.pipeline_id, true)
|
await handleCheckPluginDependencies(newDataset.pipeline_id, true)
|
||||||
setShowCreateModal(false)
|
setShowCreateModal(false)
|
||||||
push(`/datasets/${newDataset.id}/pipeline`)
|
push(`/datasets/${newDataset.dataset_id}/pipeline`)
|
||||||
},
|
},
|
||||||
onError: () => {
|
onError: () => {
|
||||||
Toast.notify({
|
Toast.notify({
|
||||||
@ -85,7 +85,7 @@ const TemplateCard = ({
|
|||||||
})
|
})
|
||||||
},
|
},
|
||||||
})
|
})
|
||||||
}, [getPipelineTemplateInfo, createEmptyDataset, t, handleCheckPluginDependencies, push, resetDatasetList])
|
}, [getPipelineTemplateInfo, createDataset, t, handleCheckPluginDependencies, push, resetDatasetList])
|
||||||
|
|
||||||
const handleShowTemplateDetails = useCallback(() => {
|
const handleShowTemplateDetails = useCallback(() => {
|
||||||
setShowDetailModal(true)
|
setShowDetailModal(true)
|
||||||
|
|||||||
@ -774,6 +774,7 @@ export type CreateDatasetResponse = {
|
|||||||
updated_by: string
|
updated_by: string
|
||||||
updated_at: number
|
updated_at: number
|
||||||
pipeline_id: string
|
pipeline_id: string
|
||||||
|
dataset_id: string
|
||||||
}
|
}
|
||||||
|
|
||||||
export type NotionPagePreviewRequest = {
|
export type NotionPagePreviewRequest = {
|
||||||
|
|||||||
@ -251,3 +251,15 @@ export const useCreatePipelineDataset = (
|
|||||||
...mutationOptions,
|
...mutationOptions,
|
||||||
})
|
})
|
||||||
}
|
}
|
||||||
|
|
||||||
|
export const useCreatePipelineDatasetFromCustomized = (
|
||||||
|
mutationOptions: MutationOptions<CreateDatasetResponse, Error, CreateDatasetReq> = {},
|
||||||
|
) => {
|
||||||
|
return useMutation({
|
||||||
|
mutationKey: [NAME_SPACE, 'create-pipeline-dataset'],
|
||||||
|
mutationFn: (req: CreateDatasetReq) => {
|
||||||
|
return post<CreateDatasetResponse>('/rag/pipeline/dataset', { body: req })
|
||||||
|
},
|
||||||
|
...mutationOptions,
|
||||||
|
})
|
||||||
|
}
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user