feat(provider): 模型测试支持自定义请求头,优化对话框布局与并发策略

- 前后端新增 request_headers 字段,测试时可自定义额外请求头
- ModelTestDialog 拆分为请求头/请求体并排双栏布局,增加格式化与重置按钮
- 区分 Pool 托管(并发5)和单 Key Provider(并发1)的测试并发数
- JsonImportInput 新增 multiple prop 支持单文件模式
- KeyFormDialog Service Account 输入改用 JsonImportInput,支持拖拽导入
This commit is contained in:
fawney19
2026-03-20 00:24:56 +08:00
parent 6984984c22
commit 28fa03451c
9 changed files with 295 additions and 58 deletions

View File

@@ -4,7 +4,7 @@
ref="fileInputRef"
type="file"
:accept="accept"
multiple
:multiple="multiple"
class="hidden"
@change="handleFileSelect"
>
@@ -94,6 +94,7 @@ const props = withDefaults(defineProps<{
disabled?: boolean
resetKey?: string | number
accept?: string
multiple?: boolean
dropTitle?: string
dropHint?: string
manualLabel?: string
@@ -106,6 +107,7 @@ const props = withDefaults(defineProps<{
disabled: false,
resetKey: '',
accept: '.json,.txt',
multiple: true,
dropTitle: '拖入导入文件或点击选择',
dropHint: '支持 .json / .txt可多选',
manualLabel: '',
@@ -218,13 +220,19 @@ function mergeFileContents(contents: string[]): string {
}
async function readFiles(files: File[]) {
const validFiles = files.filter(isValidFileType)
const sourceFiles = props.multiple ? files : files.slice(0, 1)
if (!props.multiple && files.length > 1) {
emitError('仅支持选择 1 个文件,已读取第一个文件', '提示')
}
const validFiles = sourceFiles.filter(isValidFileType)
if (validFiles.length === 0) {
emitError('仅支持 .json 或 .txt 文件', '格式错误')
return
}
if (validFiles.length < files.length) {
emitError(`已忽略 ${files.length - validFiles.length} 个不支持的文件`, '提示')
if (validFiles.length < sourceFiles.length) {
emitError(`已忽略 ${sourceFiles.length - validFiles.length} 个不支持的文件`, '提示')
}
try {