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

pull/12372/head
AkaraChen 1 year ago
commit 5f13402c6e

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

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

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

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

Loading…
Cancel
Save