mirror of
https://gitee.com/dify_ai/dify.git
synced 2024-12-02 11:18:19 +08:00
chore: code generator button should only display in code node (#9842)
This commit is contained in:
parent
1b5adf40da
commit
84a9d2d072
@ -29,6 +29,7 @@ type Props = {
|
||||
codeLanguages: CodeLanguage
|
||||
fileList?: FileEntity[]
|
||||
showFileList?: boolean
|
||||
showCodeGenerator?: boolean
|
||||
}
|
||||
|
||||
const Base: FC<Props> = ({
|
||||
@ -44,6 +45,7 @@ const Base: FC<Props> = ({
|
||||
codeLanguages,
|
||||
fileList = [],
|
||||
showFileList,
|
||||
showCodeGenerator = false,
|
||||
}) => {
|
||||
const ref = useRef<HTMLDivElement>(null)
|
||||
const {
|
||||
@ -76,9 +78,11 @@ const Base: FC<Props> = ({
|
||||
e.stopPropagation()
|
||||
}}>
|
||||
{headerRight}
|
||||
<div className='ml-1'>
|
||||
<CodeGeneratorButton onGenerated={onGenerated} codeLanguages={codeLanguages}/>
|
||||
</div>
|
||||
{showCodeGenerator && (
|
||||
<div className='ml-1'>
|
||||
<CodeGeneratorButton onGenerated={onGenerated} codeLanguages={codeLanguages}/>
|
||||
</div>
|
||||
)}
|
||||
{!isCopied
|
||||
? (
|
||||
<Clipboard className='mx-1 w-3.5 h-3.5 text-gray-500 cursor-pointer' onClick={handleCopy} />
|
||||
|
@ -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<Props> = ({
|
||||
noWrapper,
|
||||
isExpand,
|
||||
showFileList,
|
||||
showCodeGenerator = false,
|
||||
}) => {
|
||||
const [isFocus, setIsFocus] = React.useState(false)
|
||||
const [isMounted, setIsMounted] = React.useState(false)
|
||||
@ -207,6 +209,7 @@ const CodeEditor: FC<Props> = ({
|
||||
codeLanguages={language}
|
||||
fileList={fileList}
|
||||
showFileList={showFileList}
|
||||
showCodeGenerator={showCodeGenerator}
|
||||
>
|
||||
{main}
|
||||
</Base>
|
||||
|
@ -92,6 +92,7 @@ const Panel: FC<NodePanelProps<CodeNodeType>> = ({
|
||||
language={inputs.code_language}
|
||||
value={inputs.code}
|
||||
onChange={handleCodeChange}
|
||||
showCodeGenerator={true}
|
||||
/>
|
||||
</div>
|
||||
<Split />
|
||||
|
Loading…
Reference in New Issue
Block a user