增加对照表

main
guofei 2024-12-03 18:57:34 +08:00
parent 44f9b6f8ff
commit 076a71a240
2 changed files with 92 additions and 1 deletions

View File

@ -52,7 +52,16 @@
</div>
<div>
<div class="text-gray-500 mb-1">错误信息</div>
<div class="error-message">{{ currentError.error }}</div>
<div class="error-message">错误码{{ currentError.error }}</div>
</div>
<!-- 添加错误码对照表 -->
<div class="mt-6">
<div class="text-gray-500 mb-2">错误码对照表</div>
<el-table :data="errorCodeList" size="small" style="width: 100%">
<el-table-column prop="code" label="错误码" width="80" />
<el-table-column prop="message" label="说明" />
</el-table>
</div>
</div>
</el-drawer>
@ -65,6 +74,7 @@ import { ElMessage, ElMessageBox } from "element-plus";
import { getTaskListAPI, retryCloneTaskAPI, deleteTaskAPI } from "@/api/SystemCharter";
import AudioManager from "@/utils/audioManager";
import { TaskStatus, TaskStatusType, TaskStatusText } from "@/utils/dict";
import { getErrorMessage } from "@/utils/errorCode";
const props = defineProps<{
visible: boolean;
@ -88,6 +98,26 @@ const audioRefs = ref<HTMLAudioElement[]>([]);
const errorDrawer = ref(false);
const currentError = ref<any>(null);
//
const errorCodeList = [
{ code: "1001", message: "请求参数有误" },
{ code: "1101", message: "音频上传失败" },
{ code: "1102", message: "ASR语音识别成文字转写失败" },
{ code: "1103", message: "SID声纹检测失败" },
{ code: "1104", message: "声纹检测未通过,声纹跟名人相似度过高" },
{ code: "1105", message: "获取音频数据失败" },
{ code: "1106", message: "SpeakerID重复" },
{ code: "1107", message: "SpeakerID未找到" },
{ code: "1108", message: "音频转码失败" },
{ code: "1109", message: "wer检测错误上传音频与请求携带文本对比字错率过高" },
{ code: "1111", message: "aed检测错误通常由于音频不包含说话声" },
{ code: "1112", message: "SNR检测错误通常由于信噪比过高" },
{ code: "1113", message: "降噪处理失败" },
{ code: "1114", message: "音频质量低,降噪失败" },
{ code: "1122", message: "未检测到人声" },
{ code: "1123", message: "已达上传次数限制目前同一个音色支持10次上传" },
];
watch(
() => props.visible,
(val) => {
@ -293,4 +323,19 @@ const showError = (row: any) => {
border-radius: 4px;
font-family: monospace;
}
.error-code {
color: #909399;
font-size: 0.9em;
}
/* 调整表格样式 */
:deep(.el-table) {
--el-table-border-color: #ebeef5;
--el-table-header-bg-color: #f5f7fa;
}
:deep(.el-table--small) {
font-size: 12px;
}
</style>

View File

@ -0,0 +1,46 @@
export const ErrorCode = {
// 通用错误
BadRequestError: '1001',
// 音频相关错误
AudioUploadError: '1101',
ASRError: '1102',
SIDError: '1103',
SIDFailError: '1104',
GetAudioDataError: '1105',
SpeakerIDDuplicationError: '1106',
SpeakerIDNotFoundError: '1107',
AudioConvertError: '1108',
WERError: '1109',
AEDError: '1111',
SNRError: '1112',
DenoiseError: '1113',
AudioQualityError: '1114',
ASRNoSpeakerError: '1122',
UploadLimitError: '1123',
} as const;
export const ErrorMessage = {
[ErrorCode.BadRequestError]: '请求参数有误',
[ErrorCode.AudioUploadError]: '音频上传失败',
[ErrorCode.ASRError]: 'ASR语音识别成文字转写失败',
[ErrorCode.SIDError]: 'SID声纹检测失败',
[ErrorCode.SIDFailError]: '声纹检测未通过,声纹跟名人相似度过高',
[ErrorCode.GetAudioDataError]: '获取音频数据失败',
[ErrorCode.SpeakerIDDuplicationError]: 'SpeakerID重复',
[ErrorCode.SpeakerIDNotFoundError]: 'SpeakerID未找到',
[ErrorCode.AudioConvertError]: '音频转码失败',
[ErrorCode.WERError]: 'wer检测错误上传音频与请求携带文本对比字错率过高',
[ErrorCode.AEDError]: 'aed检测错误通常由于音频不包含说话声',
[ErrorCode.SNRError]: 'SNR检测错误通常由于信噪比过高',
[ErrorCode.DenoiseError]: '降噪处理失败',
[ErrorCode.AudioQualityError]: '音频质量低,降噪失败',
[ErrorCode.ASRNoSpeakerError]: '未检测到人声',
[ErrorCode.UploadLimitError]: '已达上传次数限制目前同一个音色支持10次上传',
} as const;
// 获取错误信息的辅助函数
export const getErrorMessage = (code: string | number): string => {
const strCode = String(code);
return ErrorMessage[strCode as keyof typeof ErrorMessage] || '未知错误';
};