mirror of
https://github.com/langgenius/dify.git
synced 2026-04-13 14:48:11 +08:00
refactor: Update knowledge pipeline terminology and permissions in the RAG pipeline header
This commit is contained in:
parent
c004988ecd
commit
93b1c61f5e
@ -62,7 +62,7 @@ const Popup = () => {
|
||||
const { mutateAsync: publishWorkflow } = usePublishWorkflow()
|
||||
const { notify } = useToastContext()
|
||||
const workflowStore = useWorkflowStore()
|
||||
const { isAllowPublishAsKnowledgePipeline } = useProviderContext()
|
||||
const { isAllowPublishAsCustomKnowledgePipelineTemplate } = useProviderContext()
|
||||
const setShowPricingModal = useModalContextSelector(s => s.setShowPricingModal)
|
||||
|
||||
const [confirmVisible, {
|
||||
@ -206,16 +206,16 @@ const Popup = () => {
|
||||
])
|
||||
|
||||
const handleClickPublishAsKnowledgePipeline = useCallback(() => {
|
||||
if (!isAllowPublishAsKnowledgePipeline)
|
||||
if (!isAllowPublishAsCustomKnowledgePipelineTemplate)
|
||||
setShowPricingModal()
|
||||
else
|
||||
setShowPublishAsKnowledgePipelineModal()
|
||||
}, [isAllowPublishAsKnowledgePipeline, setShowPublishAsKnowledgePipelineModal, setShowPricingModal])
|
||||
}, [isAllowPublishAsCustomKnowledgePipelineTemplate, setShowPublishAsKnowledgePipelineModal, setShowPricingModal])
|
||||
|
||||
return (
|
||||
<div className={classNames(
|
||||
'rounded-2xl border-[0.5px] border-components-panel-border bg-components-panel-bg shadow-xl shadow-shadow-shadow-5',
|
||||
isAllowPublishAsKnowledgePipeline ? 'w-[320px] ' : 'w-[360px]',
|
||||
isAllowPublishAsCustomKnowledgePipelineTemplate ? 'w-[360px]' : 'w-[400px]',
|
||||
)}>
|
||||
<div className='p-4 pt-3'>
|
||||
<div className='system-xs-medium-uppercase flex h-6 items-center text-text-tertiary'>
|
||||
@ -293,12 +293,12 @@ const Popup = () => {
|
||||
onClick={handleClickPublishAsKnowledgePipeline}
|
||||
disabled={!publishedAt || isPublishingAsCustomizedPipeline}
|
||||
>
|
||||
<div className='flex grow items-center gap-x-2'>
|
||||
<div className='flex grow items-center gap-x-2 overflow-hidden'>
|
||||
<RiHammerLine className='h-4 w-4 shrink-0' />
|
||||
<span className='grow truncate text-left' title={t('pipeline.common.publishAs')}>
|
||||
{t('pipeline.common.publishAs')}
|
||||
</span>
|
||||
{!isAllowPublishAsKnowledgePipeline && (
|
||||
{!isAllowPublishAsCustomKnowledgePipelineTemplate && (
|
||||
<PremiumBadge className='shrink-0 cursor-pointer select-none' size='s' color='indigo'>
|
||||
<SparklesSoft className='flex size-3 items-center text-components-premium-badge-indigo-text-stop-0' />
|
||||
<span className='system-2xs-medium p-0.5'>
|
||||
|
||||
@ -61,7 +61,7 @@ type ProviderContextState = {
|
||||
},
|
||||
refreshLicenseLimit: () => void
|
||||
isAllowTransferWorkspace: boolean
|
||||
isAllowPublishAsKnowledgePipeline: boolean
|
||||
isAllowPublishAsCustomKnowledgePipelineTemplate: boolean
|
||||
}
|
||||
const ProviderContext = createContext<ProviderContextState>({
|
||||
modelProviders: [],
|
||||
@ -108,7 +108,7 @@ const ProviderContext = createContext<ProviderContextState>({
|
||||
},
|
||||
refreshLicenseLimit: noop,
|
||||
isAllowTransferWorkspace: false,
|
||||
isAllowPublishAsKnowledgePipeline: false,
|
||||
isAllowPublishAsCustomKnowledgePipelineTemplate: false,
|
||||
})
|
||||
|
||||
export const useProviderContext = () => useContext(ProviderContext)
|
||||
@ -147,7 +147,7 @@ export const ProviderContextProvider = ({
|
||||
const [isEducationWorkspace, setIsEducationWorkspace] = useState(false)
|
||||
const { data: educationAccountInfo, isLoading: isLoadingEducationAccountInfo, isFetching: isFetchingEducationAccountInfo } = useEducationStatus(!enableEducationPlan)
|
||||
const [isAllowTransferWorkspace, setIsAllowTransferWorkspace] = useState(false)
|
||||
const [isAllowPublishAsKnowledgePipeline, setIsAllowPublishAsKnowledgePipeline] = useState(false)
|
||||
const [isAllowPublishAsCustomKnowledgePipelineTemplate, setIsAllowPublishAsCustomKnowledgePipelineTemplate] = useState(false)
|
||||
|
||||
const fetchPlan = async () => {
|
||||
try {
|
||||
@ -179,7 +179,7 @@ export const ProviderContextProvider = ({
|
||||
if (data.is_allow_transfer_workspace)
|
||||
setIsAllowTransferWorkspace(data.is_allow_transfer_workspace)
|
||||
if (data.knowledge_pipeline?.publish_enabled)
|
||||
setIsAllowPublishAsKnowledgePipeline(data.knowledge_pipeline?.publish_enabled)
|
||||
setIsAllowPublishAsCustomKnowledgePipelineTemplate(data.knowledge_pipeline?.publish_enabled)
|
||||
}
|
||||
catch (error) {
|
||||
console.error('Failed to fetch plan info:', error)
|
||||
@ -245,7 +245,7 @@ export const ProviderContextProvider = ({
|
||||
licenseLimit,
|
||||
refreshLicenseLimit: fetchPlan,
|
||||
isAllowTransferWorkspace,
|
||||
isAllowPublishAsKnowledgePipeline,
|
||||
isAllowPublishAsCustomKnowledgePipelineTemplate,
|
||||
}}>
|
||||
{children}
|
||||
</ProviderContext.Provider>
|
||||
|
||||
@ -1,7 +1,7 @@
|
||||
const translation = {
|
||||
common: {
|
||||
goToAddDocuments: 'Go to add documents',
|
||||
publishAs: 'Publish as a Knowledge Pipeline',
|
||||
publishAs: 'Publish as a Customized Pipeline Template',
|
||||
confirmPublish: 'Confirm Publish',
|
||||
confirmPublishContent: 'After successfully publishing the knowledge pipeline, the chunk structure of this knowledge base cannot be modified. Are you sure you want to publish it?',
|
||||
publishAsPipeline: {
|
||||
|
||||
@ -1,7 +1,7 @@
|
||||
const translation = {
|
||||
common: {
|
||||
goToAddDocuments: '去添加文档',
|
||||
publishAs: '发布为知识流水线',
|
||||
publishAs: '发布为自定义流水线模板',
|
||||
confirmPublish: '确认发布',
|
||||
confirmPublishContent: '成功发布知识流水线后,此知识库的分段结构将无法修改。您确定要发布吗?',
|
||||
publishAsPipeline: {
|
||||
|
||||
Loading…
Reference in New Issue
Block a user