新增:首页工作流失败卡片提供「查看失败原因」按钮(默认收起、点击展开,绑定 error 字段);实时与历史回显均展示详细失败原因
Co-Authored-By: Claude Code <noreply@anthropic.com>
This commit is contained in:
@@ -169,3 +169,16 @@ export function getErrorText(msg: WsStreamMessage): string {
|
||||
}
|
||||
return '执行失败,请重试';
|
||||
}
|
||||
|
||||
/** error 详细原因(error 字段优先展示失败详情;message 仅在 error 缺失时兜底)——供工作流失败卡片「查看失败原因」使用 */
|
||||
export function getErrorDetail(msg: WsStreamMessage): string {
|
||||
if (typeof msg?.error === 'string' && msg.error) return msg.error;
|
||||
if (typeof msg?.message === 'string' && msg.message) return msg.message;
|
||||
const d = msg?.data;
|
||||
if (typeof d === 'string') return d;
|
||||
if (d && typeof d === 'object') {
|
||||
const nested = d.message ?? d.error ?? d.msg;
|
||||
if (typeof nested === 'string' && nested) return nested;
|
||||
}
|
||||
return '执行失败,请重试';
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user