mirror of
				https://github.com/langgenius/dify.git
				synced 2025-11-03 20:33:00 +00:00 
			
		
		
		
	Merge branch 'feat/rag-pipeline' into deploy/rag-dev
This commit is contained in:
		
						commit
						176f9ea2f4
					
				@ -24,7 +24,7 @@ export const useDatasourceIcon = (data: DataSourceNodeType) => {
 | 
				
			|||||||
  useDataSourceList(!!pipelineId, handleUpdateDataSourceList)
 | 
					  useDataSourceList(!!pipelineId, handleUpdateDataSourceList)
 | 
				
			||||||
 | 
					
 | 
				
			||||||
  const datasourceIcon = useMemo(() => {
 | 
					  const datasourceIcon = useMemo(() => {
 | 
				
			||||||
    return dataSourceList?.find(toolWithProvider => toolWithProvider.name === data.provider_id)?.icon
 | 
					    return dataSourceList?.find(toolWithProvider => toolWithProvider.plugin_id === data.plugin_id)?.icon
 | 
				
			||||||
  }, [data, dataSourceList])
 | 
					  }, [data, dataSourceList])
 | 
				
			||||||
 | 
					
 | 
				
			||||||
  return datasourceIcon
 | 
					  return datasourceIcon
 | 
				
			||||||
 | 
				
			|||||||
@ -29,6 +29,7 @@ const ChunkStructure = ({
 | 
				
			|||||||
            effectColor={option.effectColor}
 | 
					            effectColor={option.effectColor}
 | 
				
			||||||
            showEffectColor
 | 
					            showEffectColor
 | 
				
			||||||
            className='gap-x-1.5 p-3 pr-4'
 | 
					            className='gap-x-1.5 p-3 pr-4'
 | 
				
			||||||
 | 
					            disabled
 | 
				
			||||||
          />
 | 
					          />
 | 
				
			||||||
        ))
 | 
					        ))
 | 
				
			||||||
      }
 | 
					      }
 | 
				
			||||||
 | 
				
			|||||||
@ -31,7 +31,10 @@ import { useToastContext } from '@/app/components/base/toast'
 | 
				
			|||||||
import { useParams, useRouter } from 'next/navigation'
 | 
					import { useParams, useRouter } from 'next/navigation'
 | 
				
			||||||
import { useDatasetDetailContextWithSelector } from '@/context/dataset-detail'
 | 
					import { useDatasetDetailContextWithSelector } from '@/context/dataset-detail'
 | 
				
			||||||
import { useInvalid } from '@/service/use-base'
 | 
					import { useInvalid } from '@/service/use-base'
 | 
				
			||||||
import { publishedPipelineInfoQueryKeyPrefix } from '@/service/use-pipeline'
 | 
					import {
 | 
				
			||||||
 | 
					  publishedPipelineInfoQueryKeyPrefix,
 | 
				
			||||||
 | 
					  usePublishAsCustomizedPipeline,
 | 
				
			||||||
 | 
					} from '@/service/use-pipeline'
 | 
				
			||||||
import Confirm from '@/app/components/base/confirm'
 | 
					import Confirm from '@/app/components/base/confirm'
 | 
				
			||||||
 | 
					
 | 
				
			||||||
const PUBLISH_SHORTCUT = ['⌘', '⇧', 'P']
 | 
					const PUBLISH_SHORTCUT = ['⌘', '⇧', 'P']
 | 
				
			||||||
@ -58,6 +61,10 @@ const Popup = () => {
 | 
				
			|||||||
    setFalse: hidePublishing,
 | 
					    setFalse: hidePublishing,
 | 
				
			||||||
    setTrue: showPublishing,
 | 
					    setTrue: showPublishing,
 | 
				
			||||||
  }] = useBoolean(false)
 | 
					  }] = useBoolean(false)
 | 
				
			||||||
 | 
					  const {
 | 
				
			||||||
 | 
					    mutate: publishAsCustomizedPipeline,
 | 
				
			||||||
 | 
					    isPending: isPublishingAsCustomizedPipeline,
 | 
				
			||||||
 | 
					  } = usePublishAsCustomizedPipeline()
 | 
				
			||||||
 | 
					
 | 
				
			||||||
  const invalidPublishedPipelineInfo = useInvalid([...publishedPipelineInfoQueryKeyPrefix, pipelineId])
 | 
					  const invalidPublishedPipelineInfo = useInvalid([...publishedPipelineInfoQueryKeyPrefix, pipelineId])
 | 
				
			||||||
 | 
					
 | 
				
			||||||
