| @@ -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' /> | |||
| @@ -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 ( | |||
| @@ -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, | |||
| @@ -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'> | |||
| @@ -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() | |||
| @@ -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) | |||
| @@ -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 | |||
| /> | |||
| ) | |||
| @@ -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> | |||
| @@ -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'> | |||
| @@ -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')} | |||
| @@ -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}> | |||
| @@ -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')} | |||
| @@ -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' /> | |||
| @@ -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} | |||
| @@ -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) | |||
| @@ -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('') | |||
| @@ -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) | |||
| @@ -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('') | |||
| @@ -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} | |||
| @@ -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'> | |||
| @@ -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'> | |||
| @@ -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 { | |||
| @@ -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={[]} | |||
| @@ -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, | |||
| @@ -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' | |||
| @@ -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) => { | |||
| @@ -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, | |||
| @@ -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> | |||
| @@ -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) => { | |||
| @@ -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, | |||
| @@ -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() | |||
| @@ -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) => { | |||
| @@ -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, | |||
| @@ -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> | |||
| @@ -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' /> | |||
| @@ -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> | |||
| ) | |||
| @@ -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() | |||
| @@ -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(() => { | |||
| @@ -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} | |||
| /> | |||
| ) | |||
| } | |||
| @@ -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' /> | |||
| @@ -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, | |||
| }) => { | |||
| @@ -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} />} | |||
| @@ -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 }, | |||
| }) | |||
| @@ -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, | |||
| @@ -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}> | |||
| @@ -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'> | |||
| @@ -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'> | |||
| @@ -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, | |||
| }} | |||
| @@ -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} /> | |||
| @@ -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} /> | |||
| @@ -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 | |||
| @@ -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> | |||
| @@ -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> | |||
| ) | |||
| @@ -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, | |||
| }) | |||
| @@ -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: [], | |||
| }) | |||
| @@ -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} | |||
| /> | |||
| ) | |||
| } | |||
| @@ -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} | |||
| /> | |||
| </> | |||
| )} | |||
| @@ -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} | |||
| /> | |||
| ) | |||
| } | |||
| @@ -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> | |||
| @@ -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() | |||
| @@ -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' /> | |||
| @@ -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> | |||
| @@ -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, | |||
| @@ -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() | |||
| @@ -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, | |||
| @@ -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')}> | |||
| @@ -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, | |||
| @@ -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, | |||
| @@ -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} | |||
| /> | |||
| @@ -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, | |||
| @@ -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, | |||
| }) => { | |||
| @@ -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() | |||
| @@ -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}> | |||
| @@ -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() | |||
| @@ -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() | |||
| }) | |||
| @@ -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() | |||
| }) | |||
| @@ -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({ | |||
| @@ -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> | |||
| ) | |||
| @@ -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> | |||
| @@ -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> | |||
| @@ -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')} | |||
| @@ -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, | |||
| @@ -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, | |||
| }) | |||
| @@ -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) | |||
| @@ -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 | |||
| @@ -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) | |||
| @@ -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, | |||