From 6b48f69f88a6244957e0decacf8b9cda31c8875d Mon Sep 17 00:00:00 2001 From: SyncWithRaj Date: Mon, 20 Apr 2026 22:49:31 +0530 Subject: [PATCH 1/2] fix: include chatbotConfig to retain Starter Prompts during Workspace export --- packages/ui/src/utils/exportImport.js | 12 +++++++++++- 1 file changed, 11 insertions(+), 1 deletion(-) diff --git a/packages/ui/src/utils/exportImport.js b/packages/ui/src/utils/exportImport.js index a9361a7faac..4ed51f61c24 100644 --- a/packages/ui/src/utils/exportImport.js +++ b/packages/ui/src/utils/exportImport.js @@ -23,12 +23,22 @@ const sanitizeChatflow = (ChatFlow) => { try { return ChatFlow.map((chatFlow) => { const sanitizeFlowData = generateExportFlowData(JSON.parse(chatFlow.flowData)) - return { + const sanitized = { id: chatFlow.id, name: chatFlow.name, flowData: stringify(sanitizeFlowData), type: chatFlow.type } + if (chatFlow.chatbotConfig) sanitized.chatbotConfig = chatFlow.chatbotConfig + if (chatFlow.category) sanitized.category = chatFlow.category + if (chatFlow.speechToText) sanitized.speechToText = chatFlow.speechToText + if (chatFlow.textToSpeech) sanitized.textToSpeech = chatFlow.textToSpeech + if (chatFlow.followUpPrompts) sanitized.followUpPrompts = chatFlow.followUpPrompts + if (chatFlow.apiConfig) sanitized.apiConfig = chatFlow.apiConfig + if (chatFlow.analytic) sanitized.analytic = chatFlow.analytic + if (chatFlow.isPublic !== undefined) sanitized.isPublic = chatFlow.isPublic + if (chatFlow.apikeyid) sanitized.apikeyid = chatFlow.apikeyid + return sanitized }) } catch (error) { throw new Error(`exportImport.sanitizeChatflow ${getErrorMessage(error)}`) From 33a74712f4e5c2d20c1ef5f592314c6c7b887626 Mon Sep 17 00:00:00 2001 From: SyncWithRaj Date: Mon, 20 Apr 2026 23:14:16 +0530 Subject: [PATCH 2/2] refactor: address Gemini and CodeRabbit reviews by hoisting constants and using nullish checks --- packages/ui/src/utils/exportImport.js | 29 ++++++++++++++++++--------- 1 file changed, 20 insertions(+), 9 deletions(-) diff --git a/packages/ui/src/utils/exportImport.js b/packages/ui/src/utils/exportImport.js index 4ed51f61c24..59bab61e8d9 100644 --- a/packages/ui/src/utils/exportImport.js +++ b/packages/ui/src/utils/exportImport.js @@ -19,6 +19,19 @@ const sanitizeTool = (Tool) => { } } +const CHATFLOW_FIELDS_TO_PRESERVE = [ + 'chatbotConfig', + 'category', + 'speechToText', + 'textToSpeech', + 'followUpPrompts', + 'apiConfig', + 'analytic', + 'isPublic', + 'apikeyid', + 'mcpServerConfig' +] + const sanitizeChatflow = (ChatFlow) => { try { return ChatFlow.map((chatFlow) => { @@ -29,15 +42,13 @@ const sanitizeChatflow = (ChatFlow) => { flowData: stringify(sanitizeFlowData), type: chatFlow.type } - if (chatFlow.chatbotConfig) sanitized.chatbotConfig = chatFlow.chatbotConfig - if (chatFlow.category) sanitized.category = chatFlow.category - if (chatFlow.speechToText) sanitized.speechToText = chatFlow.speechToText - if (chatFlow.textToSpeech) sanitized.textToSpeech = chatFlow.textToSpeech - if (chatFlow.followUpPrompts) sanitized.followUpPrompts = chatFlow.followUpPrompts - if (chatFlow.apiConfig) sanitized.apiConfig = chatFlow.apiConfig - if (chatFlow.analytic) sanitized.analytic = chatFlow.analytic - if (chatFlow.isPublic !== undefined) sanitized.isPublic = chatFlow.isPublic - if (chatFlow.apikeyid) sanitized.apikeyid = chatFlow.apikeyid + + CHATFLOW_FIELDS_TO_PRESERVE.forEach((field) => { + if (chatFlow[field] != null) { + sanitized[field] = chatFlow[field] + } + }) + return sanitized }) } catch (error) {