diff --git a/web/app/components/base/prompt-editor/index.tsx b/web/app/components/base/prompt-editor/index.tsx index ea946eec46..a2d64be3fe 100644 --- a/web/app/components/base/prompt-editor/index.tsx +++ b/web/app/components/base/prompt-editor/index.tsx @@ -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 = ({ style, value, editable = true, + outToolDisabled = false, onChange, onBlur, onFocus, @@ -172,6 +174,7 @@ const PromptEditor: FC = ({ historyShow={historyBlock.show} queryDisabled={!queryBlock.selectable} queryShow={queryBlock.show} + outToolDisabled={outToolDisabled} /> = ({ contextDisabled, @@ -104,6 +105,7 @@ const ComponentPicker: FC = ({ contextShow, historyShow, queryShow, + outToolDisabled, }) => { const { t } = useTranslation() const [editor] = useLexicalComposerContext() @@ -127,8 +129,8 @@ const ComponentPicker: FC = ({ }), ] : [], - 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: , onSelect: () => { editor.dispatchCommand(INSERT_VARIABLE_BLOCK_COMMAND, undefined) diff --git a/web/app/components/workflow/nodes/_base/components/prompt/editor.tsx b/web/app/components/workflow/nodes/_base/components/prompt/editor.tsx index 41e5365b0b..68e365ed14 100644 --- a/web/app/components/workflow/nodes/_base/components/prompt/editor.tsx +++ b/web/app/components/workflow/nodes/_base/components/prompt/editor.tsx @@ -116,6 +116,7 @@ const Editor: FC = ({ className={cn('min-h-[84px]')} style={isExpand ? { height: editorExpandHeight - 5 } : {}} value={value} + outToolDisabled contextBlock={{ show: justVar ? false : isShowContext, selectable: !hasSetBlockStatus?.context, diff --git a/web/app/components/workflow/nodes/start/panel.tsx b/web/app/components/workflow/nodes/start/panel.tsx index a109a2ddd0..6970dc31e3 100644 --- a/web/app/components/workflow/nodes/start/panel.tsx +++ b/web/app/components/workflow/nodes/start/panel.tsx @@ -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> = ({ data, }) => { const { t } = useTranslation() - const readOnly = false + const readOnly = false // useStore(s => s.readOnly) const { isChatMode, inputs, diff --git a/web/i18n/en-US/common.ts b/web/i18n/en-US/common.ts index ac2af35aec..d40e584ebf 100644 --- a/web/i18n/en-US/common.ts +++ b/web/i18n/en-US/common.ts @@ -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', diff --git a/web/i18n/zh-Hans/common.ts b/web/i18n/zh-Hans/common.ts index c9d5e065ba..22a739fe2f 100644 --- a/web/i18n/zh-Hans/common.ts +++ b/web/i18n/zh-Hans/common.ts @@ -478,6 +478,10 @@ const translation = { title: '变量 & 外部工具', desc: '插入变量和外部工具', }, + outputToolDisabledItem: { + title: '变量', + desc: '插入变量', + }, modal: { add: '添加新变量', addTool: '添加工具',