From 586f9d8d891c17efe2e1958a97abf2762f9c59f9 Mon Sep 17 00:00:00 2001 From: zxhlyh Date: Wed, 8 Jan 2025 16:46:07 +0800 Subject: [PATCH] fix: agent log --- .../workflow/run/agent-log/agent-log-item.tsx | 2 +- .../workflow/run/agent-log/agent-log-nav.tsx | 55 +++++++++++++------ .../run/agent-log/agent-log-trigger.tsx | 6 +- .../run/agent-log/agent-result-panel.tsx | 10 ++-- web/i18n/en-US/run-log.ts | 2 + web/i18n/zh-Hans/run-log.ts | 2 + 6 files changed, 53 insertions(+), 24 deletions(-) diff --git a/web/app/components/workflow/run/agent-log/agent-log-item.tsx b/web/app/components/workflow/run/agent-log/agent-log-item.tsx index 8403dd68dc..36b1d78bc6 100644 --- a/web/app/components/workflow/run/agent-log/agent-log-item.tsx +++ b/web/app/components/workflow/run/agent-log/agent-log-item.tsx @@ -27,7 +27,7 @@ const AgentLogItem = ({ const [expanded, setExpanded] = useState(false) return ( -
+
{ - const options = agentOrToolLogItemStack.slice(2) + const { t } = useTranslation() + const agentOrToolLogItemStackLength = agentOrToolLogItemStack.length + const first = agentOrToolLogItemStack[0] + const mid = agentOrToolLogItemStack.slice(1, -1) + const end = agentOrToolLogItemStack.at(-1) return ( -
+
/
- { - !!options.length && ( + agentOrToolLogItemStackLength > 1 + ? ( + + ) + : ( +
+ {t('workflow.nodes.agent.strategy.label')} +
+ ) + } + { + !!mid.length && ( <>
/
) } -
/
-
- Run Actions -
+ { + !!end && agentOrToolLogItemStackLength > 2 && ( + <> +
/
+
+ {end.label} +
+ + ) + }
) } diff --git a/web/app/components/workflow/run/agent-log/agent-log-trigger.tsx b/web/app/components/workflow/run/agent-log/agent-log-trigger.tsx index 987c3afc2a..589624f559 100644 --- a/web/app/components/workflow/run/agent-log/agent-log-trigger.tsx +++ b/web/app/components/workflow/run/agent-log/agent-log-trigger.tsx @@ -1,4 +1,5 @@ import { RiArrowRightLine } from '@remixicon/react' +import { useTranslation } from 'react-i18next' import type { AgentLogItemWithChildren, NodeTracing, @@ -12,12 +13,13 @@ const AgentLogTrigger = ({ nodeInfo, onShowAgentOrToolLog, }: AgentLogTriggerProps) => { + const { t } = useTranslation() const { agentLog } = nodeInfo return (
- Agent strategy + {t('workflow.nodes.agent.strategy.label')}
@@ -28,7 +30,7 @@ const AgentLogTrigger = ({ onShowAgentOrToolLog({ id: nodeInfo.id, children: agentLog || [] } as AgentLogItemWithChildren) }} > - Detail + {t('runLog.detail')}
diff --git a/web/app/components/workflow/run/agent-log/agent-result-panel.tsx b/web/app/components/workflow/run/agent-log/agent-result-panel.tsx index d02e69f8da..e2d2b24966 100644 --- a/web/app/components/workflow/run/agent-log/agent-result-panel.tsx +++ b/web/app/components/workflow/run/agent-log/agent-result-panel.tsx @@ -1,4 +1,5 @@ import { RiAlertFill } from '@remixicon/react' +import { useTranslation } from 'react-i18next' import AgentLogItem from './agent-log-item' import AgentLogNav from './agent-log-nav' import type { AgentLogItemWithChildren } from '@/types/workflow' @@ -13,17 +14,18 @@ const AgentResultPanel = ({ agentOrToolLogListMap, onShowAgentOrToolLog, }: AgentResultPanelProps) => { + const { t } = useTranslation() const top = agentOrToolLogItemStack[agentOrToolLogItemStack.length - 1] const list = agentOrToolLogListMap[top.id] return ( -
+
{ -
+
{ list.map(item => ( +
- There is circular invocation of tools/nodes in the current workflow. + {t('runLog.circularInvocationTip')}
) diff --git a/web/i18n/en-US/run-log.ts b/web/i18n/en-US/run-log.ts index 33fe5c1735..3c851f4548 100644 --- a/web/i18n/en-US/run-log.ts +++ b/web/i18n/en-US/run-log.ts @@ -24,6 +24,8 @@ const translation = { link: 'detail panel', tipRight: ' view it.', }, + actionLogs: 'Action Logs', + circularInvocationTip: 'There is circular invocation of tools/nodes in the current workflow.', } export default translation diff --git a/web/i18n/zh-Hans/run-log.ts b/web/i18n/zh-Hans/run-log.ts index 225874d827..dc93e9aeb0 100644 --- a/web/i18n/zh-Hans/run-log.ts +++ b/web/i18n/zh-Hans/run-log.ts @@ -24,6 +24,8 @@ const translation = { link: '详细信息面板', tipRight: '查看它。', }, + actionLogs: 'Action 日志', + circularInvocationTip: '当前工作流中存在工具/节点的循环调用。', } export default translation