mirror of
https://github.com/langgenius/dify.git
synced 2026-02-24 18:05:11 +00:00
Compare commits
2 Commits
release/e-
...
fix/templa
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
3f63d3aa45 | ||
|
|
2c9c246052 |
@@ -9,8 +9,7 @@ import Button from '@/app/components/base/button'
|
|||||||
import { useTranslation } from 'react-i18next'
|
import { useTranslation } from 'react-i18next'
|
||||||
import Toast from '@/app/components/base/toast'
|
import Toast from '@/app/components/base/toast'
|
||||||
import type { PipelineTemplate } from '@/models/pipeline'
|
import type { PipelineTemplate } from '@/models/pipeline'
|
||||||
import { PipelineTemplateListQueryKeyPrefix, useUpdateTemplateInfo } from '@/service/use-pipeline'
|
import { useInvalidCustomizedTemplateList, useUpdateTemplateInfo } from '@/service/use-pipeline'
|
||||||
import { useInvalid } from '@/service/use-base'
|
|
||||||
|
|
||||||
type EditPipelineInfoProps = {
|
type EditPipelineInfoProps = {
|
||||||
onClose: () => void
|
onClose: () => void
|
||||||
@@ -63,7 +62,7 @@ const EditPipelineInfo = ({
|
|||||||
}, [])
|
}, [])
|
||||||
|
|
||||||
const { mutateAsync: updatePipeline } = useUpdateTemplateInfo()
|
const { mutateAsync: updatePipeline } = useUpdateTemplateInfo()
|
||||||
const invalidCustomizedTemplateList = useInvalid([...PipelineTemplateListQueryKeyPrefix, 'customized'])
|
const invalidCustomizedTemplateList = useInvalidCustomizedTemplateList()
|
||||||
|
|
||||||
const handleSave = useCallback(async () => {
|
const handleSave = useCallback(async () => {
|
||||||
if (!name) {
|
if (!name) {
|
||||||
|
|||||||
@@ -5,9 +5,9 @@ import EditPipelineInfo from './edit-pipeline-info'
|
|||||||
import type { PipelineTemplate } from '@/models/pipeline'
|
import type { PipelineTemplate } from '@/models/pipeline'
|
||||||
import Confirm from '@/app/components/base/confirm'
|
import Confirm from '@/app/components/base/confirm'
|
||||||
import {
|
import {
|
||||||
PipelineTemplateListQueryKeyPrefix,
|
|
||||||
useDeleteTemplate,
|
useDeleteTemplate,
|
||||||
useExportTemplateDSL,
|
useExportTemplateDSL,
|
||||||
|
useInvalidCustomizedTemplateList,
|
||||||
usePipelineTemplateById,
|
usePipelineTemplateById,
|
||||||
} from '@/service/use-pipeline'
|
} from '@/service/use-pipeline'
|
||||||
import { downloadFile } from '@/utils/format'
|
import { downloadFile } from '@/utils/format'
|
||||||
@@ -18,7 +18,6 @@ import Details from './details'
|
|||||||
import Content from './content'
|
import Content from './content'
|
||||||
import Actions from './actions'
|
import Actions from './actions'
|
||||||
import { useCreatePipelineDatasetFromCustomized } from '@/service/knowledge/use-create-dataset'
|
import { useCreatePipelineDatasetFromCustomized } from '@/service/knowledge/use-create-dataset'
|
||||||
import { useInvalid } from '@/service/use-base'
|
|
||||||
import { useInvalidDatasetList } from '@/service/knowledge/use-dataset'
|
import { useInvalidDatasetList } from '@/service/knowledge/use-dataset'
|
||||||
|
|
||||||
type TemplateCardProps = {
|
type TemplateCardProps = {
|
||||||
@@ -128,7 +127,7 @@ const TemplateCard = ({
|
|||||||
}, [])
|
}, [])
|
||||||
|
|
||||||
const { mutateAsync: deletePipeline } = useDeleteTemplate()
|
const { mutateAsync: deletePipeline } = useDeleteTemplate()
|
||||||
const invalidCustomizedTemplateList = useInvalid([...PipelineTemplateListQueryKeyPrefix, 'customized'])
|
const invalidCustomizedTemplateList = useInvalidCustomizedTemplateList()
|
||||||
|
|
||||||
const onConfirmDelete = useCallback(async () => {
|
const onConfirmDelete = useCallback(async () => {
|
||||||
await deletePipeline(pipeline.id, {
|
await deletePipeline(pipeline.id, {
|
||||||
|
|||||||
@@ -33,6 +33,7 @@ import { useDatasetDetailContextWithSelector } from '@/context/dataset-detail'
|
|||||||
import { useInvalid } from '@/service/use-base'
|
import { useInvalid } from '@/service/use-base'
|
||||||
import {
|
import {
|
||||||
publishedPipelineInfoQueryKeyPrefix,
|
publishedPipelineInfoQueryKeyPrefix,
|
||||||
|
useInvalidCustomizedTemplateList,
|
||||||
usePublishAsCustomizedPipeline,
|
usePublishAsCustomizedPipeline,
|
||||||
} from '@/service/use-pipeline'
|
} from '@/service/use-pipeline'
|
||||||
import Confirm from '@/app/components/base/confirm'
|
import Confirm from '@/app/components/base/confirm'
|
||||||
@@ -158,6 +159,8 @@ const Popup = () => {
|
|||||||
push(`/datasets/${datasetId}/documents/create-from-pipeline`)
|
push(`/datasets/${datasetId}/documents/create-from-pipeline`)
|
||||||
}, [datasetId, push])
|
}, [datasetId, push])
|
||||||
|
|
||||||
|
const invalidCustomizedTemplateList = useInvalidCustomizedTemplateList()
|
||||||
|
|
||||||
const handlePublishAsKnowledgePipeline = useCallback(async (
|
const handlePublishAsKnowledgePipeline = useCallback(async (
|
||||||
name: string,
|
name: string,
|
||||||
icon: IconInfo,
|
icon: IconInfo,
|
||||||
@@ -189,6 +192,7 @@ const Popup = () => {
|
|||||||
</div>
|
</div>
|
||||||
),
|
),
|
||||||
})
|
})
|
||||||
|
invalidCustomizedTemplateList()
|
||||||
}
|
}
|
||||||
catch {
|
catch {
|
||||||
notify({ type: 'error', message: t('datasetPipeline.publishTemplate.error.message') })
|
notify({ type: 'error', message: t('datasetPipeline.publishTemplate.error.message') })
|
||||||
@@ -205,6 +209,7 @@ const Popup = () => {
|
|||||||
hidePublishAsKnowledgePipelineModal,
|
hidePublishAsKnowledgePipelineModal,
|
||||||
notify,
|
notify,
|
||||||
t,
|
t,
|
||||||
|
invalidCustomizedTemplateList,
|
||||||
])
|
])
|
||||||
|
|
||||||
const handleClickPublishAsKnowledgePipeline = useCallback(() => {
|
const handleClickPublishAsKnowledgePipeline = useCallback(() => {
|
||||||
|
|||||||
@@ -48,6 +48,10 @@ export const usePipelineTemplateList = (params: PipelineTemplateListParams) => {
|
|||||||
})
|
})
|
||||||
}
|
}
|
||||||
|
|
||||||
|
export const useInvalidCustomizedTemplateList = () => {
|
||||||
|
return useInvalid([...PipelineTemplateListQueryKeyPrefix, 'customized'])
|
||||||
|
}
|
||||||
|
|
||||||
export const usePipelineTemplateById = (params: PipelineTemplateByIdRequest, enabled: boolean) => {
|
export const usePipelineTemplateById = (params: PipelineTemplateByIdRequest, enabled: boolean) => {
|
||||||
const { template_id, type } = params
|
const { template_id, type } = params
|
||||||
return useQuery<PipelineTemplateByIdResponse>({
|
return useQuery<PipelineTemplateByIdResponse>({
|
||||||
|
|||||||
Reference in New Issue
Block a user