version panel

This commit is contained in:
zxhlyh 2025-05-22 16:43:04 +08:00
parent faf6b9ea03
commit c2a7e0e986
12 changed files with 47 additions and 11 deletions

View File

@ -3,7 +3,9 @@ import RagPipeline from '@/app/components/rag-pipeline'
const PipelinePage = () => {
return (
<RagPipeline />
<div className='h-full w-full overflow-x-auto'>
<RagPipeline />
</div>
)
}
export default PipelinePage

View File

@ -41,6 +41,7 @@ const WeightedScore = ({
value={value.value[0]}
onChange={v => !readonly && onChange({ value: [v, (10 - v * 10) / 10] })}
trackClassName='weightedScoreSliderTrack'
disabled={readonly}
/>
<div className='mt-3 flex justify-between'>
<div className='system-xs-semibold-uppercase flex w-[90px] shrink-0 items-center text-util-colors-blue-light-blue-light-500'>

View File

@ -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: <RagPipelinePanelOnRight />,
},
versionHistoryPanelProps,
}
}, [])
}, [versionHistoryPanelProps])
return (
<Panel {...panelProps} />

View File

@ -46,6 +46,7 @@ const RagPipeline = () => {
<RagPipelineMain
edges={edgesData}
nodes={nodesData}
viewport={data.graph.viewport}
/>
</WorkflowWithDefaultContext>
)

View File

@ -152,7 +152,6 @@ export const Workflow: FC<WorkflowProps> = memo(({
setAutoFreeze(true)
}
}, [])
useEffect(() => {
return () => {
handleSyncWorkflowDraft(true, true)

View File

@ -0,0 +1,5 @@
export const useConfig = (id: string) => {
return {
id,
}
}

View File

@ -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 (
<Field
fieldTitleProps={{
title: 'Chunk Structure',
tooltip: 'Chunk Structure',
title: t('workflow.nodes.knowledgeBase.chunkStructure'),
tooltip: t('workflow.nodes.knowledgeBase.chunkStructure'),
operation: (
<Selector
options={options}

View File

@ -1,4 +1,5 @@
import { useCallback, useState } from 'react'
import { useTranslation } from 'react-i18next'
import {
PortalToFollowElem,
PortalToFollowElemContent,
@ -21,6 +22,7 @@ const Selector = ({
onChange,
readonly,
}: SelectorProps) => {
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')}
</Button>
</PortalToFollowElemTrigger>
<PortalToFollowElemContent className='z-10'>
<div className='w-[404px] rounded-2xl border-[0.5px] border-components-panel-border bg-components-panel-bg-blur shadow-xl backdrop-blur-[5px]'>
<div className='system-sm-semibold px-3 pt-3.5 text-text-primary'>
change Chunk Structure
{t('workflow.nodes.knowledgeBase.changeChunkStructure')}
</div>
<div className='space-y-1 p-3 pt-2'>
{

View File

@ -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 (
<Field
fieldTitleProps={{
title: 'Input Variable',
tooltip: 'Input Variable',
title: t('workflow.nodes.common.inputVars'),
}}
>
<VarReferencePicker

View File

@ -62,8 +62,7 @@ const RetrievalSetting = ({
subTitle: (
<div className='body-xs-regular flex items-center text-text-tertiary'>
<a target='_blank' rel='noopener noreferrer' href='https://docs.dify.ai/guides/knowledge-base/create-knowledge-and-upload-documents#id-4-retrieval-settings' className='text-text-accent'>{t('datasetSettings.form.retrievalSetting.learnMore')}</a>
&nbsp;
about retrieval method.
&nbsp;{t('workflow.nodes.knowledgeBase.aboutRetrieval')}
</div>
),
}}

View File

@ -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: {

View File

@ -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: {