Feat: Display error messages from intermediate nodes. #10427 (#12038)

### What problem does this PR solve?

Feat: Display error messages from intermediate nodes. #10427

### Type of change


- [x] New Feature (non-breaking change which adds functionality)
This commit is contained in:
balibabu
2025-12-19 17:44:45 +08:00
committed by GitHub
parent 8683a5b1b7
commit 0494b92371
2 changed files with 29 additions and 2 deletions

View File

@ -182,6 +182,7 @@ export default function Agent() {
const handleButtonRunClick = useCallback(() => { const handleButtonRunClick = useCallback(() => {
if (isWebhookMode) { if (isWebhookMode) {
saveGraph();
showWebhookTestSheet(); showWebhookTestSheet();
} else if (isPipeline) { } else if (isPipeline) {
handleRunPipeline(); handleRunPipeline();
@ -193,6 +194,7 @@ export default function Agent() {
handleRunPipeline, handleRunPipeline,
isPipeline, isPipeline,
isWebhookMode, isWebhookMode,
saveGraph,
showWebhookTestSheet, showWebhookTestSheet,
]); ]);

View File

@ -10,6 +10,8 @@ import { useFetchWebhookTrace } from '@/hooks/use-agent-request';
import { MessageEventType } from '@/hooks/use-send-message'; import { MessageEventType } from '@/hooks/use-send-message';
import { IModalProps } from '@/interfaces/common'; import { IModalProps } from '@/interfaces/common';
import { cn } from '@/lib/utils'; import { cn } from '@/lib/utils';
import { upperFirst } from 'lodash';
import { useMemo } from 'react';
import { useTranslation } from 'react-i18next'; import { useTranslation } from 'react-i18next';
import { useParams } from 'umi'; import { useParams } from 'umi';
import { BeginId } from '../constant'; import { BeginId } from '../constant';
@ -42,6 +44,23 @@ const WebhookSheet = ({ hideModal }: RunSheetProps) => {
event.data.component_id !== BeginId, event.data.component_id !== BeginId,
)?.data.outputs; )?.data.outputs;
const statusInfo = useMemo(() => {
if (data?.finished === false) {
return { status: 'running' };
}
let errorItem = data?.events.find(
(x) => x.event === 'error' || x.data?.error,
);
if (errorItem) {
return {
status: 'fail',
message: errorItem.data?.error || errorItem.message,
};
}
return { status: 'success' };
}, [data?.events, data?.finished]);
return ( return (
<Sheet onOpenChange={hideModal} open modal={false}> <Sheet onOpenChange={hideModal} open modal={false}>
<SheetContent className={cn('top-20 p-2 space-y-5 flex flex-col pb-20')}> <SheetContent className={cn('top-20 p-2 space-y-5 flex flex-col pb-20')}>
@ -55,9 +74,15 @@ const WebhookSheet = ({ hideModal }: RunSheetProps) => {
</div> </div>
<section> <section>
<div className="text-state-success"> <div
{data?.finished ? 'SUCCESS' : 'RUNNING'} className={cn({
'text-state-error': statusInfo.status === 'fail',
'text-state-success': statusInfo.status === 'success',
})}
>
{upperFirst(statusInfo.status)}
</div> </div>
<div>{statusInfo?.message}</div>
</section> </section>
<Tabs <Tabs