fix(editor): Fix canvasNodes reactivity in canvas chat (no-changelog) (#11717)

This commit is contained in:
oleg 2024-11-13 15:33:02 +01:00 committed by GitHub
parent ca8cb455ba
commit b22142ddb8
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
2 changed files with 6 additions and 5 deletions

View file

@ -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,
});

View file

@ -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<INodeUi[]>;
workflow: ComputedRef<Workflow>;
}
@ -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),
);