Merge branch 'feat/plugins' of https://github.com/langgenius/dify into feat/plugins

This commit is contained in:
AkaraChen 2024-12-26 10:17:21 +08:00
commit 5f13402c6e
4 changed files with 41 additions and 2 deletions

View File

@ -28,14 +28,20 @@ export const useLogs = () => {
setIterationResultDurationMap(iterDurationMap)
}, [setShowIteratingDetailTrue, setIterationResultList, setIterationResultDurationMap])
const [showAgentDetail, {
setTrue: setShowAgentDetailTrue,
setFalse: setShowAgentDetailFalse,
}] = useBoolean(false)
return {
showSpecialResultPanel: !showRetryDetail && !showIteratingDetail,
showSpecialResultPanel: showRetryDetail || showIteratingDetail,
showRetryDetail,
setShowRetryDetailTrue,
setShowRetryDetailFalse,
retryResultList,
setRetryResultList,
handleShowRetryResultList,
showIteratingDetail,
setShowIteratingDetailTrue,
setShowIteratingDetailFalse,
@ -44,5 +50,9 @@ export const useLogs = () => {
iterationResultDurationMap,
setIterationResultDurationMap,
handleShowIterationResultList,
showAgentDetail,
setShowAgentDetailTrue,
setShowAgentDetailFalse,
}
}

View File

@ -106,16 +106,21 @@ const RunPanel: FC<RunProps> = ({ hideResult, activeTab = 'RESULT', runID, getRe
}, [loading])
const {
showSpecialResultPanel,
showRetryDetail,
setShowRetryDetailFalse,
retryResultList,
handleShowRetryResultList,
showIteratingDetail,
setShowIteratingDetailFalse,
iterationResultList,
iterationResultDurationMap,
handleShowIterationResultList,
showSpecialResultPanel,
showAgentDetail,
setShowAgentDetailFalse,
} = useLogs()
return (
@ -193,6 +198,9 @@ const RunPanel: FC<RunProps> = ({ hideResult, activeTab = 'RESULT', runID, getRe
setShowIteratingDetailFalse={setShowIteratingDetailFalse}
iterationResultList={iterationResultList}
iterationResultDurationMap={iterationResultDurationMap}
showAgentDetail={showAgentDetail}
setShowAgentDetailFalse={setShowAgentDetailFalse}
/>
)
}

View File

@ -13,6 +13,7 @@ import BlockIcon from '../block-icon'
import { BlockEnum } from '../types'
import { RetryLogTrigger } from './retry-log'
import { IterationLogTrigger } from './iteration-log'
import { AgentLogTrigger } from './agent-log'
import cn from '@/utils/classnames'
import StatusContainer from '@/app/components/workflow/run/status-container'
import CodeEditor from '@/app/components/workflow/nodes/_base/components/editor/code-editor'
@ -76,6 +77,7 @@ const NodePanel: FC<Props> = ({
const isIterationNode = nodeInfo.node_type === BlockEnum.Iteration
const isRetryNode = hasRetryNode(nodeInfo.node_type) && nodeInfo.retryDetail
const isAgentNode = nodeInfo.node_type === BlockEnum.Agent
return (
<div className={cn('px-2 py-1', className)}>
@ -139,6 +141,11 @@ const NodePanel: FC<Props> = ({
onShowRetryResultList={onShowRetryDetail}
/>
)}
{
isAgentNode && (
<AgentLogTrigger />
)
}
<div className={cn('mb-1', hideInfo && '!px-2 !py-0.5')}>
{(nodeInfo.status === 'stopped') && (
<StatusContainer status='stopped'>

View File

@ -1,5 +1,6 @@
import { RetryResultPanel } from './retry-log'
import { IterationResultPanel } from './iteration-log'
import { AgentResultPanel } from './agent-log'
import type { IterationDurationMap, NodeTracing } from '@/types/workflow'
type SpecialResultPanelProps = {
@ -11,6 +12,9 @@ type SpecialResultPanelProps = {
setShowIteratingDetailFalse: () => void
iterationResultList: NodeTracing[][]
iterationResultDurationMap: IterationDurationMap
showAgentDetail: boolean
setShowAgentDetailFalse: () => void
}
const SpecialResultPanel = ({
showRetryDetail,
@ -21,6 +25,9 @@ const SpecialResultPanel = ({
setShowIteratingDetailFalse,
iterationResultList,
iterationResultDurationMap,
showAgentDetail,
setShowAgentDetailFalse,
}: SpecialResultPanelProps) => {
return (
<>
@ -42,6 +49,13 @@ const SpecialResultPanel = ({
/>
)
}
{
showAgentDetail && (
<AgentResultPanel
onBack={setShowAgentDetailFalse}
/>
)
}
</>
)
}