diff --git a/web/app/components/workflow/nodes/_base/components/editor/base.tsx b/web/app/components/workflow/nodes/_base/components/editor/base.tsx index 8799cd0cc743f..cca565c39df80 100644 --- a/web/app/components/workflow/nodes/_base/components/editor/base.tsx +++ b/web/app/components/workflow/nodes/_base/components/editor/base.tsx @@ -29,6 +29,7 @@ type Props = { codeLanguages: CodeLanguage fileList?: FileEntity[] showFileList?: boolean + showCodeGenerator?: boolean } const Base: FC = ({ @@ -44,6 +45,7 @@ const Base: FC = ({ codeLanguages, fileList = [], showFileList, + showCodeGenerator = false, }) => { const ref = useRef(null) const { @@ -76,9 +78,11 @@ const Base: FC = ({ e.stopPropagation() }}> {headerRight} -
- -
+ {showCodeGenerator && ( +
+ +
+ )} {!isCopied ? ( diff --git a/web/app/components/workflow/nodes/_base/components/editor/code-editor/index.tsx b/web/app/components/workflow/nodes/_base/components/editor/code-editor/index.tsx index f5be15a5d8730..a31cde2c3c5a8 100644 --- a/web/app/components/workflow/nodes/_base/components/editor/code-editor/index.tsx +++ b/web/app/components/workflow/nodes/_base/components/editor/code-editor/index.tsx @@ -31,6 +31,7 @@ export type Props = { noWrapper?: boolean isExpand?: boolean showFileList?: boolean + showCodeGenerator?: boolean } export const languageMap = { @@ -63,6 +64,7 @@ const CodeEditor: FC = ({ noWrapper, isExpand, showFileList, + showCodeGenerator = false, }) => { const [isFocus, setIsFocus] = React.useState(false) const [isMounted, setIsMounted] = React.useState(false) @@ -207,6 +209,7 @@ const CodeEditor: FC = ({ codeLanguages={language} fileList={fileList} showFileList={showFileList} + showCodeGenerator={showCodeGenerator} > {main} diff --git a/web/app/components/workflow/nodes/code/panel.tsx b/web/app/components/workflow/nodes/code/panel.tsx index 838e7190d3abd..d3e5e58634f2b 100644 --- a/web/app/components/workflow/nodes/code/panel.tsx +++ b/web/app/components/workflow/nodes/code/panel.tsx @@ -92,6 +92,7 @@ const Panel: FC> = ({ language={inputs.code_language} value={inputs.code} onChange={handleCodeChange} + showCodeGenerator={true} />