dify/web/app/components/workflow/run/agent-log/agent-result-panel.tsx

61 lines
2.0 KiB
TypeScript
Raw Normal View History

2024-12-31 14:02:50 +08:00
import { RiAlertFill } from '@remixicon/react'
2025-01-08 16:46:07 +08:00
import { useTranslation } from 'react-i18next'
2024-12-26 15:44:40 +08:00
import AgentLogItem from './agent-log-item'
2024-12-27 16:17:44 +08:00
import AgentLogNav from './agent-log-nav'
2024-12-26 15:44:40 +08:00
import type { AgentLogItemWithChildren } from '@/types/workflow'
2024-12-25 16:14:51 +08:00
type AgentResultPanelProps = {
2024-12-31 14:02:50 +08:00
agentOrToolLogItemStack: AgentLogItemWithChildren[]
2024-12-30 10:23:03 +08:00
agentOrToolLogListMap: Record<string, AgentLogItemWithChildren[]>
2024-12-30 11:14:28 +08:00
onShowAgentOrToolLog: (detail?: AgentLogItemWithChildren) => void
2024-12-25 16:14:51 +08:00
}
const AgentResultPanel = ({
2024-12-30 11:14:28 +08:00
agentOrToolLogItemStack,
2024-12-30 10:23:03 +08:00
agentOrToolLogListMap,
onShowAgentOrToolLog,
2024-12-25 16:14:51 +08:00
}: AgentResultPanelProps) => {
2025-01-08 16:46:07 +08:00
const { t } = useTranslation()
2024-12-30 11:14:28 +08:00
const top = agentOrToolLogItemStack[agentOrToolLogItemStack.length - 1]
const list = agentOrToolLogListMap[top.id]
2024-12-30 10:23:03 +08:00
2024-12-25 16:14:51 +08:00
return (
2025-01-08 16:46:07 +08:00
<div className='bg-background-section overflow-y-auto'>
2024-12-30 11:14:28 +08:00
<AgentLogNav
agentOrToolLogItemStack={agentOrToolLogItemStack}
onShowAgentOrToolLog={onShowAgentOrToolLog}
/>
2024-12-26 15:44:40 +08:00
{
2025-01-08 16:46:07 +08:00
<div className='p-2 space-y-1'>
2024-12-26 15:44:40 +08:00
{
list.map(item => (
<AgentLogItem
key={item.id}
item={item}
2024-12-30 10:23:03 +08:00
onShowAgentOrToolLog={onShowAgentOrToolLog}
2024-12-26 15:44:40 +08:00
/>
))
}
</div>
}
2024-12-31 14:02:50 +08:00
{
top.hasCircle && (
2025-01-08 16:46:07 +08:00
<div className='flex items-center mt-1 rounded-xl px-3 pr-2 border border-components-panel-border bg-components-panel-bg-blur shadow-md'>
2024-12-31 14:02:50 +08:00
<div
className='absolute inset-0 opacity-[0.4] rounded-xl'
style={{
background: 'linear-gradient(92deg, rgba(247, 144, 9, 0.25) 0%, rgba(255, 255, 255, 0.00) 100%)',
}}
></div>
<RiAlertFill className='mr-1.5 w-4 h-4 text-text-warning-secondary' />
<div className='system-xs-medium text-text-primary'>
2025-01-08 16:46:07 +08:00
{t('runLog.circularInvocationTip')}
2024-12-31 14:02:50 +08:00
</div>
</div>
)
}
2024-12-25 16:14:51 +08:00
</div>
)
}
export default AgentResultPanel