dify/web/app/components/workflow/run/agent-log/agent-log-nav.tsx
盐粒 Yanli 3f2d22ec0f
feat(agent-v2): sync nightly updates to main (#37599)
Co-authored-by: Jingyi-Dify <jingyi.qi@dify.ai>
Co-authored-by: yyh <yuanyouhuilyz@gmail.com>
Co-authored-by: Joel <iamjoel007@gmail.com>
Co-authored-by: autofix-ci[bot] <114827586+autofix-ci[bot]@users.noreply.github.com>
Co-authored-by: hjlarry <hjlarry@163.com>
Co-authored-by: Bond Zhu <783504079@qq.com>
Co-authored-by: Yansong Zhang <916125788@qq.com>
Co-authored-by: yyh <92089059+lyzno1@users.noreply.github.com>
2026-06-18 05:03:34 +00:00

76 lines
2.4 KiB
TypeScript

import type { AgentLogItemWithChildren } from '@/types/workflow'
import { Button } from '@langgenius/dify-ui/button'
import { useTranslation } from 'react-i18next'
import AgentLogNavMore from './agent-log-nav-more'
type AgentLogNavProps = {
agentOrToolLogItemStack: AgentLogItemWithChildren[]
onShowAgentOrToolLog: (detail?: AgentLogItemWithChildren) => void
}
export function AgentLogNav({
agentOrToolLogItemStack,
onShowAgentOrToolLog,
}: AgentLogNavProps) {
const { t } = useTranslation()
const agentOrToolLogItemStackLength = agentOrToolLogItemStack.length
const first = agentOrToolLogItemStack[0]
const mid = agentOrToolLogItemStack.slice(1, -1)
const end = agentOrToolLogItemStack.at(-1)
return (
<div className="flex h-8 items-center bg-components-panel-bg p-1 pr-3">
<Button
className="shrink-0 px-[5px]"
size="small"
variant="ghost-accent"
onClick={() => {
onShowAgentOrToolLog()
}}
>
<span aria-hidden className="mr-1 i-ri-arrow-left-line size-3.5" />
AGENT
</Button>
<div className="mx-0.5 shrink-0 system-xs-regular text-divider-deep">/</div>
{
agentOrToolLogItemStackLength > 1
? (
<Button
className="shrink-0 px-[5px]"
size="small"
variant="ghost-accent"
onClick={() => onShowAgentOrToolLog(first)}
>
{t('nodes.agent.strategy.label', { ns: 'workflow' })}
</Button>
)
: (
<div className="flex items-center px-1.25 system-xs-medium-uppercase text-text-tertiary">
{t('nodes.agent.strategy.label', { ns: 'workflow' })}
</div>
)
}
{
!!mid.length && (
<>
<div className="mx-0.5 shrink-0 system-xs-regular text-divider-deep">/</div>
<AgentLogNavMore
options={mid}
onShowAgentOrToolLog={onShowAgentOrToolLog}
/>
</>
)
}
{
!!end && agentOrToolLogItemStackLength > 1 && (
<>
<div className="mx-0.5 shrink-0 system-xs-regular text-divider-deep">/</div>
<div className="flex items-center px-[5px] system-xs-medium-uppercase text-text-tertiary">
{end.label}
</div>
</>
)
}
</div>
)
}