| @@ -11,7 +11,7 @@ import SelectTypeItem from '../select-type-item' | |||
| import Field from './field' | |||
| import Input from '@/app/components/base/input' | |||
| 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 type { InputVar, MoreInfo, UploadFileSetting } from '@/app/components/workflow/types' | |||
| import Modal from '@/app/components/base/modal' | |||
| @@ -111,7 +111,7 @@ const ConfigModal: FC<IConfigModalProps> = ({ | |||
| }, [checkVariableName, tempPayload.label]) | |||
| const handleVarNameChange = useCallback((e: ChangeEvent<any>) => { | |||
| replaceSpaceWithUnderscreInVarNameInput(e.target) | |||
| replaceSpaceWithUnderscoreInVarNameInput(e.target) | |||
| const value = e.target.value | |||
| const { isValid, errorKey, errorMessageKey } = checkKeys([value], true) | |||
| if (!isValid) { | |||
| @@ -8,7 +8,7 @@ import RemoveButton from '../remove-button' | |||
| import VarTypePicker from './var-type-picker' | |||
| import Input from '@/app/components/base/input' | |||
| 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 Toast from '@/app/components/base/toast' | |||
| import { useDebounceFn } from 'ahooks' | |||
| @@ -62,7 +62,7 @@ const OutputVarList: FC<Props> = ({ | |||
| return (e: React.ChangeEvent<HTMLInputElement>) => { | |||
| const oldKey = list[index].variable | |||
| replaceSpaceWithUnderscreInVarNameInput(e.target) | |||
| replaceSpaceWithUnderscoreInVarNameInput(e.target) | |||
| const newKey = e.target.value | |||
| toastHandler?.clear?.() | |||
| @@ -8,7 +8,7 @@ import VarReferencePicker from './var-reference-picker' | |||
| import Input from '@/app/components/base/input' | |||
| import type { ValueSelector, Var, Variable } from '@/app/components/workflow/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 Toast from '@/app/components/base/toast' | |||
| import { ReactSortable } from 'react-sortablejs' | |||
| @@ -74,7 +74,7 @@ const VarList: FC<Props> = ({ | |||
| const handleVarNameChange = useCallback((index: number) => { | |||
| return (e: React.ChangeEvent<HTMLInputElement>) => { | |||
| replaceSpaceWithUnderscreInVarNameInput(e.target) | |||
| replaceSpaceWithUnderscoreInVarNameInput(e.target) | |||
| const newKey = e.target.value | |||
| @@ -10,7 +10,7 @@ import type { | |||
| LoopVariable, | |||
| LoopVariablesComponentShape, | |||
| } 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' | |||
| type ItemProps = { | |||
| @@ -36,7 +36,7 @@ const Item = ({ | |||
| return true | |||
| } | |||
| const handleUpdateItemLabel = useCallback((e: any) => { | |||
| replaceSpaceWithUnderscreInVarNameInput(e.target) | |||
| replaceSpaceWithUnderscoreInVarNameInput(e.target) | |||
| if (!!e.target.value && !checkVariableName(e.target.value)) | |||
| return | |||
| handleUpdateLoopVariable(item.id, { label: e.target.value }) | |||
| @@ -15,7 +15,7 @@ import { VarType } 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 { 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' | |||
| const i18nPrefix = 'workflow.nodes.variableAssigner' | |||
| @@ -89,7 +89,7 @@ const VarGroupItem: FC<Props> = ({ | |||
| }] = useBoolean(false) | |||
| const handleGroupNameChange = useCallback((e: ChangeEvent<any>) => { | |||
| replaceSpaceWithUnderscreInVarNameInput(e.target) | |||
| replaceSpaceWithUnderscoreInVarNameInput(e.target) | |||
| const value = e.target.value | |||
| const { isValid, errorKey, errorMessageKey } = checkKeys([value], false) | |||
| if (!isValid) { | |||
| @@ -16,7 +16,7 @@ import type { ConversationVariable } from '@/app/components/workflow/types' | |||
| import { CodeLanguage } from '@/app/components/workflow/nodes/code/types' | |||
| import { ChatVarType } from '@/app/components/workflow/panel/chat-variable-panel/type' | |||
| import cn from '@/utils/classnames' | |||
| import { checkKeys, replaceSpaceWithUnderscreInVarNameInput } from '@/utils/var' | |||
| import { checkKeys, replaceSpaceWithUnderscoreInVarNameInput } from '@/utils/var' | |||
| export type ModalPropsType = { | |||
| chatVar?: ConversationVariable | |||
| @@ -144,7 +144,7 @@ const ChatVariableModal = ({ | |||
| } | |||
| const handleVarNameChange = (e: React.ChangeEvent<HTMLInputElement>) => { | |||
| replaceSpaceWithUnderscreInVarNameInput(e.target) | |||
| replaceSpaceWithUnderscoreInVarNameInput(e.target) | |||
| if (!!e.target.value && !checkVariableName(e.target.value)) | |||
| return | |||
| setName(e.target.value || '') | |||
| @@ -10,7 +10,7 @@ import { ToastContext } from '@/app/components/base/toast' | |||
| import { useStore } from '@/app/components/workflow/store' | |||
| import type { EnvironmentVariable } from '@/app/components/workflow/types' | |||
| import cn from '@/utils/classnames' | |||
| import { checkKeys, replaceSpaceWithUnderscreInVarNameInput } from '@/utils/var' | |||
| import { checkKeys, replaceSpaceWithUnderscoreInVarNameInput } from '@/utils/var' | |||
| export type ModalPropsType = { | |||
| env?: EnvironmentVariable | |||
| @@ -44,7 +44,7 @@ const VariableModal = ({ | |||
| } | |||
| const handleVarNameChange = (e: React.ChangeEvent<HTMLInputElement>) => { | |||
| replaceSpaceWithUnderscreInVarNameInput(e.target) | |||
| replaceSpaceWithUnderscoreInVarNameInput(e.target) | |||
| if (!!e.target.value && !checkVariableName(e.target.value)) | |||
| return | |||
| setName(e.target.value || '') | |||
| @@ -121,7 +121,7 @@ export function getMarketplaceUrl(path: string, params?: Record<string, string | | |||
| return `${MARKETPLACE_URL_PREFIX}${path}?${searchParams.toString()}` | |||
| } | |||
| export const replaceSpaceWithUnderscreInVarNameInput = (input: HTMLInputElement) => { | |||
| export const replaceSpaceWithUnderscoreInVarNameInput = (input: HTMLInputElement) => { | |||
| const start = input.selectionStart | |||
| const end = input.selectionEnd | |||