From a3bd5eba0284aa09a35e09ee9b05857e1de10e83 Mon Sep 17 00:00:00 2001 From: TinsFox Date: Wed, 19 Jun 2024 14:13:16 +0800 Subject: [PATCH] refactor: refactor the button component using `forwardRef` (#4379) Co-authored-by: KVOJJJin --- web/app/(shareLayout)/webapp-signin/page.tsx | 2 +- web/app/activate/activateForm.tsx | 6 +- .../annotation/add-annotation-modal/index.tsx | 2 +- .../batch-add-annotation-modal/index.tsx | 2 +- .../edit-annotation-modal/edit-item/index.tsx | 2 +- .../app/annotation/header-opts/index.tsx | 2 +- .../components/app/app-publisher/index.tsx | 4 +- .../publish-with-multiple-model.tsx | 2 +- .../warning-mask/cannot-query-dataset.tsx | 2 +- .../base/warning-mask/formatting-changed.tsx | 2 +- .../base/warning-mask/has-not-set-api.tsx | 2 +- .../config-prompt/confirm-add-var/index.tsx | 2 +- .../conversation-histroy/edit-modal.tsx | 2 +- .../configuration/config-var/modal-foot.tsx | 2 +- .../config/agent/agent-setting/index.tsx | 2 +- .../agent-tools/setting-built-in-tool.tsx | 2 +- .../config/automatic/get-automatic-res.tsx | 4 +- .../configuration/ctrl-btn-group/index.tsx | 4 +- .../dataset-config/params-config/index.tsx | 2 +- .../dataset-config/select-dataset/index.tsx | 2 +- .../dataset-config/settings-modal/index.tsx | 2 +- .../chat-group/opening-statement/index.tsx | 2 +- .../prompt-value-panel/index.tsx | 2 +- .../toolbox/annotation/config-param-modal.tsx | 2 +- .../moderation/moderation-setting-modal.tsx | 4 +- .../tools/external-data-tool-modal.tsx | 2 +- .../components/app/create-app-modal/index.tsx | 8 +- .../app/create-from-dsl-modal/index.tsx | 4 +- .../components/app/duplicate-modal/index.tsx | 2 +- .../app/overview/apikey-info-panel/index.tsx | 2 +- .../app/overview/settings/index.tsx | 2 +- .../components/app/switch-app-modal/index.tsx | 4 +- web/app/components/base/button/index.tsx | 82 +++++++++---------- .../chat-with-history/config-panel/index.tsx | 4 +- web/app/components/base/confirm-ui/index.tsx | 2 +- web/app/components/base/confirm/common.tsx | 4 +- .../components/base/emoji-picker/index.tsx | 4 +- .../moderation/moderation-setting-modal.tsx | 4 +- .../feature-panel/opening-statement/index.tsx | 2 +- .../base/image-uploader/image-link-input.tsx | 2 +- .../base/modal/delete-confirm-modal/index.tsx | 2 +- .../base/tag-management/tag-remove-modal.tsx | 4 +- .../custom/custom-web-app-brand/index.tsx | 2 +- .../create/embedding-process/index.tsx | 2 +- .../empty-dataset-creation-modal/index.tsx | 4 +- .../datasets/create/step-one/index.tsx | 6 +- .../datasets/create/step-two/index.tsx | 6 +- .../create/stop-embedding-modal/index.tsx | 6 +- .../documents/detail/batch-modal/index.tsx | 4 +- .../detail/completed/SegmentCard.tsx | 2 +- .../documents/detail/completed/index.tsx | 4 +- .../documents/detail/embedding/index.tsx | 2 +- .../documents/detail/metadata/index.tsx | 8 +- .../documents/detail/new-segment-modal.tsx | 4 +- .../components/datasets/documents/index.tsx | 2 +- .../components/datasets/documents/list.tsx | 2 +- .../hit-testing/modify-retrieval-modal.tsx | 2 +- .../datasets/hit-testing/textarea.tsx | 2 +- .../datasets/rename-modal/index.tsx | 4 +- .../datasets/settings/form/index.tsx | 2 +- .../develop/secret-key/secret-key-button.tsx | 2 +- .../secret-key/secret-key-generate.tsx | 2 +- .../develop/secret-key/secret-key-modal.tsx | 4 +- web/app/components/explore/app-card/index.tsx | 4 +- .../explore/create-app-modal/index.tsx | 2 +- .../account-setting/account-page/index.tsx | 4 +- .../api-based-extension-page/modal.tsx | 2 +- .../members-page/invite-modal/index.tsx | 6 +- .../members-page/invited-modal/index.tsx | 52 ++++++------ .../model-provider-page/model-modal/index.tsx | 2 +- .../system-model-selector/index.tsx | 12 +-- .../share/chat/sidebar/rename-modal/index.tsx | 2 +- .../share/chat/value-panel/index.tsx | 2 +- .../share/chat/welcome/massive-component.tsx | 2 +- .../share/chatbot/value-panel/index.tsx | 2 +- .../chatbot/welcome/massive-component.tsx | 2 +- .../share/text-generation/index.tsx | 2 +- .../share/text-generation/run-batch/index.tsx | 2 +- .../share/text-generation/run-once/index.tsx | 2 +- .../components/tools/add-tool-modal/index.tsx | 8 +- .../components/tools/add-tool-modal/tools.tsx | 10 +-- .../config-credentials.tsx | 4 +- .../get-schema.tsx | 2 +- .../edit-custom-collection-modal/index.tsx | 2 +- .../edit-custom-collection-modal/test-api.tsx | 2 +- web/app/components/tools/provider/detail.tsx | 8 +- .../setting/build-in/config-credentials.tsx | 2 +- .../workflow-tool/confirm-modal/index.tsx | 4 +- .../components/tools/workflow-tool/index.tsx | 4 +- web/app/components/workflow/header/index.tsx | 4 +- .../components/before-run-form/index.tsx | 2 +- .../http/components/authorization/index.tsx | 2 +- .../components/extract-parameter/update.tsx | 2 +- .../components/workflow/nodes/tool/panel.tsx | 2 +- .../workflow/panel/inputs-panel.tsx | 2 +- web/app/init/InitPasswordPopup.tsx | 2 +- web/app/install/installForm.tsx | 2 +- web/app/signin/normalForm.tsx | 6 +- web/app/signin/oneMoreStep.tsx | 2 +- web/app/signin/userSSOForm.tsx | 2 +- 100 files changed, 218 insertions(+), 224 deletions(-) diff --git a/web/app/(shareLayout)/webapp-signin/page.tsx b/web/app/(shareLayout)/webapp-signin/page.tsx index 5306854638..abfdeaa6e3 100644 --- a/web/app/(shareLayout)/webapp-signin/page.tsx +++ b/web/app/(shareLayout)/webapp-signin/page.tsx @@ -137,7 +137,7 @@ const WebSSOForm: FC = () => {
-
@@ -195,7 +195,7 @@ const ActivateForm = () => {
-
diff --git a/web/app/components/app/annotation/add-annotation-modal/index.tsx b/web/app/components/app/annotation/add-annotation-modal/index.tsx index e07eaffe87..261593c00d 100644 --- a/web/app/components/app/annotation/add-annotation-modal/index.tsx +++ b/web/app/components/app/annotation/add-annotation-modal/index.tsx @@ -105,7 +105,7 @@ const AddAnnotationModal: FC = ({
- +
diff --git a/web/app/components/app/annotation/batch-add-annotation-modal/index.tsx b/web/app/components/app/annotation/batch-add-annotation-modal/index.tsx index 2faae8c45e..db5aab5251 100644 --- a/web/app/components/app/annotation/batch-add-annotation-modal/index.tsx +++ b/web/app/components/app/annotation/batch-add-annotation-modal/index.tsx @@ -110,7 +110,7 @@ const BatchModal: FC = ({ + diff --git a/web/app/components/app/annotation/header-opts/index.tsx b/web/app/components/app/annotation/header-opts/index.tsx index 18cc0a0f9c..9573b052f3 100644 --- a/web/app/components/app/annotation/header-opts/index.tsx +++ b/web/app/components/app/annotation/header-opts/index.tsx @@ -135,7 +135,7 @@ const HeaderOptions: FC = ({ return (
- diff --git a/web/app/components/app/app-publisher/index.tsx b/web/app/components/app/app-publisher/index.tsx index da7f9b56a2..29b556705b 100644 --- a/web/app/components/app/app-publisher/index.tsx +++ b/web/app/components/app/app-publisher/index.tsx @@ -119,7 +119,7 @@ const AppPublisher = ({ >
diff --git a/web/app/components/app/configuration/base/warning-mask/formatting-changed.tsx b/web/app/components/app/configuration/base/warning-mask/formatting-changed.tsx index 421e4ba59e..50e05310c8 100644 --- a/web/app/components/app/configuration/base/warning-mask/formatting-changed.tsx +++ b/web/app/components/app/configuration/base/warning-mask/formatting-changed.tsx @@ -28,7 +28,7 @@ const FormattingChanged: FC = ({ description={t('appDebug.formattingChangedText')} footer={
- diff --git a/web/app/components/app/configuration/base/warning-mask/has-not-set-api.tsx b/web/app/components/app/configuration/base/warning-mask/has-not-set-api.tsx index 80a9cc955b..67ed4250cf 100644 --- a/web/app/components/app/configuration/base/warning-mask/has-not-set-api.tsx +++ b/web/app/components/app/configuration/base/warning-mask/has-not-set-api.tsx @@ -28,7 +28,7 @@ const HasNotSetAPI: FC = ({ title={isTrailFinished ? t('appDebug.notSetAPIKey.trailFinished') : t('appDebug.notSetAPIKey.title')} description={t('appDebug.notSetAPIKey.description')} footer={ - } diff --git a/web/app/components/app/configuration/config-prompt/confirm-add-var/index.tsx b/web/app/components/app/configuration/config-prompt/confirm-add-var/index.tsx index 47a9ca11cb..38974c23dd 100644 --- a/web/app/components/app/configuration/config-prompt/confirm-add-var/index.tsx +++ b/web/app/components/app/configuration/config-prompt/confirm-add-var/index.tsx @@ -63,7 +63,7 @@ const ConfirmAddVar: FC = ({
- +
diff --git a/web/app/components/app/configuration/config-prompt/conversation-histroy/edit-modal.tsx b/web/app/components/app/configuration/config-prompt/conversation-histroy/edit-modal.tsx index 226732d03d..87b811f637 100644 --- a/web/app/components/app/configuration/config-prompt/conversation-histroy/edit-modal.tsx +++ b/web/app/components/app/configuration/config-prompt/conversation-histroy/edit-modal.tsx @@ -49,7 +49,7 @@ const EditModal: FC = ({
- +
) diff --git a/web/app/components/app/configuration/config-var/modal-foot.tsx b/web/app/components/app/configuration/config-var/modal-foot.tsx index 71efcadb25..a73ebe4141 100644 --- a/web/app/components/app/configuration/config-var/modal-foot.tsx +++ b/web/app/components/app/configuration/config-var/modal-foot.tsx @@ -17,7 +17,7 @@ const ModalFoot: FC = ({ return (
- +
) } diff --git a/web/app/components/app/configuration/config/agent/agent-setting/index.tsx b/web/app/components/app/configuration/config/agent/agent-setting/index.tsx index 8e7ecbacdb..2aad4421f6 100644 --- a/web/app/components/app/configuration/config/agent/agent-setting/index.tsx +++ b/web/app/components/app/configuration/config/agent/agent-setting/index.tsx @@ -142,7 +142,7 @@ const AgentSetting: FC = ({ {t('common.operation.cancel')} - + )} )} diff --git a/web/app/components/app/configuration/config/automatic/get-automatic-res.tsx b/web/app/components/app/configuration/config/automatic/get-automatic-res.tsx index b3f2a909e7..f17b7a4428 100644 --- a/web/app/components/app/configuration/config/automatic/get-automatic-res.tsx +++ b/web/app/components/app/configuration/config/automatic/get-automatic-res.tsx @@ -155,7 +155,7 @@ const GetAutomaticRes: FC = ({
-
diff --git a/web/app/components/app/configuration/ctrl-btn-group/index.tsx b/web/app/components/app/configuration/ctrl-btn-group/index.tsx index d7b5d49b0e..298ca4ea57 100644 --- a/web/app/components/app/configuration/ctrl-btn-group/index.tsx +++ b/web/app/components/app/configuration/ctrl-btn-group/index.tsx @@ -15,8 +15,8 @@ const ContrlBtnGroup: FC = ({ onSave, onReset }) => { return (
- - + +
) diff --git a/web/app/components/app/configuration/dataset-config/params-config/index.tsx b/web/app/components/app/configuration/dataset-config/params-config/index.tsx index 9d9eac2a66..708b2d687d 100644 --- a/web/app/components/app/configuration/dataset-config/params-config/index.tsx +++ b/web/app/components/app/configuration/dataset-config/params-config/index.tsx @@ -95,7 +95,7 @@ const ParamsConfig: FC = () => { - + ) diff --git a/web/app/components/app/configuration/dataset-config/select-dataset/index.tsx b/web/app/components/app/configuration/dataset-config/select-dataset/index.tsx index 1bcc742317..51e5b383c4 100644 --- a/web/app/components/app/configuration/dataset-config/select-dataset/index.tsx +++ b/web/app/components/app/configuration/dataset-config/select-dataset/index.tsx @@ -156,7 +156,7 @@ const SelectDataSet: FC = ({
- +
)} diff --git a/web/app/components/app/configuration/dataset-config/settings-modal/index.tsx b/web/app/components/app/configuration/dataset-config/settings-modal/index.tsx index 64d099dc70..d4c3bcb013 100644 --- a/web/app/components/app/configuration/dataset-config/settings-modal/index.tsx +++ b/web/app/components/app/configuration/dataset-config/settings-modal/index.tsx @@ -280,7 +280,7 @@ const SettingsModal: FC = ({ {t('common.operation.cancel')} + ) : ( diff --git a/web/app/components/app/configuration/prompt-value-panel/index.tsx b/web/app/components/app/configuration/prompt-value-panel/index.tsx index 6ec36ebb04..52409b4b5f 100644 --- a/web/app/components/app/configuration/prompt-value-panel/index.tsx +++ b/web/app/components/app/configuration/prompt-value-panel/index.tsx @@ -62,7 +62,7 @@ const PromptValuePanel: FC = ({ const renderRunButton = () => { return ( - +
diff --git a/web/app/components/app/create-from-dsl-modal/index.tsx b/web/app/components/app/create-from-dsl-modal/index.tsx index f2cf6b97b9..b36f467f21 100644 --- a/web/app/components/app/create-from-dsl-modal/index.tsx +++ b/web/app/components/app/create-from-dsl-modal/index.tsx @@ -80,7 +80,7 @@ const CreateFromDSLModal = ({ show, onSuccess, onClose }: CreateFromDSLModalProp {}} + onClose={() => { }} >
{t('app.createFromConfigFile')}
@@ -93,7 +93,7 @@ const CreateFromDSLModal = ({ show, onSuccess, onClose }: CreateFromDSLModalProp {isAppsFull && }
- +
) diff --git a/web/app/components/app/duplicate-modal/index.tsx b/web/app/components/app/duplicate-modal/index.tsx index 5096fa2cb2..e9710add9e 100644 --- a/web/app/components/app/duplicate-modal/index.tsx +++ b/web/app/components/app/duplicate-modal/index.tsx @@ -75,7 +75,7 @@ const DuplicateAppModal = ({ {isAppsFull && }
- +
diff --git a/web/app/components/app/overview/apikey-info-panel/index.tsx b/web/app/components/app/overview/apikey-info-panel/index.tsx index b91bfd5aaf..52f67eda74 100644 --- a/web/app/components/app/overview/apikey-info-panel/index.tsx +++ b/web/app/components/app/overview/apikey-info-panel/index.tsx @@ -44,7 +44,7 @@ const APIKeyInfoPanel: FC = () => {
{t(`appOverview.apiKeyInfo.cloud.${'trial'}.description`)}
)} - +
{showEmojiPicker && { diff --git a/web/app/components/app/switch-app-modal/index.tsx b/web/app/components/app/switch-app-modal/index.tsx index e1bf3eb7ab..2dd4e42f29 100644 --- a/web/app/components/app/switch-app-modal/index.tsx +++ b/web/app/components/app/switch-app-modal/index.tsx @@ -89,7 +89,7 @@ const SwitchAppModal = ({ show, appDetail, inAppDetail = false, onSuccess, onClo {}} + onClose={() => { }} >
@@ -133,7 +133,7 @@ const SwitchAppModal = ({ show, appDetail, inAppDetail = false, onSuccess, onClo
- +
diff --git a/web/app/components/base/button/index.tsx b/web/app/components/base/button/index.tsx index 34f16ad556..d39c69d3ae 100644 --- a/web/app/components/base/button/index.tsx +++ b/web/app/components/base/button/index.tsx @@ -1,50 +1,44 @@ -import type { FC, MouseEventHandler, PropsWithChildren } from 'react' -import React, { memo } from 'react' +import React from 'react' +import { type VariantProps, cva } from 'class-variance-authority' import classNames from 'classnames' import Spinner from '../spinner' -export type IButtonProps = PropsWithChildren<{ - type?: string - className?: string - disabled?: boolean +const buttonVariants = cva( + 'btn disabled:pointer-events-none', + { + variants: { + variant: { + primary: 'btn-primary disabled:btn-primary-disabled', + warning: + 'btn-warning disabled:btn-warning-disabled', + default: 'btn-default disabled:btn-default-disabled', + }, + }, + defaultVariants: { + variant: 'default', + }, + }, +) + +export type ButtonProps = { loading?: boolean - tabIndex?: number - onClick?: MouseEventHandler -}> +} & React.ButtonHTMLAttributes & VariantProps -const Button: FC = ({ - type, - disabled, - children, - className, - onClick, - loading = false, - tabIndex, -}) => { - let typeClassNames = 'cursor-pointer' - switch (type) { - case 'primary': - typeClassNames = (disabled || loading) ? 'btn-primary-disabled' : 'btn-primary' - break - case 'warning': - typeClassNames = (disabled || loading) ? 'btn-warning-disabled' : 'btn-warning' - break - default: - typeClassNames = disabled ? 'btn-default-disabled' : 'btn-default' - break - } +const Button = React.forwardRef( + ({ className, variant, loading, children, ...props }, ref) => { + return ( + + ) + }, +) +Button.displayName = 'Button' - return ( -
- {children} - {/* Spinner is hidden when loading is false */} - -
- ) -} - -export default memo(Button) +export default Button +export { Button, buttonVariants } diff --git a/web/app/components/base/chat/chat-with-history/config-panel/index.tsx b/web/app/components/base/chat/chat-with-history/config-panel/index.tsx index 649aa50374..f974eae786 100644 --- a/web/app/components/base/chat/chat-with-history/config-panel/index.tsx +++ b/web/app/components/base/chat/chat-with-history/config-panel/index.tsx @@ -93,7 +93,7 @@ const ConfigPanel = () => {
- +
diff --git a/web/app/components/base/confirm/common.tsx b/web/app/components/base/confirm/common.tsx index 8eba6512b7..a12f823c64 100644 --- a/web/app/components/base/confirm/common.tsx +++ b/web/app/components/base/confirm/common.tsx @@ -51,7 +51,7 @@ const ConfirmCommon: FC = ({ } return ( - {}} className='!w-[480px] !max-w-[480px] !p-0 !rounded-2xl' wrapperClassName={confirmWrapperClassName}> + { }} className='!w-[480px] !max-w-[480px] !p-0 !rounded-2xl' wrapperClassName={confirmWrapperClassName}>
@@ -77,7 +77,7 @@ const ConfirmCommon: FC = ({ ) }
- +
) : ( diff --git a/web/app/components/base/image-uploader/image-link-input.tsx b/web/app/components/base/image-uploader/image-link-input.tsx index 47d4c69ade..8149279ea1 100644 --- a/web/app/components/base/image-uploader/image-link-input.tsx +++ b/web/app/components/base/image-uploader/image-link-input.tsx @@ -42,7 +42,7 @@ const ImageLinkInput: FC = ({ placeholder={t('common.imageUploader.pasteImageLinkInputPlaceholder') || ''} /> - +
) diff --git a/web/app/components/custom/custom-web-app-brand/index.tsx b/web/app/components/custom/custom-web-app-brand/index.tsx index 68b967157d..53db78105a 100644 --- a/web/app/components/custom/custom-web-app-brand/index.tsx +++ b/web/app/components/custom/custom-web-app-brand/index.tsx @@ -192,7 +192,7 @@ const CustomWebAppBrand = () => { fileId && ( <> diff --git a/web/app/components/datasets/create/empty-dataset-creation-modal/index.tsx b/web/app/components/datasets/create/empty-dataset-creation-modal/index.tsx index 9f95c20161..9a1f64fbe0 100644 --- a/web/app/components/datasets/create/empty-dataset-creation-modal/index.tsx +++ b/web/app/components/datasets/create/empty-dataset-creation-modal/index.tsx @@ -53,7 +53,7 @@ const EmptyDatasetCreationModal = ({ >
{t('datasetCreation.stepOne.modal.title')}
- +
{t('datasetCreation.stepOne.modal.tip')}
@@ -61,7 +61,7 @@ const EmptyDatasetCreationModal = ({
- +
diff --git a/web/app/components/datasets/create/step-one/index.tsx b/web/app/components/datasets/create/step-one/index.tsx index 3e4f72f16a..d8cc51b0a3 100644 --- a/web/app/components/datasets/create/step-one/index.tsx +++ b/web/app/components/datasets/create/step-one/index.tsx @@ -49,7 +49,7 @@ export const NotionConnector = ({ onSetting }: NotionConnectorProps) => {
{t('datasetCreation.stepOne.notionSyncTitle')}
{t('datasetCreation.stepOne.notionSyncTip')}
- + ) } @@ -197,7 +197,7 @@ const StepOne = ({ )} - + )} {dataSourceType === DataSourceType.NOTION && ( @@ -217,7 +217,7 @@ const StepOne = ({ )} - + )} diff --git a/web/app/components/datasets/create/step-two/index.tsx b/web/app/components/datasets/create/step-two/index.tsx index ad7bab9780..13460b9475 100644 --- a/web/app/components/datasets/create/step-two/index.tsx +++ b/web/app/components/datasets/create/step-two/index.tsx @@ -655,7 +655,7 @@ const StepTwo = ({
- +
@@ -891,12 +891,12 @@ const StepTwo = ({
- +
) : (
- +
)} diff --git a/web/app/components/datasets/create/stop-embedding-modal/index.tsx b/web/app/components/datasets/create/stop-embedding-modal/index.tsx index a9efa7a828..c3d7f7aa5b 100644 --- a/web/app/components/datasets/create/stop-embedding-modal/index.tsx +++ b/web/app/components/datasets/create/stop-embedding-modal/index.tsx @@ -30,12 +30,12 @@ const StopEmbeddingModal = ({ onClose={onHide} className={cn(s.modal, '!max-w-[480px]', 'px-8')} > -
- +
+
{t('datasetCreation.stepThree.modelTitle')}
{t('datasetCreation.stepThree.modelContent')}
- +
diff --git a/web/app/components/datasets/documents/detail/batch-modal/index.tsx b/web/app/components/datasets/documents/detail/batch-modal/index.tsx index cfffedd6ad..abaea8d0e0 100644 --- a/web/app/components/datasets/documents/detail/batch-modal/index.tsx +++ b/web/app/components/datasets/documents/detail/batch-modal/index.tsx @@ -39,7 +39,7 @@ const BatchModal: FC = ({ }, [isShow]) return ( - {}} className='px-8 py-6 !max-w-[520px] !rounded-xl'> + { }} className='px-8 py-6 !max-w-[520px] !rounded-xl'>
{t('datasetDocuments.list.batchModal.title')}
@@ -55,7 +55,7 @@ const BatchModal: FC = ({ -
diff --git a/web/app/components/datasets/documents/detail/completed/SegmentCard.tsx b/web/app/components/datasets/documents/detail/completed/SegmentCard.tsx index 8d0ebc0034..b4c0235486 100644 --- a/web/app/components/datasets/documents/detail/completed/SegmentCard.tsx +++ b/web/app/components/datasets/documents/detail/completed/SegmentCard.tsx @@ -224,7 +224,7 @@ const SegmentCard: FC = ({
)} - diff --git a/web/app/components/datasets/documents/detail/metadata/index.tsx b/web/app/components/datasets/documents/detail/metadata/index.tsx index e43f3d4477..d034abece9 100644 --- a/web/app/components/datasets/documents/detail/metadata/index.tsx +++ b/web/app/components/datasets/documents/detail/metadata/index.tsx @@ -208,7 +208,7 @@ const Metadata: FC = ({ docDetail, loading, onUpdate }) => { })} {!doc_type && !documentType && ( - )} {documentType &&
- +
}
@@ -324,7 +324,7 @@ const Metadata: FC = ({ docDetail, loading, onUpdate }) => { - +
) diff --git a/web/app/components/datasets/hit-testing/textarea.tsx b/web/app/components/datasets/hit-testing/textarea.tsx index 17a8694de1..3432204f5f 100644 --- a/web/app/components/datasets/hit-testing/textarea.tsx +++ b/web/app/components/datasets/hit-testing/textarea.tsx @@ -128,7 +128,7 @@ const TextAreaWithButton = ({
- +
) diff --git a/web/app/components/datasets/settings/form/index.tsx b/web/app/components/datasets/settings/form/index.tsx index d284281208..d1b1a1acaa 100644 --- a/web/app/components/datasets/settings/form/index.tsx +++ b/web/app/components/datasets/settings/form/index.tsx @@ -244,7 +244,7 @@ const Form = () => {
diff --git a/web/app/components/develop/secret-key/secret-key-modal.tsx b/web/app/components/develop/secret-key/secret-key-modal.tsx index 37adaf8822..d98520f951 100644 --- a/web/app/components/develop/secret-key/secret-key-modal.tsx +++ b/web/app/components/develop/secret-key/secret-key-modal.tsx @@ -128,7 +128,7 @@ const SecretKeyModal = ({ setCopyValue(api.token) }}>
- { isCurrentWorkspaceManager + {isCurrentWorkspaceManager &&
{ setDelKeyId(api.id) setShowConfirmDelete(true) @@ -143,7 +143,7 @@ const SecretKeyModal = ({ ) }
- diff --git a/web/app/components/explore/app-card/index.tsx b/web/app/components/explore/app-card/index.tsx index 4b336c0fe8..0f6000cada 100644 --- a/web/app/components/explore/app-card/index.tsx +++ b/web/app/components/explore/app-card/index.tsx @@ -62,7 +62,7 @@ const AppCard = ({ {isExplore && canCreate && (
- @@ -72,7 +72,7 @@ const AppCard = ({ {!isExplore && (
- diff --git a/web/app/components/explore/create-app-modal/index.tsx b/web/app/components/explore/create-app-modal/index.tsx index 66bfe65595..48126e3b4b 100644 --- a/web/app/components/explore/create-app-modal/index.tsx +++ b/web/app/components/explore/create-app-modal/index.tsx @@ -102,7 +102,7 @@ const CreateAppModal = ({ {!isEditModal && isAppsFull && }
- +
diff --git a/web/app/components/header/account-setting/account-page/index.tsx b/web/app/components/header/account-setting/account-page/index.tsx index b7467f4d88..d2d61257eb 100644 --- a/web/app/components/header/account-setting/account-page/index.tsx +++ b/web/app/components/header/account-setting/account-page/index.tsx @@ -182,7 +182,7 @@ export default function AccountPage() {
} @@ -151,7 +151,7 @@ const InviteModal = ({ className='w-full text-sm font-medium' onClick={handleSend} disabled={!emails.length} - type='primary' + variant='primary' > {t('common.members.sendInvite')} diff --git a/web/app/components/header/account-setting/members-page/invited-modal/index.tsx b/web/app/components/header/account-setting/members-page/invited-modal/index.tsx index d150900e93..90840f990d 100644 --- a/web/app/components/header/account-setting/members-page/invited-modal/index.tsx +++ b/web/app/components/header/account-setting/members-page/invited-modal/index.tsx @@ -49,34 +49,34 @@ const InvitedModal = ({
{ !!successInvationResults.length - && <> -
{t('common.members.invitationLink')}
- {successInvationResults.map(item => - )} - + && <> +
{t('common.members.invitationLink')}
+ {successInvationResults.map(item => + )} + } { !!failedInvationResults.length - && <> -
{t('common.members.failedinvitationEmails')}
-
- { - failedInvationResults.map(item => -
- -
- {item.email} - -
-
-
, - ) - } -
- + && <> +
{t('common.members.failedinvitationEmails')}
+
+ { + failedInvationResults.map(item => +
+ +
+ {item.email} + +
+
+
, + ) + } +
+ }
@@ -85,7 +85,7 @@ const InvitedModal = ({ diff --git a/web/app/components/header/account-setting/model-provider-page/model-modal/index.tsx b/web/app/components/header/account-setting/model-provider-page/model-modal/index.tsx index 3d920cc5ec..fb907c4479 100644 --- a/web/app/components/header/account-setting/model-provider-page/model-modal/index.tsx +++ b/web/app/components/header/account-setting/model-provider-page/model-modal/index.tsx @@ -339,7 +339,7 @@ const ModelModal: FC = ({
@@ -168,7 +168,7 @@ const SystemModel: FC = ({
{t('common.modelProvider.embeddingModel.tip')}
} > - +
@@ -188,7 +188,7 @@ const SystemModel: FC = ({
{t('common.modelProvider.rerankModel.tip')}
} > - +
@@ -208,7 +208,7 @@ const SystemModel: FC = ({
{t('common.modelProvider.speechToTextModel.tip')}
} > - +
@@ -228,7 +228,7 @@ const SystemModel: FC = ({
{t('common.modelProvider.ttsModel.tip')}
} > - +
@@ -247,7 +247,7 @@ const SystemModel: FC = ({ {t('common.operation.cancel')} - +
) diff --git a/web/app/components/share/chat/value-panel/index.tsx b/web/app/components/share/chat/value-panel/index.tsx index b9b26d8667..249dc71f31 100644 --- a/web/app/components/share/chat/value-panel/index.tsx +++ b/web/app/components/share/chat/value-panel/index.tsx @@ -61,7 +61,7 @@ export const VarOpBtnGroup: FC<{ className?: string; onConfirm: () => void; onCa
diff --git a/web/app/components/share/text-generation/run-batch/index.tsx b/web/app/components/share/text-generation/run-batch/index.tsx index 849d02445c..cab7fed194 100644 --- a/web/app/components/share/text-generation/run-batch/index.tsx +++ b/web/app/components/share/text-generation/run-batch/index.tsx @@ -42,7 +42,7 @@ const RunBatch: FC = ({
- - + +
diff --git a/web/app/components/tools/add-tool-modal/tools.tsx b/web/app/components/tools/add-tool-modal/tools.tsx index 9ba5ba81a9..3681fd5046 100644 --- a/web/app/components/tools/add-tool-modal/tools.tsx +++ b/web/app/components/tools/add-tool-modal/tools.tsx @@ -99,23 +99,23 @@ const Blocks = ({
{tool.label[language]}
{!needAuth && added && (
- + {t('tools.addToolModal.added').toLocaleUpperCase()}
)} {!needAuth && !added && addable && ( )} {needAuth && ( @@ -135,7 +135,7 @@ const Blocks = ({ )} {!tools.length && showWorkflowEmpty && (
- +
)} {!!tools.length && tools.map(renderGroup)} diff --git a/web/app/components/tools/edit-custom-collection-modal/config-credentials.tsx b/web/app/components/tools/edit-custom-collection-modal/config-credentials.tsx index 71fd1cd94d..696b4b2f26 100644 --- a/web/app/components/tools/edit-custom-collection-modal/config-credentials.tsx +++ b/web/app/components/tools/edit-custom-collection-modal/config-credentials.tsx @@ -117,7 +117,7 @@ const ConfigCredential: FC = ({
} > - +
= ({
- diff --git a/web/app/components/tools/edit-custom-collection-modal/get-schema.tsx b/web/app/components/tools/edit-custom-collection-modal/get-schema.tsx index ac1ae55f77..345eef4814 100644 --- a/web/app/components/tools/edit-custom-collection-modal/get-schema.tsx +++ b/web/app/components/tools/edit-custom-collection-modal/get-schema.tsx @@ -74,7 +74,7 @@ const GetSchema: FC = ({ /> - +
diff --git a/web/app/components/tools/edit-custom-collection-modal/test-api.tsx b/web/app/components/tools/edit-custom-collection-modal/test-api.tsx index 793589800a..1dd80b1213 100644 --- a/web/app/components/tools/edit-custom-collection-modal/test-api.tsx +++ b/web/app/components/tools/edit-custom-collection-modal/test-api.tsx @@ -107,7 +107,7 @@ const TestApi: FC = ({ - +
{t('tools.test.testResult')}
diff --git a/web/app/components/tools/provider/detail.tsx b/web/app/components/tools/provider/detail.tsx index bf653eda4c..cb945d2c6f 100644 --- a/web/app/components/tools/provider/detail.tsx +++ b/web/app/components/tools/provider/detail.tsx @@ -197,7 +197,7 @@ const ProviderDetail = ({
{typeof collection.icon === 'string' && ( -
+
)} {typeof collection.icon !== 'string' && ( {(collection.type === CollectionType.builtIn) && needAuth && (
{/* Tools */}
- {isDetailLoading &&
} + {isDetailLoading &&
} {!isDetailLoading && (
{collection.type === CollectionType.workflow && {t('tools.createTool.toolInput.title').toLocaleUpperCase()}} diff --git a/web/app/components/tools/setting/build-in/config-credentials.tsx b/web/app/components/tools/setting/build-in/config-credentials.tsx index b315852e02..1f2f8ab8c1 100644 --- a/web/app/components/tools/setting/build-in/config-credentials.tsx +++ b/web/app/components/tools/setting/build-in/config-credentials.tsx @@ -91,7 +91,7 @@ const ConfigCredential: FC = ({ } < div className='flex space-x-2'> - +
diff --git a/web/app/components/tools/workflow-tool/confirm-modal/index.tsx b/web/app/components/tools/workflow-tool/confirm-modal/index.tsx index 7c0c0d9a33..7852013bce 100644 --- a/web/app/components/tools/workflow-tool/confirm-modal/index.tsx +++ b/web/app/components/tools/workflow-tool/confirm-modal/index.tsx @@ -21,7 +21,7 @@ const ConfirmModal = ({ show, onConfirm, onClose }: ConfirmModalProps) => { {}} + onClose={() => { }} >
@@ -36,7 +36,7 @@ const ConfirmModal = ({ show, onConfirm, onClose }: ConfirmModalProps) => {
- +
diff --git a/web/app/components/tools/workflow-tool/index.tsx b/web/app/components/tools/workflow-tool/index.tsx index 6fbcf33769..ca3d8af590 100644 --- a/web/app/components/tools/workflow-tool/index.tsx +++ b/web/app/components/tools/workflow-tool/index.tsx @@ -208,7 +208,7 @@ const WorkflowToolAsModal: FC = ({
)} {item.name !== '__image' && ( - handleParameterChange('form', value, index)}/> + handleParameterChange('form', value, index)} /> )} @@ -246,7 +246,7 @@ const WorkflowToolAsModal: FC = ({ )}
- diff --git a/web/app/components/workflow/nodes/_base/components/before-run-form/index.tsx b/web/app/components/workflow/nodes/_base/components/before-run-form/index.tsx index fd7c02eaba..77ab05d097 100644 --- a/web/app/components/workflow/nodes/_base/components/before-run-form/index.tsx +++ b/web/app/components/workflow/nodes/_base/components/before-run-form/index.tsx @@ -141,7 +141,7 @@ const BeforeRunForm: FC = ({
)} - diff --git a/web/app/components/workflow/nodes/http/components/authorization/index.tsx b/web/app/components/workflow/nodes/http/components/authorization/index.tsx index f0c65f17c3..05e4d48031 100644 --- a/web/app/components/workflow/nodes/http/components/authorization/index.tsx +++ b/web/app/components/workflow/nodes/http/components/authorization/index.tsx @@ -140,7 +140,7 @@ const Authorization: FC = ({
- +
diff --git a/web/app/components/workflow/nodes/parameter-extractor/components/extract-parameter/update.tsx b/web/app/components/workflow/nodes/parameter-extractor/components/extract-parameter/update.tsx index 1610704c67..97e90cf02d 100644 --- a/web/app/components/workflow/nodes/parameter-extractor/components/extract-parameter/update.tsx +++ b/web/app/components/workflow/nodes/parameter-extractor/components/extract-parameter/update.tsx @@ -181,7 +181,7 @@ const AddExtractParameter: FC = ({
- +
diff --git a/web/app/components/workflow/nodes/tool/panel.tsx b/web/app/components/workflow/nodes/tool/panel.tsx index e57ff6e5c2..dd263e9e4e 100644 --- a/web/app/components/workflow/nodes/tool/panel.tsx +++ b/web/app/components/workflow/nodes/tool/panel.tsx @@ -61,7 +61,7 @@ const Panel: FC> = ({ <>
-
diff --git a/web/app/install/installForm.tsx b/web/app/install/installForm.tsx index 414bd9d6fd..7270b4f450 100644 --- a/web/app/install/installForm.tsx +++ b/web/app/install/installForm.tsx @@ -148,7 +148,7 @@ const InstallForm = () => {
-
diff --git a/web/app/signin/normalForm.tsx b/web/app/signin/normalForm.tsx index 60f21c0341..988aec28bf 100644 --- a/web/app/signin/normalForm.tsx +++ b/web/app/signin/normalForm.tsx @@ -156,7 +156,7 @@ const NormalForm = () => {