@ -183,6 +190,8 @@ const Popup = () => {
 | 
				
			|||||||
        <Button
 | 
					        <Button
 | 
				
			||||||
          className='w-full hover:bg-state-accent-hover hover:text-text-accent'
 | 
					          className='w-full hover:bg-state-accent-hover hover:text-text-accent'
 | 
				
			||||||
          variant='tertiary'
 | 
					          variant='tertiary'
 | 
				
			||||||
 | 
					          onClick={() => publishAsCustomizedPipeline({ pipelineId: pipelineId || '' })}
 | 
				
			||||||
 | 
					          disabled={!publishedAt || isPublishingAsCustomizedPipeline}
 | 
				
			||||||
        >
 | 
					        >
 | 
				
			||||||
          <div className='flex grow items-center'>
 | 
					          <div className='flex grow items-center'>
 | 
				
			||||||
            <RiHammerLine className='mr-2 h-4 w-4' />
 | 
					            <RiHammerLine className='mr-2 h-4 w-4' />
 | 
				
			||||||
 | 
				
			|||||||
@ -30,7 +30,7 @@ export const useNodeMetaData = (node: Node) => {
 | 
				
			|||||||
  const nodeMetaData = availableNodesMetaData.nodesMap?.[data.type]
 | 
					  const nodeMetaData = availableNodesMetaData.nodesMap?.[data.type]
 | 
				
			||||||
  const author = useMemo(() => {
 | 
					  const author = useMemo(() => {
 | 
				
			||||||
    if (data.type === BlockEnum.DataSource)
 | 
					    if (data.type === BlockEnum.DataSource)
 | 
				
			||||||
      return dataSourceList?.find(dataSource => dataSource.id === data.provider_id)?.author
 | 
					      return dataSourceList?.find(dataSource => dataSource.plugin_id === data.plugin_id)?.author
 | 
				
			||||||
 | 
					
 | 
				
			||||||
    if (data.type === BlockEnum.Tool) {
 | 
					    if (data.type === BlockEnum.Tool) {
 | 
				
			||||||
      if (data.provider_type === CollectionType.builtIn)
 | 
					      if (data.provider_type === CollectionType.builtIn)
 | 
				
			||||||
@ -44,7 +44,7 @@ export const useNodeMetaData = (node: Node) => {
 | 
				
			|||||||
 | 
					
 | 
				
			||||||
  const description = useMemo(() => {
 | 
					  const description = useMemo(() => {
 | 
				
			||||||
    if (data.type === BlockEnum.DataSource)
 | 
					    if (data.type === BlockEnum.DataSource)
 | 
				
			||||||
      return dataSourceList?.find(dataSource => dataSource.id === data.provider_id)?.description[language]
 | 
					      return dataSourceList?.find(dataSource => dataSource.plugin_id === data.plugin_id)?.description[language]
 | 
				
			||||||
    if (data.type === BlockEnum.Tool) {
 | 
					    if (data.type === BlockEnum.Tool) {
 | 
				
			||||||
      if (data.provider_type === CollectionType.builtIn)
 | 
					      if (data.provider_type === CollectionType.builtIn)
 | 
				
			||||||
        return buildInTools.find(toolWithProvider => canFindTool(toolWithProvider.id, data.provider_id))?.description[language]
 | 
					        return buildInTools.find(toolWithProvider => canFindTool(toolWithProvider.id, data.provider_id))?.description[language]
 | 
				
			||||||
 | 
				
			|||||||
@ -33,7 +33,7 @@ export const useToolIcon = (data: Node['data']) => {
 | 
				
			|||||||
      return targetTools.find(toolWithProvider => canFindTool(toolWithProvider.id, data.provider_id))?.icon
 | 
					      return targetTools.find(toolWithProvider => canFindTool(toolWithProvider.id, data.provider_id))?.icon
 | 
				
			||||||
    }
 | 
					    }
 | 
				
			||||||
    if (data.type === BlockEnum.DataSource)
 | 
					    if (data.type === BlockEnum.DataSource)
 | 
				
			||||||
      return dataSourceList?.find(toolWithProvider => toolWithProvider.name === data.provider_id)?.icon
 | 
					      return dataSourceList?.find(toolWithProvider => toolWithProvider.plugin_id === data.plugin_id)?.icon
 | 
				
			||||||
  }, [data, buildInTools, customTools, workflowTools, dataSourceList])
 | 
					  }, [data, buildInTools, customTools, workflowTools, dataSourceList])
 | 
				
			||||||
 | 
					
 | 
				
			||||||
  return toolIcon
 | 
					  return toolIcon
 | 
				
			||||||
@ -61,7 +61,7 @@ export const useGetToolIcon = () => {
 | 
				
			|||||||
    }
 | 
					    }
 | 
				
			||||||
 | 
					
 | 
				
			||||||
    if (data.type === BlockEnum.DataSource)
 | 
					    if (data.type === BlockEnum.DataSource)
 | 
				
			||||||
      return dataSourceList?.find(toolWithProvider => toolWithProvider.name === data.provider_id)?.icon
 | 
					      return dataSourceList?.find(toolWithProvider => toolWithProvider.plugin_id === data.plugin_id)?.icon
 | 
				
			||||||
  }, [workflowStore])
 | 
					  }, [workflowStore])
 | 
				
			||||||
 | 
					
 | 
				
			||||||
  return getToolIcon
 | 
					  return getToolIcon
 | 
				
			||||||
 | 
				
			|||||||
@ -97,6 +97,9 @@ const translation = {
 | 
				
			|||||||
      upload_file: 'Upload File',
 | 
					      upload_file: 'Upload File',
 | 
				
			||||||
      notion: 'Sync form Notion',
 | 
					      notion: 'Sync form Notion',
 | 
				
			||||||
      github: 'Sync form Github',
 | 
					      github: 'Sync form Github',
 | 
				
			||||||
 | 
					      local_file: 'Local File',
 | 
				
			||||||
 | 
					      website_crawl: 'Website Crawl',
 | 
				
			||||||
 | 
					      online_document: 'Online Document',
 | 
				
			||||||
    },
 | 
					    },
 | 
				
			||||||
    type: {
 | 
					    type: {
 | 
				
			||||||
      book: 'Book',
 | 
					      book: 'Book',
 | 
				
			||||||
 | 
				
			|||||||
@ -96,6 +96,9 @@ const translation = {
 | 
				
			|||||||
      upload_file: '文件上传',
 | 
					      upload_file: '文件上传',
 | 
				
			||||||
      notion: '从 Notion 同步的文档',
 | 
					      notion: '从 Notion 同步的文档',
 | 
				
			||||||
      github: '从 Github 同步的代码',
 | 
					      github: '从 Github 同步的代码',
 | 
				
			||||||
 | 
					      local_file: '本地文件',
 | 
				
			||||||
 | 
					      website_crawl: '网站爬取',
 | 
				
			||||||
 | 
					      online_document: '在线文档',
 | 
				
			||||||
    },
 | 
					    },
 | 
				
			||||||
    type: {
 | 
					    type: {
 | 
				
			||||||
      book: '书籍',
 | 
					      book: '书籍',
 | 
				
			||||||
 | 
				
			|||||||
@ -342,3 +342,14 @@ export const useExportPipelineDSL = () => {
 | 
				
			|||||||
    },
 | 
					    },
 | 
				
			||||||
  })
 | 
					  })
 | 
				
			||||||
}
 | 
					}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					export const usePublishAsCustomizedPipeline = () => {
 | 
				
			||||||
 | 
					  return useMutation({
 | 
				
			||||||
 | 
					    mutationKey: [NAME_SPACE, 'publish-as-customized-pipeline'],
 | 
				
			||||||
 | 
					    mutationFn: ({
 | 
				
			||||||
 | 
					      pipelineId,
 | 
				
			||||||
 | 
					    }: { pipelineId: string }) => {
 | 
				
			||||||
 | 
					      return get(`/rag/customized/pipelines/${pipelineId}/publish`)
 | 
				
			||||||
 | 
					    },
 | 
				
			||||||
 | 
					  })
 | 
				
			||||||
 | 
					}
 | 
				
			||||||
 | 
				
			|||||||
		Loading…
	
	
			
			x
			
			
		
	
		Reference in New Issue
	
	Block a user