import type { FC } from 'react' import type { IChatItem } from '@/app/components/base/chat/chat/type' import { cn } from '@langgenius/dify-ui/cn' import { Dialog, DialogContent, DialogTitle } from '@langgenius/dify-ui/dialog' import { RiCloseLine } from '@remixicon/react' import { useClickAway } from 'ahooks' import { useEffect, useRef, useState } from 'react' import { useTranslation } from 'react-i18next' import AgentLogDetail from './detail' type AgentLogModalProps = Readonly<{ currentLogItem?: IChatItem width: number floating?: boolean onCancel: () => void }> const AgentLogModal: FC = ({ currentLogItem, width, floating, onCancel }) => { const { t } = useTranslation() const ref = useRef(null) const [mounted, setMounted] = useState(false) useClickAway(() => { if (mounted && !floating) onCancel() }, ref) useEffect(() => { setMounted(true) }, []) if (!currentLogItem || !currentLogItem.conversationId) return null const detailContent = ( <> ) if (floating) { return ( { if (!open) onCancel() }} > {t(($) => $['runDetail.workflowTitle'], { ns: 'appLog' })} {detailContent} ) } return (

{t(($) => $['runDetail.workflowTitle'], { ns: 'appLog' })}

{detailContent}
) } export default AgentLogModal