Build Agentic workflows, RAG pipelines, with rich AI model and tool support on one collaborative workspace. Deploy on cloud, VPC, or self-hosted, so teams move from prototype to production without rebuilding the stack.
Python agentagentic-aiagentic-frameworkagentic-workflowaiautomationclaudedeepseekgenaigptllmlow-codemcpnextjsno-codeopenaipythonskillsworkflow
import type { DatasetCardItem } from '../types'
import { useMutation } from '@tanstack/react-query'
import { useCallback } from 'react'
import { useTranslation } from 'react-i18next'
import { toast } from '@/app/notifications'
import { useRouter } from '@/next/navigation'
import { consoleQuery } from '@/service/console'
import { downloadBlob } from '@/utils/download'
import { getErrorMessage } from '@/utils/error-message'
type UseDatasetCardActionsOptions = {
dataset: DatasetCardItem
}
export const useDatasetCardActions = ({ dataset }: UseDatasetCardActionsOptions) => {
const { t } = useTranslation(['app'])
const { push } = useRouter()
const openAccessConfig = useCallback(() => {
push(`/datasets/${dataset.id}/access-config`)
}, [dataset.id, push])
const { mutateAsync: exportPipelineConfig, isPending: exporting } = useMutation(
consoleQuery.rag.pipelines.byPipelineId.exports.get.mutationOptions({
context: { silent: true },
}),
)
const handleExportPipeline = useCallback(
async (include: boolean = false) => {
const { pipeline_id, name } = dataset
if (!pipeline_id || exporting) return
try {
const { data } = await exportPipelineConfig({
params: { pipeline_id },
query: { include_secret: String(include) },
})
const file = new Blob([data], { type: 'application/yaml' })
downloadBlob({ data: file, fileName: `${name}.pipeline` })
} catch (error) {
toast.error(getErrorMessage(error) ?? t(($) => $.exportFailed, { ns: 'app' }))
}
},
[dataset, exportPipelineConfig, exporting, t],
)
return { openAccessConfig, handleExportPipeline }
}