import { Select, SelectContent, SelectItem, SelectItemIndicator, SelectItemText, SelectTrigger, } from '@langgenius/dify-ui/select' import { Textarea } from '@langgenius/dify-ui/textarea' import * as React from 'react' import { memo, useCallback } from 'react' import { useTranslation } from 'react-i18next' import { FileUploaderInAttachmentWrapper } from '@/app/components/base/file-uploader' import Input from '@/app/components/base/input' import BoolInput from '@/app/components/workflow/nodes/_base/components/before-run-form/bool-input' import CodeEditor from '@/app/components/workflow/nodes/_base/components/editor/code-editor' import { CodeLanguage } from '@/app/components/workflow/nodes/code/types' import { InputVarType } from '@/app/components/workflow/types' import { useEmbeddedChatbotContext } from '../context' type Props = Readonly<{ showTip?: boolean }> const InputsFormContent = ({ showTip }: Props) => { const { t } = useTranslation() const { appParams, inputsForms, currentConversationId, currentConversationInputs, setCurrentConversationInputs, newConversationInputs, newConversationInputsRef, handleNewConversationInputsChange, } = useEmbeddedChatbotContext() const inputsFormValue = currentConversationId ? currentConversationInputs : newConversationInputs const handleFormChange = useCallback( (variable: string, value: any) => { setCurrentConversationInputs({ ...currentConversationInputs, [variable]: value, }) handleNewConversationInputsChange({ ...newConversationInputsRef.current, [variable]: value, }) }, [ newConversationInputsRef, handleNewConversationInputsChange, currentConversationInputs, setCurrentConversationInputs, ], ) const visibleInputsForms = inputsForms.filter((form) => form.hide !== true) return (
{visibleInputsForms.map((form) => (
{form.type !== InputVarType.checkbox && (
{form.label}
{!form.required && (
{t(($) => $['panel.optional'], { ns: 'workflow' })}
)}
)} {form.type === InputVarType.textInput && ( handleFormChange(form.variable, e.target.value)} placeholder={form.label} /> )} {form.type === InputVarType.number && ( handleFormChange(form.variable, e.target.value)} placeholder={form.label} /> )} {form.type === InputVarType.paragraph && (