fix(monitoring): display processing errors on the assistant side

This commit is contained in:
Hyu
2026-10-11 00:17:02 +08:00
parent 4a700ac0f3
commit 49d2af9379
2 changed files with 8 additions and 3 deletions
@@ -333,6 +333,7 @@ class MonitoringHelper:
pipeline_id=pipeline_id,
pipeline_name=pipeline_name,
message_content=f'Error: {str(error)}',
role='assistant',
session_id=session_id,
status='error',
level='error',
@@ -341,7 +341,7 @@ const BotSessionMonitor = forwardRef<
// Collect user message IDs for feedback matching
const userMsgIds = new Set(
sorted.filter((m) => !m.role || m.role === 'user').map((m) => m.id),
sorted.filter(isUserMessage).map((m) => m.id),
);
if (userMsgIds.size > 0) {
@@ -458,11 +458,15 @@ const BotSessionMonitor = forwardRef<
return [{ type: 'Plain', text: content } as Plain];
};
const isUserMessage = (msg: SessionMessage): boolean => {
function isUserMessage(msg: SessionMessage): boolean {
// Older processing-error records inherited the default user role.
if (msg.status === 'error' && msg.message_content.startsWith('Error: ')) {
return false;
}
if (msg.role === 'assistant') return false;
if (msg.role === 'user') return true;
return !msg.runner_name;
};
}
const renderMessageComponent = (
component: MessageChainComponent,