refactor & perf: import { noop } from 'lodash-es'
across web
(#17439)
This commit is contained in:
@@ -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()
|
||||
|
Reference in New Issue
Block a user