agent-log-trigger.tsx 1.5 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950
  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='bg-components-button-tertiary-bg rounded-[10px] cursor-pointer'
  21. onClick={() => {
  22. onShowAgentOrToolLog({ id: nodeInfo.id, children: agentLog || [] } as AgentLogItemWithChildren)
  23. }}
  24. >
  25. <div className='flex items-center px-3 pt-2 system-2xs-medium-uppercase text-text-tertiary'>
  26. {t('workflow.nodes.agent.strategy.label')}
  27. </div>
  28. <div className='flex items-center pl-3 pt-1 pr-2 pb-1.5'>
  29. {
  30. agentStrategy && (
  31. <div className='grow system-xs-medium text-text-secondary'>
  32. {agentStrategy}
  33. </div>
  34. )
  35. }
  36. <div
  37. className='shrink-0 flex items-center px-[1px] system-xs-regular-uppercase text-text-tertiary cursor-pointer'
  38. >
  39. {t('runLog.detail')}
  40. <RiArrowRightLine className='ml-0.5 w-3.5 h-3.5' />
  41. </div>
  42. </div>
  43. </div>
  44. )
  45. }
  46. export default AgentLogTrigger