Skip to content

armgit / dify

Public Imported from GitHub
0

Build Agentic workflows, RAG pipelines, with rich AI model and tool support on one collaborative workspace. Deploy on cloud, VPC, or self-hosted, so teams move from prototype to production without rebuilding the stack.

refactor & perf: `import { noop } from 'lodash-es'` across `web` (#17439)

yusheng chenc05e03fc0950
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 117536e0be1..8f4e9079efd 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
@@ -11,6 +11,7 @@ import Toast from '@/app/components/base/toast'
import { annotationBatchImport, checkAnnotationBatchImportProgress } from '@/service/annotation'
import { useProviderContext } from '@/context/provider-context'
import AnnotationFull from '@/app/components/billing/annotation-full'
+import { noop } from 'lodash-es'
export enum ProcessStatus {
WAITING = 'waiting',
@@ -87,7 +88,7 @@ const BatchModal: FC<IBatchModalProps> = ({
}
return (
- <Modal isShow={isShow} onClose={() => { }} className='!max-w-[520px] !rounded-xl px-8 py-6'>
+ <Modal isShow={isShow} onClose={noop} className='!max-w-[520px] !rounded-xl px-8 py-6'>
<div className='system-xl-medium relative pb-1 text-text-primary'>{t('appAnnotation.batchModal.title')}</div>
<div className='absolute right-4 top-4 cursor-pointer p-2' onClick={onCancel}>
<RiCloseLine className='h-4 w-4 text-text-tertiary' />
diff --git a/web/app/components/app/configuration/base/operation-btn/index.tsx b/web/app/components/app/configuration/base/operation-btn/index.tsx
index 508d9e745d1..aba35cded2c 100644
--- a/web/app/components/app/configuration/base/operation-btn/index.tsx
+++ b/web/app/components/app/configuration/base/operation-btn/index.tsx
@@ -7,6 +7,7 @@ import {
RiEditLine,
} from '@remixicon/react'
import cn from '@/utils/classnames'
+import { noop } from 'lodash-es'
export type IOperationBtnProps = {
className?: string
@@ -24,7 +25,7 @@ const OperationBtn: FC<IOperationBtnProps> = ({
className,
type,
actionName,
- onClick = () => { },
+ onClick = noop,
}) => {
const { t } = useTranslation()
return (
diff --git a/web/app/components/app/configuration/config-prompt/simple-prompt-input.tsx b/web/app/components/app/configuration/config-prompt/simple-prompt-input.tsx
index 64c0924f865..90d440aba55 100644
--- a/web/app/components/app/configuration/config-prompt/simple-prompt-input.tsx
+++ b/web/app/components/app/configuration/config-prompt/simple-prompt-input.tsx
@@ -27,6 +27,7 @@ import { INSERT_VARIABLE_VALUE_BLOCK_COMMAND } from '@/app/components/base/promp
import { PROMPT_EDITOR_UPDATE_VALUE_BY_EVENT_EMITTER } from '@/app/components/base/prompt-editor/plugins/update-block'
import useBreakpoints, { MediaType } from '@/hooks/use-breakpoints'
import { useFeaturesStore } from '@/app/components/base/features/hooks'
+import { noop } from 'lodash-es'
export type ISimplePromptInput = {
mode: AppType
@@ -233,7 +234,7 @@ const Prompt: FC<ISimplePromptInput> = ({
user: '',
assistant: '',
},
- onEditRole: () => { },
+ onEditRole: noop,
}}
queryBlock={{
show: false,
diff --git a/web/app/components/app/configuration/config/agent/prompt-editor.tsx b/web/app/components/app/configuration/config/agent/prompt-editor.tsx
index 550dd0a56c9..7f7f140eda7 100644
--- a/web/app/components/app/configuration/config/agent/prompt-editor.tsx
+++ b/web/app/components/app/configuration/config/agent/prompt-editor.tsx
@@ -14,8 +14,9 @@ import type { ExternalDataTool } from '@/models/common'
import ConfigContext from '@/context/debug-configuration'
import { useModalContext } from '@/context/modal-context'
import { useToastContext } from '@/app/components/base/toast'
-
import s from '@/app/components/app/configuration/config-prompt/style.module.css'
+import { noop } from 'lodash-es'
+
type Props = {
className?: string
type: 'first-prompt' | 'next-iteration'
@@ -128,14 +129,14 @@ const Editor: FC<Props> = ({
user: '',
assistant: '',
},
- onEditRole: () => { },
+ onEditRole: noop,
}}
queryBlock={{
show: false,
selectable: false,
}}
onChange={onChange}
- onBlur={() => { }}
+ onBlur={noop}
/>
</div>
<div className='flex pb-2 pl-4'>
diff --git a/web/app/components/app/configuration/dataset-config/params-config/weighted-score.tsx b/web/app/components/app/configuration/dataset-config/params-config/weighted-score.tsx
index 2d63d6c4c4c..5f0ad94d862 100644
--- a/web/app/components/app/configuration/dataset-config/params-config/weighted-score.tsx
+++ b/web/app/components/app/configuration/dataset-config/params-config/weighted-score.tsx
@@ -3,6 +3,7 @@ import { useTranslation } from 'react-i18next'
import './weighted-score.css'
import Slider from '@/app/components/base/slider'
import cn from '@/utils/classnames'
+import { noop } from 'lodash-es'
const formatNumber = (value: number) => {
if (value > 0 && value < 1)
@@ -23,7 +24,7 @@ type WeightedScoreProps = {
}
const WeightedScore = ({
value,
- onChange = () => {},
+ onChange = noop,
}: WeightedScoreProps) => {
const { t } = useTranslation()
diff --git a/web/app/components/app/configuration/debug/debug-with-multiple-model/context.tsx b/web/app/components/app/configuration/debug/debug-with-multiple-model/context.tsx
index d95faf7ae92..1fcd878c447 100644
--- a/web/app/components/app/configuration/debug/debug-with-multiple-model/context.tsx
+++ b/web/app/components/app/configuration/debug/debug-with-multiple-model/context.tsx
@@ -2,6 +2,7 @@
import { createContext, useContext } from 'use-context-selector'
import type { ModelAndParameter } from '../types'
+import { noop } from 'lodash-es'
export type DebugWithMultipleModelContextType = {
multipleModelConfigs: ModelAndParameter[]
@@ -11,8 +12,8 @@ export type DebugWithMultipleModelContextType = {
}
const DebugWithMultipleModelContext = createContext<DebugWithMultipleModelContextType>({
multipleModelConfigs: [],
- onMultipleModelConfigsChange: () => {},
- onDebugWithMultipleModelChange: () => {},
+ onMultipleModelConfigsChange: noop,
+ onDebugWithMultipleModelChange: noop,
})
export const useDebugWithMultipleModelContext = () => useContext(DebugWithMultipleModelContext)
diff --git a/web/app/components/app/configuration/debug/debug-with-multiple-model/text-generation-item.tsx b/web/app/components/app/configuration/debug/debug-with-multiple-model/text-generation-item.tsx
index 4110c0a58a0..8f8555efa4c 100644
--- a/web/app/components/app/configuration/debug/debug-with-multiple-model/text-generation-item.tsx
+++ b/web/app/components/app/configuration/debug/debug-with-multiple-model/text-generation-item.tsx
@@ -14,6 +14,7 @@ import { TransferMethod } from '@/app/components/base/chat/types'
import { useEventEmitterContextContext } from '@/context/event-emitter'
import { useProviderContext } from '@/context/provider-context'
import { useFeatures } from '@/app/components/base/features/hooks'
+import { noop } from 'lodash-es'
type TextGenerationItemProps = {
modelAndParameter: ModelAndParameter
@@ -134,7 +135,7 @@ const TextGenerationItem: FC<TextGenerationItemProps> = ({
siteInfo={null}
messageId={messageId}
isError={false}
- onRetry={() => { }}
+ onRetry={noop}
inSidePanel
/>
)
diff --git a/web/app/components/app/configuration/debug/index.tsx b/web/app/components/app/configuration/debug/index.tsx
index 6ec400c6a5a..477328dad37 100644
--- a/web/app/components/app/configuration/debug/index.tsx
+++ b/web/app/components/app/configuration/debug/index.tsx
@@ -47,6 +47,7 @@ import AgentLogModal from '@/app/components/base/agent-log-modal'
import PromptLogModal from '@/app/components/base/prompt-log-modal'
import { useStore as useAppStore } from '@/app/components/app/store'
import { useFeatures, useFeaturesStore } from '@/app/components/base/features/hooks'
+import { noop } from 'lodash-es'
type IDebug = {
isAPIKeySet: boolean
@@ -515,7 +516,7 @@ const Debug: FC<IDebug> = ({
isInstalledApp={false}
messageId={messageId}
isError={false}
- onRetry={() => { }}
+ onRetry={noop}
siteInfo={null}
/>
</div>
diff --git a/web/app/components/app/configuration/tools/external-data-tool-modal.tsx b/web/app/components/app/configuration/tools/external-data-tool-modal.tsx
index 70b0c120b8a..9040de1b293 100644
--- a/web/app/components/app/configuration/tools/external-data-tool-modal.tsx
+++ b/web/app/components/app/configuration/tools/external-data-tool-modal.tsx
@@ -19,6 +19,7 @@ import type {
} from '@/models/common'
import { useToastContext } from '@/app/components/base/toast'
import AppIcon from '@/app/components/base/app-icon'
+import { noop } from 'lodash-es'
const systemTypes = ['api']
type ExternalDataToolModalProps = {
@@ -185,7 +186,7 @@ const ExternalDataToolModal: FC<ExternalDataToolModalProps> = ({
return (
<Modal
isShow
- onClose={() => { }}
+ onClose={noop}
className='!w-[640px] !max-w-none !p-8 !pb-6'
>
<div className='mb-2 text-xl font-semibold text-gray-900'>
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 8c4f386c7c6..e9124bd13b3 100644
--- a/web/app/components/app/create-from-dsl-modal/index.tsx
+++ b/web/app/components/app/create-from-dsl-modal/index.tsx
@@ -26,6 +26,7 @@ import { NEED_REFRESH_APP_LIST_KEY } from '@/config'
import { getRedirection } from '@/utils/app-redirection'
import cn from '@/utils/classnames'
import { usePluginDependencies } from '@/app/components/workflow/plugin-dependency/hooks'
+import { noop } from 'lodash-es'
type CreateFromDSLModalProps = {
show: boolean
@@ -203,7 +204,7 @@ const CreateFromDSLModal = ({ show, onSuccess, onClose, activeTab = CreateFromDS
<Modal
className='w-[520px] rounded-2xl border-[0.5px] border-components-panel-border bg-components-panel-bg p-0 shadow-xl'
isShow={show}
- onClose={() => { }}
+ onClose={noop}
>
<div className='title-2xl-semi-bold flex items-center justify-between pb-3 pl-6 pr-5 pt-6 text-text-primary'>
{t('app.importFromDSL')}
diff --git a/web/app/components/app/duplicate-modal/index.tsx b/web/app/components/app/duplicate-modal/index.tsx
index f0500706e58..f98fb831ed7 100644
--- a/web/app/components/app/duplicate-modal/index.tsx
+++ b/web/app/components/app/duplicate-modal/index.tsx
@@ -12,6 +12,7 @@ import AppIcon from '@/app/components/base/app-icon'
import { useProviderContext } from '@/context/provider-context'
import AppsFull from '@/app/components/billing/apps-full-in-dialog'
import type { AppIconType } from '@/types/app'
+import { noop } from 'lodash-es'
export type DuplicateAppModalProps = {
appName: string
@@ -71,7 +72,7 @@ const DuplicateAppModal = ({
<>
<Modal
isShow={show}
- onClose={() => { }}
+ onClose={noop}
className={cn('relative !max-w-[480px]', 'px-8')}
>
<div className='absolute right-4 top-4 cursor-pointer p-2' onClick={onHide}>
diff --git a/web/app/components/app/log/list.tsx b/web/app/components/app/log/list.tsx
index 0ca80c3ec38..c4e46af107d 100644
--- a/web/app/components/app/log/list.tsx
+++ b/web/app/components/app/log/list.tsx
@@ -41,6 +41,7 @@ import { CopyIcon } from '@/app/components/base/copy-icon'
import { buildChatItemTree, getThreadMessages } from '@/app/components/base/chat/utils'
import { getProcessedFilesFromResponse } from '@/app/components/base/file-uploader/utils'
import cn from '@/utils/classnames'
+import { noop } from 'lodash-es'
dayjs.extend(utc)
dayjs.extend(timezone)
@@ -411,7 +412,7 @@ function DetailPanel({ detail, onFeedback }: IDetailPanel) {
content={detail.message.answer}
messageId={detail.message.id}
isError={false}
- onRetry={() => { }}
+ onRetry={noop}
isInstalledApp={false}
supportFeedback
feedback={detail.message.feedbacks.find((item: any) => item.from_source === 'admin')}
diff --git a/web/app/components/app/switch-app-modal/index.tsx b/web/app/components/app/switch-app-modal/index.tsx
index 9bb0f4103e8..e2bab94b59b 100644
--- a/web/app/components/app/switch-app-modal/index.tsx
+++ b/web/app/components/app/switch-app-modal/index.tsx
@@ -23,6 +23,7 @@ import type { App } from '@/types/app'
import { AlertTriangle } from '@/app/components/base/icons/src/vender/solid/alertsAndFeedback'
import AppIcon from '@/app/components/base/app-icon'
import { useStore as useAppStore } from '@/app/components/app/store'
+import { noop } from 'lodash-es'
type SwitchAppModalProps = {
show: boolean
@@ -96,7 +97,7 @@ const SwitchAppModal = ({ show, appDetail, inAppDetail = false, onSuccess, onClo
<Modal
className={cn('w-[600px] max-w-[600px] p-8')}
isShow={show}
- onClose={() => { }}
+ onClose={noop}
>
<div className='absolute right-4 top-4 cursor-pointer p-2' onClick={onClose}>
<RiCloseLine className='h-4 w-4 text-text-tertiary' />
diff --git a/web/app/components/base/app-icon-picker/index.tsx b/web/app/components/base/app-icon-picker/index.tsx
index 9cd5173a50c..8304de188c8 100644
--- a/web/app/components/base/app-icon-picker/index.tsx
+++ b/web/app/components/base/app-icon-picker/index.tsx
@@ -15,6 +15,7 @@ import getCroppedImg from './utils'
import type { AppIconType, ImageFile } from '@/types/app'
import cn from '@/utils/classnames'
import { DISABLE_UPLOAD_IMAGE_AS_ICON } from '@/config'
+import { noop } from 'lodash-es'
export type AppIconEmojiSelection = {
type: 'emoji'
@@ -107,7 +108,7 @@ const AppIconPicker: FC<AppIconPickerProps> = ({
}
return <Modal
- onClose={() => { }}
+ onClose={noop}
isShow
closable={false}
wrapperClassName={className}
diff --git a/web/app/components/base/chat/chat-with-history/context.tsx b/web/app/components/base/chat/chat-with-history/context.tsx
index e5ea0d7379e..7dd7a78691e 100644
--- a/web/app/components/base/chat/chat-with-history/context.tsx
+++ b/web/app/components/base/chat/chat-with-history/context.tsx
@@ -15,6 +15,7 @@ import type {
AppMeta,
ConversationItem,
} from '@/models/share'
+import { noop } from 'lodash-es'
export type ChatWithHistoryContextValue = {
appInfoError?: any
@@ -65,29 +66,29 @@ export const ChatWithHistoryContext = createContext<ChatWithHistoryContextValue>
conversationList: [],
newConversationInputs: {},
newConversationInputsRef: { current: {} },
- handleNewConversationInputsChange: () => {},
+ handleNewConversationInputsChange: noop,
inputsForms: [],
- handleNewConversation: () => {},
- handleStartChat: () => {},
- handleChangeConversation: () => {},
- handlePinConversation: () => {},
- handleUnpinConversation: () => {},
- handleDeleteConversation: () => {},
+ handleNewConversation: noop,
+ handleStartChat: noop,
+ handleChangeConversation: noop,
+ handlePinConversation: noop,
+ handleUnpinConversation: noop,
+ handleDeleteConversation: noop,
conversationRenaming: false,
- handleRenameConversation: () => {},
- handleNewConversationCompleted: () => {},
+ handleRenameConversation: noop,
+ handleNewConversationCompleted: noop,
chatShouldReloadKey: '',
isMobile: false,
isInstalledApp: false,
- handleFeedback: () => {},
- currentChatInstanceRef: { current: { handleStop: () => {} } },
+ handleFeedback: noop,
+ currentChatInstanceRef: { current: { handleStop: noop } },
sidebarCollapseState: false,
- handleSidebarCollapse: () => {},
+ handleSidebarCollapse: noop,
clearChatList: false,
- setClearChatList: () => {},
+ setClearChatList: noop,
isResponding: false,
- setIsResponding: () => {},
+ setIsResponding: noop,
currentConversationInputs: {},
- setCurrentConversationInputs: () => {},
+ setCurrentConversationInputs: noop,
})
export const useChatWithHistoryContext = () => useContext(ChatWithHistoryContext)
diff --git a/web/app/components/base/chat/chat-with-history/hooks.tsx b/web/app/components/base/chat/chat-with-history/hooks.tsx
index adf4cc7e578..88f6c8f616c 100644
--- a/web/app/components/base/chat/chat-with-history/hooks.tsx
+++ b/web/app/components/base/chat/chat-with-history/hooks.tsx
@@ -42,6 +42,7 @@ import { changeLanguage } from '@/i18n/i18next-config'
import { useAppFavicon } from '@/hooks/use-app-favicon'
import { InputVarType } from '@/app/components/workflow/types'
import { TransferMethod } from '@/types/app'
+import { noop } from 'lodash-es'
function getFormattedChatList(messages: any[]) {
const newChatList: ChatItem[] = []
@@ -318,7 +319,7 @@ export const useChatWithHistory = (installedAppInfo?: InstalledApp) => {
callback?.()
}
}, [setShowNewConversationItemInList, checkInputsRequired])
- const currentChatInstanceRef = useRef<{ handleStop: () => void }>({ handleStop: () => { } })
+ const currentChatInstanceRef = useRef<{ handleStop: () => void }>({ handleStop: noop })
const handleChangeConversation = useCallback((conversationId: string) => {
currentChatInstanceRef.current.handleStop()
setNewConversationId('')
diff --git a/web/app/components/base/chat/embedded-chatbot/context.tsx b/web/app/components/base/chat/embedded-chatbot/context.tsx
index d2ea4b02ba2..eb5e9d697fd 100644
--- a/web/app/components/base/chat/embedded-chatbot/context.tsx
+++ b/web/app/components/base/chat/embedded-chatbot/context.tsx
@@ -14,6 +14,7 @@ import type {
AppMeta,
ConversationItem,
} from '@/models/share'
+import { noop } from 'lodash-es'
export type EmbeddedChatbotContextValue = {
appInfoError?: any
@@ -57,22 +58,22 @@ export const EmbeddedChatbotContext = createContext<EmbeddedChatbotContextValue>
conversationList: [],
newConversationInputs: {},
newConversationInputsRef: { current: {} },
- handleNewConversationInputsChange: () => {},
+ handleNewConversationInputsChange: noop,
inputsForms: [],
- handleNewConversation: () => {},
- handleStartChat: () => {},
- handleChangeConversation: () => {},
- handleNewConversationCompleted: () => {},
+ handleNewConversation: noop,
+ handleStartChat: noop,
+ handleChangeConversation: noop,
+ handleNewConversationCompleted: noop,
chatShouldReloadKey: '',
isMobile: false,
isInstalledApp: false,
- handleFeedback: () => {},
- currentChatInstanceRef: { current: { handleStop: () => {} } },
+ handleFeedback: noop,
+ currentChatInstanceRef: { current: { handleStop: noop } },
clearChatList: false,
- setClearChatList: () => {},
+ setClearChatList: noop,
isResponding: false,
- setIsResponding: () => {},
+ setIsResponding: noop,
currentConversationInputs: {},
- setCurrentConversationInputs: () => {},
+ setCurrentConversationInputs: noop,
})
export const useEmbeddedChatbotContext = () => useContext(EmbeddedChatbotContext)
diff --git a/web/app/components/base/chat/embedded-chatbot/hooks.tsx b/web/app/components/base/chat/embedded-chatbot/hooks.tsx
index 730db3550ed..197aa7649c5 100644
--- a/web/app/components/base/chat/embedded-chatbot/hooks.tsx
+++ b/web/app/components/base/chat/embedded-chatbot/hooks.tsx
@@ -35,6 +35,7 @@ import { changeLanguage } from '@/i18n/i18next-config'
import { InputVarType } from '@/app/components/workflow/types'
import { TransferMethod } from '@/types/app'
import { addFileInfos, sortAgentSorts } from '@/app/components/tools/utils'
+import { noop } from 'lodash-es'
function getFormattedChatList(messages: any[]) {
const newChatList: ChatItem[] = []
@@ -294,7 +295,7 @@ export const useEmbeddedChatbot = () => {
callback?.()
}
}, [setShowNewConversationItemInList, checkInputsRequired])
- const currentChatInstanceRef = useRef<{ handleStop: () => void }>({ handleStop: () => { } })
+ const currentChatInstanceRef = useRef<{ handleStop: () => void }>({ handleStop: noop })
const handleChangeConversation = useCallback((conversationId: string) => {
currentChatInstanceRef.current.handleStop()
setNewConversationId('')
diff --git a/web/app/components/base/emoji-picker/index.tsx b/web/app/components/base/emoji-picker/index.tsx
index f909f1c3f3f..d3b20bb507a 100644
--- a/web/app/components/base/emoji-picker/index.tsx
+++ b/web/app/components/base/emoji-picker/index.tsx
@@ -7,6 +7,7 @@ import cn from '@/utils/classnames'
import Divider from '@/app/components/base/divider'
import Button from '@/app/components/base/button'
import Modal from '@/app/components/base/modal'
+import { noop } from 'lodash-es'
type IEmojiPickerProps = {
isModal?: boolean
@@ -32,7 +33,7 @@ const EmojiPicker: FC<IEmojiPickerProps> = ({
return isModal
? <Modal
- onClose={() => { }}
+ onClose={noop}
isShow
closable={false}
wrapperClassName={className}
diff --git a/web/app/components/base/features/new-feature-panel/conversation-opener/modal.tsx b/web/app/components/base/features/new-feature-panel/conversation-opener/modal.tsx
index 5d63639e494..117c8a5558b 100644
--- a/web/app/components/base/features/new-feature-panel/conversation-opener/modal.tsx
+++ b/web/app/components/base/features/new-feature-panel/conversation-opener/modal.tsx
@@ -14,6 +14,7 @@ import type { PromptVariable } from '@/models/debug'
import type { InputVar } from '@/app/components/workflow/types'
import { getNewVar } from '@/utils/var'
import cn from '@/utils/classnames'
+import { noop } from 'lodash-es'
type OpeningSettingModalProps = {
data: OpeningStatement
@@ -171,7 +172,7 @@ const OpeningSettingModal = ({
return (
<Modal
isShow
- onClose={() => { }}
+ onClose={noop}
className='!mt-14 !w-[640px] !max-w-none !bg-components-panel-bg-blur !p-6'
>
<div className='mb-6 flex items-center justify-between'>
diff --git a/web/app/components/base/features/new-feature-panel/moderation/moderation-setting-modal.tsx b/web/app/components/base/features/new-feature-panel/moderation/moderation-setting-modal.tsx
index 6af80ec6a17..297e2b3f022 100644
--- a/web/app/components/base/features/new-feature-panel/moderation/moderation-setting-modal.tsx
+++ b/web/app/components/base/features/new-feature-panel/moderation/moderation-setting-modal.tsx
@@ -24,6 +24,7 @@ import { InfoCircle } from '@/app/components/base/icons/src/vender/line/general'
import { useModalContext } from '@/context/modal-context'
import { CustomConfigurationStatusEnum } from '@/app/components/header/account-setting/model-provider-page/declarations'
import cn from '@/utils/classnames'
+import { noop } from 'lodash-es'
const systemTypes = ['openai_moderation', 'keywords', 'api']
@@ -239,7 +240,7 @@ const ModerationSettingModal: FC<ModerationSettingModalProps> = ({
return (
<Modal
isShow
- onClose={() => { }}
+ onClose={noop}
className='!mt-14 !w-[600px] !max-w-none !p-6'
>
<div className='flex items-center justify-between'>
diff --git a/web/app/components/base/file-uploader/hooks.ts b/web/app/components/base/file-uploader/hooks.ts
index 7c82e0a04e5..66d5b46ba76 100644
--- a/web/app/components/base/file-uploader/hooks.ts
+++ b/web/app/components/base/file-uploader/hooks.ts
@@ -28,6 +28,7 @@ import type { FileUpload } from '@/app/components/base/features/types'
import { formatFileSize } from '@/utils/format'
import { uploadRemoteFileInfo } from '@/service/common'
import type { FileUploadConfigResponse } from '@/models/common'
+import { noop } from 'lodash-es'
export const useFileSizeLimit = (fileUploadConfig?: FileUploadConfigResponse) => {
const imgSizeLimit = Number(fileUploadConfig?.image_file_size_limit) * 1024 * 1024 || IMG_SIZE_LIMIT
@@ -243,9 +244,9 @@ export const useFile = (fileConfig: FileUpload) => {
})
}, [checkSizeLimit, handleAddFile, handleUpdateFile, notify, t, handleRemoveFile, fileConfig?.allowed_file_types, fileConfig.allowed_file_extensions, startProgressTimer, params.token])
- const handleLoadFileFromLinkSuccess = useCallback(() => { }, [])
+ const handleLoadFileFromLinkSuccess = useCallback(noop, [])
- const handleLoadFileFromLinkError = useCallback(() => { }, [])
+ const handleLoadFileFromLinkError = useCallback(noop, [])
const handleClearFiles = useCallback(() => {
const {
diff --git a/web/app/components/base/file-uploader/pdf-preview.tsx b/web/app/components/base/file-uploader/pdf-preview.tsx
index 54c6ae8001a..f8a02e8daaf 100644
--- a/web/app/components/base/file-uploader/pdf-preview.tsx
+++ b/web/app/components/base/file-uploader/pdf-preview.tsx
@@ -9,6 +9,7 @@ import { useHotkeys } from 'react-hotkeys-hook'
import Loading from '@/app/components/base/loading'
import useBreakpoints, { MediaType } from '@/hooks/use-breakpoints'
import Tooltip from '@/app/components/base/tooltip'
+import { noop } from 'lodash-es'
type PdfPreviewProps = {
url: string
@@ -65,8 +66,8 @@ const PdfPreview: FC<PdfPreviewProps> = ({
<PdfHighlighter
pdfDocument={pdfDocument}
enableAreaSelection={event => event.altKey}
- scrollRef={() => { }}
- onScrollChange={() => { }}
+ scrollRef={noop}
+ onScrollChange={noop}
onSelectionFinished={() => null}
highlightTransform={() => { return <div/> }}
highlights={[]}
diff --git a/web/app/components/base/fullscreen-modal/index.tsx b/web/app/components/base/fullscreen-modal/index.tsx
index 14fbded8aad..209507a09ce 100644
--- a/web/app/components/base/fullscreen-modal/index.tsx
+++ b/web/app/components/base/fullscreen-modal/index.tsx
@@ -1,6 +1,7 @@
import { Dialog, DialogPanel, Transition, TransitionChild } from '@headlessui/react'
import { RiCloseLargeLine } from '@remixicon/react'
import classNames from '@/utils/classnames'
+import { noop } from 'lodash-es'
type IModal = {
className?: string
@@ -18,7 +19,7 @@ export default function FullScreenModal({
className,
wrapperClassName,
open,
- onClose = () => { },
+ onClose = noop,
children,
closable = false,
overflowVisible = false,
diff --git a/web/app/components/base/image-uploader/image-preview.tsx b/web/app/components/base/image-uploader/image-preview.tsx
index 93c2ed5a5ab..e67edaa3ca7 100644
--- a/web/app/components/base/image-uploader/image-preview.tsx
+++ b/web/app/components/base/image-uploader/image-preview.tsx
@@ -6,6 +6,7 @@ import { RiAddBoxLine, RiCloseLine, RiDownloadCloud2Line, RiFileCopyLine, RiZoom
import { useHotkeys } from 'react-hotkeys-hook'
import Tooltip from '@/app/components/base/tooltip'
import Toast from '@/app/components/base/toast'
+import { noop } from 'lodash-es'
type ImagePreviewProps = {
url: string
@@ -198,8 +199,8 @@ const ImagePreview: FC<ImagePreviewProps> = ({
useHotkeys('esc', onCancel)
useHotkeys('up', zoomIn)
useHotkeys('down', zoomOut)
- useHotkeys('left', onPrev || (() => { }))
- useHotkeys('right', onNext || (() => { }))
+ useHotkeys('left', onPrev || noop)
+ useHotkeys('right', onNext || noop)
return createPortal(
<div className='image-preview-container fixed inset-0 z-[1000] flex items-center justify-center bg-black/80 p-8'
diff --git a/web/app/components/base/input/index.tsx b/web/app/components/base/input/index.tsx
index 4d7ab4ed73f..5f059c3b7fe 100644
--- a/web/app/components/base/input/index.tsx
+++ b/web/app/components/base/input/index.tsx
@@ -4,6 +4,7 @@ import { useTranslation } from 'react-i18next'
import { RiCloseCircleFill, RiErrorWarningLine, RiSearchLine } from '@remixicon/react'
import { type VariantProps, cva } from 'class-variance-authority'
import cn from '@/utils/classnames'
+import { noop } from 'lodash-es'
export const inputVariants = cva(
'',
@@ -43,7 +44,7 @@ const Input = ({
styleCss,
value,
placeholder,
- onChange = () => { },
+ onChange = noop,
unit,
...props
}: InputProps) => {
diff --git a/web/app/components/base/modal/index.tsx b/web/app/components/base/modal/index.tsx
index a1313322ffa..dd60b00bb25 100644
--- a/web/app/components/base/modal/index.tsx
+++ b/web/app/components/base/modal/index.tsx
@@ -2,6 +2,7 @@ import { Dialog, DialogPanel, DialogTitle, Transition, TransitionChild } from '@
import { Fragment } from 'react'
import { RiCloseLine } from '@remixicon/react'
import classNames from '@/utils/classnames'
+import { noop } from 'lodash-es'
// https://headlessui.com/react/dialog
type IModal = {
@@ -20,7 +21,7 @@ export default function Modal({
className,
wrapperClassName,
isShow,
- onClose = () => { },
+ onClose = noop,
title,
description,
children,
diff --git a/web/app/components/base/notion-page-selector/notion-page-selector-modal/index.tsx b/web/app/components/base/notion-page-selector/notion-page-selector-modal/index.tsx
index 03ec81aa890..22d2a1634e2 100644
--- a/web/app/components/base/notion-page-selector/notion-page-selector-modal/index.tsx
+++ b/web/app/components/base/notion-page-selector/notion-page-selector-modal/index.tsx
@@ -6,6 +6,7 @@ import s from './index.module.css'
import type { NotionPage } from '@/models/common'
import cn from '@/utils/classnames'
import Modal from '@/app/components/base/modal'
+import { noop } from 'lodash-es'
type NotionPageSelectorModalProps = {
isShow: boolean
@@ -36,7 +37,7 @@ const NotionPageSelectorModal = ({
<Modal
className={s.modal}
isShow={isShow}
- onClose={() => { }}
+ onClose={noop}
>
<div className='mb-6 flex h-8 items-center justify-between'>
<div className='text-xl font-semibold text-gray-900'>{t('common.dataSource.notion.selector.addPages')}</div>
diff --git a/web/app/components/base/prompt-editor/plugins/context-block/context-block-replacement-block.tsx b/web/app/components/base/prompt-editor/plugins/context-block/context-block-replacement-block.tsx
index 9d44a4023f4..7d96827b56e 100644
--- a/web/app/components/base/prompt-editor/plugins/context-block/context-block-replacement-block.tsx
+++ b/web/app/components/base/prompt-editor/plugins/context-block/context-block-replacement-block.tsx
@@ -14,12 +14,13 @@ import {
ContextBlockNode,
} from '../context-block/node'
import { CustomTextNode } from '../custom-text/node'
+import { noop } from 'lodash-es'
const REGEX = new RegExp(CONTEXT_PLACEHOLDER_TEXT)
const ContextBlockReplacementBlock = ({
datasets = [],
- onAddContext = () => {},
+ onAddContext = noop,
onInsert,
canNotAddContext,
}: ContextBlockType) => {
diff --git a/web/app/components/base/prompt-editor/plugins/context-block/index.tsx b/web/app/components/base/prompt-editor/plugins/context-block/index.tsx
index 5be4f1fad6e..c115065f8e3 100644
--- a/web/app/components/base/prompt-editor/plugins/context-block/index.tsx
+++ b/web/app/components/base/prompt-editor/plugins/context-block/index.tsx
@@ -14,6 +14,7 @@ import {
$createContextBlockNode,
ContextBlockNode,
} from './node'
+import { noop } from 'lodash-es'
export const INSERT_CONTEXT_BLOCK_COMMAND = createCommand('INSERT_CONTEXT_BLOCK_COMMAND')
export const DELETE_CONTEXT_BLOCK_COMMAND = createCommand('DELETE_CONTEXT_BLOCK_COMMAND')
@@ -26,7 +27,7 @@ export type Dataset = {
const ContextBlock = memo(({
datasets = [],
- onAddContext = () => {},
+ onAddContext = noop,
onInsert,
onDelete,
canNotAddContext,
diff --git a/web/app/components/base/prompt-editor/plugins/history-block/history-block-replacement-block.tsx b/web/app/components/base/prompt-editor/plugins/history-block/history-block-replacement-block.tsx
index 04aa0cbc896..78459030e18 100644
--- a/web/app/components/base/prompt-editor/plugins/history-block/history-block-replacement-block.tsx
+++ b/web/app/components/base/prompt-editor/plugins/history-block/history-block-replacement-block.tsx
@@ -13,12 +13,13 @@ import {
HistoryBlockNode,
} from '../history-block/node'
import { CustomTextNode } from '../custom-text/node'
+import { noop } from 'lodash-es'
const REGEX = new RegExp(HISTORY_PLACEHOLDER_TEXT)
const HistoryBlockReplacementBlock = ({
history = { user: '', assistant: '' },
- onEditRole = () => {},
+ onEditRole = noop,
onInsert,
}: HistoryBlockType) => {
const [editor] = useLexicalComposerContext()
diff --git a/web/app/components/base/prompt-editor/plugins/history-block/index.tsx b/web/app/components/base/prompt-editor/plugins/history-block/index.tsx
index 78c7349519d..d51c9867195 100644
--- a/web/app/components/base/prompt-editor/plugins/history-block/index.tsx
+++ b/web/app/components/base/prompt-editor/plugins/history-block/index.tsx
@@ -14,6 +14,7 @@ import {
$createHistoryBlockNode,
HistoryBlockNode,
} from './node'
+import { noop } from 'lodash-es'
export const INSERT_HISTORY_BLOCK_COMMAND = createCommand('INSERT_HISTORY_BLOCK_COMMAND')
export const DELETE_HISTORY_BLOCK_COMMAND = createCommand('DELETE_HISTORY_BLOCK_COMMAND')
@@ -32,7 +33,7 @@ export type HistoryBlockProps = {
const HistoryBlock = memo(({
history = { user: '', assistant: '' },
- onEditRole = () => {},
+ onEditRole = noop,
onInsert,
onDelete,
}: HistoryBlockType) => {
diff --git a/web/app/components/base/radio-card/index.tsx b/web/app/components/base/radio-card/index.tsx
index c89d6816330..417897270bf 100644
--- a/web/app/components/base/radio-card/index.tsx
+++ b/web/app/components/base/radio-card/index.tsx
@@ -2,6 +2,7 @@
import type { FC } from 'react'
import React from 'react'
import cn from '@/utils/classnames'
+import { noop } from 'lodash-es'
type Props = {
className?: string
@@ -23,7 +24,7 @@ const RadioCard: FC<Props> = ({
description,
noRadio,
isChosen,
- onChosen = () => { },
+ onChosen = noop,
chosenConfig,
chosenConfigWrapClassName,
className,
diff --git a/web/app/components/base/tag-management/selector.tsx b/web/app/components/base/tag-management/selector.tsx
index 2c5c2686ba3..038f0daf54b 100644
--- a/web/app/components/base/tag-management/selector.tsx
+++ b/web/app/components/base/tag-management/selector.tsx
@@ -15,6 +15,7 @@ import type { Tag } from '@/app/components/base/tag-management/constant'
import Checkbox from '@/app/components/base/checkbox'
import { bindTag, createTag, fetchTagList, unBindTag } from '@/service/tag'
import { ToastContext } from '@/app/components/base/toast'
+import { noop } from 'lodash-es'
type TagSelectorProps = {
targetID: string
@@ -161,7 +162,7 @@ const Panel = (props: PanelProps) => {
<Checkbox
className='shrink-0'
checked={selectedTagIDs.includes(tag.id)}
- onCheck={() => { }}
+ onCheck={noop}
/>
<div title={tag.name} className='grow truncate text-sm leading-5 text-text-secondary'>{tag.name}</div>
</div>
@@ -175,7 +176,7 @@ const Panel = (props: PanelProps) => {
<Checkbox
className='shrink-0'
checked={selectedTagIDs.includes(tag.id)}
- onCheck={() => { }}
+ onCheck={noop}
/>
<div title={tag.name} className='grow truncate text-sm leading-5 text-text-secondary'>{tag.name}</div>
</div>
diff --git a/web/app/components/base/tag-management/tag-remove-modal.tsx b/web/app/components/base/tag-management/tag-remove-modal.tsx
index a8c0e79e1a0..85f1831ac19 100644
--- a/web/app/components/base/tag-management/tag-remove-modal.tsx
+++ b/web/app/components/base/tag-management/tag-remove-modal.tsx
@@ -7,6 +7,7 @@ import Button from '@/app/components/base/button'
import Modal from '@/app/components/base/modal'
import { AlertTriangle } from '@/app/components/base/icons/src/vender/solid/alertsAndFeedback'
import type { Tag } from '@/app/components/base/tag-management/constant'
+import { noop } from 'lodash-es'
type TagRemoveModalProps = {
show: boolean
@@ -22,7 +23,7 @@ const TagRemoveModal = ({ show, tag, onConfirm, onClose }: TagRemoveModalProps)
<Modal
className={cn('w-[480px] max-w-[480px] p-8')}
isShow={show}
- onClose={() => { }}
+ onClose={noop}
>
<div className='absolute right-4 top-4 cursor-pointer p-2' onClick={onClose}>
<RiCloseLine className='h-4 w-4 text-text-tertiary' />
diff --git a/web/app/components/base/toast/index.spec.tsx b/web/app/components/base/toast/index.spec.tsx
index 366fb4cb0e0..7cbacfeb596 100644
--- a/web/app/components/base/toast/index.spec.tsx
+++ b/web/app/components/base/toast/index.spec.tsx
@@ -2,6 +2,7 @@ import React from 'react'
import { act, render, screen, waitFor } from '@testing-library/react'
import Toast, { ToastProvider, useToastContext } from '.'
import '@testing-library/jest-dom'
+import { noop } from 'lodash-es'
// Mock timers for testing timeouts
jest.useFakeTimers()
@@ -76,11 +77,11 @@ describe('Toast', () => {
test('does not render close button when close is undefined', () => {
// Create a modified context where close is undefined
- const CustomToastContext = React.createContext({ notify: () => { }, close: undefined })
+ const CustomToastContext = React.createContext({ notify: noop, close: undefined })
// Create a wrapper component using the custom context
const Wrapper = ({ children }: any) => (
- <CustomToastContext.Provider value={{ notify: () => { }, close: undefined }}>
+ <CustomToastContext.Provider value={{ notify: noop, close: undefined }}>
{children}
</CustomToastContext.Provider>
)
diff --git a/web/app/components/base/toast/index.tsx b/web/app/components/base/toast/index.tsx
index fe870445198..b84a321dd49 100644
--- a/web/app/components/base/toast/index.tsx
+++ b/web/app/components/base/toast/index.tsx
@@ -12,6 +12,7 @@ import {
import { createContext, useContext } from 'use-context-selector'
import ActionButton from '@/app/components/base/action-button'
import classNames from '@/utils/classnames'
+import { noop } from 'lodash-es'
export type IToastProps = {
type?: 'success' | 'error' | 'warning' | 'info'
@@ -134,7 +135,7 @@ Toast.notify = ({
root.render(
<ToastContext.Provider value={{
- notify: () => { },
+ notify: noop,
close: () => {
if (holder) {
root.unmount()
diff --git a/web/app/components/base/with-input-validation/index.spec.tsx b/web/app/components/base/with-input-validation/index.spec.tsx
index 9f49c8d18f1..732a16d8f16 100644
--- a/web/app/components/base/with-input-validation/index.spec.tsx
+++ b/web/app/components/base/with-input-validation/index.spec.tsx
@@ -2,6 +2,7 @@ import { render, screen } from '@testing-library/react'
import '@testing-library/jest-dom'
import { z } from 'zod'
import withValidation from '.'
+import { noop } from 'lodash-es'
describe('withValidation HOC', () => {
// schema for validation
@@ -16,7 +17,7 @@ describe('withValidation HOC', () => {
const WrappedComponent = withValidation(TestComponent, schema)
beforeAll(() => {
- jest.spyOn(console, 'error').mockImplementation(() => { })
+ jest.spyOn(console, 'error').mockImplementation(noop)
})
afterAll(() => {
diff --git a/web/app/components/datasets/common/document-status-with-action/index-failed.tsx b/web/app/components/datasets/common/document-status-with-action/index-failed.tsx
index 37311768b95..802e3d872fa 100644
--- a/web/app/components/datasets/common/document-status-with-action/index-failed.tsx
+++ b/web/app/components/datasets/common/document-status-with-action/index-failed.tsx
@@ -6,6 +6,7 @@ import useSWR from 'swr'
import StatusWithAction from './status-with-action'
import { getErrorDocs, retryErrorDocs } from '@/service/datasets'
import type { IndexingStatusResponse } from '@/models/datasets'
+import { noop } from 'lodash-es'
type Props = {
datasetId: string
@@ -62,7 +63,7 @@ const RetryButton: FC<Props> = ({ datasetId }) => {
description={`${errorDocs?.total} ${t('dataset.docsFailedNotice')}`}
actionText={t('dataset.retry')}
disabled={indexState.value === 'retry'}
- onAction={indexState.value === 'error' ? onRetryErrorDocs : () => { }}
+ onAction={indexState.value === 'error' ? onRetryErrorDocs : noop}
/>
)
}
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 f7518844d55..775d755106d 100644
--- a/web/app/components/datasets/documents/detail/batch-modal/index.tsx
+++ b/web/app/components/datasets/documents/detail/batch-modal/index.tsx
@@ -8,6 +8,7 @@ import CSVDownloader from './csv-downloader'
import Button from '@/app/components/base/button'
import Modal from '@/app/components/base/modal'
import type { ChunkingMode } from '@/models/datasets'
+import { noop } from 'lodash-es'
export type IBatchModalProps = {
isShow: boolean
@@ -39,7 +40,7 @@ const BatchModal: FC<IBatchModalProps> = ({
}, [isShow])
return (
- <Modal isShow={isShow} onClose={() => { }} className='!max-w-[520px] !rounded-xl px-8 py-6'>
+ <Modal isShow={isShow} onClose={noop} className='!max-w-[520px] !rounded-xl px-8 py-6'>
<div className='relative pb-1 text-xl font-medium leading-[30px] text-gray-900'>{t('datasetDocuments.list.batchModal.title')}</div>
<div className='absolute right-4 top-4 cursor-pointer p-2' onClick={onCancel}>
<RiCloseLine className='h-4 w-4 text-gray-500' />
diff --git a/web/app/components/datasets/documents/detail/completed/common/full-screen-drawer.tsx b/web/app/components/datasets/documents/detail/completed/common/full-screen-drawer.tsx
index 0d86d2de61f..64f5bd70330 100644
--- a/web/app/components/datasets/documents/detail/completed/common/full-screen-drawer.tsx
+++ b/web/app/components/datasets/documents/detail/completed/common/full-screen-drawer.tsx
@@ -1,6 +1,7 @@
import React, { type FC } from 'react'
import Drawer from '@/app/components/base/drawer'
import classNames from '@/utils/classnames'
+import { noop } from 'lodash-es'
type IFullScreenDrawerProps = {
isOpen: boolean
@@ -11,7 +12,7 @@ type IFullScreenDrawerProps = {
const FullScreenDrawer: FC<IFullScreenDrawerProps> = ({
isOpen,
- onClose = () => {},
+ onClose = noop,
fullScreen,
children,
}) => {
diff --git a/web/app/components/datasets/documents/detail/completed/common/regeneration-modal.tsx b/web/app/components/datasets/documents/detail/completed/common/regeneration-modal.tsx
index c2dfe04e7bd..95bb339db91 100644
--- a/web/app/components/datasets/documents/detail/completed/common/regeneration-modal.tsx
+++ b/web/app/components/datasets/documents/detail/completed/common/regeneration-modal.tsx
@@ -5,6 +5,7 @@ import { useCountDown } from 'ahooks'
import Modal from '@/app/components/base/modal'
import Button from '@/app/components/base/button'
import { useEventEmitterContextContext } from '@/context/event-emitter'
+import { noop } from 'lodash-es'
type IDefaultContentProps = {
onCancel: () => void
@@ -120,7 +121,7 @@ const RegenerationModal: FC<IRegenerationModalProps> = ({
})
return (
- <Modal isShow={isShow} onClose={() => {}} className='!max-w-[480px] !rounded-2xl'>
+ <Modal isShow={isShow} onClose={noop} className='!max-w-[480px] !rounded-2xl'>
{!loading && !updateSucceeded && <DefaultContent onCancel={onCancel} onConfirm={onConfirm} />}
{loading && !updateSucceeded && <RegeneratingContent />}
{!loading && updateSucceeded && <RegenerationCompletedContent onClose={onClose} />}
diff --git a/web/app/components/datasets/documents/detail/completed/index.tsx b/web/app/components/datasets/documents/detail/completed/index.tsx
index 9095f8854ee..197a6514da3 100644
--- a/web/app/components/datasets/documents/detail/completed/index.tsx
+++ b/web/app/components/datasets/documents/detail/completed/index.tsx
@@ -46,6 +46,7 @@ import {
useUpdateSegment,
} from '@/service/knowledge/use-segment'
import { useInvalid } from '@/service/use-base'
+import { noop } from 'lodash-es'
const DEFAULT_LIMIT = 10
@@ -71,7 +72,7 @@ type SegmentListContextValue = {
const SegmentListContext = createContext<SegmentListContextValue>({
isCollapsed: true,
fullScreen: false,
- toggleFullScreen: () => {},
+ toggleFullScreen: noop,
currSegment: { showModal: false },
currChildChunk: { showModal: false },
})
diff --git a/web/app/components/datasets/metadata/metadata-dataset/create-content.tsx b/web/app/components/datasets/metadata/metadata-dataset/create-content.tsx
index 4f94cc55787..3ac1a046ff7 100644
--- a/web/app/components/datasets/metadata/metadata-dataset/create-content.tsx
+++ b/web/app/components/datasets/metadata/metadata-dataset/create-content.tsx
@@ -8,6 +8,7 @@ import OptionCard from '../../../workflow/nodes/_base/components/option-card'
import Input from '@/app/components/base/input'
import { RiArrowLeftLine } from '@remixicon/react'
import { useTranslation } from 'react-i18next'
+import { noop } from 'lodash-es'
const i18nPrefix = 'dataset.metadata.createMetadata'
@@ -19,7 +20,7 @@ export type Props = {
}
const CreateContent: FC<Props> = ({
- onClose = () => { },
+ onClose = noop,
hasBack,
onBack,
onSave,
diff --git a/web/app/components/datasets/rename-modal/index.tsx b/web/app/components/datasets/rename-modal/index.tsx
index 57c7d6fc9e2..6a64804702e 100644
--- a/web/app/components/datasets/rename-modal/index.tsx
+++ b/web/app/components/datasets/rename-modal/index.tsx
@@ -13,6 +13,7 @@ import Modal from '@/app/components/base/modal'
import { ToastContext } from '@/app/components/base/toast'
import type { DataSet } from '@/models/datasets'
import { updateDatasetSetting } from '@/service/datasets'
+import { noop } from 'lodash-es'
type RenameDatasetModalProps = {
show: boolean
@@ -66,7 +67,7 @@ const RenameDatasetModal = ({ show, dataset, onSuccess, onClose }: RenameDataset
<Modal
className='w-[520px] max-w-[520px] rounded-xl px-8 py-6'
isShow={show}
- onClose={() => { }}
+ onClose={noop}
>
<div className='relative pb-2 text-xl font-medium leading-[30px] text-text-primary'>{t('datasetSettings.title')}</div>
<div className='absolute right-4 top-4 cursor-pointer p-2' onClick={onClose}>
diff --git a/web/app/components/header/account-about/index.tsx b/web/app/components/header/account-about/index.tsx
index 87761b4dc7b..a9d08279b8f 100644
--- a/web/app/components/header/account-about/index.tsx
+++ b/web/app/components/header/account-about/index.tsx
@@ -8,6 +8,7 @@ import Button from '@/app/components/base/button'
import type { LangGeniusVersionResponse } from '@/models/common'
import { IS_CE_EDITION } from '@/config'
import LogoSite from '@/app/components/base/logo/logo-site'
+import { noop } from 'lodash-es'
type IAccountSettingProps = {
langeniusVersionInfo: LangGeniusVersionResponse
@@ -27,7 +28,7 @@ export default function AccountAbout({
return (
<Modal
isShow
- onClose={() => { }}
+ onClose={noop}
className='!w-[480px] !max-w-[480px] !px-6 !py-4'
>
<div className='relative pt-4'>
diff --git a/web/app/components/header/account-setting/api-based-extension-page/modal.tsx b/web/app/components/header/account-setting/api-based-extension-page/modal.tsx
index 81869b2b57c..53f7673b152 100644
--- a/web/app/components/header/account-setting/api-based-extension-page/modal.tsx
+++ b/web/app/components/header/account-setting/api-based-extension-page/modal.tsx
@@ -10,6 +10,7 @@ import {
updateApiBasedExtension,
} from '@/service/common'
import { useToastContext } from '@/app/components/base/toast'
+import { noop } from 'lodash-es'
export type ApiBasedExtensionData = {
name?: string
@@ -74,7 +75,7 @@ const ApiBasedExtensionModal: FC<ApiBasedExtensionModalProps> = ({
return (
<Modal
isShow
- onClose={() => { }}
+ onClose={noop}
className='!w-[640px] !max-w-none !p-8 !pb-6'
>
<div className='mb-2 text-xl font-semibold text-text-primary'>
diff --git a/web/app/components/header/account-setting/data-source-page/data-source-notion/index.tsx b/web/app/components/header/account-setting/data-source-page/data-source-notion/index.tsx
index b0db5115505..38efdcb1b7d 100644
--- a/web/app/components/header/account-setting/data-source-page/data-source-notion/index.tsx
+++ b/web/app/components/header/account-setting/data-source-page/data-source-notion/index.tsx
@@ -8,6 +8,7 @@ import type { DataSourceNotion as TDataSourceNotion } from '@/models/common'
import { useAppContext } from '@/context/app-context'
import { fetchNotionConnection } from '@/service/common'
import NotionIcon from '@/app/components/base/notion-icon'
+import { noop } from 'lodash-es'
const Icon: FC<{
src: string
@@ -74,7 +75,7 @@ const DataSourceNotion: FC<Props> = ({
total: workspace.source_info.total || 0,
},
}))}
- onRemove={() => { }} // handled in operation/index.tsx
+ onRemove={noop} // handled in operation/index.tsx
notionActions={{
onChangeAuthorizedPage: handleAuthAgain,
}}
diff --git a/web/app/components/header/account-setting/members-page/edit-workspace-modal/index.tsx b/web/app/components/header/account-setting/members-page/edit-workspace-modal/index.tsx
index b84fd20a823..22a427b63b9 100644
--- a/web/app/components/header/account-setting/members-page/edit-workspace-modal/index.tsx
+++ b/web/app/components/header/account-setting/members-page/edit-workspace-modal/index.tsx
@@ -11,6 +11,8 @@ import { RiCloseLine } from '@remixicon/react'
import { useAppContext } from '@/context/app-context'
import { updateWorkspaceInfo } from '@/service/common'
import { ToastContext } from '@/app/components/base/toast'
+import { noop } from 'lodash-es'
+
type IEditWorkspaceModalProps = {
onCancel: () => void
}
@@ -40,7 +42,7 @@ const EditWorkspaceModal = ({
return (
<div className={cn(s.wrap)}>
- <Modal overflowVisible isShow onClose={() => {}} className={cn(s.modal)}>
+ <Modal overflowVisible isShow onClose={noop} className={cn(s.modal)}>
<div className='mb-2 flex justify-between'>
<div className='text-xl font-semibold text-text-primary'>{t('common.account.editWorkspaceInfo')}</div>
<RiCloseLine className='h-4 w-4 cursor-pointer text-text-tertiary' onClick={onCancel} />
diff --git a/web/app/components/header/account-setting/members-page/invite-modal/index.tsx b/web/app/components/header/account-setting/members-page/invite-modal/index.tsx
index c663f054e69..55f19c4a205 100644
--- a/web/app/components/header/account-setting/members-page/invite-modal/index.tsx
+++ b/web/app/components/header/account-setting/members-page/invite-modal/index.tsx
@@ -15,8 +15,9 @@ import { emailRegex } from '@/config'
import { ToastContext } from '@/app/components/base/toast'
import type { InvitationResult } from '@/models/common'
import I18n from '@/context/i18n'
-
import 'react-multi-email/dist/style.css'
+import { noop } from 'lodash-es'
+
type IInviteModalProps = {
isEmailSetup: boolean
onCancel: () => void
@@ -57,7 +58,7 @@ const InviteModal = ({
return (
<div className={cn(s.wrap)}>
- <Modal overflowVisible isShow onClose={() => { }} className={cn(s.modal)}>
+ <Modal overflowVisible isShow onClose={noop} className={cn(s.modal)}>
<div className='mb-2 flex justify-between'>
<div className='text-xl font-semibold text-text-primary'>{t('common.members.inviteTeamMember')}</div>
<RiCloseLine className='h-4 w-4 cursor-pointer text-text-tertiary' onClick={onCancel} />
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 785d6c1ccfb..2719708672f 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
@@ -10,6 +10,7 @@ import Button from '@/app/components/base/button'
import { IS_CE_EDITION } from '@/config'
import type { InvitationResult } from '@/models/common'
import Tooltip from '@/app/components/base/tooltip'
+import { noop } from 'lodash-es'
export type SuccessInvitationResult = Extract<InvitationResult, { status: 'success' }>
export type FailedInvitationResult = Extract<InvitationResult, { status: 'failed' }>
@@ -29,7 +30,7 @@ const InvitedModal = ({
return (
<div className={s.wrap}>
- <Modal isShow onClose={() => {}} className={s.modal}>
+ <Modal isShow onClose={noop} className={s.modal}>
<div className='mb-3 flex justify-between'>
<div className='
flex h-12 w-12 items-center justify-center rounded-xl
diff --git a/web/app/components/header/account-setting/menu-dialog.tsx b/web/app/components/header/account-setting/menu-dialog.tsx
index 08177cabc23..ad3a1e71090 100644
--- a/web/app/components/header/account-setting/menu-dialog.tsx
+++ b/web/app/components/header/account-setting/menu-dialog.tsx
@@ -2,6 +2,7 @@ import { Fragment, useCallback, useEffect } from 'react'
import type { ReactNode } from 'react'
import { Dialog, DialogPanel, Transition, TransitionChild } from '@headlessui/react'
import cn from '@/utils/classnames'
+import { noop } from 'lodash-es'
type DialogProps = {
className?: string
@@ -34,7 +35,7 @@ const MenuDialog = ({
return (
<Transition appear show={show} as={Fragment}>
- <Dialog as="div" className="relative z-[60]" onClose={() => { }}>
+ <Dialog as="div" className="relative z-[60]" onClose={noop}>
<div className="fixed inset-0">
<div className="flex min-h-full flex-col items-center justify-center">
<TransitionChild>
diff --git a/web/app/components/header/app-selector/index.tsx b/web/app/components/header/app-selector/index.tsx
index 2c88668d5db..1c0dbc55d6a 100644
--- a/web/app/components/header/app-selector/index.tsx
+++ b/web/app/components/header/app-selector/index.tsx
@@ -9,6 +9,7 @@ import type { AppDetailResponse } from '@/models/app'
import CreateAppDialog from '@/app/components/app/create-app-dialog'
import AppIcon from '@/app/components/base/app-icon'
import { useAppContext } from '@/context/app-context'
+import { noop } from 'lodash-es'
type IAppSelectorProps = {
appItems: AppDetailResponse[]
@@ -104,7 +105,7 @@ export default function AppSelector({ appItems, curApp }: IAppSelectorProps) {
<CreateAppDialog
show={showNewAppDialog}
onClose={() => setShowNewAppDialog(false)}
- onSuccess={() => { }}
+ onSuccess={noop}
/>
</div>
)
diff --git a/web/app/components/plugins/marketplace/context.tsx b/web/app/components/plugins/marketplace/context.tsx
index 47da7ee1607..53f57c02525 100644
--- a/web/app/components/plugins/marketplace/context.tsx
+++ b/web/app/components/plugins/marketplace/context.tsx
@@ -37,6 +37,7 @@ import {
getMarketplaceListFilterType,
} from './utils'
import { useInstalledPluginList } from '@/service/use-plugins'
+import { noop } from 'lodash-es'
export type MarketplaceContextValue = {
intersected: boolean
@@ -66,26 +67,26 @@ export type MarketplaceContextValue = {
export const MarketplaceContext = createContext<MarketplaceContextValue>({
intersected: true,
- setIntersected: () => {},
+ setIntersected: noop,
searchPluginText: '',
- handleSearchPluginTextChange: () => {},
+ handleSearchPluginTextChange: noop,
filterPluginTags: [],
- handleFilterPluginTagsChange: () => {},
+ handleFilterPluginTagsChange: noop,
activePluginType: 'all',
- handleActivePluginTypeChange: () => {},
+ handleActivePluginTypeChange: noop,
page: 1,
- handlePageChange: () => {},
+ handlePageChange: noop,
plugins: undefined,
pluginsTotal: 0,
- resetPlugins: () => {},
+ resetPlugins: noop,
sort: DEFAULT_SORT,
- handleSortChange: () => {},
- handleQueryPlugins: () => {},
- handleMoreClick: () => {},
+ handleSortChange: noop,
+ handleQueryPlugins: noop,
+ handleMoreClick: noop,
marketplaceCollectionsFromClient: [],
- setMarketplaceCollectionsFromClient: () => {},
+ setMarketplaceCollectionsFromClient: noop,
marketplaceCollectionPluginsMapFromClient: {},
- setMarketplaceCollectionPluginsMapFromClient: () => {},
+ setMarketplaceCollectionPluginsMapFromClient: noop,
isLoading: false,
isSuccessCollections: false,
})
diff --git a/web/app/components/plugins/plugin-page/context.tsx b/web/app/components/plugins/plugin-page/context.tsx
index 6363bcae696..cf26cd4e080 100644
--- a/web/app/components/plugins/plugin-page/context.tsx
+++ b/web/app/components/plugins/plugin-page/context.tsx
@@ -14,6 +14,7 @@ import { useSelector as useAppContextSelector } from '@/context/app-context'
import type { FilterState } from './filter-management'
import { useTranslation } from 'react-i18next'
import { useTabSearchParams } from '@/hooks/use-tab-searchparams'
+import { noop } from 'lodash-es'
export type PluginPageContextValue = {
containerRef: React.RefObject<HTMLDivElement>
@@ -29,15 +30,15 @@ export type PluginPageContextValue = {
export const PluginPageContext = createContext<PluginPageContextValue>({
containerRef: { current: null },
currentPluginID: undefined,
- setCurrentPluginID: () => { },
+ setCurrentPluginID: noop,
filters: {
categories: [],
tags: [],
searchQuery: '',
},
- setFilters: () => { },
+ setFilters: noop,
activeTab: '',
- setActiveTab: () => { },
+ setActiveTab: noop,
options: [],
})
diff --git a/web/app/components/plugins/plugin-page/empty/index.tsx b/web/app/components/plugins/plugin-page/empty/index.tsx
index 8654fc8e8e4..372adac29c1 100644
--- a/web/app/components/plugins/plugin-page/empty/index.tsx
+++ b/web/app/components/plugins/plugin-page/empty/index.tsx
@@ -11,6 +11,7 @@ import Line from '../../marketplace/empty/line'
import { useInstalledPluginList } from '@/service/use-plugins'
import { useTranslation } from 'react-i18next'
import { SUPPORT_INSTALL_LOCAL_FILE_EXTENSIONS } from '@/config'
+import { noop } from 'lodash-es'
const Empty = () => {
const { t } = useTranslation()
@@ -99,14 +100,14 @@ const Empty = () => {
</div>
</div>
{selectedAction === 'github' && <InstallFromGitHub
- onSuccess={() => { }}
+ onSuccess={noop}
onClose={() => setSelectedAction(null)}
/>}
{selectedAction === 'local' && selectedFile
&& (<InstallFromLocalPackage
file={selectedFile}
onClose={() => setSelectedAction(null)}
- onSuccess={() => { }}
+ onSuccess={noop}
/>
)
}
diff --git a/web/app/components/plugins/plugin-page/index.tsx b/web/app/components/plugins/plugin-page/index.tsx
index eb28e176550..801eaf66074 100644
--- a/web/app/components/plugins/plugin-page/index.tsx
+++ b/web/app/components/plugins/plugin-page/index.tsx
@@ -39,6 +39,7 @@ import { marketplaceApiPrefix } from '@/config'
import { SUPPORT_INSTALL_LOCAL_FILE_EXTENSIONS } from '@/config'
import { LanguagesSupported } from '@/i18n/language'
import I18n from '@/context/i18n'
+import { noop } from 'lodash-es'
const PACKAGE_IDS_KEY = 'package-ids'
const BUNDLE_INFO_KEY = 'bundle-info'
@@ -230,8 +231,8 @@ const PluginPage = ({
{currentFile && (
<InstallFromLocalPackage
file={currentFile}
- onClose={removeFile ?? (() => { })}
- onSuccess={() => { }}
+ onClose={removeFile ?? noop}
+ onSuccess={noop}
/>
)}
<input
@@ -240,7 +241,7 @@ const PluginPage = ({
type="file"
id="fileUploader"
accept={SUPPORT_INSTALL_LOCAL_FILE_EXTENSIONS}
- onChange={fileChangeHandle ?? (() => { })}
+ onChange={fileChangeHandle ?? noop}
/>
</>
)}
diff --git a/web/app/components/plugins/plugin-page/install-plugin-dropdown.tsx b/web/app/components/plugins/plugin-page/install-plugin-dropdown.tsx
index 33ef06df055..5a61adf8ac2 100644
--- a/web/app/components/plugins/plugin-page/install-plugin-dropdown.tsx
+++ b/web/app/components/plugins/plugin-page/install-plugin-dropdown.tsx
@@ -17,6 +17,7 @@ import {
import { useSelector as useAppContextSelector } from '@/context/app-context'
import { useTranslation } from 'react-i18next'
import { SUPPORT_INSTALL_LOCAL_FILE_EXTENSIONS } from '@/config'
+import { noop } from 'lodash-es'
type Props = {
onSwitchToMarketplaceTab: () => void
@@ -118,14 +119,14 @@ const InstallPluginDropdown = ({
</PortalToFollowElemContent>
</div>
{selectedAction === 'github' && <InstallFromGitHub
- onSuccess={() => { }}
+ onSuccess={noop}
onClose={() => setSelectedAction(null)}
/>}
{selectedAction === 'local' && selectedFile
&& (<InstallFromLocalPackage
file={selectedFile}
onClose={() => setSelectedAction(null)}
- onSuccess={() => { }}
+ onSuccess={noop}
/>
)
}
diff --git a/web/app/components/tools/labels/selector.tsx b/web/app/components/tools/labels/selector.tsx
index 339b3141313..587c2044568 100644
--- a/web/app/components/tools/labels/selector.tsx
+++ b/web/app/components/tools/labels/selector.tsx
@@ -14,6 +14,7 @@ import { Tag03 } from '@/app/components/base/icons/src/vender/line/financeAndECo
import Checkbox from '@/app/components/base/checkbox'
import type { Label } from '@/app/components/tools/labels/constant'
import { useTags } from '@/app/components/plugins/hooks'
+import { noop } from 'lodash-es'
type LabelSelectorProps = {
value: string[]
@@ -99,7 +100,7 @@ const LabelSelector: FC<LabelSelectorProps> = ({
<Checkbox
className='shrink-0'
checked={value.includes(label.name)}
- onCheck={() => { }}
+ onCheck={noop}
/>
<div title={label.label} className='grow truncate text-sm leading-5 text-text-secondary'>{label.label}</div>
</div>
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 276f3c10f5a..3ce3f62639c 100644
--- a/web/app/components/tools/setting/build-in/config-credentials.tsx
+++ b/web/app/components/tools/setting/build-in/config-credentials.tsx
@@ -13,6 +13,7 @@ import Loading from '@/app/components/base/loading'
import Form from '@/app/components/header/account-setting/model-provider-page/model-modal/Form'
import { LinkExternal02 } from '@/app/components/base/icons/src/vender/line/general'
import { useLanguage } from '@/app/components/header/account-setting/model-provider-page/hooks'
+import { noop } from 'lodash-es'
type Props = {
collection: Collection
@@ -28,7 +29,7 @@ const ConfigCredential: FC<Props> = ({
onCancel,
onSaved,
isHideRemoveBtn,
- onRemove = () => { },
+ onRemove = noop,
isSaving,
}) => {
const { t } = useTranslation()
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 1f8515bfae8..1327adc7e56 100644
--- a/web/app/components/tools/workflow-tool/confirm-modal/index.tsx
+++ b/web/app/components/tools/workflow-tool/confirm-modal/index.tsx
@@ -6,6 +6,7 @@ import cn from '@/utils/classnames'
import Button from '@/app/components/base/button'
import Modal from '@/app/components/base/modal'
import { AlertTriangle } from '@/app/components/base/icons/src/vender/solid/alertsAndFeedback'
+import { noop } from 'lodash-es'
type ConfirmModalProps = {
show: boolean
@@ -20,7 +21,7 @@ const ConfirmModal = ({ show, onConfirm, onClose }: ConfirmModalProps) => {
<Modal
className={cn('w-[600px] max-w-[600px] p-8')}
isShow={show}
- onClose={() => { }}
+ onClose={noop}
>
<div className='absolute right-4 top-4 cursor-pointer p-2' onClick={onClose}>
<RiCloseLine className='h-4 w-4 text-text-tertiary' />
diff --git a/web/app/components/workflow/dsl-export-confirm-modal.tsx b/web/app/components/workflow/dsl-export-confirm-modal.tsx
index c504b5ec169..e9c51de9369 100644
--- a/web/app/components/workflow/dsl-export-confirm-modal.tsx
+++ b/web/app/components/workflow/dsl-export-confirm-modal.tsx
@@ -8,6 +8,7 @@ import Modal from '@/app/components/base/modal'
import Checkbox from '@/app/components/base/checkbox'
import Button from '@/app/components/base/button'
import type { EnvironmentVariable } from '@/app/components/workflow/types'
+import { noop } from 'lodash-es'
export type DSLExportConfirmModalProps = {
envList: EnvironmentVariable[]
@@ -32,7 +33,7 @@ const DSLExportConfirmModal = ({
return (
<Modal
isShow={true}
- onClose={() => { }}
+ onClose={noop}
className={cn('w-[480px] max-w-[480px]')}
>
<div className='title-2xl-semi-bold relative pb-6 text-text-primary'>{t('workflow.env.export.title')}</div>
diff --git a/web/app/components/workflow/nodes/_base/components/editor/code-editor/index.tsx b/web/app/components/workflow/nodes/_base/components/editor/code-editor/index.tsx
index 1e6ef906dd3..8aacfba64b8 100644
--- a/web/app/components/workflow/nodes/_base/components/editor/code-editor/index.tsx
+++ b/web/app/components/workflow/nodes/_base/components/editor/code-editor/index.tsx
@@ -8,8 +8,8 @@ import { CodeLanguage } from '@/app/components/workflow/nodes/code/types'
import {
getFilesInLogs,
} from '@/app/components/base/file-uploader/utils'
-
import './style.css'
+import { noop } from 'lodash-es'
// load file from local instead of cdn https://github.com/suren-atoyan/monaco-react/issues/482
loader.config({ paths: { vs: '/vs' } })
@@ -55,7 +55,7 @@ const DEFAULT_THEME = {
const CodeEditor: FC<Props> = ({
value = '',
placeholder = '',
- onChange = () => { },
+ onChange = noop,
title = '',
headerRight,
language,
diff --git a/web/app/components/workflow/nodes/_base/components/file-type-item.tsx b/web/app/components/workflow/nodes/_base/components/file-type-item.tsx
index 17cf28d6e29..6791dbbec54 100644
--- a/web/app/components/workflow/nodes/_base/components/file-type-item.tsx
+++ b/web/app/components/workflow/nodes/_base/components/file-type-item.tsx
@@ -8,6 +8,7 @@ import { FILE_EXTS } from '@/app/components/base/prompt-editor/constants'
import TagInput from '@/app/components/base/tag-input'
import Checkbox from '@/app/components/base/checkbox'
import { FileTypeIcon } from '@/app/components/base/file-uploader'
+import { noop } from 'lodash-es'
type Props = {
type: SupportUploadFileTypes.image | SupportUploadFileTypes.document | SupportUploadFileTypes.audio | SupportUploadFileTypes.video | SupportUploadFileTypes.custom
@@ -22,7 +23,7 @@ const FileTypeItem: FC<Props> = ({
selected,
onToggle,
customFileTypes = [],
- onCustomFileTypesChange = () => { },
+ onCustomFileTypesChange = noop,
}) => {
const { t } = useTranslation()
diff --git a/web/app/components/workflow/nodes/_base/components/input-support-select-var.tsx b/web/app/components/workflow/nodes/_base/components/input-support-select-var.tsx
index 8ba2a2cf2d9..33e13637d4c 100644
--- a/web/app/components/workflow/nodes/_base/components/input-support-select-var.tsx
+++ b/web/app/components/workflow/nodes/_base/components/input-support-select-var.tsx
@@ -12,6 +12,7 @@ import { BlockEnum } from '@/app/components/workflow/types'
import PromptEditor from '@/app/components/base/prompt-editor'
import { Variable02 } from '@/app/components/base/icons/src/vender/solid/development'
import Tooltip from '@/app/components/base/tooltip'
+import { noop } from 'lodash-es'
type Props = {
instanceId?: string
@@ -68,7 +69,7 @@ const Editor: FC<Props> = ({
show: false,
selectable: false,
datasets: [],
- onAddContext: () => { },
+ onAddContext: noop,
}}
historyBlock={{
show: false,
@@ -77,7 +78,7 @@ const Editor: FC<Props> = ({
user: 'Human',
assistant: 'Assistant',
},
- onEditRole: () => { },
+ onEditRole: noop,
}}
queryBlock={{
show: false,
diff --git a/web/app/components/workflow/nodes/_base/components/variable/var-reference-picker.tsx b/web/app/components/workflow/nodes/_base/components/variable/var-reference-picker.tsx
index 16476429503..3597c6493cc 100644
--- a/web/app/components/workflow/nodes/_base/components/variable/var-reference-picker.tsx
+++ b/web/app/components/workflow/nodes/_base/components/variable/var-reference-picker.tsx
@@ -37,6 +37,7 @@ import AddButton from '@/app/components/base/button/add-button'
import Badge from '@/app/components/base/badge'
import Tooltip from '@/app/components/base/tooltip'
import { isExceptionVariable } from '@/app/components/workflow/utils'
+import { noop } from 'lodash-es'
const TRIGGER_DEFAULT_WIDTH = 227
@@ -73,7 +74,7 @@ const VarReferencePicker: FC<Props> = ({
className,
isShowNodeName = true,
value = [],
- onOpen = () => { },
+ onOpen = noop,
onChange,
isSupportConstantValue,
defaultVarKindType = VarKindType.constant,
@@ -283,7 +284,7 @@ const VarReferencePicker: FC<Props> = ({
{isAddBtnTrigger
? (
<div>
- <AddButton onClick={() => { }}></AddButton>
+ <AddButton onClick={noop}></AddButton>
</div>
)
: (<div ref={!isSupportConstantValue ? triggerRef : null} className={cn((open || isFocus) ? 'border-gray-300' : 'border-gray-100', 'group/wrap relative flex h-8 w-full items-center', !isSupportConstantValue && 'rounded-lg bg-components-input-bg-normal p-1', isInTable && 'border-none bg-transparent', readonly && 'bg-components-input-bg-disabled')}>
diff --git a/web/app/components/workflow/nodes/assigner/components/var-list/index.tsx b/web/app/components/workflow/nodes/assigner/components/var-list/index.tsx
index e334c0b2815..e7392eece61 100644
--- a/web/app/components/workflow/nodes/assigner/components/var-list/index.tsx
+++ b/web/app/components/workflow/nodes/assigner/components/var-list/index.tsx
@@ -15,6 +15,7 @@ import ActionButton from '@/app/components/base/action-button'
import Input from '@/app/components/base/input'
import Textarea from '@/app/components/base/textarea'
import CodeEditor from '@/app/components/workflow/nodes/_base/components/editor/code-editor'
+import { noop } from 'lodash-es'
type Props = {
readonly: boolean
@@ -36,7 +37,7 @@ const VarList: FC<Props> = ({
nodeId,
list,
onChange,
- onOpen = () => { },
+ onOpen = noop,
filterVar,
filterToAssignedVar,
getAssignedVarType,
diff --git a/web/app/components/workflow/nodes/if-else/components/condition-wrap.tsx b/web/app/components/workflow/nodes/if-else/components/condition-wrap.tsx
index d13cb04c3e1..ec6f474f35e 100644
--- a/web/app/components/workflow/nodes/if-else/components/condition-wrap.tsx
+++ b/web/app/components/workflow/nodes/if-else/components/condition-wrap.tsx
@@ -18,6 +18,7 @@ import ConditionAdd from './condition-add'
import cn from '@/utils/classnames'
import Button from '@/app/components/base/button'
import { PortalSelect as Select } from '@/app/components/base/select'
+import { noop } from 'lodash-es'
type Props = {
isSubVariable?: boolean
@@ -49,7 +50,7 @@ const ConditionWrap: FC<Props> = ({
nodeId: id = '',
cases = [],
readOnly,
- handleSortCase = () => { },
+ handleSortCase = noop,
handleRemoveCase,
handleUpdateCondition,
handleAddCondition,
diff --git a/web/app/components/workflow/nodes/knowledge-retrieval/components/metadata/metadata-filter/index.tsx b/web/app/components/workflow/nodes/knowledge-retrieval/components/metadata/metadata-filter/index.tsx
index fd67ae4c289..925970e3114 100644
--- a/web/app/components/workflow/nodes/knowledge-retrieval/components/metadata/metadata-filter/index.tsx
+++ b/web/app/components/workflow/nodes/knowledge-retrieval/components/metadata/metadata-filter/index.tsx
@@ -10,6 +10,7 @@ import Tooltip from '@/app/components/base/tooltip'
import type { MetadataShape } from '@/app/components/workflow/nodes/knowledge-retrieval/types'
import { MetadataFilteringModeEnum } from '@/app/components/workflow/nodes/knowledge-retrieval/types'
import ModelParameterModal from '@/app/components/header/account-setting/model-provider-page/model-parameter-modal'
+import { noop } from 'lodash-es'
type MetadataFilterProps = {
metadataFilterMode?: MetadataFilteringModeEnum
@@ -85,8 +86,8 @@ const MetadataFilter = ({
provider={metadataModelConfig?.provider || ''}
completionParams={metadataModelConfig?.completion_params || { temperature: 0.7 }}
modelId={metadataModelConfig?.name || ''}
- setModel={handleMetadataModelChange || (() => {})}
- onCompletionParamsChange={handleMetadataCompletionParamsChange || (() => {})}
+ setModel={handleMetadataModelChange || noop}
+ onCompletionParamsChange={handleMetadataCompletionParamsChange || noop}
hideDebugWithMultipleModel
debugWithMultipleModel={false}
/>
diff --git a/web/app/components/workflow/nodes/start/components/var-item.tsx b/web/app/components/workflow/nodes/start/components/var-item.tsx
index e19a669e86c..9d94ebe14a8 100644
--- a/web/app/components/workflow/nodes/start/components/var-item.tsx
+++ b/web/app/components/workflow/nodes/start/components/var-item.tsx
@@ -12,6 +12,7 @@ import { Variable02 } from '@/app/components/base/icons/src/vender/solid/develop
import { Edit03 } from '@/app/components/base/icons/src/vender/solid/general'
import Badge from '@/app/components/base/badge'
import ConfigVarModal from '@/app/components/app/configuration/config-var/config-modal'
+import { noop } from 'lodash-es'
type Props = {
readonly: boolean
@@ -26,8 +27,8 @@ type Props = {
const VarItem: FC<Props> = ({
readonly,
payload,
- onChange = () => { },
- onRemove = () => { },
+ onChange = noop,
+ onRemove = noop,
rightContent,
varKeys = [],
showLegacyBadge = false,
diff --git a/web/app/components/workflow/nodes/tool/components/input-var-list.tsx b/web/app/components/workflow/nodes/tool/components/input-var-list.tsx
index 8ed1032d8a0..dc25184f5a8 100644
--- a/web/app/components/workflow/nodes/tool/components/input-var-list.tsx
+++ b/web/app/components/workflow/nodes/tool/components/input-var-list.tsx
@@ -16,6 +16,7 @@ import useAvailableVarList from '@/app/components/workflow/nodes/_base/hooks/use
import { VarType } from '@/app/components/workflow/types'
import AppSelector from '@/app/components/plugins/plugin-detail-panel/app-selector'
import ModelParameterModal from '@/app/components/plugins/plugin-detail-panel/model-selector'
+import { noop } from 'lodash-es'
type Props = {
readOnly: boolean
@@ -34,7 +35,7 @@ const InputVarList: FC<Props> = ({
schema,
value,
onChange,
- onOpen = () => { },
+ onOpen = noop,
isSupportConstantValue,
filterVar,
}) => {
diff --git a/web/app/components/workflow/nodes/variable-assigner/components/var-list/index.tsx b/web/app/components/workflow/nodes/variable-assigner/components/var-list/index.tsx
index a89215b7cc1..2b3a06f39bf 100644
--- a/web/app/components/workflow/nodes/variable-assigner/components/var-list/index.tsx
+++ b/web/app/components/workflow/nodes/variable-assigner/components/var-list/index.tsx
@@ -8,6 +8,7 @@ import ListNoDataPlaceholder from '../../../_base/components/list-no-data-placeh
import VarReferencePicker from '@/app/components/workflow/nodes/_base/components/variable/var-reference-picker'
import type { ValueSelector, Var } from '@/app/components/workflow/types'
import { VarType as VarKindType } from '@/app/components/workflow/nodes/tool/types'
+import { noop } from 'lodash-es'
type Props = {
readonly: boolean
@@ -23,7 +24,7 @@ const VarList: FC<Props> = ({
nodeId,
list,
onChange,
- onOpen = () => { },
+ onOpen = noop,
filterVar,
}) => {
const { t } = useTranslation()
diff --git a/web/app/components/workflow/panel/debug-and-preview/conversation-variable-modal.tsx b/web/app/components/workflow/panel/debug-and-preview/conversation-variable-modal.tsx
index 6c1e4583bbb..57fe461e038 100644
--- a/web/app/components/workflow/panel/debug-and-preview/conversation-variable-modal.tsx
+++ b/web/app/components/workflow/panel/debug-and-preview/conversation-variable-modal.tsx
@@ -21,6 +21,7 @@ import { CodeLanguage } from '@/app/components/workflow/nodes/code/types'
import useTimestamp from '@/hooks/use-timestamp'
import { fetchCurrentValueOfConversationVariable } from '@/service/workflow'
import cn from '@/utils/classnames'
+import { noop } from 'lodash-es'
export type Props = {
conversationID: string
@@ -76,7 +77,7 @@ const ConversationVariableModal = ({
return (
<Modal
isShow
- onClose={() => { }}
+ onClose={noop}
className={cn('h-[640px] w-[920px] max-w-[920px] p-0')}
>
<div className='absolute right-4 top-4 cursor-pointer p-2' onClick={onHide}>
diff --git a/web/app/components/workflow/panel/debug-and-preview/index.tsx b/web/app/components/workflow/panel/debug-and-preview/index.tsx
index b691b866984..e94032f805c 100644
--- a/web/app/components/workflow/panel/debug-and-preview/index.tsx
+++ b/web/app/components/workflow/panel/debug-and-preview/index.tsx
@@ -23,13 +23,14 @@ import { BubbleX } from '@/app/components/base/icons/src/vender/line/others'
import Tooltip from '@/app/components/base/tooltip'
import ActionButton, { ActionButtonState } from '@/app/components/base/action-button'
import { useStore } from '@/app/components/workflow/store'
+import { noop } from 'lodash-es'
export type ChatWrapperRefType = {
handleRestart: () => void
}
const DebugAndPreview = () => {
const { t } = useTranslation()
- const chatRef = useRef({ handleRestart: () => { } })
+ const chatRef = useRef({ handleRestart: noop })
const { handleCancelDebugAndPreviewPanel } = useWorkflowInteractions()
const { handleNodeCancelRunningStatus } = useNodesInteractions()
const { handleEdgeCancelRunningStatus } = useEdgesInteractions()
diff --git a/web/app/components/workflow/run/utils/format-log/iteration/index.spec.ts b/web/app/components/workflow/run/utils/format-log/iteration/index.spec.ts
index 478df67f79e..f5feb5c367f 100644
--- a/web/app/components/workflow/run/utils/format-log/iteration/index.spec.ts
+++ b/web/app/components/workflow/run/utils/format-log/iteration/index.spec.ts
@@ -1,10 +1,11 @@
import format from '.'
import graphToLogStruct from '../graph-to-log-struct'
+import { noop } from 'lodash-es'
describe('iteration', () => {
const list = graphToLogStruct('start -> (iteration, iterationNode, plainNode1 -> plainNode2)')
// const [startNode, iterationNode, ...iterations] = list
- const result = format(list as any, () => { })
+ const result = format(list as any, noop)
test('result should have no nodes in iteration node', () => {
expect((result as any).find((item: any) => !!item.execution_metadata?.iteration_id)).toBeUndefined()
})
diff --git a/web/app/components/workflow/run/utils/format-log/loop/index.spec.ts b/web/app/components/workflow/run/utils/format-log/loop/index.spec.ts
index 3371328fcf1..73162cf6b45 100644
--- a/web/app/components/workflow/run/utils/format-log/loop/index.spec.ts
+++ b/web/app/components/workflow/run/utils/format-log/loop/index.spec.ts
@@ -1,10 +1,11 @@
import format from '.'
import graphToLogStruct from '../graph-to-log-struct'
+import { noop } from 'lodash-es'
describe('loop', () => {
const list = graphToLogStruct('start -> (loop, loopNode, plainNode1 -> plainNode2)')
const [startNode, loopNode, ...loops] = list
- const result = format(list as any, () => { })
+ const result = format(list as any, noop)
test('result should have no nodes in loop node', () => {
expect((result as any).find((item: any) => !!item.execution_metadata?.loop_id)).toBeUndefined()
})
diff --git a/web/app/components/workflow/workflow-history-store.tsx b/web/app/components/workflow/workflow-history-store.tsx
index a49e9b64e70..52132f3657d 100644
--- a/web/app/components/workflow/workflow-history-store.tsx
+++ b/web/app/components/workflow/workflow-history-store.tsx
@@ -4,8 +4,9 @@ import { type TemporalState, temporal } from 'zundo'
import isDeepEqual from 'fast-deep-equal'
import type { Edge, Node } from './types'
import type { WorkflowHistoryEvent } from './hooks'
+import { noop } from 'lodash-es'
-export const WorkflowHistoryStoreContext = createContext<WorkflowHistoryStoreContextType>({ store: null, shortcutsEnabled: true, setShortcutsEnabled: () => {} })
+export const WorkflowHistoryStoreContext = createContext<WorkflowHistoryStoreContextType>({ store: null, shortcutsEnabled: true, setShortcutsEnabled: noop })
export const Provider = WorkflowHistoryStoreContext.Provider
export function WorkflowHistoryProvider({
diff --git a/web/app/education-apply/education-apply-page.tsx b/web/app/education-apply/education-apply-page.tsx
index 8d822f2ab08..f99cca26704 100644
--- a/web/app/education-apply/education-apply-page.tsx
+++ b/web/app/education-apply/education-apply-page.tsx
@@ -24,6 +24,7 @@ import { useProviderContext } from '@/context/provider-context'
import { useToastContext } from '@/app/components/base/toast'
import { EDUCATION_VERIFYING_LOCALSTORAGE_ITEM } from '@/app/education-apply/constants'
import { getLocaleOnClient } from '@/i18n'
+import { noop } from 'lodash-es'
const EducationApplyAge = () => {
const { t } = useTranslation()
@@ -35,7 +36,7 @@ const EducationApplyAge = () => {
const {
isPending,
mutateAsync: educationAdd,
- } = useEducationAdd({ onSuccess: () => {} })
+ } = useEducationAdd({ onSuccess: noop })
const [modalShow, setShowModal] = useState<undefined | { title: string; desc: string; onConfirm?: () => void }>(undefined)
const { onPlanInfoChanged } = useProviderContext()
const updateEducationStatus = useInvalidateEducationStatus()
@@ -181,8 +182,8 @@ const EducationApplyAge = () => {
isShow={!!modalShow}
title={modalShow?.title || ''}
content={modalShow?.desc}
- onConfirm={modalShow?.onConfirm || (() => {})}
- onCancel={modalShow?.onConfirm || (() => {})}
+ onConfirm={modalShow?.onConfirm || noop}
+ onCancel={modalShow?.onConfirm || noop}
/>
</div>
)
diff --git a/web/app/reset-password/page.tsx b/web/app/reset-password/page.tsx
index 3a138807fcd..dd8cdbc69eb 100644
--- a/web/app/reset-password/page.tsx
+++ b/web/app/reset-password/page.tsx
@@ -12,6 +12,7 @@ import Input from '@/app/components/base/input'
import Toast from '@/app/components/base/toast'
import { sendResetPasswordCode } from '@/service/common'
import I18NContext from '@/context/i18n'
+import { noop } from 'lodash-es'
export default function CheckCode() {
const { t } = useTranslation()
@@ -76,7 +77,7 @@ export default function CheckCode() {
</p>
</div>
- <form onSubmit={() => { }}>
+ <form onSubmit={noop}>
<input type='text' className='hidden' />
<div className='mb-2'>
<label htmlFor="email" className='system-md-semibold my-2 text-text-secondary'>{t('login.email')}</label>
diff --git a/web/app/signin/components/mail-and-code-auth.tsx b/web/app/signin/components/mail-and-code-auth.tsx
index ab9b02c65a4..3ad57de8551 100644
--- a/web/app/signin/components/mail-and-code-auth.tsx
+++ b/web/app/signin/components/mail-and-code-auth.tsx
@@ -9,6 +9,7 @@ import Toast from '@/app/components/base/toast'
import { sendEMailLoginCode } from '@/service/common'
import { COUNT_DOWN_KEY, COUNT_DOWN_TIME_MS } from '@/app/components/signin/countdown'
import I18NContext from '@/context/i18n'
+import { noop } from 'lodash-es'
type MailAndCodeAuthProps = {
isInvite: boolean
@@ -55,7 +56,7 @@ export default function MailAndCodeAuth({ isInvite }: MailAndCodeAuthProps) {
}
}
- return (<form onSubmit={() => { }}>
+ return (<form onSubmit={noop}>
<input type='text' className='hidden' />
<div className='mb-2'>
<label htmlFor="email" className='system-md-semibold my-2 text-text-secondary'>{t('login.email')}</label>
diff --git a/web/app/signin/components/mail-and-password-auth.tsx b/web/app/signin/components/mail-and-password-auth.tsx
index 27302d3a9a7..7360fdac448 100644
--- a/web/app/signin/components/mail-and-password-auth.tsx
+++ b/web/app/signin/components/mail-and-password-auth.tsx
@@ -9,6 +9,7 @@ import { emailRegex } from '@/config'
import { login } from '@/service/common'
import Input from '@/app/components/base/input'
import I18NContext from '@/context/i18n'
+import { noop } from 'lodash-es'
type MailAndPasswordAuthProps = {
isInvite: boolean
@@ -103,7 +104,7 @@ export default function MailAndPasswordAuth({ isInvite, isEmailSetup, allowRegis
}
}
- return <form onSubmit={() => { }}>
+ return <form onSubmit={noop}>
<div className='mb-3'>
<label htmlFor="email" className="system-md-semibold my-2 text-text-secondary">
{t('login.email')}
diff --git a/web/context/app-context.tsx b/web/context/app-context.tsx
index 096d388e1b9..79cc246a93b 100644
--- a/web/context/app-context.tsx
+++ b/web/context/app-context.tsx
@@ -12,6 +12,7 @@ import type { ICurrentWorkspace, LangGeniusVersionResponse, UserProfileResponse
import MaintenanceNotice from '@/app/components/header/maintenance-notice'
import type { SystemFeatures } from '@/types/feature'
import { defaultSystemFeatures } from '@/types/feature'
+import { noop } from 'lodash-es'
export type AppContextValue = {
apps: App[]
@@ -54,7 +55,7 @@ const initialWorkspaceInfo: ICurrentWorkspace = {
const AppContext = createContext<AppContextValue>({
systemFeatures: defaultSystemFeatures,
apps: [],
- mutateApps: () => { },
+ mutateApps: noop,
userProfile: {
id: '',
name: '',
@@ -68,8 +69,8 @@ const AppContext = createContext<AppContextValue>({
isCurrentWorkspaceOwner: false,
isCurrentWorkspaceEditor: false,
isCurrentWorkspaceDatasetOperator: false,
- mutateUserProfile: () => { },
- mutateCurrentWorkspace: () => { },
+ mutateUserProfile: noop,
+ mutateCurrentWorkspace: noop,
pageContainerRef: createRef(),
langeniusVersionInfo: initialLangeniusVersionInfo,
useSelector,
diff --git a/web/context/datasets-context.tsx b/web/context/datasets-context.tsx
index ba708233beb..e3dc38d78df 100644
--- a/web/context/datasets-context.tsx
+++ b/web/context/datasets-context.tsx
@@ -2,6 +2,7 @@
import { createContext, useContext } from 'use-context-selector'
import type { DataSet } from '@/models/datasets'
+import { noop } from 'lodash-es'
export type DatasetsContextValue = {
datasets: DataSet[]
@@ -11,7 +12,7 @@ export type DatasetsContextValue = {
const DatasetsContext = createContext<DatasetsContextValue>({
datasets: [],
- mutateDatasets: () => {},
+ mutateDatasets: noop,
currentDataset: undefined,
})
diff --git a/web/context/debug-configuration.ts b/web/context/debug-configuration.ts
index 3564a0f8220..47710c8fc1a 100644
--- a/web/context/debug-configuration.ts
+++ b/web/context/debug-configuration.ts
@@ -26,6 +26,7 @@ import { ModelModeType, RETRIEVE_TYPE, Resolution, TransferMethod } from '@/type
import { ANNOTATION_DEFAULT, DEFAULT_AGENT_SETTING, DEFAULT_CHAT_PROMPT_CONFIG, DEFAULT_COMPLETION_PROMPT_CONFIG } from '@/config'
import type { FormValue } from '@/app/components/header/account-setting/model-provider-page/declarations'
import type { Collection } from '@/app/components/tools/types'
+import { noop } from 'lodash-es'
type IDebugConfiguration = {
appId: string
@@ -112,64 +113,64 @@ const DebugConfigurationContext = createContext<IDebugConfiguration>({
mode: '',
modelModeType: ModelModeType.chat,
promptMode: PromptMode.simple,
- setPromptMode: () => { },
+ setPromptMode: noop,
isAdvancedMode: false,
isAgent: false,
isFunctionCall: false,
isOpenAI: false,
collectionList: [],
canReturnToSimpleMode: false,
- setCanReturnToSimpleMode: () => { },
+ setCanReturnToSimpleMode: noop,
chatPromptConfig: DEFAULT_CHAT_PROMPT_CONFIG,
completionPromptConfig: DEFAULT_COMPLETION_PROMPT_CONFIG,
currentAdvancedPrompt: [],
- showHistoryModal: () => { },
+ showHistoryModal: noop,
conversationHistoriesRole: {
user_prefix: 'user',
assistant_prefix: 'assistant',
},
- setConversationHistoriesRole: () => { },
- setCurrentAdvancedPrompt: () => { },
+ setConversationHistoriesRole: noop,
+ setCurrentAdvancedPrompt: noop,
hasSetBlockStatus: {
context: false,
history: false,
query: false,
},
conversationId: '',
- setConversationId: () => { },
+ setConversationId: noop,
introduction: '',
- setIntroduction: () => { },
+ setIntroduction: noop,
suggestedQuestions: [],
- setSuggestedQuestions: () => { },
+ setSuggestedQuestions: noop,
controlClearChatMessage: 0,
- setControlClearChatMessage: () => { },
+ setControlClearChatMessage: noop,
prevPromptConfig: {
prompt_template: '',
prompt_variables: [],
},
- setPrevPromptConfig: () => { },
+ setPrevPromptConfig: noop,
moreLikeThisConfig: {
enabled: false,
},
- setMoreLikeThisConfig: () => { },
+ setMoreLikeThisConfig: noop,
suggestedQuestionsAfterAnswerConfig: {
enabled: false,
},
- setSuggestedQuestionsAfterAnswerConfig: () => { },
+ setSuggestedQuestionsAfterAnswerConfig: noop,
speechToTextConfig: {
enabled: false,
},
- setSpeechToTextConfig: () => { },
+ setSpeechToTextConfig: noop,
textToSpeechConfig: {
enabled: false,
voice: '',
language: '',
},
- setTextToSpeechConfig: () => { },
+ setTextToSpeechConfig: noop,
citationConfig: {
enabled: false,
},
- setCitationConfig: () => { },
+ setCitationConfig: noop,
moderationConfig: {
enabled: false,
},
@@ -182,16 +183,16 @@ const DebugConfigurationContext = createContext<IDebugConfiguration>({
embedding_provider_name: '',
},
},
- setAnnotationConfig: () => { },
- setModerationConfig: () => { },
+ setAnnotationConfig: noop,
+ setModerationConfig: noop,
externalDataToolsConfig: [],
- setExternalDataToolsConfig: () => { },
+ setExternalDataToolsConfig: noop,
formattingChanged: false,
- setFormattingChanged: () => { },
+ setFormattingChanged: noop,
inputs: {},
- setInputs: () => { },
+ setInputs: noop,
query: '',
- setQuery: () => { },
+ setQuery: noop,
completionParams: {
max_tokens: 16,
temperature: 1, // 0-2
@@ -199,7 +200,7 @@ const DebugConfigurationContext = createContext<IDebugConfiguration>({
presence_penalty: 1, // -2-2
frequency_penalty: 1, // -2-2
},
- setCompletionParams: () => { },
+ setCompletionParams: noop,
modelConfig: {
provider: 'OPENAI', // 'OPENAI'
model_id: 'gpt-3.5-turbo', // 'gpt-3.5-turbo'
@@ -221,10 +222,10 @@ const DebugConfigurationContext = createContext<IDebugConfiguration>({
dataSets: [],
agentConfig: DEFAULT_AGENT_SETTING,
},
- setModelConfig: () => { },
+ setModelConfig: noop,
dataSets: [],
- showSelectDataSet: () => { },
- setDataSets: () => { },
+ showSelectDataSet: noop,
+ setDataSets: noop,
datasetConfigs: {
retrieval_model: RETRIEVE_TYPE.multiWay,
reranking_model: {
@@ -241,7 +242,7 @@ const DebugConfigurationContext = createContext<IDebugConfiguration>({
datasetConfigsRef: {
current: null,
},
- setDatasetConfigs: () => { },
+ setDatasetConfigs: noop,
hasSetContextVar: false,
isShowVisionConfig: false,
visionConfig: {
@@ -250,11 +251,11 @@ const DebugConfigurationContext = createContext<IDebugConfiguration>({
detail: Resolution.low,
transfer_methods: [TransferMethod.remote_url],
},
- setVisionConfig: () => { },
+ setVisionConfig: noop,
isAllowVideoUpload: false,
isShowDocumentConfig: false,
rerankSettingModalOpen: false,
- setRerankSettingModalOpen: () => { },
+ setRerankSettingModalOpen: noop,
})
export const useDebugConfigurationContext = () => useContext(DebugConfigurationContext)
diff --git a/web/context/explore-context.ts b/web/context/explore-context.ts
index 796b6a5bfbb..11124bd54a9 100644
--- a/web/context/explore-context.ts
+++ b/web/context/explore-context.ts
@@ -1,5 +1,6 @@
import { createContext } from 'use-context-selector'
import type { InstalledApp } from '@/models/explore'
+import { noop } from 'lodash-es'
type IExplore = {
controlUpdateInstalledApps: number
@@ -11,10 +12,10 @@ type IExplore = {
const ExploreContext = createContext<IExplore>({
controlUpdateInstalledApps: 0,
- setControlUpdateInstalledApps: () => { },
+ setControlUpdateInstalledApps: noop,
hasEditPermission: false,
installedApps: [],
- setInstalledApps: () => { },
+ setInstalledApps: noop,
})
export default ExploreContext
diff --git a/web/context/modal-context.tsx b/web/context/modal-context.tsx
index 8641dce617a..d86590335d6 100644
--- a/web/context/modal-context.tsx
+++ b/web/context/modal-context.tsx
@@ -36,6 +36,7 @@ import type { InputVar } from '@/app/components/workflow/types'
import type { UpdatePluginPayload } from '@/app/components/plugins/types'
import UpdatePlugin from '@/app/components/plugins/update-plugin'
import { removeSpecificQueryParam } from '@/utils'
+import { noop } from 'lodash-es'
export type ModalState<T> = {
payload: T
@@ -77,18 +78,18 @@ export type ModalContextState = {
setShowUpdatePluginModal: Dispatch<SetStateAction<ModalState<UpdatePluginPayload> | null>>
}
const ModalContext = createContext<ModalContextState>({
- setShowAccountSettingModal: () => { },
- setShowApiBasedExtensionModal: () => { },
- setShowModerationSettingModal: () => { },
- setShowExternalDataToolModal: () => { },
- setShowPricingModal: () => { },
- setShowAnnotationFullModal: () => { },
- setShowModelModal: () => { },
- setShowExternalKnowledgeAPIModal: () => { },
- setShowModelLoadBalancingModal: () => { },
- setShowModelLoadBalancingEntryModal: () => { },
- setShowOpeningModal: () => { },
- setShowUpdatePluginModal: () => { },
+ setShowAccountSettingModal: noop,
+ setShowApiBasedExtensionModal: noop,
+ setShowModerationSettingModal: noop,
+ setShowExternalDataToolModal: noop,
+ setShowPricingModal: noop,
+ setShowAnnotationFullModal: noop,
+ setShowModelModal: noop,
+ setShowExternalKnowledgeAPIModal: noop,
+ setShowModelLoadBalancingModal: noop,
+ setShowModelLoadBalancingEntryModal: noop,
+ setShowOpeningModal: noop,
+ setShowUpdatePluginModal: noop,
})
export const useModalContext = () => useContext(ModalContext)
diff --git a/web/context/provider-context.tsx b/web/context/provider-context.tsx
index ce3e15e8b84..bd997380e7d 100644
--- a/web/context/provider-context.tsx
+++ b/web/context/provider-context.tsx
@@ -25,6 +25,7 @@ import Toast from '@/app/components/base/toast'
import {
useEducationStatus,
} from '@/service/use-education'
+import { noop } from 'lodash-es'
type ProviderContextState = {
modelProviders: ModelProvider[]
@@ -49,7 +50,7 @@ type ProviderContextState = {
}
const ProviderContext = createContext<ProviderContextState>({
modelProviders: [],
- refreshModelProviders: () => { },
+ refreshModelProviders: noop,
textGenerationModelList: [],
supportRetrievalMethods: [],
isAPIKeySet: true,
@@ -72,7 +73,7 @@ const ProviderContext = createContext<ProviderContextState>({
},
isFetchedPlan: false,
enableBilling: false,
- onPlanInfoChanged: () => { },
+ onPlanInfoChanged: noop,
enableReplaceWebAppLogo: false,
modelLoadBalancingEnabled: false,
datasetOperatorEnabled: false,