mirror of
https://github.com/langgenius/dify.git
synced 2026-04-28 22:48:07 +08:00
feat: Human Input Node (#32060)
The frontend and backend implementation for the human input node. Co-authored-by: twwu <twwu@dify.ai> Co-authored-by: JzoNg <jzongcode@gmail.com> Co-authored-by: yyh <92089059+lyzno1@users.noreply.github.com> Co-authored-by: zhsama <torvalds@linux.do>
This commit is contained in:
@ -4,12 +4,14 @@ import { useCallback } from 'react'
|
||||
import { useTranslation } from 'react-i18next'
|
||||
import Badge from '@/app/components/base/badge'
|
||||
import { CustomTextNode } from '@/app/components/base/prompt-editor/plugins/custom-text/node'
|
||||
import { cn } from '@/utils/classnames'
|
||||
|
||||
type PlaceholderProps = {
|
||||
disableVariableInsertion?: boolean
|
||||
hideBadge?: boolean
|
||||
}
|
||||
|
||||
const Placeholder = ({ disableVariableInsertion = false }: PlaceholderProps) => {
|
||||
const Placeholder = ({ disableVariableInsertion = false, hideBadge = false }: PlaceholderProps) => {
|
||||
const { t } = useTranslation()
|
||||
const [editor] = useLexicalComposerContext()
|
||||
|
||||
@ -23,7 +25,10 @@ const Placeholder = ({ disableVariableInsertion = false }: PlaceholderProps) =>
|
||||
|
||||
return (
|
||||
<div
|
||||
className="pointer-events-auto flex h-full w-full cursor-text items-center px-2"
|
||||
className={cn(
|
||||
'pointer-events-auto flex h-full w-full cursor-text px-2',
|
||||
!hideBadge ? 'items-center' : 'items-start py-1',
|
||||
)}
|
||||
onClick={(e) => {
|
||||
e.stopPropagation()
|
||||
handleInsert('')
|
||||
@ -47,11 +52,13 @@ const Placeholder = ({ disableVariableInsertion = false }: PlaceholderProps) =>
|
||||
</>
|
||||
)}
|
||||
</div>
|
||||
<Badge
|
||||
className="shrink-0"
|
||||
text="String"
|
||||
uppercase={false}
|
||||
/>
|
||||
{!hideBadge && (
|
||||
<Badge
|
||||
className="shrink-0"
|
||||
text="String"
|
||||
uppercase={false}
|
||||
/>
|
||||
)}
|
||||
</div>
|
||||
)
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user