wwf
2 天以前 a430284aa21e3ae1f0d5654e55b2ad2852519cc2
utils/var.ts
@@ -7,7 +7,7 @@
} from '@/app/components/base/prompt-editor/constants'
import { InputVarType } from '@/app/components/workflow/types'
const otherAllowedRegex = /^\w+$/
const otherAllowedRegex = /^[a-zA-Z0-9_]+$/
export const getNewVar = (key: string, type: string) => {
  const { ...rest } = VAR_ITEM_TEMPLATE
@@ -56,7 +56,7 @@
    return 'tooLong'
  if (otherAllowedRegex.test(key)) {
    if (/\d/.test(key[0]))
    if (/[0-9]/.test(key[0]))
      return 'notStartWithNumber'
    return true
@@ -82,7 +82,7 @@
  return { isValid, errorKey, errorMessageKey }
}
const varRegex = /\{\{([a-zA-Z_]\w*)\}\}/g
const varRegex = /\{\{([a-zA-Z_][a-zA-Z0-9_]*)\}\}/g
export const getVars = (value: string) => {
  if (!value)
    return []
@@ -104,7 +104,3 @@
  })
  return res
}
// Set the value of basePath
// example: /dify
export const basePath = ''