diff --git a/projects/app/src/components/core/chat/components/AIResponseBox.tsx b/projects/app/src/components/core/chat/components/AIResponseBox.tsx index 98f2dbcda..aa04a7288 100644 --- a/projects/app/src/components/core/chat/components/AIResponseBox.tsx +++ b/projects/app/src/components/core/chat/components/AIResponseBox.tsx @@ -291,7 +291,6 @@ const getResponseRenderer = ( return null; }; -// AI响应框主组件 const AIResponseBox = React.memo(function AIResponseBox({ value, isLastResponseValue, diff --git a/projects/app/src/components/core/chat/components/Form/FormComponents.tsx b/projects/app/src/components/core/chat/components/Form/FormComponents.tsx index 0a328408d..bafec0562 100644 --- a/projects/app/src/components/core/chat/components/Form/FormComponents.tsx +++ b/projects/app/src/components/core/chat/components/Form/FormComponents.tsx @@ -27,6 +27,41 @@ export type SelectOptionsComponentPropsType = { variant?: string; }; +const DescriptionBox = React.memo(function DescriptionBox({ + description +}: { + description?: string; +}) { + if (!description) return null; + + return ( + + + + ); +}); + +const inputBaseStyle = { + bg: 'white', + borderWidth: '1px', + borderColor: 'gray.300', + _hover: { borderColor: 'gray.400' }, + _focus: { + borderColor: 'primary.500', + boxShadow: '0 0 0 1px var(--chakra-colors-primary-500)' + }, + borderRadius: 'md' +}; + export const SelectOptionsComponent = React.memo(function SelectOptionsComponent({ options = [], description, @@ -37,20 +72,7 @@ export const SelectOptionsComponent = React.memo(function SelectOptionsComponent }: SelectOptionsComponentPropsType) { return ( - {description && ( - - - - )} + {options.map((option: SelectOptionType) => { const selected = option.value === selectedValue; @@ -118,12 +140,133 @@ export type FormInputComponentProps = { onSubmit?: (data: Record) => void; isDisabled?: boolean; defaultValues?: Record; - submitButtonText?: 'common:Submit' | string; // 使用联合类型指定特定的i18n键名 + submitButtonText?: 'common:Submit' | string; showSubmitButton?: boolean; submitButtonIcon?: IconNameType; isCompact?: boolean; }; +// 表单项标签组件 +const FormItemLabel = React.memo(function FormItemLabel({ + label, + required, + description +}: { + label: string; + required?: boolean; + description?: string; +}) { + return ( + + + {label} + + {description && } + + ); +}); + +// 渲染不同类型的表单输入项 +const renderFormInput = ( + input: FormItemType, + register: any, + control: any, + setValue: any, + isDisabled: boolean +) => { + const { type, label, required, maxLength, min, max, defaultValue, list } = input; + + switch (type) { + case FlowNodeInputTypeEnum.input: + return ( + + ); + + case FlowNodeInputTypeEnum.textarea: + return ( +