From a430284aa21e3ae1f0d5654e55b2ad2852519cc2 Mon Sep 17 00:00:00 2001
From: wwf <yearningwang@iqtogether.com>
Date: 星期三, 04 六月 2025 15:17:49 +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