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 c06c84af4..0a328408d 100644 --- a/projects/app/src/components/core/chat/components/Form/FormComponents.tsx +++ b/projects/app/src/components/core/chat/components/Form/FormComponents.tsx @@ -11,15 +11,15 @@ import MyNumberInput from '@fastgpt/web/components/common/Input/NumberInput'; import { FlowNodeInputTypeEnum } from '@fastgpt/global/core/workflow/node/constant'; import MyIcon from '@fastgpt/web/components/common/Icon'; -type IconName = 'core/workflow/debugNext' | 'common/loading' | 'core/chat/think'; +type IconNameType = 'core/workflow/debugNext' | 'common/loading' | 'core/chat/think'; -export type SelectOption = { +export type SelectOptionType = { key: string; value: string; }; -export type SelectOptionsComponentProps = { - options: SelectOption[]; +export type SelectOptionsComponentPropsType = { + options: SelectOptionType[]; description?: string; selectedValue?: string; onSelectOption: (value: string) => void; @@ -34,7 +34,7 @@ export const SelectOptionsComponent = React.memo(function SelectOptionsComponent onSelectOption, isDisabled = false, variant = 'outline' -}: SelectOptionsComponentProps) { +}: SelectOptionsComponentPropsType) { return ( {description && ( @@ -52,7 +52,7 @@ export const SelectOptionsComponent = React.memo(function SelectOptionsComponent )} - {options.map((option: SelectOption) => { + {options.map((option: SelectOptionType) => { const selected = option.value === selectedValue; return ( @@ -95,7 +95,7 @@ export const SelectOptionsComponent = React.memo(function SelectOptionsComponent ); }); -export type FormItem = { +export type FormItemType = { label: string; key?: string; type: FlowNodeInputTypeEnum; @@ -113,14 +113,14 @@ export type FormItem = { }; export type FormInputComponentProps = { - inputForm: FormItem[]; + inputForm: FormItemType[]; description?: string; onSubmit?: (data: Record) => void; isDisabled?: boolean; defaultValues?: Record; submitButtonText?: 'common:Submit' | string; // 使用联合类型指定特定的i18n键名 showSubmitButton?: boolean; - submitButtonIcon?: IconName; + submitButtonIcon?: IconNameType; isCompact?: boolean; }; @@ -174,7 +174,7 @@ export const FormInputComponent = React.memo(function FormInputComponent({ borderRadius="md" > - {inputForm.map((input: FormItem) => ( + {inputForm.map((input: FormItemType) => ( @@ -308,7 +308,7 @@ export const FormInputComponent = React.memo(function FormInputComponent({ ); }); -export type UseFormHandlerReturn> = { +export type UseFormHandlerReturnType> = { register: UseFormReturn['register']; setValue: UseFormReturn['setValue']; handleSubmit: UseFormReturn['handleSubmit']; @@ -321,7 +321,7 @@ export type UseFormHandlerReturn> = export const useFormHandler = >( formConfig: UseFormProps = {}, onSubmitCallback?: (data: T) => void -): UseFormHandlerReturn => { +): UseFormHandlerReturnType => { const methods = useForm(formConfig); const { handleSubmit } = methods; diff --git a/projects/app/src/pageComponents/app/detail/WorkflowComponents/Flow/nodes/render/RenderDebug/InteractiveComponents/DebugInteractive.tsx b/projects/app/src/pageComponents/app/detail/WorkflowComponents/Flow/nodes/render/RenderDebug/InteractiveComponents/DebugInteractive.tsx index 1b91906ff..06e3d2abe 100644 --- a/projects/app/src/pageComponents/app/detail/WorkflowComponents/Flow/nodes/render/RenderDebug/InteractiveComponents/DebugInteractive.tsx +++ b/projects/app/src/pageComponents/app/detail/WorkflowComponents/Flow/nodes/render/RenderDebug/InteractiveComponents/DebugInteractive.tsx @@ -4,15 +4,15 @@ import { useTranslation } from 'next-i18next'; import { useContextSelector } from 'use-context-selector'; import { WorkflowContext } from '@/pageComponents/app/detail/WorkflowComponents/context'; import { ChatItemValueTypeEnum, ChatRoleEnum } from '@fastgpt/global/core/chat/constants'; -import { ChatItemType, UserChatItemValueItemType } from '@fastgpt/global/core/chat/type'; +import type { ChatItemType, UserChatItemValueItemType } from '@fastgpt/global/core/chat/type'; import { initWorkflowEdgeStatus } from '@fastgpt/global/core/workflow/runtime/utils'; -import { +import type { UserInputInteractive, UserSelectInteractive } from '@fastgpt/global/core/workflow/template/system/interactive/type'; import { - type SelectOption, - type FormItem, + type SelectOptionType, + type FormItemType, FormInputComponent, SelectOptionsComponent } from '@/components/core/chat/components/Form/FormComponents'; @@ -112,7 +112,7 @@ export const RenderUserSelectInteractive = React.memo(function RenderInteractive return (