mirror of
https://github.com/fawney19/Aether.git
synced 2026-09-01 17:00:21 +08:00
refactor: 移除 API Key 最小长度限制并放宽最大长度至 10000 字符
This commit is contained in:
@@ -47,9 +47,7 @@ export const BUSINESS_CONSTANTS = {
|
||||
PROVIDER_MIN_PRIORITY: 0,
|
||||
PROVIDER_MAX_PRIORITY: 999,
|
||||
|
||||
// API Key 相关
|
||||
API_KEY_MIN_LENGTH: 10,
|
||||
API_KEY_MAX_LENGTH: 500,
|
||||
// API Key 相关(不限制长度)
|
||||
|
||||
// 分页配置
|
||||
DEFAULT_PAGE_SIZE: 20,
|
||||
|
||||
@@ -83,13 +83,7 @@
|
||||
/>
|
||||
</template>
|
||||
<p
|
||||
v-if="apiKeyError"
|
||||
class="text-xs text-destructive mt-1"
|
||||
>
|
||||
{{ apiKeyError }}
|
||||
</p>
|
||||
<p
|
||||
v-else-if="editingKey && form.auth_type === 'api_key'"
|
||||
v-if="editingKey && form.auth_type === 'api_key'"
|
||||
class="text-xs text-muted-foreground mt-1"
|
||||
>
|
||||
留空表示不修改
|
||||
@@ -400,8 +394,6 @@ const canSave = computed(() => {
|
||||
}
|
||||
// 必须至少选择一个 API 格式
|
||||
if (form.value.api_formats.length === 0) return false
|
||||
// API 密钥格式验证(如果有输入)
|
||||
if (form.value.auth_type === 'api_key' && form.value.api_key.trim() && form.value.api_key.trim().length < 3) return false
|
||||
return true
|
||||
})
|
||||
|
||||
@@ -487,26 +479,6 @@ function updateRateMultiplier(format: string, value: string | number) {
|
||||
}
|
||||
|
||||
|
||||
// API 密钥验证错误信息
|
||||
const apiKeyError = computed(() => {
|
||||
const apiKey = form.value.api_key.trim()
|
||||
if (!apiKey) {
|
||||
// 新增模式下必填
|
||||
if (!props.editingKey) {
|
||||
return '' // 空值由 required 属性处理
|
||||
}
|
||||
// 编辑模式下可以为空(表示不修改)
|
||||
return ''
|
||||
}
|
||||
|
||||
// 如果输入了值,检查长度
|
||||
if (apiKey.length < 3) {
|
||||
return 'API 密钥至少需要 3 个字符'
|
||||
}
|
||||
|
||||
return ''
|
||||
})
|
||||
|
||||
// 重置表单
|
||||
function resetForm() {
|
||||
formNonce.value = createFieldNonce()
|
||||
@@ -609,12 +581,6 @@ async function handleSave() {
|
||||
return
|
||||
}
|
||||
|
||||
// 提交前验证
|
||||
if (apiKeyError.value) {
|
||||
showError(apiKeyError.value, '验证失败')
|
||||
return
|
||||
}
|
||||
|
||||
// 验证认证信息
|
||||
if (form.value.auth_type === 'api_key') {
|
||||
// API Key 模式:新增时必填
|
||||
|
||||
Reference in New Issue
Block a user