Use index.json to load workflow templates (#2803)

This commit is contained in:
bymyself
2025-03-02 13:37:15 -07:00
committed by GitHub
parent e6a583e11b
commit 8d515dc309
5 changed files with 34 additions and 15 deletions

View File

@@ -29,6 +29,7 @@ import {
type ComfyNodeDef,
validateComfyNodeDef
} from '@/schemas/nodeDefSchema'
import { WorkflowTemplates } from '@/types/workflowTemplateTypes'
interface QueuePromptRequestBody {
client_id: string
@@ -414,6 +415,14 @@ export class ComfyApi extends EventTarget {
return await res.json()
}
/**
* Gets the index of core workflow templates.
*/
async getCoreWorkflowTemplates(): Promise<WorkflowTemplates[]> {
const res = await axios.get('/templates/index.json')
return res.status === 200 ? res.data : []
}
/**
* Gets a list of embedding names
*/