From c2a7e0e986b3a71b223e5e60ba93fe97b1ed1116 Mon Sep 17 00:00:00 2001 From: zxhlyh Date: Thu, 22 May 2025 16:43:04 +0800 Subject: [PATCH] version panel --- .../[datasetId]/pipeline/page.tsx | 4 +++- .../dataset-config/params-config/weighted-score.tsx | 1 + .../rag-pipeline/components/panel/index.tsx | 13 ++++++++++++- web/app/components/rag-pipeline/index.tsx | 1 + web/app/components/workflow/index.tsx | 1 - .../workflow/nodes/data-source/hooks/use-config.ts | 5 +++++ .../components/chunk-structure/index.tsx | 6 ++++-- .../components/chunk-structure/selector.tsx | 6 ++++-- .../knowledge-base/components/input-variable.tsx | 6 ++++-- .../components/retrieval-setting/index.tsx | 3 +-- web/i18n/en-US/workflow.ts | 6 ++++++ web/i18n/zh-Hans/workflow.ts | 6 ++++++ 12 files changed, 47 insertions(+), 11 deletions(-) create mode 100644 web/app/components/workflow/nodes/data-source/hooks/use-config.ts diff --git a/web/app/(commonLayout)/datasets/(datasetDetailLayout)/[datasetId]/pipeline/page.tsx b/web/app/(commonLayout)/datasets/(datasetDetailLayout)/[datasetId]/pipeline/page.tsx index c5b5f22bf1..9a18021cc0 100644 --- a/web/app/(commonLayout)/datasets/(datasetDetailLayout)/[datasetId]/pipeline/page.tsx +++ b/web/app/(commonLayout)/datasets/(datasetDetailLayout)/[datasetId]/pipeline/page.tsx @@ -3,7 +3,9 @@ import RagPipeline from '@/app/components/rag-pipeline' const PipelinePage = () => { return ( - +
+ +
) } export default PipelinePage diff --git a/web/app/components/app/configuration/dataset-config/params-config/weighted-score.tsx b/web/app/components/app/configuration/dataset-config/params-config/weighted-score.tsx index d3ee89f28c..ebfa3b1e12 100644 --- a/web/app/components/app/configuration/dataset-config/params-config/weighted-score.tsx +++ b/web/app/components/app/configuration/dataset-config/params-config/weighted-score.tsx @@ -41,6 +41,7 @@ const WeightedScore = ({ value={value.value[0]} onChange={v => !readonly && onChange({ value: [v, (10 - v * 10) / 10] })} trackClassName='weightedScoreSliderTrack' + disabled={readonly} />
diff --git a/web/app/components/rag-pipeline/components/panel/index.tsx b/web/app/components/rag-pipeline/components/panel/index.tsx index 14140e41f0..12811c6790 100644 --- a/web/app/components/rag-pipeline/components/panel/index.tsx +++ b/web/app/components/rag-pipeline/components/panel/index.tsx @@ -24,14 +24,25 @@ const RagPipelinePanelOnRight = () => { } const RagPipelinePanel = () => { + const pipelineId = useStore(s => s.pipelineId) + const versionHistoryPanelProps = useMemo(() => { + return { + getVersionListUrl: `/rag/pipelines/${pipelineId}/workflows`, + deleteVersionUrl: (versionId: string) => `/rag/pipelines/${pipelineId}/workflows/${versionId}`, + updateVersionUrl: (versionId: string) => `/rag/pipelines/${pipelineId}/workflows/${versionId}`, + latestVersionId: '', + } + }, [pipelineId]) + const panelProps: PanelProps = useMemo(() => { return { components: { left: null, right: , }, + versionHistoryPanelProps, } - }, []) + }, [versionHistoryPanelProps]) return ( diff --git a/web/app/components/rag-pipeline/index.tsx b/web/app/components/rag-pipeline/index.tsx index c6b642994a..d1f0208684 100644 --- a/web/app/components/rag-pipeline/index.tsx +++ b/web/app/components/rag-pipeline/index.tsx @@ -46,6 +46,7 @@ const RagPipeline = () => { ) diff --git a/web/app/components/workflow/index.tsx b/web/app/components/workflow/index.tsx index 549117faf7..beea4116cf 100644 --- a/web/app/components/workflow/index.tsx +++ b/web/app/components/workflow/index.tsx @@ -152,7 +152,6 @@ export const Workflow: FC = memo(({ setAutoFreeze(true) } }, []) - useEffect(() => { return () => { handleSyncWorkflowDraft(true, true) diff --git a/web/app/components/workflow/nodes/data-source/hooks/use-config.ts b/web/app/components/workflow/nodes/data-source/hooks/use-config.ts new file mode 100644 index 0000000000..e3aee2d19c --- /dev/null +++ b/web/app/components/workflow/nodes/data-source/hooks/use-config.ts @@ -0,0 +1,5 @@ +export const useConfig = (id: string) => { + return { + id, + } +} diff --git a/web/app/components/workflow/nodes/knowledge-base/components/chunk-structure/index.tsx b/web/app/components/workflow/nodes/knowledge-base/components/chunk-structure/index.tsx index b4e2e59ede..92d1e3e748 100644 --- a/web/app/components/workflow/nodes/knowledge-base/components/chunk-structure/index.tsx +++ b/web/app/components/workflow/nodes/knowledge-base/components/chunk-structure/index.tsx @@ -1,4 +1,5 @@ import { memo } from 'react' +import { useTranslation } from 'react-i18next' import { Field } from '@/app/components/workflow/nodes/_base/components/layout' import type { ChunkStructureEnum } from '../../types' import OptionCard from '../option-card' @@ -15,6 +16,7 @@ const ChunkStructure = ({ onChunkStructureChange, readonly = false, }: ChunkStructureProps) => { + const { t } = useTranslation() const { options, optionMap, @@ -23,8 +25,8 @@ const ChunkStructure = ({ return ( { + const { t } = useTranslation() const [open, setOpen] = useState(false) const handleSelect = useCallback((optionId: ChunkStructureEnum) => { @@ -47,13 +49,13 @@ const Selector = ({ size='small' variant='ghost-accent' > - change + {t('workflow.panel.change')}
- change Chunk Structure + {t('workflow.nodes.knowledgeBase.changeChunkStructure')}
{ diff --git a/web/app/components/workflow/nodes/knowledge-base/components/input-variable.tsx b/web/app/components/workflow/nodes/knowledge-base/components/input-variable.tsx index 91f5e396c2..ae91041903 100644 --- a/web/app/components/workflow/nodes/knowledge-base/components/input-variable.tsx +++ b/web/app/components/workflow/nodes/knowledge-base/components/input-variable.tsx @@ -1,4 +1,5 @@ import { memo } from 'react' +import { useTranslation } from 'react-i18next' import VarReferencePicker from '@/app/components/workflow/nodes/_base/components/variable/var-reference-picker' import { Field } from '@/app/components/workflow/nodes/_base/components/layout' import type { ValueSelector } from '@/app/components/workflow/types' @@ -15,11 +16,12 @@ const InputVariable = ({ onInputVariableChange, readonly = false, }: InputVariableProps) => { + const { t } = useTranslation() + return ( {t('datasetSettings.form.retrievalSetting.learnMore')} -   - about retrieval method. +  {t('workflow.nodes.knowledgeBase.aboutRetrieval')}
), }} diff --git a/web/i18n/en-US/workflow.ts b/web/i18n/en-US/workflow.ts index d28cab291f..81726464a4 100644 --- a/web/i18n/en-US/workflow.ts +++ b/web/i18n/en-US/workflow.ts @@ -368,6 +368,7 @@ const translation = { ms: 'ms', retries: '{{num}} Retries', }, + inputVars: 'Input Variables', }, start: { required: 'required', @@ -767,6 +768,11 @@ const translation = { currentLoopCount: 'Current loop count: {{count}}', totalLoopCount: 'Total loop count: {{count}}', }, + knowledgeBase: { + chunkStructure: 'Chunk Structure', + changeChunkStructure: 'Change Chunk Structure', + aboutRetrieval: 'about retrieval method.', + }, note: { addNote: 'Add Note', editor: { diff --git a/web/i18n/zh-Hans/workflow.ts b/web/i18n/zh-Hans/workflow.ts index ae381b9b8a..1d854c4749 100644 --- a/web/i18n/zh-Hans/workflow.ts +++ b/web/i18n/zh-Hans/workflow.ts @@ -369,6 +369,7 @@ const translation = { ms: '毫秒', retries: '{{num}} 重试次数', }, + inputVars: '输入变量', }, start: { required: '必填', @@ -768,6 +769,11 @@ const translation = { currentLoopCount: '当前循环次数:{{count}}', totalLoopCount: '总循环次数:{{count}}', }, + knowledgeBase: { + chunkStructure: '分段结构', + changeChunkStructure: '更改分段结构', + aboutRetrieval: '关于知识检索。', + }, note: { addNote: '添加注释', editor: {