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:
QuantumGhost
2026-02-09 14:57:23 +08:00
committed by GitHub
parent 56e3a55023
commit a1fc280102
474 changed files with 32667 additions and 2050 deletions

View File

@ -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>
)
}