mirror of
https://github.com/Comfy-Org/ComfyUI_frontend.git
synced 2026-04-20 06:20:11 +00:00
fix: support progressive fallback for deeply nested model directories
Previously, modelToNode fallback only tried exact match then top-level
segment (e.g., "a/b/c" → "a"), skipping intermediate paths. Now tries
all parent paths progressively ("a/b/c" → "a/b" → "a"), fixing custom
nodes with longer nested directory structures.
Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
This commit is contained in:
@@ -75,8 +75,8 @@ export const useModelToNodeStore = defineStore('modelToNode', () => {
|
||||
|
||||
/**
|
||||
* 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".
|
||||
* Tries exact match first, then progressively shorter parent paths.
|
||||
* e.g., "a/b/c" tries "a/b/c" → "a/b" → "a".
|
||||
*/
|
||||
function findProvidersWithFallback(
|
||||
modelType: string
|
||||
@@ -88,12 +88,13 @@ export const useModelToNodeStore = defineStore('modelToNode', () => {
|
||||
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
|
||||
// Try progressively shorter parent paths
|
||||
const segments = modelType.split('/')
|
||||
for (let i = segments.length - 1; i >= 1; i--) {
|
||||
const parentPath = segments.slice(0, i).join('/')
|
||||
const fallback = modelToNodeMap.value[parentPath]
|
||||
if (fallback && fallback.length > 0) return fallback
|
||||
}
|
||||
|
||||
return undefined
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user