mirror of
https://github.com/langgenius/dify.git
synced 2026-08-28 21:23:22 +08:00
chore: workflow editor not choose outtool in var
This commit is contained in:
parent
4df8fa0afb
commit
d984eb3648
@ -48,6 +48,7 @@ export type PromptEditorProps = {
|
|||||||
style?: React.CSSProperties
|
style?: React.CSSProperties
|
||||||
value?: string
|
value?: string
|
||||||
editable?: boolean
|
editable?: boolean
|
||||||
|
outToolDisabled?: boolean
|
||||||
onChange?: (text: string) => void
|
onChange?: (text: string) => void
|
||||||
onBlur?: () => void
|
onBlur?: () => void
|
||||||
onFocus?: () => void
|
onFocus?: () => void
|
||||||
@ -86,6 +87,7 @@ const PromptEditor: FC<PromptEditorProps> = ({
|
|||||||
style,
|
style,
|
||||||
value,
|
value,
|
||||||
editable = true,
|
editable = true,
|
||||||
|
outToolDisabled = false,
|
||||||
onChange,
|
onChange,
|
||||||
onBlur,
|
onBlur,
|
||||||
onFocus,
|
onFocus,
|
||||||
@ -172,6 +174,7 @@ const PromptEditor: FC<PromptEditorProps> = ({
|
|||||||
historyShow={historyBlock.show}
|
historyShow={historyBlock.show}
|
||||||
queryDisabled={!queryBlock.selectable}
|
queryDisabled={!queryBlock.selectable}
|
||||||
queryShow={queryBlock.show}
|
queryShow={queryBlock.show}
|
||||||
|
outToolDisabled={outToolDisabled}
|
||||||
/>
|
/>
|
||||||
<VariablePicker
|
<VariablePicker
|
||||||
items={variableBlock.variables}
|
items={variableBlock.variables}
|
||||||
|
|||||||
@ -96,6 +96,7 @@ type ComponentPickerProps = {
|
|||||||
contextShow?: boolean
|
contextShow?: boolean
|
||||||
historyShow?: boolean
|
historyShow?: boolean
|
||||||
queryShow?: boolean
|
queryShow?: boolean
|
||||||
|
outToolDisabled?: boolean
|
||||||
}
|
}
|
||||||
const ComponentPicker: FC<ComponentPickerProps> = ({
|
const ComponentPicker: FC<ComponentPickerProps> = ({
|
||||||
contextDisabled,
|
contextDisabled,
|
||||||
@ -104,6 +105,7 @@ const ComponentPicker: FC<ComponentPickerProps> = ({
|
|||||||
contextShow,
|
contextShow,
|
||||||
historyShow,
|
historyShow,
|
||||||
queryShow,
|
queryShow,
|
||||||
|
outToolDisabled,
|
||||||
}) => {
|
}) => {
|
||||||
const { t } = useTranslation()
|
const { t } = useTranslation()
|
||||||
const [editor] = useLexicalComposerContext()
|
const [editor] = useLexicalComposerContext()
|
||||||
@ -127,8 +129,8 @@ const ComponentPicker: FC<ComponentPickerProps> = ({
|
|||||||
}),
|
}),
|
||||||
]
|
]
|
||||||
: [],
|
: [],
|
||||||
new ComponentPickerOption(t('common.promptEditor.variable.item.title'), {
|
new ComponentPickerOption(t(`common.promptEditor.variable.${!outToolDisabled ? 'item' : 'outputToolDisabledItem'}.title`), {
|
||||||
desc: t('common.promptEditor.variable.item.desc'),
|
desc: t(`common.promptEditor.variable.${!outToolDisabled ? 'item' : 'outputToolDisabledItem'}.desc`),
|
||||||
icon: <Variable className='w-4 h-4 text-[#2970FF]' />,
|
icon: <Variable className='w-4 h-4 text-[#2970FF]' />,
|
||||||
onSelect: () => {
|
onSelect: () => {
|
||||||
editor.dispatchCommand(INSERT_VARIABLE_BLOCK_COMMAND, undefined)
|
editor.dispatchCommand(INSERT_VARIABLE_BLOCK_COMMAND, undefined)
|
||||||
|
|||||||
@ -116,6 +116,7 @@ const Editor: FC<Props> = ({
|
|||||||
className={cn('min-h-[84px]')}
|
className={cn('min-h-[84px]')}
|
||||||
style={isExpand ? { height: editorExpandHeight - 5 } : {}}
|
style={isExpand ? { height: editorExpandHeight - 5 } : {}}
|
||||||
value={value}
|
value={value}
|
||||||
|
outToolDisabled
|
||||||
contextBlock={{
|
contextBlock={{
|
||||||
show: justVar ? false : isShowContext,
|
show: justVar ? false : isShowContext,
|
||||||
selectable: !hasSetBlockStatus?.context,
|
selectable: !hasSetBlockStatus?.context,
|
||||||
|
|||||||
@ -4,6 +4,7 @@ import { useTranslation } from 'react-i18next'
|
|||||||
import VarList from './components/var-list'
|
import VarList from './components/var-list'
|
||||||
import useConfig from './use-config'
|
import useConfig from './use-config'
|
||||||
import type { StartNodeType } from './types'
|
import type { StartNodeType } from './types'
|
||||||
|
// import { useStore } from '@/app/components/workflow/store'
|
||||||
import Split from '@/app/components/workflow/nodes/_base/components/split'
|
import Split from '@/app/components/workflow/nodes/_base/components/split'
|
||||||
import Field from '@/app/components/workflow/nodes/_base/components/field'
|
import Field from '@/app/components/workflow/nodes/_base/components/field'
|
||||||
import OutputVars, { VarItem } from '@/app/components/workflow/nodes/_base/components/output-vars'
|
import OutputVars, { VarItem } from '@/app/components/workflow/nodes/_base/components/output-vars'
|
||||||
@ -18,7 +19,7 @@ const Panel: FC<NodePanelProps<StartNodeType>> = ({
|
|||||||
data,
|
data,
|
||||||
}) => {
|
}) => {
|
||||||
const { t } = useTranslation()
|
const { t } = useTranslation()
|
||||||
const readOnly = false
|
const readOnly = false // useStore(s => s.readOnly)
|
||||||
const {
|
const {
|
||||||
isChatMode,
|
isChatMode,
|
||||||
inputs,
|
inputs,
|
||||||
|
|||||||
@ -478,6 +478,10 @@ const translation = {
|
|||||||
title: 'Variables & External Tools',
|
title: 'Variables & External Tools',
|
||||||
desc: 'Insert Variables & External Tools',
|
desc: 'Insert Variables & External Tools',
|
||||||
},
|
},
|
||||||
|
outputToolDisabledItem: {
|
||||||
|
title: 'Variables',
|
||||||
|
desc: 'Insert Variables',
|
||||||
|
},
|
||||||
modal: {
|
modal: {
|
||||||
add: 'New variable',
|
add: 'New variable',
|
||||||
addTool: 'New tool',
|
addTool: 'New tool',
|
||||||
|
|||||||
@ -478,6 +478,10 @@ const translation = {
|
|||||||
title: '变量 & 外部工具',
|
title: '变量 & 外部工具',
|
||||||
desc: '插入变量和外部工具',
|
desc: '插入变量和外部工具',
|
||||||
},
|
},
|
||||||
|
outputToolDisabledItem: {
|
||||||
|
title: '变量',
|
||||||
|
desc: '插入变量',
|
||||||
|
},
|
||||||
modal: {
|
modal: {
|
||||||
add: '添加新变量',
|
add: '添加新变量',
|
||||||
addTool: '添加工具',
|
addTool: '添加工具',
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user