From 4b7c5b338ec38b429d1de7a80d92cc1fff82253d Mon Sep 17 00:00:00 2001 From: balibabu Date: Tue, 14 Jul 2026 13:45:02 +0800 Subject: [PATCH] Feat: Adjust the timeline style. (#16894) ### Summary Feat: Adjust the timeline style. --- .../components/knowledge-chunk/index.tsx | 176 +++++++++--------- .../timeline-x6-graph/hooks/use-x6-graph.ts | 7 +- .../chunk/representation/utils/adapters.ts | 19 +- .../components/template-sidebar.tsx | 2 +- 4 files changed, 111 insertions(+), 93 deletions(-) diff --git a/web/src/pages/chunk/parsed-result/add-knowledge/components/knowledge-chunk/index.tsx b/web/src/pages/chunk/parsed-result/add-knowledge/components/knowledge-chunk/index.tsx index a615c8663d..046bb504e0 100644 --- a/web/src/pages/chunk/parsed-result/add-knowledge/components/knowledge-chunk/index.tsx +++ b/web/src/pages/chunk/parsed-result/add-knowledge/components/knowledge-chunk/index.tsx @@ -2,7 +2,6 @@ import { useFetchNextChunkList, useSwitchChunk, } from '@/hooks/use-chunk-request'; -import classNames from 'classnames'; import { useCallback, useEffect, useMemo, useState } from 'react'; import { useTranslation } from 'react-i18next'; import ChunkCard from './components/chunk-card'; @@ -29,13 +28,17 @@ import { RAGFlowPagination, RAGFlowPaginationType, } from '@/components/ui/ragflow-pagination'; +import { + ResizableHandle, + ResizablePanel, + ResizablePanelGroup, +} from '@/components/ui/resizable'; import { Spin } from '@/components/ui/spin'; import { QueryStringMap, useNavigatePage, } from '@/hooks/logic-hooks/navigate-hooks'; import { LucideArrowBigLeft } from 'lucide-react'; -import styles from './index.module.less'; function Chunk() { const [filterChunkIds, setFilterChunkIds] = useState([]); @@ -52,7 +55,6 @@ function Chunk() { dataUpdatedAt, } = useFetchNextChunkList(true, { chunkIds: filterChunkIds }); const { handleChunkCardClick, selectedChunkId } = useHandleChunkCardClick(); - const isPdf = documentInfo?.type === 'pdf'; const { t } = useTranslation(); const { changeChunkTextMode, textMode } = useChangeChunkTextMode(); @@ -197,93 +199,99 @@ function Chunk() { -
- + +
+ +
+
+ + -
-
-
-

{t('chunk.chunkResult')}

-
- {t('chunk.chunkResultTip')} -
-
+ +
+
+

{t('chunk.chunkResult')}

+
+ {t('chunk.chunkResultTip')} +
+
- -
-
- + +
+
+ - -
+ +
-
- {chunkList.map((item) => ( - x === item.chunk_id, - )} - handleCheckboxClick={handleSingleCheckboxClick} - switchChunk={handleSwitchChunk} - clickChunkCard={handleChunkCardClick} - selected={item.chunk_id === selectedChunkId} - textMode={textMode} - t={dataUpdatedAt} - /> - ))} -
+
+ {chunkList.map((item) => ( + x === item.chunk_id, + )} + handleCheckboxClick={handleSingleCheckboxClick} + switchChunk={handleSwitchChunk} + clickChunkCard={handleChunkCardClick} + selected={item.chunk_id === selectedChunkId} + textMode={textMode} + t={dataUpdatedAt} + /> + ))} +
-
- { - onPaginationChange(page, pageSize); - }} - /> -
-
- -
+
+ { + onPaginationChange(page, pageSize); + }} + /> +
+ + +
+ +
diff --git a/web/src/pages/chunk/representation/components/timeline-x6-graph/hooks/use-x6-graph.ts b/web/src/pages/chunk/representation/components/timeline-x6-graph/hooks/use-x6-graph.ts index 8968d900d7..f9ac25b038 100644 --- a/web/src/pages/chunk/representation/components/timeline-x6-graph/hooks/use-x6-graph.ts +++ b/web/src/pages/chunk/representation/components/timeline-x6-graph/hooks/use-x6-graph.ts @@ -2,6 +2,7 @@ import { DagreLayout } from '@antv/layout'; import { Graph, type EdgeMetadata, type NodeMetadata } from '@antv/x6'; import { useEffect, useRef } from 'react'; +import { type TimelineX6NodeData } from '../../../utils/adapters'; import { type TimelineNodeValue, type TimelineX6GraphProps } from '../types'; export function useX6Graph( @@ -54,7 +55,6 @@ export function useX6Graph( const dagreLayout = new DagreLayout({ type: 'dagre', rankdir: 'LR', - align: 'UL', ranksep: 240, nodesep: 200, edgeMinLen: 2, @@ -70,10 +70,11 @@ export function useX6Graph( const positionedNodes = new Map(); dagreLayout.forEachNode((node) => { + const original = node._original as TimelineX6NodeData; positionedNodes.set(String(node.id), { ...(node._original as NodeMetadata), - x: node.x, - y: node.y, + x: (node.x ?? 0) - original.width / 2, + y: (node.y ?? 0) - original.height / 2, }); }); diff --git a/web/src/pages/chunk/representation/utils/adapters.ts b/web/src/pages/chunk/representation/utils/adapters.ts index e511961466..0e8866b904 100644 --- a/web/src/pages/chunk/representation/utils/adapters.ts +++ b/web/src/pages/chunk/representation/utils/adapters.ts @@ -185,20 +185,29 @@ export function adaptTimelineToX6Data(template: IStructureGraphTemplate): { return { id: entity.id, shape: isTimestamp ? ('circle' as const) : ('rect' as const), - width: isTimestamp ? 96 : 200, - height: isTimestamp ? 96 : 80, + width: isTimestamp ? 40 : 200, + height: isTimestamp ? 40 : 80, label: entity.name, data: entity, attrs: { body: { - fill: isTimestamp ? '#e6f7ff' : '#fff7e6', - stroke: isTimestamp ? '#1890ff' : '#fa8c16', + fill: isTimestamp ? 'rgb(var(--accent-primary))' : 'transparent', + stroke: 'rgb(var(--accent-primary))', rx: isTimestamp ? 48 : 8, ry: isTimestamp ? 48 : 8, }, label: { - fill: '#262626', + fill: isTimestamp + ? 'rgb(var(--accent-primary))' + : 'rgb(var(--text-primary))', fontSize: 12, + ...(isTimestamp && { + refX: '50%', + refY: 0, + refY2: -8, + textAnchor: 'middle', + textVerticalAnchor: 'bottom', + }), textWrap: { width: isTimestamp ? 80 : 180, height: isTimestamp ? 80 : 64, diff --git a/web/src/pages/user-setting/compilation-templates/create-next/components/template-sidebar.tsx b/web/src/pages/user-setting/compilation-templates/create-next/components/template-sidebar.tsx index 3243041b8f..3e61552919 100644 --- a/web/src/pages/user-setting/compilation-templates/create-next/components/template-sidebar.tsx +++ b/web/src/pages/user-setting/compilation-templates/create-next/components/template-sidebar.tsx @@ -152,7 +152,7 @@ export function TemplateSidebar({ {t('setting.templates')} - {!isAddButtonHidden && ( + {false && !isAddButtonHidden && (