From 0c5963eb9214b59b426e2e6000cbc2462cef9911 Mon Sep 17 00:00:00 2001 From: fit2cloud-chenyw Date: Tue, 2 Sep 2025 15:24:01 +0800 Subject: [PATCH] perf: Model Configuration - Model Name Length Limit --- frontend/src/i18n/en.json | 1 + frontend/src/i18n/zh-CN.json | 1 + frontend/src/views/system/model/ModelForm.vue | 9 ++++++++- 3 files changed, 10 insertions(+), 1 deletion(-) diff --git a/frontend/src/i18n/en.json b/frontend/src/i18n/en.json index e1494497..fd3b3021 100644 --- a/frontend/src/i18n/en.json +++ b/frontend/src/i18n/en.json @@ -308,6 +308,7 @@ "select_supplier": "Select supplier", "the_basic_model": "Please set a name for the basic model", "the_basic_model_de": "Please select the basic model", + "length_max_error": "{msg} is limited to {max} characters", "model_name": "Model name", "custom_model_name": "Custom model name", "enter_to_add": "For models not listed in the list, just enter the model name and press Enter to add", diff --git a/frontend/src/i18n/zh-CN.json b/frontend/src/i18n/zh-CN.json index dea3e69c..a7aa851e 100644 --- a/frontend/src/i18n/zh-CN.json +++ b/frontend/src/i18n/zh-CN.json @@ -308,6 +308,7 @@ "select_supplier": "选择供应商", "the_basic_model": "请给基础模型设置一个名称", "the_basic_model_de": "请选择基础模型", + "length_max_error": "{msg}长度不能超过{max}个字符", "model_name": "模型名称", "custom_model_name": "自定义的模型名称", "enter_to_add": "列表中未列出的模型,直接输入模型名称,回车即可添加", diff --git a/frontend/src/views/system/model/ModelForm.vue b/frontend/src/views/system/model/ModelForm.vue index d116da81..a3c933bd 100644 --- a/frontend/src/views/system/model/ModelForm.vue +++ b/frontend/src/views/system/model/ModelForm.vue @@ -107,7 +107,14 @@ const rules = computed(() => ({ }, ], base_model: [{ required: true, message: t('model.the_basic_model_de'), trigger: 'blur' }], - name: [{ required: true, message: t('model.the_basic_model'), trigger: 'blur' }], + name: [ + { required: true, message: t('model.the_basic_model'), trigger: 'blur' }, + { + max: 100, + message: t('model.length_max_error', { msg: t('model.model_name'), max: 100 }), + trigger: 'blur', + }, + ], api_key: [ { required: !currentSupplier.value?.is_private,