From 207855ff76cf007bac92eeece658cf3915e3192f Mon Sep 17 00:00:00 2001 From: Subagent 5 Date: Thu, 29 Jan 2026 14:39:31 -0800 Subject: [PATCH] feat: add text preview rendering in LinearPreview Amp-Thread-ID: https://ampcode.com/threads/T-019c0be0-9fc6-71ac-853a-7c7cc846b375 Co-authored-by: Amp --- src/locales/en/main.json | 3 ++- src/platform/remote/comfyui/jobs/jobTypes.ts | 10 ++++++---- .../extensions/linearMode/LinearPreview.vue | 10 ++++++++-- src/renderer/extensions/linearMode/mediaTypes.ts | 1 + src/stores/queueStore.ts | 15 ++++++++++++++- 5 files changed, 31 insertions(+), 8 deletions(-) diff --git a/src/locales/en/main.json b/src/locales/en/main.json index 25214e179e..f47e576418 100644 --- a/src/locales/en/main.json +++ b/src/locales/en/main.json @@ -2713,7 +2713,8 @@ "runCount": "Run count:", "rerun": "Rerun", "reuseParameters": "Reuse Parameters", - "downloadAll": "Download All" + "downloadAll": "Download All", + "textTruncated": "Text truncated to 1KB for preview. View full output in job details." }, "missingNodes": { "cloud": { diff --git a/src/platform/remote/comfyui/jobs/jobTypes.ts b/src/platform/remote/comfyui/jobs/jobTypes.ts index 48e2bfbc46..da536bf67a 100644 --- a/src/platform/remote/comfyui/jobs/jobTypes.ts +++ b/src/platform/remote/comfyui/jobs/jobTypes.ts @@ -19,11 +19,13 @@ const zJobStatus = z.enum([ ]) const zPreviewOutput = z.object({ - filename: z.string(), - subfolder: z.string(), - type: resultItemType, + filename: z.string().optional(), + subfolder: z.string().optional(), + type: resultItemType.optional(), nodeId: z.string(), - mediaType: z.string() + mediaType: z.string(), + content: z.string().optional(), + truncated: z.boolean().optional() }) /** diff --git a/src/renderer/extensions/linearMode/LinearPreview.vue b/src/renderer/extensions/linearMode/LinearPreview.vue index 378a579dc1..319bce8db9 100644 --- a/src/renderer/extensions/linearMode/LinearPreview.vue +++ b/src/renderer/extensions/linearMode/LinearPreview.vue @@ -170,8 +170,14 @@ async function rerun(e: Event) {
+ > +
{{
+      selectedOutput!.content
+    }}
+

+ {{ t('linearMode.textTruncated') }} +

+
= { export function getMediaType(output?: ResultItemImpl) { if (!output) return '' if (output.isVideo) return 'video' + if (output.isText) return 'text' return output.mediaType } diff --git a/src/stores/queueStore.ts b/src/stores/queueStore.ts index c302a1076e..71cbbd9519 100644 --- a/src/stores/queueStore.ts +++ b/src/stores/queueStore.ts @@ -44,6 +44,10 @@ export class ResultItemImpl { format?: string frame_rate?: number + // Text output specific fields + content?: string + truncated?: boolean + constructor(obj: Record) { this.filename = obj.filename ?? '' this.subfolder = obj.subfolder ?? '' @@ -54,6 +58,9 @@ export class ResultItemImpl { this.format = obj.format this.frame_rate = obj.frame_rate + + this.content = obj.content + this.truncated = obj.truncated } get urlParams(): URLSearchParams { @@ -202,8 +209,14 @@ export class ResultItemImpl { return getMediaTypeFromFilename(this.filename) === '3D' } + get isText(): boolean { + return this.mediaType === 'text' && this.content !== undefined + } + get supportsPreview(): boolean { - return this.isImage || this.isVideo || this.isAudio || this.is3D + return ( + this.isImage || this.isVideo || this.isAudio || this.is3D || this.isText + ) } static filterPreviewable(