From 22994a6d145de3a209cbde3e5a81067a89e97641 Mon Sep 17 00:00:00 2001 From: sino Date: Mon, 15 Apr 2024 15:49:53 +0800 Subject: [PATCH] fix: stringify object while exporting batch result to csv (#3481) --- web/app/components/share/text-generation/index.tsx | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/web/app/components/share/text-generation/index.tsx b/web/app/components/share/text-generation/index.tsx index 58d9b42e4..1a88fcddd 100644 --- a/web/app/components/share/text-generation/index.tsx +++ b/web/app/components/share/text-generation/index.tsx @@ -174,7 +174,12 @@ const TextGeneration: FC = ({ promptConfig?.prompt_variables.forEach((v) => { res[v.name] = inputs[v.key] }) - res[t('share.generation.completionResult')] = batchCompletionResLatest[task.id] + let result = batchCompletionResLatest[task.id] + // task might return multiple fields, should marshal object to string + if (typeof batchCompletionResLatest[task.id] === 'object') + result = JSON.stringify(result) + + res[t('share.generation.completionResult')] = result return res }) const checkBatchInputs = (data: string[][]) => {