mirror of
https://github.com/Comfy-Org/ComfyUI_frontend.git
synced 2026-05-05 21:54:50 +00:00
feat(templates): migrate cloud template dialog to hub list/detail API
Replace static index.json template loading on cloud with the hub
workflows API (GET /api/hub/workflows for listing, GET
/api/hub/workflows/{share_id} for workflow JSON).
- Add listHubWorkflows, listAllHubWorkflows, getHubWorkflowDetail to api.ts
- Create adapter to convert HubWorkflowSummary to TemplateInfo
- Branch on isCloud in workflowTemplatesStore.fetchCoreTemplates()
- Update thumbnail URL resolution for absolute hub URLs
- Update workflow JSON loading to use detail API via shareId
- Add shareId-based fallback in URL template loader
This commit is contained in:
@@ -2,9 +2,11 @@ import { useToast } from 'primevue/usetoast'
|
||||
import { useI18n } from 'vue-i18n'
|
||||
import { useRoute, useRouter } from 'vue-router'
|
||||
|
||||
import { isCloud } from '@/platform/distribution/types'
|
||||
import { clearPreservedQuery } from '@/platform/navigation/preservedQueryManager'
|
||||
import { PRESERVED_QUERY_NAMESPACES } from '@/platform/navigation/preservedQueryNamespaces'
|
||||
import { useTelemetry } from '@/platform/telemetry'
|
||||
import { useWorkflowTemplatesStore } from '@/platform/workflow/templates/repositories/workflowTemplatesStore'
|
||||
// eslint-disable-next-line import-x/no-restricted-paths
|
||||
import { useCanvasStore } from '@/renderer/core/canvas/canvasStore'
|
||||
|
||||
@@ -108,11 +110,23 @@ export function useTemplateUrlLoader() {
|
||||
try {
|
||||
await templateWorkflows.loadTemplates()
|
||||
|
||||
const success = await templateWorkflows.loadWorkflowTemplate(
|
||||
let success = await templateWorkflows.loadWorkflowTemplate(
|
||||
templateParam,
|
||||
sourceParam
|
||||
)
|
||||
|
||||
// On cloud, if name-based lookup fails, try by shareId (hub templates)
|
||||
if (!success && isCloud) {
|
||||
const store = useWorkflowTemplatesStore()
|
||||
const templateByShareId = store.getTemplateByShareId(templateParam)
|
||||
if (templateByShareId) {
|
||||
success = await templateWorkflows.loadWorkflowTemplate(
|
||||
templateByShareId.name,
|
||||
templateByShareId.sourceModule
|
||||
)
|
||||
}
|
||||
}
|
||||
|
||||
if (!success) {
|
||||
toast.add({
|
||||
severity: 'error',
|
||||
|
||||
Reference in New Issue
Block a user