mirror of
https://github.com/Comfy-Org/ComfyUI_frontend.git
synced 2026-02-09 17:40:09 +00:00
@@ -8,12 +8,9 @@ import {
|
||||
} from '@/schemas/apiSchema'
|
||||
import { api } from '@/scripts/api'
|
||||
import { app } from '@/scripts/app'
|
||||
import type { NodeExecutionId } from '@/types'
|
||||
import { parseFilePath } from '@/utils/formatUtil'
|
||||
import { isVideoNode } from '@/utils/litegraphUtil'
|
||||
|
||||
import { useExecutionStore } from './executionStore'
|
||||
|
||||
const createOutputs = (
|
||||
filenames: string[],
|
||||
type: ResultItemType,
|
||||
@@ -26,20 +23,16 @@ const createOutputs = (
|
||||
}
|
||||
|
||||
export const useNodeOutputStore = defineStore('nodeOutput', () => {
|
||||
const executionStore = useExecutionStore()
|
||||
const getMostRecentExecutionId = (node: LGraphNode): NodeExecutionId =>
|
||||
executionStore.locatorIdToExecutionIdMap.get(
|
||||
executionStore.getNodeLocatorId(node)
|
||||
) ?? node.id.toString()
|
||||
const getNodeId = (node: LGraphNode): string => node.id.toString()
|
||||
|
||||
function getNodeOutputs(
|
||||
node: LGraphNode
|
||||
): ExecutedWsMessage['output'] | undefined {
|
||||
return app.nodeOutputs[getMostRecentExecutionId(node)]
|
||||
return app.nodeOutputs[getNodeId(node)]
|
||||
}
|
||||
|
||||
function getNodePreviews(node: LGraphNode): string[] | undefined {
|
||||
return app.nodePreviewImages[getMostRecentExecutionId(node)]
|
||||
return app.nodePreviewImages[getNodeId(node)]
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -98,23 +91,12 @@ export const useNodeOutputStore = defineStore('nodeOutput', () => {
|
||||
filenames: string | string[] | ResultItem,
|
||||
{
|
||||
folder = 'input',
|
||||
isAnimated = false,
|
||||
isInitialLoad = false
|
||||
}: {
|
||||
folder?: ResultItemType
|
||||
isAnimated?: boolean
|
||||
isInitialLoad?: boolean
|
||||
} = {}
|
||||
isAnimated = false
|
||||
}: { folder?: ResultItemType; isAnimated?: boolean } = {}
|
||||
) {
|
||||
if (!filenames || !node) return
|
||||
|
||||
const nodeId = isInitialLoad
|
||||
? executionStore.getNodeLocatorId(node)
|
||||
: getMostRecentExecutionId(node)
|
||||
|
||||
if (isInitialLoad) {
|
||||
executionStore.locatorIdToExecutionIdMap.set(nodeId, nodeId)
|
||||
}
|
||||
const nodeId = getNodeId(node)
|
||||
|
||||
if (typeof filenames === 'string') {
|
||||
app.nodeOutputs[nodeId] = createOutputs([filenames], folder, isAnimated)
|
||||
|
||||
Reference in New Issue
Block a user