Skip to content

RAGFlow is an agent-native database: a Retrieval-Augmented Generation (RAG) engine that grew into context infrastructure.

Feat: Hide the delete and update buttons related to the Go version of the wiki. (#19620)

balibabu02d1fdfd0695
diff --git a/web/src/pages/chunk/representation/index.tsx b/web/src/pages/chunk/representation/index.tsx
index 1aa2a98ae0..92b05a1a04 100644
--- a/web/src/pages/chunk/representation/index.tsx
+++ b/web/src/pages/chunk/representation/index.tsx
@@ -7,6 +7,7 @@ import {
useDeleteDocumentStructureGraph,
useFetchDocumentClaims,
} from '@/hooks/use-document-request';
+import { useIsGoBackend } from '@/utils/backend-variant';
import { Trash2 } from 'lucide-react';
import { memo, useCallback, useEffect, useState } from 'react';
import { useTranslation } from 'react-i18next';
@@ -42,6 +43,7 @@ function Representation({
onEvidencePanelChange,
}: RepresentationProps) {
const { t } = useTranslation();
+ const isGo = useIsGoBackend();
const { deleteDocumentStructureGraph, loading: deleting } =
useDeleteDocumentStructureGraph();
@@ -207,7 +209,7 @@ function Representation({
/>
)}
</div>
- {templates.length > 0 && (
+ {templates.length > 0 && !isGo && (
<ConfirmDeleteDialog onOk={handleDelete}>
<Button
variant="ghost"
diff --git a/web/src/pages/dataset/compilation/dataset-structure-view.tsx b/web/src/pages/dataset/compilation/dataset-structure-view.tsx
index 9c70cd63b4..4bb2ed105c 100644
--- a/web/src/pages/dataset/compilation/dataset-structure-view.tsx
+++ b/web/src/pages/dataset/compilation/dataset-structure-view.tsx
@@ -25,6 +25,7 @@ import {
useFetchKnowledgeBaseConfiguration,
useKnowledgeBaseId,
} from '@/hooks/use-knowledge-request';
+import { useIsGoBackend } from '@/utils/backend-variant';
import { useQueryClient } from '@tanstack/react-query';
import { Trash2 } from 'lucide-react';
import { useCallback, useMemo, useState } from 'react';
@@ -48,6 +49,7 @@ interface DatasetStructureViewProps {
export function DatasetStructureView({ kind }: DatasetStructureViewProps) {
const { t } = useTranslation();
+ const isGo = useIsGoBackend();
const queryClient = useQueryClient();
const knowledgeBaseId = useKnowledgeBaseId();
const { data: knowledgeBase } = useFetchKnowledgeBaseConfiguration();
@@ -170,33 +172,35 @@ export function DatasetStructureView({ kind }: DatasetStructureViewProps) {
return (
<Card className="flex-1 min-h-0 overflow-hidden flex border-border-button rounded-xl flex-col">
<div className="flex justify-between gap-4 px-4 pt-4">
- <div className="flex items-center gap-2">
- <ConfirmDeleteDialog
- title={t('knowledgeCompilation.deleteStructureConfirm', {
- name: t(ViewModeLabelKeyMap[kind]),
- })}
- onOk={handleDeleteStructure}
- >
- <Button variant="outline" size="sm" disabled={deleting}>
- <Trash2 />
- </Button>
- </ConfirmDeleteDialog>
- <CompilationUpdateButton
- traceData={structureRunData}
- generateType={generateType}
- hasChanges={hasChanges}
- newlyUploaded={newlyUploaded}
- removed={removed}
- retryPageCount={retryPageCount}
- loading={alterationLoading || runLoading}
- tooltip={t('knowledgeCompilation.updateStructureTooltip', {
- newlyUploaded,
- removed,
- name: t(ViewModeLabelKeyMap[kind]),
- })}
- onClick={handleUpdateClick}
- />
- </div>
+ {!isGo && (
+ <div className="flex items-center gap-2">
+ <ConfirmDeleteDialog
+ title={t('knowledgeCompilation.deleteStructureConfirm', {
+ name: t(ViewModeLabelKeyMap[kind]),
+ })}
+ onOk={handleDeleteStructure}
+ >
+ <Button variant="outline" size="sm" disabled={deleting}>
+ <Trash2 />
+ </Button>
+ </ConfirmDeleteDialog>
+ <CompilationUpdateButton
+ traceData={structureRunData}
+ generateType={generateType}
+ hasChanges={hasChanges}
+ newlyUploaded={newlyUploaded}
+ removed={removed}
+ retryPageCount={retryPageCount}
+ loading={alterationLoading || runLoading}
+ tooltip={t('knowledgeCompilation.updateStructureTooltip', {
+ newlyUploaded,
+ removed,
+ name: t(ViewModeLabelKeyMap[kind]),
+ })}
+ onClick={handleUpdateClick}
+ />
+ </div>
+ )}
{kind === ViewMode.Graph && (
<SelectWithSearch
options={entityOptions}
diff --git a/web/src/pages/dataset/compilation/nav-tree-left-panel.tsx b/web/src/pages/dataset/compilation/nav-tree-left-panel.tsx
index 804c235d26..6aac2f23f8 100644
--- a/web/src/pages/dataset/compilation/nav-tree-left-panel.tsx
+++ b/web/src/pages/dataset/compilation/nav-tree-left-panel.tsx
@@ -8,6 +8,7 @@ import {
DatasetNavNode,
} from '@/interfaces/database/dataset-nav';
import { IStructureGraphTemplate } from '@/interfaces/database/document-structure';
+import { useIsGoBackend } from '@/utils/backend-variant';
import { FileText, Folder, Trash2 } from 'lucide-react';
import { useCallback, useMemo } from 'react';
import { useTranslation } from 'react-i18next';
@@ -27,6 +28,7 @@ function NavNodeDeleteAction({
onDelete,
}: NavNodeDeleteActionProps) {
const { t } = useTranslation();
+ const isGo = useIsGoBackend();
const handleTriggerClick = useCallback(
(e: React.MouseEvent<HTMLButtonElement>) => {
@@ -41,6 +43,9 @@ function NavNodeDeleteAction({
onDelete(name, parentName);
}, [name, parentName, onDelete]);
+ // The Go backend does not support deleting nav nodes; don't mount the action.
+ if (isGo) return null;
+
return (
<ConfirmDeleteDialog
title={t('knowledgeCompilation.navDeleteNodeTitle')}
@@ -99,6 +104,7 @@ export function NavTreeLeftPanel({
onDeleteNode,
}: NavTreeLeftPanelProps) {
const { t } = useTranslation();
+ const isGo = useIsGoBackend();
const renderNavActions = useCallback(
(node: DatasetNavNode, parentName: string | null) => (
@@ -144,7 +150,7 @@ export function NavTreeLeftPanel({
<span className="text-sm font-medium text-text-primary">
{t('knowledgeCompilation.navTitle')} ({navList?.total ?? 0})
</span>
- {treeData.length > 0 && (
+ {!isGo && treeData.length > 0 && (
<ConfirmDeleteDialog
title={t('knowledgeCompilation.navDeleteAllTitle')}
content={{
diff --git a/web/src/pages/dataset/compilation/skills-left-panel.tsx b/web/src/pages/dataset/compilation/skills-left-panel.tsx
index f975394e10..af99b0f12e 100644
--- a/web/src/pages/dataset/compilation/skills-left-panel.tsx
+++ b/web/src/pages/dataset/compilation/skills-left-panel.tsx
@@ -8,6 +8,7 @@ import {
useDeleteDatasetSkillTree,
useFetchDatasetSkillTree,
} from '@/hooks/use-dataset-skill-request';
+import { useIsGoBackend } from '@/utils/backend-variant';
import { useDebounce } from 'ahooks';
import { FileText, Folder, Trash2 } from 'lucide-react';
import { useCallback, useMemo, useState } from 'react';
@@ -41,6 +42,7 @@ function SkillDeleteAction({
onDelete,
}: SkillDeleteActionProps) {
const { t } = useTranslation();
+ const isGo = useIsGoBackend();
const handleTriggerClick = useCallback(
(e: React.MouseEvent<HTMLButtonElement>) => {
@@ -55,6 +57,9 @@ function SkillDeleteAction({
onDelete(skillKwd);
}, [skillKwd, onDelete]);
+ // The Go backend does not support deleting skill pages; don't mount the action.
+ if (isGo) return null;
+
return (
<ConfirmDeleteDialog
title={t('knowledgeCompilation.skillDeleteTitle')}
@@ -82,6 +87,7 @@ export function SkillsLeftPanel({
onSelectSkill,
}: SkillsLeftPanelProps) {
const { t } = useTranslation();
+ const isGo = useIsGoBackend();
const { data: tree, loading } = useFetchDatasetSkillTree();
const { deleteSkillTree, loading: deleteTreeLoading } =
useDeleteDatasetSkillTree();
@@ -153,20 +159,24 @@ export function SkillsLeftPanel({
<span className="text-sm font-medium text-text-primary">
{t('knowledgeCompilation.skillFolders')} ({totalCount})
</span>
- <ConfirmDeleteDialog
- title={t('knowledgeCompilation.skillDeleteAllTitle')}
- content={{ title: t('knowledgeCompilation.skillDeleteAllDescription') }}
- onOk={handleDeleteAll}
- >
- <Button
- variant="ghost"
- size="icon-sm"
- disabled={deleteTreeLoading}
- data-testid="skills-clear-trigger"
+ {!isGo && (
+ <ConfirmDeleteDialog
+ title={t('knowledgeCompilation.skillDeleteAllTitle')}
+ content={{
+ title: t('knowledgeCompilation.skillDeleteAllDescription'),
+ }}
+ onOk={handleDeleteAll}
>
- <Trash2 />
- </Button>
- </ConfirmDeleteDialog>
+ <Button
+ variant="ghost"
+ size="icon-sm"
+ disabled={deleteTreeLoading}
+ data-testid="skills-clear-trigger"
+ >
+ <Trash2 />
+ </Button>
+ </ConfirmDeleteDialog>
+ )}
</section>
<div className="px-3 py-2">
diff --git a/web/src/pages/dataset/compilation/wiki-left-panel/index.tsx b/web/src/pages/dataset/compilation/wiki-left-panel/index.tsx
index 63dbcfc411..b7e369bb96 100644
--- a/web/src/pages/dataset/compilation/wiki-left-panel/index.tsx
+++ b/web/src/pages/dataset/compilation/wiki-left-panel/index.tsx
@@ -4,6 +4,7 @@ import { Tabs, TabsList, TabsTrigger } from '@/components/ui/tabs';
import { GenerateStatus, GenerateType } from '@/constants/knowledge';
import { ITraceInfo, useGenerateStatus } from '@/hooks/use-dataset-generate';
import { IArtifact } from '@/interfaces/database/dataset';
+import { useIsGoBackend } from '@/utils/backend-variant';
import { Trash2 } from 'lucide-react';
import { useCallback } from 'react';
import { useTranslation } from 'react-i18next';
@@ -40,6 +41,7 @@ export function WikiLeftPanel({
traceData,
}: WikiLeftPanelProps) {
const { t } = useTranslation();
+ const isGo = useIsGoBackend();
const { open, setOpen, handleConfirm, loading } = useWikiClear({
onClearWiki,
@@ -67,43 +69,45 @@ export function WikiLeftPanel({
return (
<aside className="size-full flex flex-col p-5">
- <div className="flex items-center justify-between pb-5">
- <CompilationUpdateButton
- traceData={traceData}
- generateType={GenerateType.Artifact}
- hasChanges={hasChanges}
- newlyUploaded={newlyUploaded}
- removed={removed}
- changed={changed}
- retryPageCount={retryPageCount}
- loading={updateLoading}
- tooltip={t('knowledgeCompilation.updateTooltip', {
- newlyUploaded,
- removed,
- changed,
- defaultValue:
- '{{newlyUploaded}} new, {{removed}} removed, {{changed}} changed documents found. Click to compile and merge into current Wiki.',
- })}
- onClick={handleUpdateClick}
- />
- <ConfirmDeleteDialog
- open={open}
- onOpenChange={setOpen}
- title={t('knowledgeCompilation.clearWikiTitle')}
- content={{ title: t('knowledgeCompilation.clearWikiDescription') }}
- onOk={handleConfirm}
- >
- <Button
- variant="ghost"
- size="icon-sm"
- className="ml-auto"
- disabled={loading}
- data-testid="wiki-clear-trigger"
+ {!isGo && (
+ <div className="flex items-center justify-between pb-5">
+ <CompilationUpdateButton
+ traceData={traceData}
+ generateType={GenerateType.Artifact}
+ hasChanges={hasChanges}
+ newlyUploaded={newlyUploaded}
+ removed={removed}
+ changed={changed}
+ retryPageCount={retryPageCount}
+ loading={updateLoading}
+ tooltip={t('knowledgeCompilation.updateTooltip', {
+ newlyUploaded,
+ removed,
+ changed,
+ defaultValue:
+ '{{newlyUploaded}} new, {{removed}} removed, {{changed}} changed documents found. Click to compile and merge into current Wiki.',
+ })}
+ onClick={handleUpdateClick}
+ />
+ <ConfirmDeleteDialog
+ open={open}
+ onOpenChange={setOpen}
+ title={t('knowledgeCompilation.clearWikiTitle')}
+ content={{ title: t('knowledgeCompilation.clearWikiDescription') }}
+ onOk={handleConfirm}
>
- <Trash2 className="size-[1em]" />
- </Button>
- </ConfirmDeleteDialog>
- </div>
+ <Button
+ variant="ghost"
+ size="icon-sm"
+ className="ml-auto"
+ disabled={loading}
+ data-testid="wiki-clear-trigger"
+ >
+ <Trash2 className="size-[1em]" />
+ </Button>
+ </ConfirmDeleteDialog>
+ </div>
+ )}
<Tabs value={tab} onValueChange={onTabChange} className="pb-5">
<TabsList className="grid grid-cols-2 w-80">
<TabsTrigger value={LeftPanelTab.Contents}>