From fcd87e15017b91f9712761175fef577ea6fb259c Mon Sep 17 00:00:00 2001
From: sd0ric4 <1286518974@qq.com>
Date: Thu, 27 Mar 2025 14:37:17 +0800
Subject: [PATCH] =?UTF-8?q?refactor:=20=E6=9B=B4=E6=96=B0=E7=B1=BB?=
=?UTF-8?q?=E5=9E=8B=E5=AE=9A=E4=B9=89=EF=BC=8C=E4=BD=BF=E7=94=A8=E7=B1=BB?=
=?UTF-8?q?=E5=9E=8B=E5=88=AB=E5=90=8D=E7=AE=80=E5=8C=96=E4=BB=A3=E7=A0=81?=
=?UTF-8?q?=E7=BB=93=E6=9E=84?=
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
---
.../chat/components/Form/FormComponents.tsx | 24 +++++++++----------
.../DebugInteractive.tsx | 12 +++++-----
2 files changed, 18 insertions(+), 18 deletions(-)
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 (