mirror of
https://github.com/xinnan-tech/xiaozhi-esp32-server.git
synced 2026-07-21 22:53:56 +08:00
fix:声音复刻后自动刷新页面状态和错误详情
This commit is contained in:
@@ -343,62 +343,32 @@ export default {
|
|||||||
// 复刻成功后刷新列表
|
// 复刻成功后刷新列表
|
||||||
this.fetchVoiceCloneList();
|
this.fetchVoiceCloneList();
|
||||||
} else {
|
} else {
|
||||||
// 出错时更新状态为训练失败
|
// 复刻失败时刷新列表以获取完整的错误信息
|
||||||
console.log('API返回错误,更新状态为训练失败');
|
console.log('API返回错误,刷新列表获取详细错误信息');
|
||||||
// 尝试从错误信息中提取状态码
|
|
||||||
let statusCode = null;
|
|
||||||
if (res.msg) {
|
|
||||||
// 尝试匹配状态码格式,如"状态码: 403"
|
|
||||||
const statusMatch = res.msg.match(/状态码: (\d+)/);
|
|
||||||
if (statusMatch && statusMatch[1]) {
|
|
||||||
statusCode = parseInt(statusMatch[1]);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
this.updateRowStatus(row, 3, statusCode);
|
|
||||||
this.$message.error(res.msg || this.$t('message.error'));
|
this.$message.error(res.msg || this.$t('message.error'));
|
||||||
// 检查是否包含403错误
|
// 刷新列表以获取后端保存的完整错误详情
|
||||||
if (res.msg && res.msg.includes('状态码: 403')) {
|
this.fetchVoiceCloneList();
|
||||||
console.error('权限错误: 403');
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
} catch (error) {
|
} catch (error) {
|
||||||
// 出错时更新状态为训练失败
|
// 处理响应时出错,刷新列表
|
||||||
this.updateRowStatus(row, 3);
|
|
||||||
console.error('处理响应时出错:', error);
|
console.error('处理响应时出错:', error);
|
||||||
this.$message.error('处理响应时出错');
|
this.$message.error('处理响应时出错');
|
||||||
|
this.fetchVoiceCloneList();
|
||||||
} finally {
|
} finally {
|
||||||
row._submitting = false;
|
row._submitting = false;
|
||||||
}
|
}
|
||||||
}, (error) => {
|
}, (error) => {
|
||||||
// 出错时更新状态为训练失败
|
// API调用失败,刷新列表以获取最新状态
|
||||||
this.updateRowStatus(row, 3);
|
|
||||||
console.error('API调用失败:', error);
|
console.error('API调用失败:', error);
|
||||||
// 尝试从错误信息中提取状态码
|
this.$message.error('请求失败');
|
||||||
let statusCode = null;
|
this.fetchVoiceCloneList();
|
||||||
if (error.message) {
|
row._submitting = false;
|
||||||
const statusMatch = error.message.match(/状态码: (\d+)/);
|
|
||||||
if (statusMatch && statusMatch[1]) {
|
|
||||||
statusCode = parseInt(statusMatch[1]);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
this.updateRowStatus(row, 3, statusCode);
|
|
||||||
this.$message.error('请求失败');
|
|
||||||
row._submitting = false;
|
|
||||||
});
|
});
|
||||||
} catch (error) {
|
} catch (error) {
|
||||||
// 出错时更新状态为训练失败
|
// 调用API时出错,刷新列表
|
||||||
this.updateRowStatus(row, 3);
|
|
||||||
console.error('调用API时出错:', error);
|
console.error('调用API时出错:', error);
|
||||||
// 尝试从错误信息中提取状态码
|
|
||||||
let statusCode = null;
|
|
||||||
if (error.message && error.message.includes('状态码: ')) {
|
|
||||||
const statusMatch = error.message.match(/状态码: (\d+)/);
|
|
||||||
if (statusMatch && statusMatch[1]) {
|
|
||||||
statusCode = parseInt(statusMatch[1]);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
this.updateRowStatus(row, 3, statusCode);
|
|
||||||
this.$message.error('调用API时出错');
|
this.$message.error('调用API时出错');
|
||||||
|
this.fetchVoiceCloneList();
|
||||||
row._submitting = false;
|
row._submitting = false;
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
|
|||||||
Reference in New Issue
Block a user