diff --git a/projects/app/src/components/core/chat/components/AIResponseBox.tsx b/projects/app/src/components/core/chat/components/AIResponseBox.tsx index aa04a7288..540eb7063 100644 --- a/projects/app/src/components/core/chat/components/AIResponseBox.tsx +++ b/projects/app/src/components/core/chat/components/AIResponseBox.tsx @@ -32,10 +32,8 @@ import { FormInputComponent, type FormItemType } from './Form/FormComponents'; - const onSendPrompt = (e: { text: string; isInteractivePrompt: boolean }) => eventBus.emit(EventNameEnum.sendQuestion, e); - const formatJsonString = (jsonString: string) => { try { return JSON.stringify(JSON.parse(jsonString), null, 2); @@ -43,7 +41,6 @@ const formatJsonString = (jsonString: string) => { return jsonString; } }; - const StyledAccordionItem = React.memo(function StyledAccordionItem({ children }: { @@ -55,7 +52,6 @@ const StyledAccordionItem = React.memo(function StyledAccordionItem({ ); }); - const StyledAccordionButton = React.memo(function StyledAccordionButton({ children, py = 0 @@ -82,7 +78,6 @@ const StyledAccordionButton = React.memo(function StyledAccordionButton({ ); }); - const RenderText = React.memo(function RenderText({ showAnimation, text @@ -107,7 +102,6 @@ const RenderTool = React.memo( {tools.map((tool) => { const toolParams = formatJsonString(tool.params); const toolResponse = formatJsonString(tool.response); - return ( @@ -152,7 +146,6 @@ ${toolResponse}`} }, (prevProps, nextProps) => isEqual(prevProps, nextProps) ); - const RenderResoningContent = React.memo(function RenderResoningContent({ content, isChatting, @@ -164,7 +157,6 @@ const RenderResoningContent = React.memo(function RenderResoningContent({ }) { const { t } = useTranslation(); const showAnimation = isChatting && isLastResponseValue; - return ( @@ -173,7 +165,6 @@ const RenderResoningContent = React.memo(function RenderResoningContent({ {t('chat:ai_reasoning')} - {showAnimation && } @@ -192,7 +183,6 @@ const RenderResoningContent = React.memo(function RenderResoningContent({ ); }); - const RenderUserSelectInteractive = React.memo(function RenderInteractive({ interactive }: { @@ -214,7 +204,6 @@ const RenderUserSelectInteractive = React.memo(function RenderInteractive({ /> ); }); - const RenderUserFormInteractive = React.memo(function RenderFormInput({ interactive }: { @@ -238,7 +227,6 @@ const RenderUserFormInteractive = React.memo(function RenderFormInput({ isInteractivePrompt: true }); }, []); - return ( ); }); - const getResponseRenderer = ( value: UserChatItemValueItemType | AIChatItemValueItemType, isChatting: boolean, @@ -264,7 +251,6 @@ const getResponseRenderer = ( ); } - if (value.type === ChatItemValueTypeEnum.reasoning && value.reasoning) { return ( ); } - if (value.type === ChatItemValueTypeEnum.tool && value.tools) { return ; } - if (value.type === ChatItemValueTypeEnum.interactive && value.interactive) { if (value.interactive.type === 'userSelect') { return ; @@ -287,10 +271,8 @@ const getResponseRenderer = ( return ; } } - return null; }; - const AIResponseBox = React.memo(function AIResponseBox({ value, isLastResponseValue, @@ -302,5 +284,4 @@ const AIResponseBox = React.memo(function AIResponseBox({ }) { return getResponseRenderer(value, isChatting, isLastResponseValue); }); - export default AIResponseBox; 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 bafec0562..1676cfb58 100644 --- a/projects/app/src/components/core/chat/components/Form/FormComponents.tsx +++ b/projects/app/src/components/core/chat/components/Form/FormComponents.tsx @@ -10,14 +10,11 @@ import MyTextarea from '@/components/common/Textarea/MyTextarea'; 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 IconNameType = 'core/workflow/debugNext' | 'common/loading' | 'core/chat/think'; - export type SelectOptionType = { key: string; value: string; }; - export type SelectOptionsComponentPropsType = { options: SelectOptionType[]; description?: string; @@ -26,7 +23,6 @@ export type SelectOptionsComponentPropsType = { isDisabled?: boolean; variant?: string; }; - const DescriptionBox = React.memo(function DescriptionBox({ description }: { @@ -49,7 +45,6 @@ const DescriptionBox = React.memo(function DescriptionBox({ ); }); - const inputBaseStyle = { bg: 'white', borderWidth: '1px', @@ -61,7 +56,6 @@ const inputBaseStyle = { }, borderRadius: 'md' }; - export const SelectOptionsComponent = React.memo(function SelectOptionsComponent({ options = [], description, @@ -116,7 +110,6 @@ export const SelectOptionsComponent = React.memo(function SelectOptionsComponent ); }); - export type FormItemType = { label: string; key?: string; @@ -133,7 +126,6 @@ export type FormItemType = { value: string; }>; }; - export type FormInputComponentProps = { inputForm: FormItemType[]; description?: string; @@ -145,8 +137,6 @@ export type FormInputComponentProps = { submitButtonIcon?: IconNameType; isCompact?: boolean; }; - -// 表单项标签组件 const FormItemLabel = React.memo(function FormItemLabel({ label, required, @@ -165,8 +155,6 @@ const FormItemLabel = React.memo(function FormItemLabel({ ); }); - -// 渲染不同类型的表单输入项 const renderFormInput = ( input: FormItemType, register: any, @@ -175,7 +163,6 @@ const renderFormInput = ( isDisabled: boolean ) => { const { type, label, required, maxLength, min, max, defaultValue, list } = input; - switch (type) { case FlowNodeInputTypeEnum.input: return ( @@ -189,7 +176,6 @@ const renderFormInput = ( p={3} /> ); - case FlowNodeInputTypeEnum.textarea: return (