[Refactor] Remove app.getWidgetType (#2880)

This commit is contained in:
Chenlei Hu
2025-03-05 14:02:13 -05:00
committed by GitHub
parent ba4e4ed0b8
commit 15e396b4cc
5 changed files with 21 additions and 44 deletions

View File

@@ -2,6 +2,10 @@ import { defineStore } from 'pinia'
import { computed, ref } from 'vue'
import type { InputSpec as InputSpecV2 } from '@/schemas/nodeDef/nodeDefSchemaV2'
import {
type InputSpec as InputSpecV1,
getInputSpecType
} from '@/schemas/nodeDefSchema'
import { ComfyWidgetConstructor, ComfyWidgets } from '@/scripts/widgets'
export const useWidgetStore = defineStore('widget', () => {
@@ -12,8 +16,9 @@ export const useWidgetStore = defineStore('widget', () => {
...coreWidgets
}))
function inputIsWidget(spec: InputSpecV2) {
return spec.type in widgets.value
function inputIsWidget(spec: InputSpecV2 | InputSpecV1) {
const type = Array.isArray(spec) ? getInputSpecType(spec) : spec.type
return type in widgets.value
}
function registerCustomWidgets(