mirror of
https://github.com/langgenius/dify.git
synced 2025-11-16 19:33:57 +00:00
fix
This commit is contained in:
parent
f995436eec
commit
4d9b15e519
@ -165,6 +165,8 @@ const ComponentPicker = ({
|
|||||||
isSupportFileVar={isSupportFileVar}
|
isSupportFileVar={isSupportFileVar}
|
||||||
onClose={handleClose}
|
onClose={handleClose}
|
||||||
onBlur={handleClose}
|
onBlur={handleClose}
|
||||||
|
showManageInputField={workflowVariableBlock.showManageInputField}
|
||||||
|
onManageInputField={workflowVariableBlock.onManageInputField}
|
||||||
/>
|
/>
|
||||||
</div>
|
</div>
|
||||||
)
|
)
|
||||||
@ -205,7 +207,7 @@ const ComponentPicker = ({
|
|||||||
}
|
}
|
||||||
</>
|
</>
|
||||||
)
|
)
|
||||||
}, [allFlattenOptions.length, workflowVariableBlock?.show, refs, isPositioned, floatingStyles, queryString, workflowVariableOptions, handleSelectWorkflowVariable, handleClose, isSupportFileVar])
|
}, [allFlattenOptions.length, workflowVariableBlock?.show, refs, isPositioned, floatingStyles, queryString, workflowVariableOptions, handleSelectWorkflowVariable, handleClose, isSupportFileVar, workflowVariableBlock?.showManageInputField, workflowVariableBlock?.onManageInputField])
|
||||||
|
|
||||||
return (
|
return (
|
||||||
<LexicalTypeaheadMenuPlugin
|
<LexicalTypeaheadMenuPlugin
|
||||||
|
|||||||
@ -68,6 +68,8 @@ export type WorkflowVariableBlockType = {
|
|||||||
onInsert?: () => void
|
onInsert?: () => void
|
||||||
onDelete?: () => void
|
onDelete?: () => void
|
||||||
getVarType?: GetVarType
|
getVarType?: GetVarType
|
||||||
|
showManageInputField?: boolean
|
||||||
|
onManageInputField?: () => void
|
||||||
}
|
}
|
||||||
|
|
||||||
export type MenuTextMatch = {
|
export type MenuTextMatch = {
|
||||||
|
|||||||
@ -21,7 +21,7 @@ const DialogWrapper = ({
|
|||||||
const close = useCallback(() => onClose?.(), [onClose])
|
const close = useCallback(() => onClose?.(), [onClose])
|
||||||
return (
|
return (
|
||||||
<Transition appear show={show} as={Fragment}>
|
<Transition appear show={show} as={Fragment}>
|
||||||
<Dialog as='div' className='relative z-40' onClose={close}>
|
<Dialog as='div' className='relative z-[2000]' onClose={close}>
|
||||||
<TransitionChild>
|
<TransitionChild>
|
||||||
<div className={cn(
|
<div className={cn(
|
||||||
'fixed inset-0 bg-black/25',
|
'fixed inset-0 bg-black/25',
|
||||||
|
|||||||
@ -21,7 +21,7 @@ const DialogWrapper = ({
|
|||||||
const close = useCallback(() => onClose?.(), [onClose])
|
const close = useCallback(() => onClose?.(), [onClose])
|
||||||
return (
|
return (
|
||||||
<Transition appear show={show} as={Fragment}>
|
<Transition appear show={show} as={Fragment}>
|
||||||
<Dialog as='div' className='relative z-40' onClose={close}>
|
<Dialog as='div' className='relative z-[2001]' onClose={close}>
|
||||||
<TransitionChild>
|
<TransitionChild>
|
||||||
<div className={cn(
|
<div className={cn(
|
||||||
'fixed inset-0 bg-black/25',
|
'fixed inset-0 bg-black/25',
|
||||||
|
|||||||
@ -1251,7 +1251,7 @@ export const useNodesInteractions = () => {
|
|||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
// If no nodeId is provided, fall back to the current behavior
|
// If no nodeId is provided, fall back to the current behavior
|
||||||
const bundledNodes = nodes.filter(node => node.data._isBundled && node.data.type !== BlockEnum.Start && node.data.type !== BlockEnum.DataSource
|
const bundledNodes = nodes.filter(node => node.data._isBundled && node.data.type !== BlockEnum.Start && node.data.type !== BlockEnum.DataSource && node.data.type !== BlockEnum.KnowledgeBase
|
||||||
&& !node.data.isInIteration && !node.data.isInLoop)
|
&& !node.data.isInIteration && !node.data.isInLoop)
|
||||||
|
|
||||||
if (bundledNodes.length) {
|
if (bundledNodes.length) {
|
||||||
|
|||||||
@ -13,6 +13,7 @@ import PromptEditor from '@/app/components/base/prompt-editor'
|
|||||||
import { Variable02 } from '@/app/components/base/icons/src/vender/solid/development'
|
import { Variable02 } from '@/app/components/base/icons/src/vender/solid/development'
|
||||||
import Tooltip from '@/app/components/base/tooltip'
|
import Tooltip from '@/app/components/base/tooltip'
|
||||||
import { noop } from 'lodash-es'
|
import { noop } from 'lodash-es'
|
||||||
|
import { useStore } from '@/app/components/workflow/store'
|
||||||
|
|
||||||
type Props = {
|
type Props = {
|
||||||
instanceId?: string
|
instanceId?: string
|
||||||
@ -56,6 +57,9 @@ const Editor: FC<Props> = ({
|
|||||||
// eslint-disable-next-line react-hooks/exhaustive-deps
|
// eslint-disable-next-line react-hooks/exhaustive-deps
|
||||||
}, [isFocus])
|
}, [isFocus])
|
||||||
|
|
||||||
|
const pipelineId = useStore(s => s.pipelineId)
|
||||||
|
const setShowInputFieldDialog = useStore(s => s.setShowInputFieldDialog)
|
||||||
|
|
||||||
return (
|
return (
|
||||||
<div className={cn(className, 'relative')}>
|
<div className={cn(className, 'relative')}>
|
||||||
<>
|
<>
|
||||||
@ -103,6 +107,8 @@ const Editor: FC<Props> = ({
|
|||||||
}
|
}
|
||||||
return acc
|
return acc
|
||||||
}, {} as any),
|
}, {} as any),
|
||||||
|
showManageInputField: !!pipelineId,
|
||||||
|
onManageInputField: () => setShowInputFieldDialog?.(true),
|
||||||
}}
|
}}
|
||||||
onChange={onChange}
|
onChange={onChange}
|
||||||
editable={!readOnly}
|
editable={!readOnly}
|
||||||
|
|||||||
@ -254,7 +254,7 @@ const Editor: FC<Props> = ({
|
|||||||
workflowVariableBlock={{
|
workflowVariableBlock={{
|
||||||
show: true,
|
show: true,
|
||||||
variables: nodesOutputVars || [],
|
variables: nodesOutputVars || [],
|
||||||
getVarType,
|
getVarType: getVarType as any,
|
||||||
workflowNodesMap: availableNodes.reduce((acc, node) => {
|
workflowNodesMap: availableNodes.reduce((acc, node) => {
|
||||||
acc[node.id] = {
|
acc[node.id] = {
|
||||||
title: node.data.title,
|
title: node.data.title,
|
||||||
|
|||||||
@ -0,0 +1,38 @@
|
|||||||
|
import { useTranslation } from 'react-i18next'
|
||||||
|
import { RiAddLine } from '@remixicon/react'
|
||||||
|
|
||||||
|
type ManageInputFieldProps = {
|
||||||
|
onManage: () => void
|
||||||
|
}
|
||||||
|
|
||||||
|
const ManageInputField = ({
|
||||||
|
onManage,
|
||||||
|
}: ManageInputFieldProps) => {
|
||||||
|
const { t } = useTranslation()
|
||||||
|
|
||||||
|
return (
|
||||||
|
<div className='flex items-center border-t border-divider-subtle pt-1'>
|
||||||
|
<div
|
||||||
|
className='flex h-8 grow cursor-pointer items-center px-3'
|
||||||
|
onClick={onManage}
|
||||||
|
>
|
||||||
|
<RiAddLine className='mr-1 h-4 w-4 text-text-tertiary' />
|
||||||
|
<div
|
||||||
|
className='system-xs-medium truncate text-text-tertiary'
|
||||||
|
title='Create user input field'
|
||||||
|
>
|
||||||
|
{t('pipeline.inputField.create')}
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
<div className='mx-1 h-3 w-[1px] shrink-0 bg-divider-regular'></div>
|
||||||
|
<div
|
||||||
|
className='system-xs-medium flex h-8 shrink-0 cursor-pointer items-center justify-center px-3 text-text-tertiary'
|
||||||
|
onClick={onManage}
|
||||||
|
>
|
||||||
|
{t('pipeline.inputField.manage')}
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
)
|
||||||
|
}
|
||||||
|
|
||||||
|
export default ManageInputField
|
||||||
@ -319,6 +319,7 @@ const VarReferencePicker: FC<Props> = ({
|
|||||||
|
|
||||||
return null
|
return null
|
||||||
}, [isValidVar, isShowAPart, hasValue, t, outputVarNode?.title, outputVarNode?.type, value, type])
|
}, [isValidVar, isShowAPart, hasValue, t, outputVarNode?.title, outputVarNode?.type, value, type])
|
||||||
|
|
||||||
return (
|
return (
|
||||||
<div className={cn(className, !readonly && 'cursor-pointer')}>
|
<div className={cn(className, !readonly && 'cursor-pointer')}>
|
||||||
<PortalToFollowElem
|
<PortalToFollowElem
|
||||||
|
|||||||
@ -1,6 +1,6 @@
|
|||||||
'use client'
|
'use client'
|
||||||
import type { FC } from 'react'
|
import type { FC } from 'react'
|
||||||
import React from 'react'
|
import React, { useMemo } from 'react'
|
||||||
import { useTranslation } from 'react-i18next'
|
import { useTranslation } from 'react-i18next'
|
||||||
import { useContext } from 'use-context-selector'
|
import { useContext } from 'use-context-selector'
|
||||||
import VarReferenceVars from './var-reference-vars'
|
import VarReferenceVars from './var-reference-vars'
|
||||||
@ -8,6 +8,7 @@ import type { NodeOutPutVar, ValueSelector, Var } from '@/app/components/workflo
|
|||||||
import ListEmpty from '@/app/components/base/list-empty'
|
import ListEmpty from '@/app/components/base/list-empty'
|
||||||
import { LanguagesSupported } from '@/i18n/language'
|
import { LanguagesSupported } from '@/i18n/language'
|
||||||
import I18n from '@/context/i18n'
|
import I18n from '@/context/i18n'
|
||||||
|
import { useStore } from '@/app/components/workflow/store'
|
||||||
|
|
||||||
type Props = {
|
type Props = {
|
||||||
vars: NodeOutPutVar[]
|
vars: NodeOutPutVar[]
|
||||||
@ -25,6 +26,9 @@ const VarReferencePopup: FC<Props> = ({
|
|||||||
}) => {
|
}) => {
|
||||||
const { t } = useTranslation()
|
const { t } = useTranslation()
|
||||||
const { locale } = useContext(I18n)
|
const { locale } = useContext(I18n)
|
||||||
|
const pipelineId = useStore(s => s.pipelineId)
|
||||||
|
const showManageRagInputFields = useMemo(() => !!pipelineId, [pipelineId])
|
||||||
|
const setShowInputFieldDialog = useStore(s => s.setShowInputFieldDialog)
|
||||||
// max-h-[300px] overflow-y-auto todo: use portal to handle long list
|
// max-h-[300px] overflow-y-auto todo: use portal to handle long list
|
||||||
return (
|
return (
|
||||||
<div className='space-y-1 rounded-lg border border-components-panel-border bg-components-panel-bg p-1 shadow-lg' style={{
|
<div className='space-y-1 rounded-lg border border-components-panel-border bg-components-panel-bg p-1 shadow-lg' style={{
|
||||||
@ -57,6 +61,8 @@ const VarReferencePopup: FC<Props> = ({
|
|||||||
onChange={onChange}
|
onChange={onChange}
|
||||||
itemWidth={itemWidth}
|
itemWidth={itemWidth}
|
||||||
isSupportFileVar={isSupportFileVar}
|
isSupportFileVar={isSupportFileVar}
|
||||||
|
showManageInputField={showManageRagInputFields}
|
||||||
|
onManageInputField={() => setShowInputFieldDialog?.(true)}
|
||||||
/>
|
/>
|
||||||
}
|
}
|
||||||
</div >
|
</div >
|
||||||
|
|||||||
@ -24,6 +24,7 @@ import { FILE_STRUCT } from '@/app/components/workflow/constants'
|
|||||||
import { Loop } from '@/app/components/base/icons/src/vender/workflow'
|
import { Loop } from '@/app/components/base/icons/src/vender/workflow'
|
||||||
import { noop } from 'lodash-es'
|
import { noop } from 'lodash-es'
|
||||||
import { InputField } from '@/app/components/base/icons/src/vender/pipeline'
|
import { InputField } from '@/app/components/base/icons/src/vender/pipeline'
|
||||||
|
import ManageInputField from './manage-input-field'
|
||||||
|
|
||||||
type ObjectChildrenProps = {
|
type ObjectChildrenProps = {
|
||||||
nodeId: string
|
nodeId: string
|
||||||
@ -266,6 +267,8 @@ type Props = {
|
|||||||
maxHeightClass?: string
|
maxHeightClass?: string
|
||||||
onClose?: () => void
|
onClose?: () => void
|
||||||
onBlur?: () => void
|
onBlur?: () => void
|
||||||
|
showManageInputField?: boolean
|
||||||
|
onManageInputField?: () => void
|
||||||
}
|
}
|
||||||
const VarReferenceVars: FC<Props> = ({
|
const VarReferenceVars: FC<Props> = ({
|
||||||
hideSearch,
|
hideSearch,
|
||||||
@ -277,6 +280,8 @@ const VarReferenceVars: FC<Props> = ({
|
|||||||
maxHeightClass,
|
maxHeightClass,
|
||||||
onClose,
|
onClose,
|
||||||
onBlur,
|
onBlur,
|
||||||
|
showManageInputField,
|
||||||
|
onManageInputField,
|
||||||
}) => {
|
}) => {
|
||||||
const { t } = useTranslation()
|
const { t } = useTranslation()
|
||||||
const [searchText, setSearchText] = useState('')
|
const [searchText, setSearchText] = useState('')
|
||||||
@ -367,6 +372,13 @@ const VarReferenceVars: FC<Props> = ({
|
|||||||
}
|
}
|
||||||
</div>
|
</div>
|
||||||
: <div className='pl-3 text-xs font-medium uppercase leading-[18px] text-gray-500'>{t('workflow.common.noVar')}</div>}
|
: <div className='pl-3 text-xs font-medium uppercase leading-[18px] text-gray-500'>{t('workflow.common.noVar')}</div>}
|
||||||
|
{
|
||||||
|
showManageInputField && (
|
||||||
|
<ManageInputField
|
||||||
|
onManage={onManageInputField || noop}
|
||||||
|
/>
|
||||||
|
)
|
||||||
|
}
|
||||||
</>
|
</>
|
||||||
)
|
)
|
||||||
}
|
}
|
||||||
|
|||||||
@ -23,6 +23,8 @@ const ConditionInput = ({
|
|||||||
}: ConditionInputProps) => {
|
}: ConditionInputProps) => {
|
||||||
const { t } = useTranslation()
|
const { t } = useTranslation()
|
||||||
const controlPromptEditorRerenderKey = useStore(s => s.controlPromptEditorRerenderKey)
|
const controlPromptEditorRerenderKey = useStore(s => s.controlPromptEditorRerenderKey)
|
||||||
|
const pipelineId = useStore(s => s.pipelineId)
|
||||||
|
const setShowInputFieldDialog = useStore(s => s.setShowInputFieldDialog)
|
||||||
|
|
||||||
return (
|
return (
|
||||||
<PromptEditor
|
<PromptEditor
|
||||||
@ -49,6 +51,8 @@ const ConditionInput = ({
|
|||||||
}
|
}
|
||||||
return acc
|
return acc
|
||||||
}, {} as any),
|
}, {} as any),
|
||||||
|
showManageInputField: !!pipelineId,
|
||||||
|
onManageInputField: () => setShowInputFieldDialog?.(true),
|
||||||
}}
|
}}
|
||||||
onChange={onChange}
|
onChange={onChange}
|
||||||
editable={!disabled}
|
editable={!disabled}
|
||||||
|
|||||||
@ -13,7 +13,7 @@ const nodeDefault: NodeDefault<KnowledgeBaseNodeType> = {
|
|||||||
index_chunk_variable_selector: [],
|
index_chunk_variable_selector: [],
|
||||||
keyword_number: 10,
|
keyword_number: 10,
|
||||||
retrieval_model: {
|
retrieval_model: {
|
||||||
top_k: 2,
|
top_k: 3,
|
||||||
score_threshold_enabled: false,
|
score_threshold_enabled: false,
|
||||||
score_threshold: 0.5,
|
score_threshold: 0.5,
|
||||||
},
|
},
|
||||||
|
|||||||
@ -20,6 +20,8 @@ const ConditionInput = ({
|
|||||||
}: ConditionInputProps) => {
|
}: ConditionInputProps) => {
|
||||||
const { t } = useTranslation()
|
const { t } = useTranslation()
|
||||||
const controlPromptEditorRerenderKey = useStore(s => s.controlPromptEditorRerenderKey)
|
const controlPromptEditorRerenderKey = useStore(s => s.controlPromptEditorRerenderKey)
|
||||||
|
const pipelineId = useStore(s => s.pipelineId)
|
||||||
|
const setShowInputFieldDialog = useStore(s => s.setShowInputFieldDialog)
|
||||||
|
|
||||||
return (
|
return (
|
||||||
<PromptEditor
|
<PromptEditor
|
||||||
@ -43,6 +45,8 @@ const ConditionInput = ({
|
|||||||
}
|
}
|
||||||
return acc
|
return acc
|
||||||
}, {} as any),
|
}, {} as any),
|
||||||
|
showManageInputField: !!pipelineId,
|
||||||
|
onManageInputField: () => setShowInputFieldDialog?.(true),
|
||||||
}}
|
}}
|
||||||
onChange={onChange}
|
onChange={onChange}
|
||||||
editable={!disabled}
|
editable={!disabled}
|
||||||
|
|||||||
@ -11,6 +11,10 @@ const translation = {
|
|||||||
descriptionPlaceholder: 'Please enter the description of this Knowledge Pipeline. (Optional) ',
|
descriptionPlaceholder: 'Please enter the description of this Knowledge Pipeline. (Optional) ',
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
|
inputField: {
|
||||||
|
create: 'Create user input field',
|
||||||
|
manage: 'Manage',
|
||||||
|
},
|
||||||
}
|
}
|
||||||
|
|
||||||
export default translation
|
export default translation
|
||||||
|
|||||||
@ -11,6 +11,10 @@ const translation = {
|
|||||||
descriptionPlaceholder: '请输入此 Pipeline 的描述。 (可选)',
|
descriptionPlaceholder: '请输入此 Pipeline 的描述。 (可选)',
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
|
inputField: {
|
||||||
|
create: '创建用户输入字段',
|
||||||
|
manage: '管理',
|
||||||
|
},
|
||||||
}
|
}
|
||||||
|
|
||||||
export default translation
|
export default translation
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user