Przeglądaj źródła

chore: fix function name typo (#23306)

tags/1.7.2
Matri Qi 3 miesięcy temu
rodzic
commit
99a4bd82b5
No account linked to committer's email address

+ 2
- 2
web/app/components/app/configuration/config-var/config-modal/index.tsx Wyświetl plik

import Field from './field' import Field from './field'
import Input from '@/app/components/base/input' import Input from '@/app/components/base/input'
import Toast from '@/app/components/base/toast' import Toast from '@/app/components/base/toast'
import { checkKeys, getNewVarInWorkflow, replaceSpaceWithUnderscreInVarNameInput } from '@/utils/var'
import { checkKeys, getNewVarInWorkflow, replaceSpaceWithUnderscoreInVarNameInput } from '@/utils/var'
import ConfigContext from '@/context/debug-configuration' import ConfigContext from '@/context/debug-configuration'
import type { InputVar, MoreInfo, UploadFileSetting } from '@/app/components/workflow/types' import type { InputVar, MoreInfo, UploadFileSetting } from '@/app/components/workflow/types'
import Modal from '@/app/components/base/modal' import Modal from '@/app/components/base/modal'
}, [checkVariableName, tempPayload.label]) }, [checkVariableName, tempPayload.label])


const handleVarNameChange = useCallback((e: ChangeEvent<any>) => { const handleVarNameChange = useCallback((e: ChangeEvent<any>) => {
replaceSpaceWithUnderscreInVarNameInput(e.target)
replaceSpaceWithUnderscoreInVarNameInput(e.target)
const value = e.target.value const value = e.target.value
const { isValid, errorKey, errorMessageKey } = checkKeys([value], true) const { isValid, errorKey, errorMessageKey } = checkKeys([value], true)
if (!isValid) { if (!isValid) {

+ 2
- 2
web/app/components/workflow/nodes/_base/components/variable/output-var-list.tsx Wyświetl plik

import VarTypePicker from './var-type-picker' import VarTypePicker from './var-type-picker'
import Input from '@/app/components/base/input' import Input from '@/app/components/base/input'
import type { VarType } from '@/app/components/workflow/types' import type { VarType } from '@/app/components/workflow/types'
import { checkKeys, replaceSpaceWithUnderscreInVarNameInput } from '@/utils/var'
import { checkKeys, replaceSpaceWithUnderscoreInVarNameInput } from '@/utils/var'
import type { ToastHandle } from '@/app/components/base/toast' import type { ToastHandle } from '@/app/components/base/toast'
import Toast from '@/app/components/base/toast' import Toast from '@/app/components/base/toast'
import { useDebounceFn } from 'ahooks' import { useDebounceFn } from 'ahooks'
return (e: React.ChangeEvent<HTMLInputElement>) => { return (e: React.ChangeEvent<HTMLInputElement>) => {
const oldKey = list[index].variable const oldKey = list[index].variable


replaceSpaceWithUnderscreInVarNameInput(e.target)
replaceSpaceWithUnderscoreInVarNameInput(e.target)
const newKey = e.target.value const newKey = e.target.value


toastHandler?.clear?.() toastHandler?.clear?.()

+ 2
- 2
web/app/components/workflow/nodes/_base/components/variable/var-list.tsx Wyświetl plik

import Input from '@/app/components/base/input' import Input from '@/app/components/base/input'
import type { ValueSelector, Var, Variable } from '@/app/components/workflow/types' import type { ValueSelector, Var, Variable } from '@/app/components/workflow/types'
import { VarType as VarKindType } from '@/app/components/workflow/nodes/tool/types' import { VarType as VarKindType } from '@/app/components/workflow/nodes/tool/types'
import { checkKeys, replaceSpaceWithUnderscreInVarNameInput } from '@/utils/var'
import { checkKeys, replaceSpaceWithUnderscoreInVarNameInput } from '@/utils/var'
import type { ToastHandle } from '@/app/components/base/toast' import type { ToastHandle } from '@/app/components/base/toast'
import Toast from '@/app/components/base/toast' import Toast from '@/app/components/base/toast'
import { ReactSortable } from 'react-sortablejs' import { ReactSortable } from 'react-sortablejs'


const handleVarNameChange = useCallback((index: number) => { const handleVarNameChange = useCallback((index: number) => {
return (e: React.ChangeEvent<HTMLInputElement>) => { return (e: React.ChangeEvent<HTMLInputElement>) => {
replaceSpaceWithUnderscreInVarNameInput(e.target)
replaceSpaceWithUnderscoreInVarNameInput(e.target)


const newKey = e.target.value const newKey = e.target.value



+ 2
- 2
web/app/components/workflow/nodes/loop/components/loop-variables/item.tsx Wyświetl plik

LoopVariable, LoopVariable,
LoopVariablesComponentShape, LoopVariablesComponentShape,
} from '@/app/components/workflow/nodes/loop/types' } from '@/app/components/workflow/nodes/loop/types'
import { checkKeys, replaceSpaceWithUnderscreInVarNameInput } from '@/utils/var'
import { checkKeys, replaceSpaceWithUnderscoreInVarNameInput } from '@/utils/var'
import Toast from '@/app/components/base/toast' import Toast from '@/app/components/base/toast'


type ItemProps = { type ItemProps = {
return true return true
} }
const handleUpdateItemLabel = useCallback((e: any) => { const handleUpdateItemLabel = useCallback((e: any) => {
replaceSpaceWithUnderscreInVarNameInput(e.target)
replaceSpaceWithUnderscoreInVarNameInput(e.target)
if (!!e.target.value && !checkVariableName(e.target.value)) if (!!e.target.value && !checkVariableName(e.target.value))
return return
handleUpdateLoopVariable(item.id, { label: e.target.value }) handleUpdateLoopVariable(item.id, { label: e.target.value })

+ 2
- 2
web/app/components/workflow/nodes/variable-assigner/components/var-group-item.tsx Wyświetl plik

import type { NodeOutPutVar, ValueSelector, Var } from '@/app/components/workflow/types' import type { NodeOutPutVar, ValueSelector, Var } from '@/app/components/workflow/types'
import { VarType as VarKindType } from '@/app/components/workflow/nodes/tool/types' import { VarType as VarKindType } from '@/app/components/workflow/nodes/tool/types'
import { Folder } from '@/app/components/base/icons/src/vender/line/files' import { Folder } from '@/app/components/base/icons/src/vender/line/files'
import { checkKeys, replaceSpaceWithUnderscreInVarNameInput } from '@/utils/var'
import { checkKeys, replaceSpaceWithUnderscoreInVarNameInput } from '@/utils/var'
import Toast from '@/app/components/base/toast' import Toast from '@/app/components/base/toast'


const i18nPrefix = 'workflow.nodes.variableAssigner' const i18nPrefix = 'workflow.nodes.variableAssigner'
}] = useBoolean(false) }] = useBoolean(false)


const handleGroupNameChange = useCallback((e: ChangeEvent<any>) => { const handleGroupNameChange = useCallback((e: ChangeEvent<any>) => {
replaceSpaceWithUnderscreInVarNameInput(e.target)
replaceSpaceWithUnderscoreInVarNameInput(e.target)
const value = e.target.value const value = e.target.value
const { isValid, errorKey, errorMessageKey } = checkKeys([value], false) const { isValid, errorKey, errorMessageKey } = checkKeys([value], false)
if (!isValid) { if (!isValid) {

+ 2
- 2
web/app/components/workflow/panel/chat-variable-panel/components/variable-modal.tsx Wyświetl plik

import { CodeLanguage } from '@/app/components/workflow/nodes/code/types' import { CodeLanguage } from '@/app/components/workflow/nodes/code/types'
import { ChatVarType } from '@/app/components/workflow/panel/chat-variable-panel/type' import { ChatVarType } from '@/app/components/workflow/panel/chat-variable-panel/type'
import cn from '@/utils/classnames' import cn from '@/utils/classnames'
import { checkKeys, replaceSpaceWithUnderscreInVarNameInput } from '@/utils/var'
import { checkKeys, replaceSpaceWithUnderscoreInVarNameInput } from '@/utils/var'


export type ModalPropsType = { export type ModalPropsType = {
chatVar?: ConversationVariable chatVar?: ConversationVariable
} }


const handleVarNameChange = (e: React.ChangeEvent<HTMLInputElement>) => { const handleVarNameChange = (e: React.ChangeEvent<HTMLInputElement>) => {
replaceSpaceWithUnderscreInVarNameInput(e.target)
replaceSpaceWithUnderscoreInVarNameInput(e.target)
if (!!e.target.value && !checkVariableName(e.target.value)) if (!!e.target.value && !checkVariableName(e.target.value))
return return
setName(e.target.value || '') setName(e.target.value || '')

+ 2
- 2
web/app/components/workflow/panel/env-panel/variable-modal.tsx Wyświetl plik

import { useStore } from '@/app/components/workflow/store' import { useStore } from '@/app/components/workflow/store'
import type { EnvironmentVariable } from '@/app/components/workflow/types' import type { EnvironmentVariable } from '@/app/components/workflow/types'
import cn from '@/utils/classnames' import cn from '@/utils/classnames'
import { checkKeys, replaceSpaceWithUnderscreInVarNameInput } from '@/utils/var'
import { checkKeys, replaceSpaceWithUnderscoreInVarNameInput } from '@/utils/var'


export type ModalPropsType = { export type ModalPropsType = {
env?: EnvironmentVariable env?: EnvironmentVariable
} }


const handleVarNameChange = (e: React.ChangeEvent<HTMLInputElement>) => { const handleVarNameChange = (e: React.ChangeEvent<HTMLInputElement>) => {
replaceSpaceWithUnderscreInVarNameInput(e.target)
replaceSpaceWithUnderscoreInVarNameInput(e.target)
if (!!e.target.value && !checkVariableName(e.target.value)) if (!!e.target.value && !checkVariableName(e.target.value))
return return
setName(e.target.value || '') setName(e.target.value || '')

+ 1
- 1
web/utils/var.ts Wyświetl plik

return `${MARKETPLACE_URL_PREFIX}${path}?${searchParams.toString()}` return `${MARKETPLACE_URL_PREFIX}${path}?${searchParams.toString()}`
} }


export const replaceSpaceWithUnderscreInVarNameInput = (input: HTMLInputElement) => {
export const replaceSpaceWithUnderscoreInVarNameInput = (input: HTMLInputElement) => {
const start = input.selectionStart const start = input.selectionStart
const end = input.selectionEnd const end = input.selectionEnd



Ładowanie…
Anuluj
Zapisz