fix(web): change string regExp

This commit is contained in:
zhaoying
2026-03-03 10:24:21 +08:00
parent c9a8753473
commit aa7d52568b
3 changed files with 4 additions and 5 deletions

View File

@@ -455,6 +455,7 @@ export const en = {
recommend: 'Recommend',
logoTip: `Supported image formats: JPG, PNG \n Suggested size: square ratio \n Maximum size: ≤ 2MB`,
imageSquareRequired: 'Please upload a square image',
nameInvalid: 'Name cannot start or end with a space',
},
model: {
searchPlaceholder: 'search model…',
@@ -545,7 +546,6 @@ export const en = {
xinference: "Xinference",
gpustack: "Gpustack",
bedrock: "Bedrock",
nameInvalid: 'Model name can only contain letters, numbers, underscores and spaces, cannot be empty or pure whitespace',
},
modelNew: {
group: 'Model Group',

View File

@@ -1031,6 +1031,7 @@ export const zh = {
recommend: '推荐',
logoTip: `支持图片格式JPG、PNG\n 尺寸:正方形比例 \n 文件大小限制:≤ 2MB`,
imageSquareRequired: '请上传正方形比例图片',
nameInvalid: '不能是空格开头或结尾',
},
model: {
searchPlaceholder: '搜索模型…',
@@ -1179,7 +1180,6 @@ export const zh = {
xinference: "Xinference",
gpustack: "Gpustack",
bedrock: "Bedrock",
nameInvalid: '模型名称只能包含字母、数字、下划线和空格, 不能为空或纯空格',
},
timezones: {
'Asia/Shanghai': '中国标准时间 (UTC+8)',

View File

@@ -45,6 +45,5 @@ export const validateSquareImage = (errorMessage: string = 'Image must be square
};
};
// - Cannot be empty or pure whitespace
// - Cannot start with a space
export const stringRegExp = /^[a-zA-Z0-9\u4e00-\u9fa5][a-zA-Z0-9\u4e00-\u9fa5\s]*$/
// - Cannot start or end with a space
export const stringRegExp = /^(?!\s).*(?<!\s)$/