mirror of
https://github.com/langgenius/dify.git
synced 2026-05-05 01:48:04 +08:00
refactor: replace GeneratedFormInputItem with FormInputItem across components for consistency
This commit is contained in:
@ -6,12 +6,12 @@ import { RiArrowLeftLine } from '@remixicon/react'
|
||||
import Button from '@/app/components/base/button'
|
||||
import ContentItem from '@/app/components/base/chat/chat/answer/human-input-content/content-item'
|
||||
import { UserActionButtonType } from '@/app/components/workflow/nodes/human-input/types'
|
||||
import type { GeneratedFormInputItem, UserAction } from '@/app/components/workflow/nodes/human-input/types'
|
||||
import type { FormInputItem, UserAction } from '@/app/components/workflow/nodes/human-input/types'
|
||||
|
||||
type Props = {
|
||||
nodeName: string
|
||||
formContent: string
|
||||
inputFields: GeneratedFormInputItem[]
|
||||
inputFields: FormInputItem[]
|
||||
userActions: UserAction[]
|
||||
showBackButton?: boolean
|
||||
handleBack?: () => void
|
||||
@ -33,7 +33,7 @@ const FormContent = ({
|
||||
return parts.filter(part => part.length > 0)
|
||||
}
|
||||
|
||||
const initializeInputs = (formInputs: GeneratedFormInputItem[]) => {
|
||||
const initializeInputs = (formInputs: FormInputItem[]) => {
|
||||
const initialInputs: Record<string, any> = {}
|
||||
formInputs.forEach((item) => {
|
||||
if (item.type === 'text-input' || item.type === 'paragraph')
|
||||
|
||||
@ -1,4 +1,9 @@
|
||||
import type { CommonNodeType, InputVarType, ValueSelector, Variable } from '@/app/components/workflow/types'
|
||||
import type {
|
||||
CommonNodeType,
|
||||
InputVarType,
|
||||
ValueSelector,
|
||||
Variable,
|
||||
} from '@/app/components/workflow/types'
|
||||
|
||||
export type HumanInputNodeType = CommonNodeType & {
|
||||
delivery_methods: DeliveryMethod[]
|
||||
@ -43,24 +48,6 @@ export type DeliveryMethod = {
|
||||
config?: EmailConfig | {} | null
|
||||
}
|
||||
|
||||
export type FormInputItemPlaceholder = {
|
||||
type: 'variable' | 'constant',
|
||||
selector: ValueSelector
|
||||
value: string
|
||||
}
|
||||
|
||||
export type FormInputItem = {
|
||||
type: InputVarType
|
||||
output_variable_name: string
|
||||
// only text-input and paragraph support placeholder
|
||||
placeholder?: FormInputItemPlaceholder
|
||||
options?: any[]
|
||||
max_length?: number
|
||||
allowed_file_extensions?: string[]
|
||||
allowed_file_types?: string[]
|
||||
allowed_file_upload_methods?: string[]
|
||||
}
|
||||
|
||||
export enum UserActionButtonType {
|
||||
Primary = 'primary',
|
||||
Default = 'default',
|
||||
@ -74,12 +61,14 @@ export type UserAction = {
|
||||
button_style: UserActionButtonType
|
||||
}
|
||||
|
||||
export type GeneratedFormInputItem = {
|
||||
export type FormInputItemPlaceholder = {
|
||||
selector: ValueSelector
|
||||
type: 'variable' | 'constant'
|
||||
value: string
|
||||
}
|
||||
|
||||
export type FormInputItem = {
|
||||
type: InputVarType
|
||||
output_variable_name: string
|
||||
placeholder: {
|
||||
selector: ValueSelector
|
||||
type: 'variable' | 'constant'
|
||||
value: string
|
||||
}
|
||||
placeholder: FormInputItemPlaceholder
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user