修复模型管理v2对话模型回显与异步弹窗崩溃问题

- 修复 chatModel 开关回显:字段大小写与后端对齐(chatModel)
- 修复异步模型 asyncTaskMapping 内字段为 null 时编辑弹窗崩溃
- lastFrame 提交仅限视频模型,避免占位符误提交
- 切换返回类型时清空 responseBodyMapping 残留
- 列表页访问类型列改为供应商列(后端不再返回 PrivateModel)
- ModelManageItem 类型与后端返回字段对齐(modelSupplier/chatModel/minDuration 等)
This commit is contained in:
2026-08-15 10:43:40 +08:00
parent c4c2625714
commit 3b71f144c4
3 changed files with 38 additions and 9 deletions
@@ -155,7 +155,7 @@
<el-col :xs="24" :sm="12" :md="12" :lg="12" :xl="12" class="mb20">
<el-form-item label="回调响应映射">
<el-button @click="openMappingEditor('asyncResponseMapping')" style="width: 100%">
配置 ({{ Object.keys(formData.asyncTaskMapping.responseMapping).length }})
配置 ({{ Object.keys((formData.asyncTaskMapping.responseMapping || {})).length }})
</el-button>
</el-form-item>
</el-col>
@@ -529,6 +529,7 @@ const hasTaskStatusConfig = computed(() => taskStatusOptions.value.length > 0);
/** 用户手动切换返回类型时清空 token 映射(编程赋值不触发) */
function handleResponseTypeChange() {
formData.tokenMapping = { ...defaultTokenMapping };
formData.responseBodyMapping = [];
}
@@ -661,7 +662,7 @@ const openDialog = async (type: 'add' | 'edit', id?: string) => {
formData.apiKey = row.apiKey || '';
formData.responseType = row.responseType ?? row.invokeType;
formData.enabled = row.enabled ?? true;
formData.chatModel = row.ChatModel ?? false;
formData.chatModel = row.chatModel ?? row.ChatModel ?? false;
formData.maxConcurrency = row.maxConcurrency || 10;
formData.maxTokens = row.maxTokens || 4096;
formData.tokenPredictPrice = row.tokenPredictPrice ?? 0;
@@ -672,7 +673,14 @@ const openDialog = async (type: 'add' | 'edit', id?: string) => {
? (Array.isArray(row.responseBodyMapping) ? row.responseBodyMapping : Object.keys(row.responseBodyMapping))
: [];
formData.tokenMapping = row.tokenMapping ? { ...defaultTokenMapping, ...row.tokenMapping } : { ...defaultTokenMapping };
formData.asyncTaskMapping = row.asyncTaskMapping ? { ...defaultAsyncTaskMapping, ...row.asyncTaskMapping } : { ...defaultAsyncTaskMapping };
formData.asyncTaskMapping = row.asyncTaskMapping
? {
...defaultAsyncTaskMapping,
...row.asyncTaskMapping,
requestHeadMapping: row.asyncTaskMapping.requestHeadMapping || {},
responseMapping: row.asyncTaskMapping.responseMapping || {},
}
: { ...defaultAsyncTaskMapping };
formData.lastFrame = row.lastFrame || '';
formData.maxDuration = row.maxDuration ?? 0;
formData.tokenPredictPriceUnit = row.tokenPredictPriceUnit || '';
@@ -730,7 +738,7 @@ const handleSubmit = async () => {
asyncTaskMapping = hasAsyncConfig ? ({ ...atm } as AsyncTaskMapping) : undefined;
}
if (formData.lastFrame) {
if (isVideoModel.value && formData.lastFrame) {
lastFrame = formData.lastFrame;
}
let maxDuration: number | undefined;