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/WorkflowTemplateDetail.stories.ts b/src/components/custom/widget/WorkflowTemplateDetail.stories.ts index f94bb952664..ccbe9788f3a 100644 --- a/src/components/custom/widget/WorkflowTemplateDetail.stories.ts +++ b/src/components/custom/widget/WorkflowTemplateDetail.stories.ts @@ -1,6 +1,7 @@ import type { Meta, StoryObj } from '@storybook/vue3-vite' import WorkflowTemplateDetail from '@/components/custom/widget/WorkflowTemplateDetail.vue' +import { i18n } from '@/i18n' import type { TemplateDetailGroup } from '@/platform/workflow/templates/types/templateDetail' const meta: Meta = { @@ -12,18 +13,17 @@ const meta: Meta = { export default meta type Story = StoryObj -/** Stands in for the template thumbnail the dialog passes through this slot. */ -const withPreview = (args: Record) => ({ +const t = i18n.global.t + +const withPreview: NonNullable = (args) => ({ components: { WorkflowTemplateDetail }, setup: () => ({ args }), template: ` -
+