diff --git a/web/app/components/app/configuration/config-prompt/simple-prompt-input.tsx b/web/app/components/app/configuration/config-prompt/simple-prompt-input.tsx index 2fb081366f..5be43e6f7a 100644 --- a/web/app/components/app/configuration/config-prompt/simple-prompt-input.tsx +++ b/web/app/components/app/configuration/config-prompt/simple-prompt-input.tsx @@ -276,6 +276,7 @@ const Prompt: FC = ({ isShow={showAutomatic} onClose={showAutomaticFalse} onFinished={handleAutomaticRes} + currentPrompt={promptTemplate} isBasicMode /> )} diff --git a/web/app/components/app/configuration/config/automatic/get-automatic-res.tsx b/web/app/components/app/configuration/config/automatic/get-automatic-res.tsx index 62ea35d305..c8f19ffb81 100644 --- a/web/app/components/app/configuration/config/automatic/get-automatic-res.tsx +++ b/web/app/components/app/configuration/config/automatic/get-automatic-res.tsx @@ -144,7 +144,7 @@ const GetAutomaticRes: FC = ({ } }, [t]) - const { data: instructionTemplate } = useGenerateRuleTemplate(GeneratorType.prompt) + const { data: instructionTemplate } = useGenerateRuleTemplate(GeneratorType.prompt, isBasicMode) useEffect(() => { if (!instruction && instructionTemplate) { setInstruction(instructionTemplate.data) @@ -337,6 +337,7 @@ const GetAutomaticRes: FC = ({ availableVars={[]} availableNodes={[]} isShowCurrentBlock={!!currentPrompt} + isShowLastRunBlock={false} /> ) : ( = ({ isShowCurrentBlock, }) => { const workflowStore = useWorkflowStore() - + const nodesWithInspectVars = useStore(s => s.nodesWithInspectVars) + const isShowLastRunBlock = useMemo(() => { + return !!nodesWithInspectVars.find(node => node.nodeId === nodeId) + }, [nodesWithInspectVars]) const filterVar = useCallback((payload: Var, selector: ValueSelector) => { const { nodesWithInspectVars } = workflowStore.getState() const nodeId = selector?.[0] @@ -52,6 +55,7 @@ const InstructionEditorInWorkflow: FC = ({ availableNodes={availableNodes} getVarType={getVarType} isShowCurrentBlock={isShowCurrentBlock} + isShowLastRunBlock /> ) } 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 4c68424046..aeb8399620 100644 --- a/web/app/components/app/configuration/config/automatic/instruction-editor.tsx +++ b/web/app/components/app/configuration/config/automatic/instruction-editor.tsx @@ -21,6 +21,7 @@ type Props = { valueSelector: ValueSelector, }) => Type isShowCurrentBlock: boolean + isShowLastRunBlock: boolean } const i18nPrefix = 'appDebug.generate' @@ -34,6 +35,7 @@ const InstructionEditor: FC = ({ availableNodes, getVarType = () => Type.string, isShowCurrentBlock, + isShowLastRunBlock, }) => { const { t } = useTranslation() const isBasicMode = !!getVarType @@ -88,7 +90,7 @@ const InstructionEditor: FC = ({ show: isCode, }} lastRunBlock={{ - show: true, + show: isShowLastRunBlock, }} onChange={onChange} editable 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 6fe43c0009..6d521a7358 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 @@ -416,7 +416,7 @@ const VarReferenceVars: FC = ({ )) } - :
{t('workflow.common.noVar')}
} + :
{t('workflow.common.noVar')}
} ) } diff --git a/web/service/use-apps.ts b/web/service/use-apps.ts index 0335eb5507..8a2df8db1d 100644 --- a/web/service/use-apps.ts +++ b/web/service/use-apps.ts @@ -27,7 +27,7 @@ export const useAppDetail = (appID: string) => { }) } -export const useGenerateRuleTemplate = (type: GeneratorType) => { +export const useGenerateRuleTemplate = (type: GeneratorType, disabled?: boolean) => { return useQuery({ queryKey: [NAME_SPACE, 'generate-rule-template', type], queryFn: () => post<{ data: string }>('instruction-generate/template', { @@ -35,6 +35,7 @@ export const useGenerateRuleTemplate = (type: GeneratorType) => { type, }, }), + enabled: !disabled, retry: 0, }) }