mirror of
http://112.124.100.131/huang.ze/ebiz-dify-ai.git
synced 2025-12-24 10:13:01 +08:00
Fix App logs page modal show different model icon. (#1224)
This commit is contained in:
@@ -1,5 +1,5 @@
|
||||
import { VAR_ITEM_TEMPLATE, getMaxVarNameLength, zhRegex, emojiRegex, MAX_VAR_KEY_LENGHT } from "@/config"
|
||||
const otherAllowedRegex = new RegExp(`^[a-zA-Z0-9_]+$`)
|
||||
import { MAX_VAR_KEY_LENGHT, VAR_ITEM_TEMPLATE, getMaxVarNameLength } from '@/config'
|
||||
const otherAllowedRegex = /^[a-zA-Z0-9_]+$/
|
||||
|
||||
export const getNewVar = (key: string) => {
|
||||
return {
|
||||
@@ -10,19 +10,19 @@ export const getNewVar = (key: string) => {
|
||||
}
|
||||
|
||||
const checkKey = (key: string, canBeEmpty?: boolean) => {
|
||||
if (key.length === 0 && !canBeEmpty) {
|
||||
if (key.length === 0 && !canBeEmpty)
|
||||
return 'canNoBeEmpty'
|
||||
}
|
||||
if (canBeEmpty && key === '') {
|
||||
|
||||
if (canBeEmpty && key === '')
|
||||
return true
|
||||
}
|
||||
if (key.length > MAX_VAR_KEY_LENGHT) {
|
||||
|
||||
if (key.length > MAX_VAR_KEY_LENGHT)
|
||||
return 'tooLong'
|
||||
}
|
||||
|
||||
if (otherAllowedRegex.test(key)) {
|
||||
if (/[0-9]/.test(key[0])) {
|
||||
if (/[0-9]/.test(key[0]))
|
||||
return 'notStartWithNumber'
|
||||
}
|
||||
|
||||
return true
|
||||
}
|
||||
return 'notValid'
|
||||
@@ -33,9 +33,9 @@ export const checkKeys = (keys: string[], canBeEmpty?: boolean) => {
|
||||
let errorKey = ''
|
||||
let errorMessageKey = ''
|
||||
keys.forEach((key) => {
|
||||
if (!isValid) {
|
||||
if (!isValid)
|
||||
return
|
||||
}
|
||||
|
||||
const res = checkKey(key, canBeEmpty)
|
||||
if (res !== true) {
|
||||
isValid = false
|
||||
@@ -44,4 +44,4 @@ export const checkKeys = (keys: string[], canBeEmpty?: boolean) => {
|
||||
}
|
||||
})
|
||||
return { isValid, errorKey, errorMessageKey }
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user