-
-
-
-
-
- {{
- $t(`templateWorkflows.template.${template}`)
- }}
-
+
diff --git a/src/scripts/api.ts b/src/scripts/api.ts
index 686372481..5b5fe857e 100644
--- a/src/scripts/api.ts
+++ b/src/scripts/api.ts
@@ -397,6 +397,17 @@ export class ComfyApi extends EventTarget {
return await resp.json()
}
+ /**
+ * Gets the available workflow templates from custom nodes.
+ * @returns A map of custom_node names and associated template workflow names.
+ */
+ async getWorkflowTemplates(): Promise<{
+ [customNodesName: string]: string[]
+ }> {
+ const res = await this.fetchApi('/workflow_templates')
+ return await res.json()
+ }
+
/**
* Gets a list of embedding names
*/
diff --git a/src/stores/workflowTemplatesStore.ts b/src/stores/workflowTemplatesStore.ts
new file mode 100644
index 000000000..1c5721642
--- /dev/null
+++ b/src/stores/workflowTemplatesStore.ts
@@ -0,0 +1,30 @@
+import { defineStore } from 'pinia'
+import { ref } from 'vue'
+import { api } from '@/scripts/api'
+
+export const useWorkflowTemplatesStore = defineStore(
+ 'workflowTemplates',
+ () => {
+ const items = ref<{
+ [customNodesName: string]: string[]
+ }>({})
+ const isLoaded = ref(false)
+
+ async function loadWorkflowTemplates() {
+ try {
+ if (!isLoaded.value) {
+ items.value = await api.getWorkflowTemplates()
+ isLoaded.value = true
+ }
+ } catch (error) {
+ console.error('Error fetching workflow templates:', error)
+ }
+ }
+
+ return {
+ items,
+ isLoaded,
+ loadWorkflowTemplates
+ }
+ }
+)
diff --git a/vite.config.mts b/vite.config.mts
index 7d454479b..9d94fe575 100644
--- a/vite.config.mts
+++ b/vite.config.mts
@@ -119,6 +119,10 @@ export default defineConfig({
ws: true
},
+ '/workflow_templates': {
+ target: DEV_SERVER_COMFYUI_URL
+ },
+
'/testsubrouteindex': {
target: 'http://localhost:5173',
rewrite: (path) => path.substring('/testsubrouteindex'.length)
@@ -183,4 +187,4 @@ export default defineConfig({
'@comfyorg/comfyui-electron-types'
]
}
-}) as UserConfigExport
+}) as UserConfigExport
\ No newline at end of file