mirror of
https://github.com/Comfy-Org/ComfyUI_frontend.git
synced 2026-04-23 07:50:15 +00:00
Add Asset Widget (#5475)
* [feat] carve out path to call asset browser in combo widget * Add Asset Widget * [feat] add fallback "Select model" label --------- Co-authored-by: Arjan Singh <arjan@comfy.org>
This commit is contained in:
@@ -69,19 +69,15 @@ const addComboWidget = (
|
||||
)
|
||||
|
||||
if (isUsingAssetAPI && isEligible) {
|
||||
// Create button widget for Asset Browser
|
||||
// Get the default value for the button text (currently selected model)
|
||||
const currentValue = getDefaultValue(inputSpec)
|
||||
const displayLabel = currentValue ?? t('widgets.selectModel')
|
||||
|
||||
const widget = node.addWidget(
|
||||
'button',
|
||||
inputSpec.name,
|
||||
t('widgets.selectModel'),
|
||||
() => {
|
||||
console.log(
|
||||
`Asset Browser would open here for:\nNode: ${node.type}\nWidget: ${inputSpec.name}\nCurrent Value:${currentValue}`
|
||||
)
|
||||
}
|
||||
)
|
||||
const widget = node.addWidget('asset', inputSpec.name, displayLabel, () => {
|
||||
console.log(
|
||||
`Asset Browser would open here for:\nNode: ${node.type}\nWidget: ${inputSpec.name}\nCurrent Value:${currentValue}`
|
||||
)
|
||||
})
|
||||
|
||||
return widget
|
||||
}
|
||||
@@ -129,7 +125,7 @@ const addComboWidget = (
|
||||
)
|
||||
}
|
||||
|
||||
return widget
|
||||
return widget as IBaseWidget
|
||||
}
|
||||
|
||||
export const useComboWidget = () => {
|
||||
|
||||
Reference in New Issue
Block a user