mirror of
https://github.com/Comfy-Org/ComfyUI_frontend.git
synced 2026-04-24 00:09:32 +00:00
Allow duplicated output names (#232)
This commit is contained in:
@@ -15,6 +15,7 @@ https://github.com/Nuked88/ComfyUI-N-Sidebar/blob/7ae7da4a9761009fb6629bc04c6830
|
||||
<div
|
||||
v-for="[slotInput, slotOutput] in _.zip(slotInputDefs, allOutputDefs)"
|
||||
class="_sb_row slot_row"
|
||||
:key="(slotInput?.name || '') + (slotOutput?.index.toString() || '')"
|
||||
>
|
||||
<div class="_sb_col">
|
||||
<div v-if="slotInput" :class="['_sb_dot', slotInput.type]"></div>
|
||||
@@ -22,7 +23,7 @@ https://github.com/Nuked88/ComfyUI-N-Sidebar/blob/7ae7da4a9761009fb6629bc04c6830
|
||||
<div class="_sb_col">{{ slotInput ? slotInput.name : '' }}</div>
|
||||
<div class="_sb_col middle-column"></div>
|
||||
<div class="_sb_col _sb_inherit">
|
||||
{{ slotOutput ? slotOutput.display_name : '' }}
|
||||
{{ slotOutput ? slotOutput.name : '' }}
|
||||
</div>
|
||||
<div class="_sb_col">
|
||||
<div v-if="slotOutput" :class="['_sb_dot', slotOutput.type]"></div>
|
||||
@@ -30,7 +31,11 @@ https://github.com/Nuked88/ComfyUI-N-Sidebar/blob/7ae7da4a9761009fb6629bc04c6830
|
||||
</div>
|
||||
|
||||
<!-- Node widget inputs -->
|
||||
<div v-for="widgetInput in widgetInputDefs" class="_sb_row _long_field">
|
||||
<div
|
||||
v-for="widgetInput in widgetInputDefs"
|
||||
class="_sb_row _long_field"
|
||||
:key="widgetInput.name"
|
||||
>
|
||||
<div class="_sb_col _sb_arrow">◀</div>
|
||||
<div class="_sb_col">{{ widgetInput.name }}</div>
|
||||
<div class="_sb_col middle-column"></div>
|
||||
|
||||
@@ -133,8 +133,9 @@ export class ComfyInputsSpec {
|
||||
|
||||
export class ComfyOutputSpec {
|
||||
constructor(
|
||||
public index: number,
|
||||
// Name is not unique for output params
|
||||
public name: string,
|
||||
public display_name: string,
|
||||
public type: string,
|
||||
public is_list: boolean,
|
||||
public comboOptions?: any[]
|
||||
@@ -142,10 +143,10 @@ export class ComfyOutputSpec {
|
||||
}
|
||||
|
||||
export class ComfyOutputsSpec {
|
||||
constructor(public outputByName: Record<string, ComfyOutputSpec>) {}
|
||||
constructor(public outputs: ComfyOutputSpec[]) {}
|
||||
|
||||
get all() {
|
||||
return Object.values(this.outputByName)
|
||||
return this.outputs
|
||||
}
|
||||
}
|
||||
|
||||
@@ -164,27 +165,17 @@ export class ComfyNodeDefImpl {
|
||||
|
||||
private static transformOutputSpec(obj: any): ComfyOutputsSpec {
|
||||
const { output, output_is_list, output_name } = obj
|
||||
const result = {}
|
||||
|
||||
output.forEach((type: string | any[], index: number) => {
|
||||
const result = output.map((type: string | any[], index: number) => {
|
||||
const typeString = Array.isArray(type) ? 'COMBO' : type
|
||||
const display_name = output_name[index]
|
||||
const name = display_name === typeString ? index.toString() : display_name
|
||||
|
||||
const outputSpec = new ComfyOutputSpec(
|
||||
name,
|
||||
display_name,
|
||||
return new ComfyOutputSpec(
|
||||
index,
|
||||
output_name[index],
|
||||
typeString,
|
||||
output_is_list[index],
|
||||
Array.isArray(type) ? type : undefined
|
||||
)
|
||||
|
||||
if (name in result) {
|
||||
throw new Error(`Duplicate output name: ${name}`)
|
||||
}
|
||||
result[name] = outputSpec
|
||||
})
|
||||
|
||||
return new ComfyOutputsSpec(result)
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user