diff --git a/packages/editor-ui/src/components/CanvasChat/CanvasChat.vue b/packages/editor-ui/src/components/CanvasChat/CanvasChat.vue index 4d551a67be..51bf1bf8be 100644 --- a/packages/editor-ui/src/components/CanvasChat/CanvasChat.vue +++ b/packages/editor-ui/src/components/CanvasChat/CanvasChat.vue @@ -52,6 +52,7 @@ const isChatOpen = computed(() => { const result = workflowsStore.isChatPanelOpen; return result; }); +const canvasNodes = computed(() => workflowsStore.allNodes); const isLogsOpen = computed(() => workflowsStore.isLogsPanelOpen); const previousChatMessages = computed(() => workflowsStore.getPastChatMessages); @@ -70,7 +71,7 @@ const { runWorkflow } = useRunWorkflow({ router }); const { chatTriggerNode, connectedNode, allowFileUploads, setChatTriggerNode, setConnectedNode } = useChatTrigger({ workflow, - canvasNodes: workflowsStore.allNodes, + canvasNodes, getNodeByName: workflowsStore.getNodeByName, getNodeType: nodeTypesStore.getNodeType, }); diff --git a/packages/editor-ui/src/components/CanvasChat/composables/useChatTrigger.ts b/packages/editor-ui/src/components/CanvasChat/composables/useChatTrigger.ts index 9ec2e346a6..7d0cff0d8d 100644 --- a/packages/editor-ui/src/components/CanvasChat/composables/useChatTrigger.ts +++ b/packages/editor-ui/src/components/CanvasChat/composables/useChatTrigger.ts @@ -1,5 +1,5 @@ -import type { ComputedRef } from 'vue'; -import { ref, computed } from 'vue'; +import type { ComputedRef, MaybeRef } from 'vue'; +import { ref, computed, unref } from 'vue'; import { CHAIN_SUMMARIZATION_LANGCHAIN_NODE_TYPE, NodeConnectionType, @@ -19,7 +19,7 @@ import type { INodeUi } from '@/Interface'; export interface ChatTriggerDependencies { getNodeByName: (name: string) => INodeUi | null; getNodeType: (type: string, version: number) => INodeTypeDescription | null; - canvasNodes: INodeUi[]; + canvasNodes: MaybeRef; workflow: ComputedRef; } @@ -52,7 +52,7 @@ export function useChatTrigger({ /** Gets the chat trigger node from the workflow */ function setChatTriggerNode() { - const triggerNode = canvasNodes.find((node) => + const triggerNode = unref(canvasNodes).find((node) => [CHAT_TRIGGER_NODE_TYPE, MANUAL_CHAT_TRIGGER_NODE_TYPE].includes(node.type), );