From d8de2017b5edcf7db2de7c5342166105431a8baa Mon Sep 17 00:00:00 2001 From: zxhlyh Date: Tue, 6 Feb 2024 13:43:09 +0800 Subject: [PATCH] fix: webapp variable input & app unavailable status (#2405) --- .../config-panel/form-input.tsx | 46 +++++++++++++++++++ .../chat-with-history/config-panel/form.tsx | 28 ++++------- .../base/chat/chat-with-history/context.tsx | 1 + .../base/chat/chat-with-history/hooks.tsx | 3 +- .../base/chat/chat-with-history/index.tsx | 31 ++++++++++++- 5 files changed, 87 insertions(+), 22 deletions(-) create mode 100644 web/app/components/base/chat/chat-with-history/config-panel/form-input.tsx diff --git a/web/app/components/base/chat/chat-with-history/config-panel/form-input.tsx b/web/app/components/base/chat/chat-with-history/config-panel/form-input.tsx new file mode 100644 index 0000000000..c163e9409c --- /dev/null +++ b/web/app/components/base/chat/chat-with-history/config-panel/form-input.tsx @@ -0,0 +1,46 @@ +import type { FC } from 'react' +import { useTranslation } from 'react-i18next' +import { memo } from 'react' + +type InputProps = { + form: any + value: string + onChange: (variable: string, value: string) => void +} +const FormInput: FC = ({ + form, + value, + onChange, +}) => { + const { t } = useTranslation() + const { + type, + label, + required, + max_length, + variable, + } = form + + if (type === 'paragraph') { + return ( +