feat: workflow new nodes (#4683)
Co-authored-by: Joel <iamjoel007@gmail.com> Co-authored-by: Patryk Garstecki <patryk20120@yahoo.pl> Co-authored-by: Sebastian.W <thiner@gmail.com> Co-authored-by: 呆萌闷油瓶 <253605712@qq.com> Co-authored-by: takatost <takatost@users.noreply.github.com> Co-authored-by: rechardwang <wh_goodjob@163.com> Co-authored-by: Nite Knite <nkCoding@gmail.com> Co-authored-by: Chenhe Gu <guchenhe@gmail.com> Co-authored-by: Joshua <138381132+joshua20231026@users.noreply.github.com> Co-authored-by: Weaxs <459312872@qq.com> Co-authored-by: Ikko Eltociear Ashimine <eltociear@gmail.com> Co-authored-by: leejoo0 <81673835+leejoo0@users.noreply.github.com> Co-authored-by: JzoNg <jzongcode@gmail.com> Co-authored-by: sino <sino2322@gmail.com> Co-authored-by: Vikey Chen <vikeytk@gmail.com> Co-authored-by: wanghl <Wang-HL@users.noreply.github.com> Co-authored-by: Haolin Wang-汪皓临 <haolin.wang@atlaslovestravel.com> Co-authored-by: Zixuan Cheng <61724187+Theysua@users.noreply.github.com> Co-authored-by: crazywoola <100913391+crazywoola@users.noreply.github.com> Co-authored-by: Bowen Liang <bowenliang@apache.org> Co-authored-by: Bowen Liang <liangbowen@gf.com.cn> Co-authored-by: fanghongtai <42790567+fanghongtai@users.noreply.github.com> Co-authored-by: wxfanghongtai <wxfanghongtai@gf.com.cn> Co-authored-by: Matri <qjp@bithuman.io> Co-authored-by: Benjamin <benjaminx@gmail.com>
This commit is contained in:
@@ -1,20 +1,24 @@
|
||||
import type { FC } from 'react'
|
||||
import { useTranslation } from 'react-i18next'
|
||||
import cn from 'classnames'
|
||||
import { useEffect, useRef, useState } from 'react'
|
||||
import { useClickAway } from 'ahooks'
|
||||
import { useCallback, useEffect, useRef, useState } from 'react'
|
||||
import { useBoolean, useClickAway } from 'ahooks'
|
||||
import IterationResultPanel from '../../workflow/run/iteration-result-panel'
|
||||
import { XClose } from '@/app/components/base/icons/src/vender/line/general'
|
||||
import type { IChatItem } from '@/app/components/app/chat/type'
|
||||
import Run from '@/app/components/workflow/run'
|
||||
import type { NodeTracing } from '@/types/workflow'
|
||||
|
||||
type MessageLogModalProps = {
|
||||
currentLogItem?: IChatItem
|
||||
defaultTab?: string
|
||||
width: number
|
||||
fixedWidth?: boolean
|
||||
onCancel: () => void
|
||||
}
|
||||
const MessageLogModal: FC<MessageLogModalProps> = ({
|
||||
currentLogItem,
|
||||
defaultTab = 'DETAIL',
|
||||
width,
|
||||
fixedWidth,
|
||||
onCancel,
|
||||
@@ -32,6 +36,17 @@ const MessageLogModal: FC<MessageLogModalProps> = ({
|
||||
setMounted(true)
|
||||
}, [])
|
||||
|
||||
const [iterationRunResult, setIterationRunResult] = useState<NodeTracing[][]>([])
|
||||
const [isShowIterationDetail, {
|
||||
setTrue: doShowIterationDetail,
|
||||
setFalse: doHideIterationDetail,
|
||||
}] = useBoolean(false)
|
||||
|
||||
const handleShowIterationDetail = useCallback((detail: NodeTracing[][]) => {
|
||||
setIterationRunResult(detail)
|
||||
doShowIterationDetail()
|
||||
}, [doShowIterationDetail])
|
||||
|
||||
if (!currentLogItem || !currentLogItem.workflow_run_id)
|
||||
return null
|
||||
|
||||
@@ -53,11 +68,28 @@ const MessageLogModal: FC<MessageLogModalProps> = ({
|
||||
}}
|
||||
ref={ref}
|
||||
>
|
||||
<h1 className='shrink-0 px-4 py-1 text-md font-semibold text-gray-900'>{t('appLog.runDetail.title')}</h1>
|
||||
<span className='absolute right-3 top-4 p-1 cursor-pointer z-20' onClick={onCancel}>
|
||||
<XClose className='w-4 h-4 text-gray-500' />
|
||||
</span>
|
||||
<Run hideResult activeTab='DETAIL' runID={currentLogItem.workflow_run_id}/>
|
||||
{isShowIterationDetail
|
||||
? (
|
||||
<IterationResultPanel
|
||||
list={iterationRunResult}
|
||||
onHide={doHideIterationDetail}
|
||||
onBack={doHideIterationDetail}
|
||||
/>
|
||||
)
|
||||
: (
|
||||
<>
|
||||
<h1 className='shrink-0 px-4 py-1 text-md font-semibold text-gray-900'>{t('appLog.runDetail.title')}</h1>
|
||||
<span className='absolute right-3 top-4 p-1 cursor-pointer z-20' onClick={onCancel}>
|
||||
<XClose className='w-4 h-4 text-gray-500' />
|
||||
</span>
|
||||
<Run
|
||||
hideResult activeTab={defaultTab as any}
|
||||
runID={currentLogItem.workflow_run_id}
|
||||
onShowIterationDetail={handleShowIterationDetail}
|
||||
/>
|
||||
</>
|
||||
)}
|
||||
|
||||
</div>
|
||||
)
|
||||
}
|
||||
|
Reference in New Issue
Block a user