agent-log-trigger.tsx 1.5 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849
  1. import { RiArrowRightLine } from '@remixicon/react'
  2. import { useTranslation } from 'react-i18next'
  3. import type {
  4. AgentLogItemWithChildren,
  5. NodeTracing,
  6. } from '@/types/workflow'
  7. type AgentLogTriggerProps = {
  8. nodeInfo: NodeTracing
  9. onShowAgentOrToolLog: (detail?: AgentLogItemWithChildren) => void
  10. }
  11. const AgentLogTrigger = ({
  12. nodeInfo,
  13. onShowAgentOrToolLog,
  14. }: AgentLogTriggerProps) => {
  15. const { t } = useTranslation()
  16. const { agentLog, execution_metadata } = nodeInfo
  17. const agentStrategy = execution_metadata?.tool_info?.agent_strategy
  18. return (
  19. <div
  20. className='cursor-pointer rounded-[10px] bg-components-button-tertiary-bg'
  21. onClick={() => {
  22. onShowAgentOrToolLog({ id: nodeInfo.id, children: agentLog || [] } as AgentLogItemWithChildren)
  23. }}
  24. >
  25. <div className='system-2xs-medium-uppercase flex items-center px-3 pt-2 text-text-tertiary'>
  26. {t('workflow.nodes.agent.strategy.label')}
  27. </div>
  28. <div className='flex items-center pb-1.5 pl-3 pr-2 pt-1'>
  29. {
  30. agentStrategy && (
  31. <div className='system-xs-medium grow text-text-secondary'>
  32. {agentStrategy}
  33. </div>
  34. )
  35. }
  36. <div
  37. className='system-xs-regular-uppercase flex shrink-0 cursor-pointer items-center px-[1px] text-text-tertiary'
  38. >
  39. {t('runLog.detail')}
  40. <RiArrowRightLine className='ml-0.5 h-3.5 w-3.5' />
  41. </div>
  42. </div>
  43. </div>
  44. )
  45. }
  46. export default AgentLogTrigger