From e2512b0af9c1fe62acea39d5d0f7ac0f43f95e96 Mon Sep 17 00:00:00 2001 From: Joel Date: Fri, 18 Jul 2025 18:15:25 +0800 Subject: [PATCH] fix: can not choose error message in code gen --- .../config/automatic/instruction-editor.tsx | 9 +++++---- .../components/variable/var-reference-vars.tsx | 13 ++++++++----- 2 files changed, 13 insertions(+), 9 deletions(-) diff --git a/web/app/components/app/configuration/config/automatic/instruction-editor.tsx b/web/app/components/app/configuration/config/automatic/instruction-editor.tsx index 0cc0c3cd49..7865b3f294 100644 --- a/web/app/components/app/configuration/config/automatic/instruction-editor.tsx +++ b/web/app/components/app/configuration/config/automatic/instruction-editor.tsx @@ -30,6 +30,7 @@ const InstructionEditor: FC = ({ const { t } = useTranslation() const controlPromptEditorRerenderKey = useStore(s => s.controlPromptEditorRerenderKey) const getVarType = useWorkflowVariableType() + const isCode = generatorType === 'code' const placeholder = (
{t(`${i18nPrefix}.instructionPlaceHolderTitle`)}
@@ -71,14 +72,14 @@ const InstructionEditor: FC = ({ return acc }, {} as any), }} - currentBlock = {{ + currentBlock={{ show: true, generatorType, }} - errorMessageBlock = {{ - show: true, + errorMessageBlock={{ + show: isCode, }} - lastRunBlock = {{ + lastRunBlock={{ show: true, }} onChange={onChange} diff --git a/web/app/components/workflow/nodes/_base/components/variable/var-reference-vars.tsx b/web/app/components/workflow/nodes/_base/components/variable/var-reference-vars.tsx index e828d86b6f..cc7add569e 100644 --- a/web/app/components/workflow/nodes/_base/components/variable/var-reference-vars.tsx +++ b/web/app/components/workflow/nodes/_base/components/variable/var-reference-vars.tsx @@ -50,6 +50,7 @@ type ItemProps = { isFlat?: boolean isInCodeGeneratorInstructionEditor?: boolean zIndex?: number + className?: string } const objVarTypes = [VarType.object, VarType.file] @@ -67,6 +68,7 @@ const Item: FC = ({ isFlat, isInCodeGeneratorInstructionEditor, zIndex, + className, }) => { const isStructureOutput = itemData.type === VarType.object && (itemData.children as StructuredOutput)?.schema?.properties const isFile = itemData.type === VarType.file && !isStructureOutput @@ -75,7 +77,7 @@ const Item: FC = ({ const isEnv = itemData.variable.startsWith('env.') const isChatVar = itemData.variable.startsWith('conversation.') const flatVarIcon = useMemo(() => { - if(!isFlat) + if (!isFlat) return null const variable = itemData.variable let Icon @@ -91,7 +93,7 @@ const Item: FC = ({ }, [isFlat, isInCodeGeneratorInstructionEditor, itemData.variable]) const varName = useMemo(() => { - if(!isFlat) + if (!isFlat) return itemData.variable if (itemData.variable === 'current') return isInCodeGeneratorInstructionEditor ? 'current_code' : 'current_prompt' @@ -153,7 +155,7 @@ const Item: FC = ({ if (!isSupportFileVar && isFile) return - if(isFlat) { + if (isFlat) { onChange([itemData.variable], itemData) } else if (isSys || isEnv || isChatVar) { // system variable | environment variable | conversation variable @@ -175,7 +177,8 @@ const Item: FC = ({ className={cn( (isObj || isStructureOutput) ? ' pr-1' : 'pr-[18px]', isHovering && ((isObj || isStructureOutput) ? 'bg-components-panel-on-panel-item-bg-hover' : 'bg-state-base-hover'), - 'relative flex h-6 w-full cursor-pointer items-center rounded-md pl-3', + 'relative flex h-6 w-full cursor-pointer items-center rounded-md pl-3', + className, ) } onClick={handleChosen} @@ -379,7 +382,7 @@ const VarReferenceVars: FC = ({ { filteredVars.map((item, i) => ( -
+
{!item.isFlat && (