From bf701aaf98516dcd5d26dd2dba99bfa0fe8f6bee Mon Sep 17 00:00:00 2001 From: jaeone94 <89377375+jaeone94@users.noreply.github.com> Date: Sat, 26 Sep 2026 13:22:17 +0900 Subject: [PATCH 01/12] feat(templates): provision Desktop template inputs The input asset design, logic and detail-view presentation in this slice are Ryan Di's work, originally spread across 14 commits on ryan-di/fe-1491-stack-06-input-assets. They are squashed here because the branch predated the stack rewrite and still carried pre-rebase copies of the model download and routing slices, which is why its diff measured +6771 against a stale base. The input asset work itself is ~950 lines. Handing the stack over was agreed in the FE-1491 thread. Carried over unchanged: - resolveTemplateInputAssets / startMissingTemplateInputDownloads ask the Desktop host what a template needs and let it fetch what is missing - templateInputDownloadStore tracks per-asset progress and exposes the preview revision so a downloaded file stops serving its stale preview - useTemplateInputDownloadGraphSync rebinds the graph once assets land - the detail view lists trusted input assets alongside model requirements Adapted to what landed on main: - the download kickoff hangs off openPreparedWorkflowTemplate, which now owns telemetry and dialog closing, rather than the removed prepareWorkflowTemplateForOpen - missing-media counts compose both filters: main gates on the missing warning being visible, this slice also excludes assets still downloading - the drop-zone preview revision moved into getLoaderDropIndicator, since main extracted that builder out of AppModeWidgetList The bridge shim declares the 0.3.0 template-input methods as optional module augmentations, so this typechecks against the catalog's 0.2.0 and degrades to no-ops on hosts without them. Comfy-Desktop #1435 is still needed for the host side to actually serve them. --- src/components/builder/AppModeWidgetList.vue | 5 +- .../builder/useLoaderDropIndicator.ts | 14 ++- .../widget/WorkflowTemplateDetailGroup.vue | 30 ++++- ...kflowTemplateSelectorDialog.detail.test.ts | 71 ++++++++++++ .../widget/WorkflowTemplateSelectorDialog.vue | 64 +++++++++-- src/locales/en/main.json | 10 ++ .../missingMedia/missingMediaPipeline.test.ts | 15 +++ .../missingMedia/missingMediaPipeline.ts | 4 +- .../missingMedia/missingMediaStore.test.ts | 17 +++ .../missingMedia/missingMediaStore.ts | 17 ++- .../useTemplateInputDownloadGraphSync.ts | 106 ++++++++++++++++++ .../useTemplateModelRowDownloads.test.ts | 6 +- .../useTemplateModelRowDownloads.ts | 17 ++- .../composables/useTemplateWorkflows.test.ts | 1 + .../composables/useTemplateWorkflows.ts | 27 ++++- .../templates/types/templateDetail.ts | 5 + ...eshDownloadedTemplateInputBindings.test.ts | 60 ++++++++++ .../refreshDownloadedTemplateInputBindings.ts | 27 +++++ .../templates/utils/templateInputAssets.ts | 62 ++++++++++ .../linearMode/LinearControls.test.ts | 27 +++++ .../extensions/linearMode/LinearControls.vue | 100 +++++++++++++++-- src/stores/templateInputDownloadStore.test.ts | 42 +++++++ src/stores/templateInputDownloadStore.ts | 92 +++++++++++++++ .../comfyDesktopBridgeTemplateInputs.d.ts | 55 +++++++++ src/views/GraphView.test.ts | 83 ++++++++++++++ src/views/GraphView.vue | 41 +++++++ 26 files changed, 955 insertions(+), 43 deletions(-) create mode 100644 src/platform/workflow/templates/composables/useTemplateInputDownloadGraphSync.ts create mode 100644 src/platform/workflow/templates/utils/refreshDownloadedTemplateInputBindings.test.ts create mode 100644 src/platform/workflow/templates/utils/refreshDownloadedTemplateInputBindings.ts create mode 100644 src/platform/workflow/templates/utils/templateInputAssets.ts create mode 100644 src/stores/templateInputDownloadStore.test.ts create mode 100644 src/stores/templateInputDownloadStore.ts create mode 100644 src/types/comfyDesktopBridgeTemplateInputs.d.ts diff --git a/src/components/builder/AppModeWidgetList.vue b/src/components/builder/AppModeWidgetList.vue index 47ea99fafb0..8ab2d109153 100644 --- a/src/components/builder/AppModeWidgetList.vue +++ b/src/components/builder/AppModeWidgetList.vue @@ -22,6 +22,7 @@ import { useLinkStore } from '@/stores/linkStore' import { graphScopeOf } from '@/types/graphScopeId' import { useWidgetValueStore } from '@/stores/widgetValueStore' import { useAppModeStore } from '@/stores/appModeStore' +import { useTemplateInputDownloadStore } from '@/stores/templateInputDownloadStore' import { cn } from '@comfyorg/tailwind-utils' import { HideLayoutFieldKey, WidgetHeightKey } from '@/types/widgetTypes' import { UNASSIGNED_NODE_ID } from '@/types/nodeId' @@ -44,6 +45,7 @@ const { mobile = false, builderMode = false } = defineProps<{ const { t } = useI18n() const executionErrorStore = useExecutionErrorStore() const appModeStore = useAppModeStore() +const templateInputDownloadStore = useTemplateInputDownloadStore() const widgetValueStore = useWidgetValueStore() const linkStore = useLinkStore() const maskEditor = useMaskEditor() @@ -119,7 +121,8 @@ function getDropIndicator(node: LGraphNode, id: WidgetId) { mobile, label: t, onMaskEdit: maskEditor.openMaskEditor, - widgetValueStore + widgetValueStore, + previewRevision: templateInputDownloadStore.previewRevision }) } diff --git a/src/components/builder/useLoaderDropIndicator.ts b/src/components/builder/useLoaderDropIndicator.ts index 90557fe26c5..ca288c1c07b 100644 --- a/src/components/builder/useLoaderDropIndicator.ts +++ b/src/components/builder/useLoaderDropIndicator.ts @@ -55,12 +55,15 @@ function buildMediaUrl( mediaType: LoaderMediaType, filename: string, subfolder: string, - type: string + type: string, + previewRevision?: (filename: string) => number ) { if (!filename) return undefined const params = new URLSearchParams({ filename, subfolder, type }) appendCloudResParam(params, filename) + const revision = previewRevision?.(filename) + if (revision) params.set('template_input_revision', String(revision)) const previewParam = mediaType === 'image' ? app.getPreviewFormatParam() : '' return api.apiURL(`/view?${params}${previewParam}`) } @@ -78,6 +81,7 @@ export function getLoaderDropIndicator( label: (key: string) => string onMaskEdit: (node: LGraphNode) => void widgetValueStore: Pick, 'getWidget'> + previewRevision?: (filename: string) => number } ): LoaderDropIndicator | undefined { const config = LOADER_MEDIA_CONFIG[node.type] @@ -91,7 +95,13 @@ export function getLoaderDropIndicator( ? parseImageWidgetValue(stringValue) : { filename: '', subfolder: '', type: 'input' } - const mediaUrl = buildMediaUrl(config.mediaType, filename, subfolder, type) + const mediaUrl = buildMediaUrl( + config.mediaType, + filename, + subfolder, + type, + options.previewRevision + ) return { iconClass: iconForMediaType(config.mediaType), diff --git a/src/components/custom/widget/WorkflowTemplateDetailGroup.vue b/src/components/custom/widget/WorkflowTemplateDetailGroup.vue index 876d8377934..790877cbbb6 100644 --- a/src/components/custom/widget/WorkflowTemplateDetailGroup.vue +++ b/src/components/custom/widget/WorkflowTemplateDetailGroup.vue @@ -38,9 +38,35 @@ const emit = defineEmits<{ 'download-model': [rowId: string] }>() " > -