mirror of
https://github.com/Comfy-Org/ComfyUI_frontend.git
synced 2026-03-14 01:20:03 +00:00
feat: add Chatterbox model support for Cloud asset browser (#8418)
## Summary Adds support for creating Chatterbox TTS nodes when clicking Chatterbox models in the Cloud asset browser. ## Changes ### modelToNodeStore.ts - Add `findProvidersWithFallback()` helper for hierarchical model type lookups (e.g., `parent/child` falls back to `parent`) - Register 4 Chatterbox model directories with empty widget keys: - `chatterbox/chatterbox` → `FL_ChatterboxTTS` - `chatterbox/chatterbox_turbo` → `FL_ChatterboxTurboTTS` - `chatterbox/chatterbox_multilingual` → `FL_ChatterboxMultilingualTTS` - `chatterbox/chatterbox_vc` → `FL_ChatterboxVC` ### createModelNodeFromAsset.ts - Skip widget assignment when `provider.key` is empty (for nodes that auto-load models without a widget selector) ### Tests - Add tests for hierarchical fallback behavior - Add tests for empty widget key (auto-load nodes) - Add Chatterbox node types to mock data ## Notes - Empty `key` convention: Chatterbox nodes auto-load their models and don't have a model selector widget, so we register them with `key: ''` and skip the widget assignment step - Hierarchical fallback only goes one level deep (`a/b/c` → `a`, not `a/b`) ┆Issue is synchronized with this [Notion page](https://www.notion.so/PR-8418-feat-add-Chatterbox-model-support-for-Cloud-asset-browser-2f76d73d365081be822bc369b155f099) by [Unito](https://www.unito.io) --------- Co-authored-by: Subagent 5 <subagent@example.com> Co-authored-by: Amp <amp@ampcode.com> Co-authored-by: Alexander Brown <drjkl@comfy.org> Co-authored-by: GitHub Action <action@github.com>
This commit is contained in:
@@ -9,7 +9,7 @@ export class ModelNodeProvider {
|
||||
/** The node definition to use for this model. */
|
||||
public nodeDef: ComfyNodeDefImpl
|
||||
|
||||
/** The node input key for where to inside the model name. */
|
||||
/** The node input key for where to insert the model name. */
|
||||
public key: string
|
||||
|
||||
constructor(nodeDef: ComfyNodeDefImpl, key: string) {
|
||||
@@ -73,23 +73,51 @@ export const useModelToNodeStore = defineStore('modelToNode', () => {
|
||||
return nodeTypeToCategory.value[nodeType]
|
||||
}
|
||||
|
||||
/**
|
||||
* Find providers for modelType with hierarchical fallback.
|
||||
* Tries exact match first, then falls back to top-level segment (e.g., "parent/child" → "parent").
|
||||
* Note: Only falls back one level; "a/b/c" tries "a/b/c" then "a", not "a/b".
|
||||
*/
|
||||
function findProvidersWithFallback(
|
||||
modelType: string
|
||||
): ModelNodeProvider[] | undefined {
|
||||
if (!modelType || typeof modelType !== 'string') {
|
||||
return undefined
|
||||
}
|
||||
|
||||
const exactMatch = modelToNodeMap.value[modelType]
|
||||
if (exactMatch && exactMatch.length > 0) return exactMatch
|
||||
|
||||
const topLevel = modelType.split('/')[0]
|
||||
if (topLevel === modelType) return undefined
|
||||
|
||||
const fallback = modelToNodeMap.value[topLevel]
|
||||
|
||||
if (fallback && fallback.length > 0) return fallback
|
||||
|
||||
return undefined
|
||||
}
|
||||
|
||||
/**
|
||||
* Get the node provider for the given model type name.
|
||||
* Supports hierarchical lookups: if "parent/child" has no match, falls back to "parent".
|
||||
* @param modelType The name of the model type to get the node provider for.
|
||||
* @returns The node provider for the given model type name.
|
||||
*/
|
||||
function getNodeProvider(modelType: string): ModelNodeProvider | undefined {
|
||||
registerDefaults()
|
||||
return modelToNodeMap.value[modelType]?.[0]
|
||||
return findProvidersWithFallback(modelType)?.[0]
|
||||
}
|
||||
|
||||
/**
|
||||
* Get the list of all valid node providers for the given model type name.
|
||||
* Supports hierarchical lookups: if "parent/child" has no match, falls back to "parent".
|
||||
* @param modelType The name of the model type to get the node providers for.
|
||||
* @returns The list of all valid node providers for the given model type name.
|
||||
*/
|
||||
function getAllNodeProviders(modelType: string): ModelNodeProvider[] {
|
||||
registerDefaults()
|
||||
return modelToNodeMap.value[modelType] ?? []
|
||||
return findProvidersWithFallback(modelType) ?? []
|
||||
}
|
||||
/**
|
||||
* Register a node provider for the given model type name.
|
||||
@@ -153,6 +181,17 @@ export const useModelToNodeStore = defineStore('modelToNode', () => {
|
||||
'ADE_AnimateDiffLoRALoader',
|
||||
'name'
|
||||
)
|
||||
|
||||
// Chatterbox TTS nodes: empty key means the node auto-loads models without
|
||||
// a widget selector (createModelNodeFromAsset skips widget assignment)
|
||||
quickRegister('chatterbox/chatterbox', 'FL_ChatterboxTTS', '')
|
||||
quickRegister('chatterbox/chatterbox_turbo', 'FL_ChatterboxTurboTTS', '')
|
||||
quickRegister(
|
||||
'chatterbox/chatterbox_multilingual',
|
||||
'FL_ChatterboxMultilingualTTS',
|
||||
''
|
||||
)
|
||||
quickRegister('chatterbox/chatterbox_vc', 'FL_ChatterboxVC', '')
|
||||
}
|
||||
|
||||
return {
|
||||
|
||||
Reference in New Issue
Block a user