Skip to content

Commit

Permalink
Validate model id
Browse files Browse the repository at this point in the history
  • Loading branch information
朱鑫睿 committed Sep 26, 2024
1 parent a0a346d commit 4c7b788
Show file tree
Hide file tree
Showing 4 changed files with 14 additions and 0 deletions.
6 changes: 6 additions & 0 deletions frontend/src/components/endpoints/NewEndpoint.vue
Original file line number Diff line number Diff line change
Expand Up @@ -269,6 +269,12 @@
{
required: true,
message: t('all.pleaseInput', { value: t('endpoints.new.modelId') }),
trigger: 'change'
},
// 确保字符串中包含一个 /,但不能出现在首位或末尾
{
pattern: /^(?!\/)[a-zA-Z0-9-_\.]+\/[a-zA-Z0-9-_\.]+(?<!\/)$/,
message: t('all.inputFormatError'),
trigger: 'blur'
}
],
Expand Down
6 changes: 6 additions & 0 deletions frontend/src/components/finetune/NewFinetune.vue
Original file line number Diff line number Diff line change
Expand Up @@ -232,6 +232,12 @@
{
required: true,
message: t('all.pleaseInput', { value: t('finetune.new.modelId') }),
trigger: 'change'
},
// 确保字符串中包含一个 /,但不能出现在首位或末尾
{
pattern: /^(?!\/)[a-zA-Z0-9-_\.]+\/[a-zA-Z0-9-_\.]+(?<!\/)$/,
message: t('all.inputFormatError'),
trigger: 'blur'
}
],
Expand Down
1 change: 1 addition & 0 deletions frontend/src/locales/en_js/all.js
Original file line number Diff line number Diff line change
Expand Up @@ -72,6 +72,7 @@ export const all = {
lfsTips2: "If you do not want to download the content of LFS files, please add it to the environment variables.",
pleaseSelect: "Please select {value}",
pleaseInput: "Please input {value}",
inputFormatError: "The input format is incorrect",
languages: "Languages",
previous:"Previous",
next:"Next",
Expand Down
1 change: 1 addition & 0 deletions frontend/src/locales/zh_js/all.js
Original file line number Diff line number Diff line change
Expand Up @@ -72,6 +72,7 @@ export const all = {
lfsTips2: "如果您不想下载LFS文件的内容,请在环境变量中添加",
pleaseSelect: "请选择{value}",
pleaseInput: "请输入{value}",
inputFormatError: "输入格式不正确",
languages: "语言",
previous:"上一页",
next:"下一页",
Expand Down

0 comments on commit 4c7b788

Please sign in to comment.