mirror of
https://github.com/Comfy-Org/ComfyUI_frontend.git
synced 2026-03-12 08:30:08 +00:00
### Fix: Fail to load audio node ## Summary When using Modern Node Design (Nodes 2.0), the Load Audio node is able to work as expected. https://github.com/Comfy-Org/ComfyUI_frontend/issues/7155 ## Changes Aligned `Load Audio` node appearance with the `Load Image` (/src/renderer/extensions/vueNodes/components/NodeWidgets.vue) node for consistency. ## Screenshots <img width="674" height="464" alt="zzzzw" src="https://github.com/user-attachments/assets/a7bf6a81-00e3-41a8-962b-560e7acb5c41" /> ┆Issue is synchronized with this [Notion page](https://www.notion.so/PR-7175-Fix-issue-No-7155-Nodes-2-0-Load-Audio-node-is-broken-2c06d73d365081ae9ab3c2ea20f061a4) by [Unito](https://www.unito.io)
62 lines
1.7 KiB
Vue
62 lines
1.7 KiB
Vue
<template>
|
|
<div
|
|
class="w-full col-span-2 widget-expands grid grid-cols-[minmax(80px,max-content)_minmax(125px,auto)] gap-y-3 p-3"
|
|
>
|
|
<WidgetSelect v-model="modelValue" :widget class="col-span-2" />
|
|
<AudioPreviewPlayer
|
|
class="col-span-2"
|
|
:audio-url="audioUrlFromWidget"
|
|
:readonly="readonly"
|
|
:hide-when-empty="isOutputNodeRef"
|
|
:show-options-button="true"
|
|
/>
|
|
</div>
|
|
</template>
|
|
|
|
<script setup lang="ts">
|
|
import { computed } from 'vue'
|
|
|
|
import type { LGraphNode } from '@/lib/litegraph/src/litegraph'
|
|
import { app } from '@/scripts/app'
|
|
import type { SimplifiedWidget } from '@/types/simplifiedWidget'
|
|
import { isOutputNode } from '@/utils/nodeFilterUtil'
|
|
|
|
import { getAudioUrlFromPath } from '../utils/audioUtils'
|
|
import WidgetSelect from './WidgetSelect.vue'
|
|
import AudioPreviewPlayer from './audio/AudioPreviewPlayer.vue'
|
|
|
|
const props = defineProps<{
|
|
widget: SimplifiedWidget<string | undefined>
|
|
readonly?: boolean
|
|
nodeId: string
|
|
}>()
|
|
|
|
const modelValue = defineModel<string>('modelValue')
|
|
|
|
defineEmits<{
|
|
'update:modelValue': [value: string]
|
|
}>()
|
|
|
|
// Get litegraph node
|
|
const litegraphNode = computed(() => {
|
|
if (!props.nodeId || !app.rootGraph) return null
|
|
return app.rootGraph.getNodeById(props.nodeId) as LGraphNode | null
|
|
})
|
|
|
|
// Check if this is an output node (PreviewAudio, SaveAudio, etc)
|
|
const isOutputNodeRef = computed(() => {
|
|
const node = litegraphNode.value
|
|
if (!node) return false
|
|
return isOutputNode(node)
|
|
})
|
|
|
|
const audioFilePath = computed(() => props.widget.value as string)
|
|
|
|
// Computed audio URL from widget value (for input files)
|
|
const audioUrlFromWidget = computed(() => {
|
|
const path = audioFilePath.value
|
|
if (!path) return ''
|
|
return getAudioUrlFromPath(path, 'input')
|
|
})
|
|
</script>
|