From f44796142ff1d364b277c736eb3ed8929a513b0c Mon Sep 17 00:00:00 2001 From: Michael Kret Date: Wed, 13 Mar 2024 11:38:56 +0200 Subject: [PATCH 1/2] :zap: exclude summarization node from valid ai nodes, error message update --- packages/editor-ui/src/components/WorkflowLMChat.vue | 4 +++- packages/editor-ui/src/constants.ts | 2 ++ 2 files changed, 5 insertions(+), 1 deletion(-) diff --git a/packages/editor-ui/src/components/WorkflowLMChat.vue b/packages/editor-ui/src/components/WorkflowLMChat.vue index 14badd2de527d..53941274f66d1 100644 --- a/packages/editor-ui/src/components/WorkflowLMChat.vue +++ b/packages/editor-ui/src/components/WorkflowLMChat.vue @@ -128,6 +128,7 @@ import { AI_CATEGORY_CHAINS, AI_CODE_NODE_TYPE, AI_SUBCATEGORY, + CHAIN_SUMMARIZATION_LANGCHAIN_NODE_TYPE, CHAT_EMBED_MODAL_KEY, CHAT_TRIGGER_NODE_TYPE, MANUAL_CHAT_TRIGGER_NODE_TYPE, @@ -297,6 +298,7 @@ export default defineComponent({ const workflow = this.workflowHelpers.getCurrentWorkflow(); const chatNode = this.workflowsStore.getNodes().find((node: INodeUi): boolean => { + if (node.type === CHAIN_SUMMARIZATION_LANGCHAIN_NODE_TYPE) return false; const nodeType = this.nodeTypesStore.getNodeType(node.type, node.typeVersion); if (!nodeType) return false; @@ -335,7 +337,7 @@ export default defineComponent({ if (!chatNode) { this.showError( new Error( - 'Chat only works when an AI agent or chain is connected to the chat trigger node', + 'Chat only works when an AI agent or chain(except summarization chain) is connected to the chat trigger node', ), 'Missing AI node', ); diff --git a/packages/editor-ui/src/constants.ts b/packages/editor-ui/src/constants.ts index 4696fb720790e..38be7f0fdb98b 100644 --- a/packages/editor-ui/src/constants.ts +++ b/packages/editor-ui/src/constants.ts @@ -181,6 +181,8 @@ export const CRYPTO_NODE_TYPE = 'n8n-nodes-base.crypto'; export const RSS_READ_NODE_TYPE = 'n8n-nodes-base.rssFeedRead'; export const COMPRESSION_NODE_TYPE = 'n8n-nodes-base.compression'; export const EDIT_IMAGE_NODE_TYPE = 'n8n-nodes-base.editImage'; +export const CHAIN_SUMMARIZATION_LANGCHAIN_NODE_TYPE = + '@n8n/n8n-nodes-langchain.chainSummarization'; export const CREDENTIAL_ONLY_NODE_PREFIX = 'n8n-creds-base'; export const CREDENTIAL_ONLY_HTTP_NODE_VERSION = 4.1; From 4701974558814499366ea15a4c1e108c077ecd72 Mon Sep 17 00:00:00 2001 From: Michael Kret Date: Wed, 13 Mar 2024 18:35:06 +0200 Subject: [PATCH 2/2] :zap: test fix --- .../src/components/__tests__/WorkflowLMChatModal.test.ts | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/packages/editor-ui/src/components/__tests__/WorkflowLMChatModal.test.ts b/packages/editor-ui/src/components/__tests__/WorkflowLMChatModal.test.ts index 85c56750d0833..34dc0ceb962a8 100644 --- a/packages/editor-ui/src/components/__tests__/WorkflowLMChatModal.test.ts +++ b/packages/editor-ui/src/components/__tests__/WorkflowLMChatModal.test.ts @@ -105,7 +105,7 @@ describe('WorkflowLMChatModal', () => { await waitFor(() => expect(document.querySelectorAll('.el-notification')[0]).toHaveTextContent( - 'Missing AI node Chat only works when an AI agent or chain is connected to the chat trigger node', + 'Missing AI node Chat only works when an AI agent or chain(except summarization chain) is connected to the chat trigger node', ), ); }); @@ -120,7 +120,7 @@ describe('WorkflowLMChatModal', () => { await waitFor(() => expect(document.querySelectorAll('.el-notification')[1]).toHaveTextContent( - 'Missing AI node Chat only works when an AI agent or chain is connected to the chat trigger node', + 'Missing AI node Chat only works when an AI agent or chain(except summarization chain) is connected to the chat trigger node', ), ); });