From 3fdf29b6093e0d7d899576180f0cd65e3d7774cb Mon Sep 17 00:00:00 2001 From: balibabu Date: Fri, 14 Aug 2026 14:48:59 +0800 Subject: [PATCH] Fix: Editing a document slice requires showing the wiki's update button (#18267) --- web/src/interfaces/database/dataset.ts | 2 ++ web/src/locales/en.ts | 2 +- web/src/locales/zh.ts | 2 +- web/src/pages/dataset/compilation/llm-wiki-view.tsx | 4 ++++ web/src/pages/dataset/compilation/update-button.tsx | 7 +++++++ .../compilation/wiki-left-panel/hooks/use-wiki-update.ts | 4 +++- .../pages/dataset/compilation/wiki-left-panel/index.tsx | 5 ++++- 7 files changed, 22 insertions(+), 4 deletions(-) diff --git a/web/src/interfaces/database/dataset.ts b/web/src/interfaces/database/dataset.ts index 9a328d4943..b12d397621 100644 --- a/web/src/interfaces/database/dataset.ts +++ b/web/src/interfaces/database/dataset.ts @@ -279,8 +279,10 @@ export interface IArtifactGraphEntity { export interface IArtifactAlteration { removed: number; newly_uploaded: number; + changed: number; removed_doc_ids: string[]; newly_uploaded_doc_ids: string[]; + changed_doc_ids: string[]; involved_doc_ids: string[]; eligible_doc_ids: string[]; } diff --git a/web/src/locales/en.ts b/web/src/locales/en.ts index 70706a8f2c..3f369d9ab3 100644 --- a/web/src/locales/en.ts +++ b/web/src/locales/en.ts @@ -467,7 +467,7 @@ Example: A 1 KB message with 1024-dim embedding uses ~9 KB. The 5 MB default lim 'Are you sure you want to clear all wiki pages in this dataset? This action cannot be undone.', update: 'Update', updateTooltip: - '{{newlyUploaded}} new, {{removed}} removed documents found. Click to compile and merge into current Wiki.', + '{{newlyUploaded}} new, {{removed}} removed, {{changed}} changed documents found. Click to compile and merge into current Wiki.', updateSheetTitle: 'Update Wiki', updateStructureSheetTitle: 'Update {{name}}', updateStructureTooltip: diff --git a/web/src/locales/zh.ts b/web/src/locales/zh.ts index 29287a69b4..cd24c9e3ae 100644 --- a/web/src/locales/zh.ts +++ b/web/src/locales/zh.ts @@ -421,7 +421,7 @@ export default { '确定要清空该数据集下的所有 Wiki 页面吗?此操作无法撤销。', update: '更新', updateTooltip: - '发现 {{newlyUploaded}} 个新文档,{{removed}} 个已移除文档。点击编译并合并到当前 Wiki。', + '发现 {{newlyUploaded}} 个新文档,{{removed}} 个已移除文档,{{changed}} 个已变更文档。点击编译并合并到当前 Wiki。', updateSheetTitle: '更新 Wiki', updateStructureSheetTitle: '更新{{name}}', updateStructureTooltip: diff --git a/web/src/pages/dataset/compilation/llm-wiki-view.tsx b/web/src/pages/dataset/compilation/llm-wiki-view.tsx index f404b290f1..b8f56289c9 100644 --- a/web/src/pages/dataset/compilation/llm-wiki-view.tsx +++ b/web/src/pages/dataset/compilation/llm-wiki-view.tsx @@ -10,6 +10,7 @@ import { useTraceRunData, } from '@/hooks/use-dataset-generate'; import { + ArtifactAlterationKeys, ArtifactKeys, ArtifactTopicKeys, useFetchArtifactTopicList, @@ -46,6 +47,9 @@ export function LlmWikiView() { const [updateSheetOpen, setUpdateSheetOpen] = useState(false); const handleRunEnd = useCallback(() => { + queryClient.invalidateQueries({ + queryKey: ArtifactAlterationKeys.detail(id!, 'wiki'), + }); queryClient.invalidateQueries({ queryKey: ArtifactKeys.listByDataset(id!), }); diff --git a/web/src/pages/dataset/compilation/update-button.tsx b/web/src/pages/dataset/compilation/update-button.tsx index 6737add545..a02b897367 100644 --- a/web/src/pages/dataset/compilation/update-button.tsx +++ b/web/src/pages/dataset/compilation/update-button.tsx @@ -21,6 +21,7 @@ type CompilationUpdateButtonProps = { hasChanges: boolean; newlyUploaded: number; removed: number; + changed?: number; loading: boolean; tooltip: string; onClick: () => void; @@ -32,6 +33,7 @@ export function CompilationUpdateButton({ hasChanges, newlyUploaded, removed, + changed = 0, loading, tooltip, onClick, @@ -75,6 +77,11 @@ export function CompilationUpdateButton({ {removed} )} + {changed > 0 && ( + + {changed} + + )} )} diff --git a/web/src/pages/dataset/compilation/wiki-left-panel/hooks/use-wiki-update.ts b/web/src/pages/dataset/compilation/wiki-left-panel/hooks/use-wiki-update.ts index 71a4edb7ce..35cd0547e4 100644 --- a/web/src/pages/dataset/compilation/wiki-left-panel/hooks/use-wiki-update.ts +++ b/web/src/pages/dataset/compilation/wiki-left-panel/hooks/use-wiki-update.ts @@ -15,7 +15,8 @@ export function useWikiUpdate({ onUpdate }: UseWikiUpdateOptions = {}) { const newlyUploaded = data?.newly_uploaded ?? 0; const removed = data?.removed ?? 0; - const hasChanges = newlyUploaded > 0 || removed > 0; + const changed = data?.changed ?? 0; + const hasChanges = newlyUploaded > 0 || removed > 0 || changed > 0; const handleUpdate = useCallback(async () => { const result = await runArtifactIndex(); @@ -28,6 +29,7 @@ export function useWikiUpdate({ onUpdate }: UseWikiUpdateOptions = {}) { hasChanges, newlyUploaded, removed, + changed, handleUpdate, loading: queryLoading || mutationLoading, }; 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 2e27f5b1bb..089ff73885 100644 --- a/web/src/pages/dataset/compilation/wiki-left-panel/index.tsx +++ b/web/src/pages/dataset/compilation/wiki-left-panel/index.tsx @@ -49,6 +49,7 @@ export function WikiLeftPanel({ hasChanges, newlyUploaded, removed, + changed, handleUpdate, loading: updateLoading, } = useWikiUpdate(); @@ -72,12 +73,14 @@ export function WikiLeftPanel({ hasChanges={hasChanges} newlyUploaded={newlyUploaded} removed={removed} + changed={changed} loading={updateLoading} tooltip={t('knowledgeDetails.updateTooltip', { newlyUploaded, removed, + changed, defaultValue: - '{{newlyUploaded}} new, {{removed}} removed documents found. Click to compile and merge into current Wiki.', + '{{newlyUploaded}} new, {{removed}} removed, {{changed}} changed documents found. Click to compile and merge into current Wiki.', })} onClick={handleUpdateClick} />