mirror of
https://github.com/Comfy-Org/ComfyUI_frontend.git
synced 2026-02-04 07:00:23 +00:00
Use LiteGraph validation for node search->create (#822)
Adds LiteGraph type to augmentation until LG types are auto-generated Removes @ts-expect-error
This commit is contained in:
@@ -130,7 +130,6 @@ app.registerExtension({
|
||||
: null
|
||||
if (
|
||||
inputType &&
|
||||
// @ts-expect-error Will self-resolve when LiteGraph types are generated
|
||||
!LiteGraph.isValidConnection(inputType, nodeOutType)
|
||||
) {
|
||||
// The output doesnt match our input so disconnect it
|
||||
|
||||
2
src/types/litegraph-core-augmentation.d.ts
vendored
2
src/types/litegraph-core-augmentation.d.ts
vendored
@@ -11,6 +11,8 @@ declare module '@comfyorg/litegraph' {
|
||||
slot_types_out: string[]
|
||||
slot_types_default_out: Record<string, string[]>
|
||||
slot_types_default_in: Record<string, string[]>
|
||||
|
||||
isValidConnection(type_a: ISlotType, type_b: ISlotType): boolean
|
||||
}
|
||||
|
||||
import type { LiteGraph as LG } from '@comfyorg/litegraph/dist/litegraph'
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
import {
|
||||
import type {
|
||||
ConnectingLink,
|
||||
LGraphNode,
|
||||
Vector2,
|
||||
@@ -6,6 +6,7 @@ import {
|
||||
INodeOutputSlot,
|
||||
INodeSlot
|
||||
} from '@comfyorg/litegraph'
|
||||
import { LiteGraph } from '@comfyorg/litegraph'
|
||||
|
||||
export class ConnectingLinkImpl implements ConnectingLink {
|
||||
node: LGraphNode
|
||||
@@ -56,9 +57,8 @@ export class ConnectingLinkImpl implements ConnectingLink {
|
||||
this.releaseSlotType === 'output' ? newNode.outputs : newNode.inputs
|
||||
if (!newNodeSlots) return
|
||||
|
||||
const newNodeSlot = newNodeSlots.findIndex(
|
||||
(slot: INodeSlot) =>
|
||||
slot.type === this.type || slot.type === '*' || this.type === '*'
|
||||
const newNodeSlot = newNodeSlots.findIndex((slot: INodeSlot) =>
|
||||
LiteGraph.isValidConnection(slot.type, this.type)
|
||||
)
|
||||
|
||||
if (newNodeSlot === -1) {
|
||||
|
||||
Reference in New Issue
Block a user