diff --git a/packages/web/components/common/Textarea/PromptEditor/index.tsx b/packages/web/components/common/Textarea/PromptEditor/index.tsx index cb56c923c..60b4fecb0 100644 --- a/packages/web/components/common/Textarea/PromptEditor/index.tsx +++ b/packages/web/components/common/Textarea/PromptEditor/index.tsx @@ -1,6 +1,6 @@ import type { BoxProps } from '@chakra-ui/react'; import { Box, Button, ModalBody, ModalFooter, useDisclosure } from '@chakra-ui/react'; -import React from 'react'; +import React, { useMemo } from 'react'; import { editorStateToText } from './utils'; import Editor from './Editor'; import MyModal from '../../MyModal'; @@ -58,6 +58,12 @@ const PromptEditor = ({ }, [onBlur] ); + const formattedValue = useMemo(() => { + if (typeof value === 'object') { + return JSON.stringify(value); + } + return value; + }, [value]); return ( <> @@ -70,7 +76,7 @@ const PromptEditor = ({ minH={minH} maxH={maxH} maxLength={maxLength} - value={value} + value={formattedValue} onChange={onChangeInput} onBlur={onBlurInput} placeholder={placeholder} diff --git a/projects/app/src/components/core/app/formRender/utils.ts b/projects/app/src/components/core/app/formRender/utils.ts index ab60ce74a..d4fdd6362 100644 --- a/projects/app/src/components/core/app/formRender/utils.ts +++ b/projects/app/src/components/core/app/formRender/utils.ts @@ -6,11 +6,15 @@ import { InputTypeEnum } from './constant'; import { FlowNodeInputTypeEnum } from '@fastgpt/global/core/workflow/node/constant'; import type { InputConfigType } from '@fastgpt/global/core/workflow/type/io'; -export const variableInputTypeToInputType = (inputType: VariableInputEnum) => { +export const variableInputTypeToInputType = ( + inputType: VariableInputEnum, + valueType?: WorkflowIOValueTypeEnum +) => { if (inputType === VariableInputEnum.input) return InputTypeEnum.input; if (inputType === VariableInputEnum.textarea) return InputTypeEnum.textarea; if (inputType === VariableInputEnum.numberInput) return InputTypeEnum.numberInput; if (inputType === VariableInputEnum.select) return InputTypeEnum.select; + if (inputType === VariableInputEnum.custom) return valueTypeToInputType(valueType); return InputTypeEnum.JSONEditor; }; diff --git a/projects/app/src/components/core/chat/ChatContainer/ChatBox/Provider.tsx b/projects/app/src/components/core/chat/ChatContainer/ChatBox/Provider.tsx index d02d9f230..a89df6388 100644 --- a/projects/app/src/components/core/chat/ChatContainer/ChatBox/Provider.tsx +++ b/projects/app/src/components/core/chat/ChatContainer/ChatBox/Provider.tsx @@ -23,13 +23,14 @@ import { getChatResData } from '@/web/core/chat/api'; import { ChatItemContext } from '@/web/core/chat/context/chatItemContext'; import { ChatRecordContext } from '@/web/core/chat/context/chatRecordContext'; import { useCreation } from 'ahooks'; +import type { ChatTypeEnum } from './constants'; export type ChatProviderProps = { appId: string; chatId: string; outLinkAuthData?: OutLinkChatAuthProps; - chatType: 'log' | 'chat' | 'share' | 'team'; + chatType: ChatTypeEnum; }; type useChatStoreType = ChatProviderProps & { @@ -130,7 +131,7 @@ const Provider = ({ appId, chatId, outLinkAuthData, - chatType = 'chat', + chatType, children, ...props }: ChatProviderProps & { diff --git a/projects/app/src/components/core/chat/ChatContainer/ChatBox/components/VariableInputForm.tsx b/projects/app/src/components/core/chat/ChatContainer/ChatBox/components/VariableInputForm.tsx index 01c816b59..fc539c4d2 100644 --- a/projects/app/src/components/core/chat/ChatContainer/ChatBox/components/VariableInputForm.tsx +++ b/projects/app/src/components/core/chat/ChatContainer/ChatBox/components/VariableInputForm.tsx @@ -79,17 +79,19 @@ const VariableInput = ({ {t('chat:variable_invisable_in_share')} - {externalVariableList.map((item) => ( - - ))} + {externalVariableList.map((item) => { + return ( + + ); + })} {variableList.length === 0 && !chatStarted && (