diff --git a/web/app/components/datasets/create-from-pipeline/list/built-in-pipeline-list.tsx b/web/app/components/datasets/create-from-pipeline/list/built-in-pipeline-list.tsx index ab35066fd3..4866c41169 100644 --- a/web/app/components/datasets/create-from-pipeline/list/built-in-pipeline-list.tsx +++ b/web/app/components/datasets/create-from-pipeline/list/built-in-pipeline-list.tsx @@ -13,6 +13,7 @@ const BuiltInPipelineList = () => { {list.map((pipeline, index) => ( diff --git a/web/app/components/datasets/create-from-pipeline/list/customized-list.tsx b/web/app/components/datasets/create-from-pipeline/list/customized-list.tsx index 9ffdf45f1c..5b5a2f3396 100644 --- a/web/app/components/datasets/create-from-pipeline/list/customized-list.tsx +++ b/web/app/components/datasets/create-from-pipeline/list/customized-list.tsx @@ -13,6 +13,7 @@ const CustomizedList = () => { {list.map((pipeline, index) => ( ))} diff --git a/web/app/components/datasets/create-from-pipeline/list/template-card/details.tsx b/web/app/components/datasets/create-from-pipeline/list/template-card/details.tsx index 9cc7093c45..edc3bc9f0e 100644 --- a/web/app/components/datasets/create-from-pipeline/list/template-card/details.tsx +++ b/web/app/components/datasets/create-from-pipeline/list/template-card/details.tsx @@ -11,17 +11,19 @@ import WorkflowPreview from '@/app/components/workflow/workflow-preview' type DetailsProps = { id: string + type: 'customized' | 'built-in' onApplyTemplate: () => void onClose: () => void } const Details = ({ id, + type, onApplyTemplate, onClose, }: DetailsProps) => { const { t } = useTranslation() - const { data: pipelineTemplateInfo } = usePipelineTemplateById(id, true) + const { data: pipelineTemplateInfo } = usePipelineTemplateById(id, type, true) const appIcon = React.useMemo(() => { if (!pipelineTemplateInfo) return { type: 'emoji', icon: '📙', background: '#FFF4ED' } @@ -41,7 +43,7 @@ const Details = ({
diff --git a/web/app/components/datasets/create-from-pipeline/list/template-card/index.tsx b/web/app/components/datasets/create-from-pipeline/list/template-card/index.tsx index a39baf608d..a83ae4a16c 100644 --- a/web/app/components/datasets/create-from-pipeline/list/template-card/index.tsx +++ b/web/app/components/datasets/create-from-pipeline/list/template-card/index.tsx @@ -23,11 +23,13 @@ import CreateModal from './create-modal' type TemplateCardProps = { pipeline: PipelineTemplate showMoreOperations?: boolean + type: 'customized' | 'built-in' } const TemplateCard = ({ pipeline, showMoreOperations = true, + type, }: TemplateCardProps) => { const { t } = useTranslation() const { push } = useRouter() @@ -36,7 +38,7 @@ const TemplateCard = ({ const [showDetailModal, setShowDetailModal] = useState(false) const [showCreateModal, setShowCreateModal] = useState(false) - const { refetch: getPipelineTemplateInfo } = usePipelineTemplateById(pipeline.id, false) + const { refetch: getPipelineTemplateInfo } = usePipelineTemplateById(pipeline.id, type, false) const { mutateAsync: createEmptyDataset } = useCreatePipelineDataset() const { handleCheckPluginDependencies } = usePluginDependencies() @@ -179,6 +181,7 @@ const TemplateCard = ({ >
diff --git a/web/models/pipeline.ts b/web/models/pipeline.ts index 68ceafbfe8..4552bfe010 100644 --- a/web/models/pipeline.ts +++ b/web/models/pipeline.ts @@ -30,17 +30,23 @@ export type PipelineTemplateListResponse = { } export type PipelineTemplateByIdResponse = { + id: string name: string icon: IconInfo description: string author: string // todo: TBD structure: string // todo: TBD - graph: { - nodes: Node[] - edges: Edge[] - viewport: Viewport + export_data: { + workflow: { + graph: { + nodes: Node[] + edges: Edge[] + viewport: Viewport + } + environment_variables?: EnvironmentVariable[] + rag_pipeline_variables?: RAGPipelineVariables + } } - export_data: string } export type CreateFormData = { diff --git a/web/service/use-pipeline.ts b/web/service/use-pipeline.ts index 4993439df6..a6b0794db2 100644 --- a/web/service/use-pipeline.ts +++ b/web/service/use-pipeline.ts @@ -42,11 +42,11 @@ export const usePipelineTemplateList = (params: PipelineTemplateListParams) => { }) } -export const usePipelineTemplateById = (templateId: string, enabled: boolean) => { +export const usePipelineTemplateById = (templateId: string, type: string, enabled: boolean) => { return useQuery({ queryKey: [NAME_SPACE, 'template', templateId], queryFn: () => { - return get(`/rag/pipeline/templates/${templateId}`) + return get(`/rag/pipeline/templates/${templateId}?type=${type}`) }, enabled, })