fix(editor): Fix error rendering and indexing of LLM sub-node outputs (#10688)

This commit is contained in:
oleg
2024-09-11 16:17:13 +02:00
committed by GitHub
parent 5c47a5f691
commit 50459bacab
4 changed files with 69 additions and 31 deletions

View File

@@ -56,6 +56,7 @@ import { useWorkflowsStore } from '@/stores/workflows.store';
import { useNDVStore } from '@/stores/ndv.store';
import { useNodeTypesStore } from '@/stores/nodeTypes.store';
import { useNodeHelpers } from '@/composables/useNodeHelpers';
import { useNodeType } from '@/composables/useNodeType';
import { useToast } from '@/composables/useToast';
import { isEqual, isObject } from 'lodash-es';
import { useExternalHooks } from '@/composables/useExternalHooks';
@@ -171,12 +172,16 @@ export default defineComponent({
runIndex: props.runIndex,
displayMode: ndvStore.getPanelDisplayMode(props.paneType),
});
const { isSubNodeType } = useNodeType({
node,
});
return {
...useToast(),
externalHooks,
nodeHelpers,
pinnedData,
isSubNodeType,
};
},
data() {
@@ -308,6 +313,12 @@ export default defineComponent({
if (!this.node) {
return null;
}
// If the node is a sub-node, we need to get the parent node error to check for input errors
if (this.isSubNodeType && this.paneType === 'input') {
const parentNode = this.workflow.getChildNodes(this.node?.name ?? '', 'ALL_NON_MAIN')[0];
return this.workflowRunData?.[parentNode]?.[this.runIndex]?.error as NodeError;
}
return this.workflowRunData?.[this.node?.name]?.[this.runIndex]?.error as NodeError;
},
hasRunError(): boolean {