mirror of https://github.com/langgenius/dify.git
refactor: rename icon property to icon_info in UpdateTemplateInfoRequest and related components
This commit is contained in:
parent
6ecdac6344
commit
45c76c1d68
|
|
@ -76,7 +76,7 @@ const EditPipelineInfo = ({
|
|||
const request = {
|
||||
template_id: pipeline.id,
|
||||
name,
|
||||
icon: {
|
||||
icon_info: {
|
||||
icon_type: appIcon.type,
|
||||
icon: appIcon.type === 'image' ? appIcon.fileId : appIcon.icon,
|
||||
icon_background: appIcon.type === 'image' ? undefined : appIcon.background,
|
||||
|
|
|
|||
|
|
@ -5,6 +5,7 @@ import EditPipelineInfo from './edit-pipeline-info'
|
|||
import type { PipelineTemplate } from '@/models/pipeline'
|
||||
import Confirm from '@/app/components/base/confirm'
|
||||
import {
|
||||
PipelineTemplateListQueryKeyPrefix,
|
||||
useDeleteTemplate,
|
||||
useExportTemplateDSL,
|
||||
usePipelineTemplateById,
|
||||
|
|
@ -19,6 +20,7 @@ import Actions from './actions'
|
|||
import type { CreateDatasetReq } from '@/models/datasets'
|
||||
import { useCreatePipelineDataset } from '@/service/knowledge/use-create-dataset'
|
||||
import CreateModal from './create-modal'
|
||||
import { useInvalid } from '@/service/use-base'
|
||||
|
||||
type TemplateCardProps = {
|
||||
pipeline: PipelineTemplate
|
||||
|
|
@ -127,14 +129,16 @@ const TemplateCard = ({
|
|||
}, [])
|
||||
|
||||
const { mutateAsync: deletePipeline } = useDeleteTemplate()
|
||||
const invalidCustomizedTemplateList = useInvalid([...PipelineTemplateListQueryKeyPrefix, 'customized'])
|
||||
|
||||
const onConfirmDelete = useCallback(async () => {
|
||||
await deletePipeline(pipeline.id, {
|
||||
onSettled: () => {
|
||||
onSuccess: () => {
|
||||
invalidCustomizedTemplateList()
|
||||
setShowConfirmDelete(false)
|
||||
},
|
||||
})
|
||||
}, [pipeline.id, deletePipeline])
|
||||
}, [pipeline.id, deletePipeline, invalidCustomizedTemplateList])
|
||||
|
||||
return (
|
||||
<div className='group relative flex h-[132px] cursor-pointer flex-col rounded-xl border-[0.5px] border-components-panel-border bg-components-panel-on-panel-item-bg pb-3 shadow-xs shadow-shadow-shadow-3'>
|
||||
|
|
|
|||
|
|
@ -60,7 +60,7 @@ export type CreateFormData = {
|
|||
export type UpdateTemplateInfoRequest = {
|
||||
template_id: string
|
||||
name: string
|
||||
icon: IconInfo
|
||||
icon_info: IconInfo
|
||||
description: string
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -59,7 +59,7 @@ export const useUpdateTemplateInfo = (
|
|||
mutationKey: [NAME_SPACE, 'template', 'update'],
|
||||
mutationFn: (request: UpdateTemplateInfoRequest) => {
|
||||
const { template_id, ...rest } = request
|
||||
return patch<UpdateTemplateInfoResponse>(`/rag/customized/templates/${template_id}`, {
|
||||
return patch<UpdateTemplateInfoResponse>(`/rag/pipeline/customized/templates/${template_id}`, {
|
||||
body: rest,
|
||||
})
|
||||
},
|
||||
|
|
@ -73,7 +73,7 @@ export const useDeleteTemplate = (
|
|||
return useMutation({
|
||||
mutationKey: [NAME_SPACE, 'template', 'delete'],
|
||||
mutationFn: (templateId: string) => {
|
||||
return del<DeleteTemplateResponse>(`/rag/customized/templates/${templateId}`)
|
||||
return del<DeleteTemplateResponse>(`/rag/pipeline/customized/templates/${templateId}`)
|
||||
},
|
||||
...mutationOptions,
|
||||
})
|
||||
|
|
@ -85,7 +85,7 @@ export const useExportTemplateDSL = (
|
|||
return useMutation({
|
||||
mutationKey: [NAME_SPACE, 'dsl-export'],
|
||||
mutationFn: (templateId: string) => {
|
||||
return get<ExportTemplateDSLResponse>(`/rag/customized/templates/${templateId}`)
|
||||
return post<ExportTemplateDSLResponse>(`/rag/pipeline/customized/templates/${templateId}`)
|
||||
},
|
||||
...mutationOptions,
|
||||
})
|
||||
|
|
|
|||
Loading…
Reference in New Issue