Fix LoadAudio node (#3065)

Co-authored-by: github-actions <github-actions@github.com>
This commit is contained in:
Christian Byrne
2025-03-14 21:44:39 -07:00
committed by GitHub
parent 679f2daa8d
commit 3956e31810
3 changed files with 6 additions and 7 deletions

Binary file not shown.

Before

Width:  |  Height:  |  Size: 42 KiB

After

Width:  |  Height:  |  Size: 45 KiB

View File

@@ -88,11 +88,11 @@ app.registerExtension({
name: 'Comfy.AudioWidget',
async beforeRegisterNodeDef(nodeType, nodeData) {
if (
// @ts-expect-error ComfyNode
['LoadAudio', 'SaveAudio', 'PreviewAudio'].includes(nodeType.comfyClass)
['LoadAudio', 'SaveAudio', 'PreviewAudio'].includes(
nodeType.prototype.comfyClass
)
) {
// @ts-expect-error InputSpec is not typed correctly
nodeData.input.required.audioUI = ['AUDIO_UI']
nodeData.input.required.audioUI = ['AUDIO_UI', {}]
}
},
getCustomWidgets() {
@@ -150,8 +150,7 @@ app.registerExtension({
name: 'Comfy.UploadAudio',
async beforeRegisterNodeDef(nodeType, nodeData: ComfyNodeDef) {
if (nodeData?.input?.required?.audio?.[1]?.audio_upload === true) {
// @ts-expect-error InputSpec is not typed correctly
nodeData.input.required.upload = ['AUDIOUPLOAD']
nodeData.input.required.upload = ['AUDIOUPLOAD', {}]
}
},
getCustomWidgets() {

View File

@@ -172,6 +172,7 @@ export const useLitegraphService = () => {
// Note: Some extensions expects node.comfyClass to be set in
// `beforeRegisterNodeDef`.
node.prototype.comfyClass = nodeDefV1.name
node.comfyClass = nodeDefV1.name
await extensionService.invokeExtensionsAsync(
'beforeRegisterNodeDef',
node,
@@ -179,7 +180,6 @@ export const useLitegraphService = () => {
)
const nodeDef = new ComfyNodeDefImpl(nodeDefV1)
node.comfyClass = nodeDef.name
node.nodeData = nodeDef
LiteGraph.registerNodeType(nodeId, node)
// Note: Do not following assignments before `LiteGraph.registerNodeType`