Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Allow dragging model library outputs onto existing nodes #1004

Open
wants to merge 4 commits into
base: main
Choose a base branch
from

Conversation

mcmonkey4eva
Copy link
Member

for #1000

This also changes modelToNodeStore to be backed by a list, which allows multiple node type registrations - that way many different nodes can be registered as compatible with a given model class.

(Future todo: automatic registration from object_info maybe? We can easily identify which inputs have lists that exact match a given expected model type list, and arguably that can be abused to define compatibility. Or if not, maybe a field in the custom node in python side?)

Having the list that allows multiple entries also means we can in the future display a list of what node types are valid and let the user choose / set defaults / etc.

I've registered a second core loader node for checkpoint and lora, and validated that dragging onto either works. Naturally this also providers an easy test reference for other future usages of the multiple node options list.

Also added quickRegister to reduce the copypasta

Copy link
Member

@huchenlei huchenlei left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Can you add a playwright test to verify this feature works?

@huchenlei
Copy link
Member

You can use the new util functions to get node ref for node position now and avoid hardcoded node position calculation.

async getNodeRefById(id: NodeId) {
return new NodeReference(id, this)
}
async getNodeRefsByType(type: string): Promise<NodeReference[]> {
return (
await this.page.evaluate((type) => {
return window['app'].graph.nodes
.filter((n) => n.type === type)
.map((n) => n.id)
}, type)
).map((id: NodeId) => this.getNodeRefById(id))
}
async getFirstNodeRef(): Promise<NodeReference | null> {
const id = await this.page.evaluate(() => {
return window['app'].graph.nodes[0]?.id
})
if (!id) return null
return this.getNodeRefById(id)
}
}

@huchenlei
Copy link
Member

Followup-work: when dragging a model, highlight all nodes that can be dropped onto.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants