chore: workflow editor not choose outtool in var

This commit is contained in:
Joel 2024-03-20 12:05:30 +08:00
parent 4df8fa0afb
commit d984eb3648
6 changed files with 18 additions and 3 deletions

View File

@ -48,6 +48,7 @@ export type PromptEditorProps = {
style?: React.CSSProperties
value?: string
editable?: boolean
outToolDisabled?: boolean
onChange?: (text: string) => void
onBlur?: () => void
onFocus?: () => void
@ -86,6 +87,7 @@ const PromptEditor: FC<PromptEditorProps> = ({
style,
value,
editable = true,
outToolDisabled = false,
onChange,
onBlur,
onFocus,
@ -172,6 +174,7 @@ const PromptEditor: FC<PromptEditorProps> = ({
historyShow={historyBlock.show}
queryDisabled={!queryBlock.selectable}
queryShow={queryBlock.show}
outToolDisabled={outToolDisabled}
/>
<VariablePicker
items={variableBlock.variables}

View File

@ -96,6 +96,7 @@ type ComponentPickerProps = {
contextShow?: boolean
historyShow?: boolean
queryShow?: boolean
outToolDisabled?: boolean
}
const ComponentPicker: FC<ComponentPickerProps> = ({
contextDisabled,
@ -104,6 +105,7 @@ const ComponentPicker: FC<ComponentPickerProps> = ({
contextShow,
historyShow,
queryShow,
outToolDisabled,
}) => {
const { t } = useTranslation()
const [editor] = useLexicalComposerContext()
@ -127,8 +129,8 @@ const ComponentPicker: FC<ComponentPickerProps> = ({
}),
]
: [],
new ComponentPickerOption(t('common.promptEditor.variable.item.title'), {
desc: t('common.promptEditor.variable.item.desc'),
new ComponentPickerOption(t(`common.promptEditor.variable.${!outToolDisabled ? 'item' : 'outputToolDisabledItem'}.title`), {
desc: t(`common.promptEditor.variable.${!outToolDisabled ? 'item' : 'outputToolDisabledItem'}.desc`),
icon: <Variable className='w-4 h-4 text-[#2970FF]' />,
onSelect: () => {
editor.dispatchCommand(INSERT_VARIABLE_BLOCK_COMMAND, undefined)

View File

@ -116,6 +116,7 @@ const Editor: FC<Props> = ({
className={cn('min-h-[84px]')}
style={isExpand ? { height: editorExpandHeight - 5 } : {}}
value={value}
outToolDisabled
contextBlock={{
show: justVar ? false : isShowContext,
selectable: !hasSetBlockStatus?.context,

View File

@ -4,6 +4,7 @@ import { useTranslation } from 'react-i18next'
import VarList from './components/var-list'
import useConfig from './use-config'
import type { StartNodeType } from './types'
// import { useStore } from '@/app/components/workflow/store'
import Split from '@/app/components/workflow/nodes/_base/components/split'
import Field from '@/app/components/workflow/nodes/_base/components/field'
import OutputVars, { VarItem } from '@/app/components/workflow/nodes/_base/components/output-vars'
@ -18,7 +19,7 @@ const Panel: FC<NodePanelProps<StartNodeType>> = ({
data,
}) => {
const { t } = useTranslation()
const readOnly = false
const readOnly = false // useStore(s => s.readOnly)
const {
isChatMode,
inputs,

View File

@ -478,6 +478,10 @@ const translation = {
title: 'Variables & External Tools',
desc: 'Insert Variables & External Tools',
},
outputToolDisabledItem: {
title: 'Variables',
desc: 'Insert Variables',
},
modal: {
add: 'New variable',
addTool: 'New tool',

View File

@ -478,6 +478,10 @@ const translation = {
title: '变量 & 外部工具',
desc: '插入变量和外部工具',
},
outputToolDisabledItem: {
title: '变量',
desc: '插入变量',
},
modal: {
add: '添加新变量',
addTool: '添加工具',