fix(bom-costing): auto-resume malformed model responses

This commit is contained in:
WuYongJie 2026-08-05 00:21:26 +08:00
parent e5e5f62504
commit 0e20ab41c5
2 changed files with 10 additions and 3 deletions

View File

@ -76,6 +76,10 @@ describe('BOM 多模态网关', () => {
ErrorCode.BOM_COSTING_INVALID_PROVIDER,
'多模态分析服务暂时无法连接',
))).toBe(true)
expect(isBomCostingMultimodalTransientError(new AppError(
ErrorCode.BOM_COSTING_INVALID_PROVIDER,
'多模态分析返回的 SKU 信息不完整,请重新处理',
))).toBe(true)
expect(isBomCostingMultimodalTransientError(new AppError(
ErrorCode.BOM_COSTING_INVALID_PROVIDER,
'多模态分析服务返回 400',

View File

@ -373,8 +373,9 @@ export function isBomCostingMultimodalTimeoutError(error: unknown) {
}
// A completed image-fact snapshot and synthesis checkpoint are both durable.
// A short-lived gateway outage should therefore requeue the same run rather
// than showing the user a terminal failure that they have to resume manually.
// A short-lived gateway outage or an occasional malformed model answer should
// therefore requeue the same run rather than showing the user a terminal
// failure that they have to resume manually.
export function isBomCostingMultimodalTransientError(error: unknown) {
return (
error instanceof AppError &&
@ -382,7 +383,9 @@ export function isBomCostingMultimodalTransientError(error: unknown) {
(
error.message.startsWith('多模态 BOM 分析超时') ||
error.message.startsWith('多模态分析服务处理超时') ||
error.message.startsWith('多模态分析服务暂时无法连接')
error.message.startsWith('多模态分析服务暂时无法连接') ||
error.message.startsWith('多模态分析返回的 SKU 信息不完整') ||
error.message.startsWith('多模态分析返回的产品结构信息不完整')
)
)
}