From 77950e48c76f4a3b29d01831d43039caba29888a Mon Sep 17 00:00:00 2001
From: wwf <1971391498@qq.com>
Date: 星期二, 18 十一月 2025 14:12:42 +0800
Subject: [PATCH] 修改
---
utils/var.ts | 10 +++-------
1 files changed, 3 insertions(+), 7 deletions(-)
diff --git a/utils/var.ts b/utils/var.ts
index 06cb43c..7035933 100644
--- a/utils/var.ts
+++ b/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 = ''
--
Gitblit v1.8.0