From 4aaebfd4358f590e98c453ad4e65cc2c9d0f76f8 Mon Sep 17 00:00:00 2001 From: oleg Date: Fri, 11 Oct 2024 09:47:10 +0200 Subject: [PATCH] fix(editor): Fix chat crashing when rendering output-parsed content (#11210) --- .../src/components/WorkflowLMChat/WorkflowLMChat.vue | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/packages/editor-ui/src/components/WorkflowLMChat/WorkflowLMChat.vue b/packages/editor-ui/src/components/WorkflowLMChat/WorkflowLMChat.vue index b4d082e7bd..cd889278f8 100644 --- a/packages/editor-ui/src/components/WorkflowLMChat/WorkflowLMChat.vue +++ b/packages/editor-ui/src/components/WorkflowLMChat/WorkflowLMChat.vue @@ -384,7 +384,12 @@ function extractResponseMessage(responseData?: IDataObject) { if (!matchedPath) return JSON.stringify(responseData, null, 2); - return get(responseData, matchedPath) as string; + const matchedOutput = get(responseData, matchedPath); + if (typeof matchedOutput === 'object') { + return '```json\n' + JSON.stringify(matchedOutput, null, 2) + '\n```'; + } + + return matchedOutput?.toString() ?? ''; } async function sendMessage(message: string, files?: File[]) {