From 297890b437c4f705ef755dea8f2f50632d9b8b6a Mon Sep 17 00:00:00 2001 From: euvre <93761161+euvre@users.noreply.github.com> Date: Fri, 24 Jul 2026 10:57:34 +0800 Subject: [PATCH] fix: include full conversation details in agent log CSV export (#17291) --- web/src/locales/en.ts | 3 +++ web/src/locales/zh.ts | 3 +++ .../pages/agents/hooks/use-export-agent-log.ts | 16 ++++++++++++++++ 3 files changed, 22 insertions(+) diff --git a/web/src/locales/en.ts b/web/src/locales/en.ts index 71eca01e4d..510c11a1da 100644 --- a/web/src/locales/en.ts +++ b/web/src/locales/en.ts @@ -3407,6 +3407,9 @@ Important structured information may include: names, dates, locations, events, k success: 'Success', failed: 'Failed', logTitle: 'Title', + conversationDetail: 'Conversation detail', + user: 'User', + assistant: 'Assistant', }, llmTools: { bad_calculator: { diff --git a/web/src/locales/zh.ts b/web/src/locales/zh.ts index 7d24c69351..eafda7224d 100644 --- a/web/src/locales/zh.ts +++ b/web/src/locales/zh.ts @@ -2083,6 +2083,9 @@ NER:使用 spaCy NER 和基于规则的关键词提取来抽取实体和关系 agents: '智能体', id: 'ID', logTitle: '标题', + conversationDetail: '对话详情', + user: '用户', + assistant: '助手', state: '状态', number: '轮数', latestDate: '最新日期', diff --git a/web/src/pages/agents/hooks/use-export-agent-log.ts b/web/src/pages/agents/hooks/use-export-agent-log.ts index 59edeaabb2..1866432de8 100644 --- a/web/src/pages/agents/hooks/use-export-agent-log.ts +++ b/web/src/pages/agents/hooks/use-export-agent-log.ts @@ -20,11 +20,26 @@ export const useExportAgentLogToCSV = () => { const { id: canvasId } = useParams(); const { exportLogs, loading } = useExportAgentLog(); + const formatConversation = (item: IAgentLogResponse): string => { + if (!item.message?.length) { + return ''; + } + + const lines = item.message.map((msg) => { + const role = + msg.role === 'assistant' ? t('flow.assistant') : t('flow.user'); + return `${role}: ${msg.content ?? ''}`; + }); + + return lines.join('\n'); + }; + const convertToCSV = (data: IAgentLogResponse[]) => { const headers = [ t('flow.id'), t('flow.userId'), t('flow.logTitle'), + t('flow.conversationDetail'), t('flow.state'), t('flow.number'), t('flow.latestDate'), @@ -36,6 +51,7 @@ export const useExportAgentLogToCSV = () => { item.id, item.user_id, item.message?.length ? item.message[0]?.content : '', + formatConversation(item), item.errors ? t('flow.failed') : t('flow.success'), item.round, item.update_date,