Commit 57f522f
feat(frontend): add HuggingFace media output rendering in result panel (#5675)
### What changes were proposed in this PR?
Render image, audio, and video outputs from HuggingFace tasks inline in
the workflow result panel instead of displaying raw data URLs as text.
**New file — `media-type.util.ts`:**
- `isImageUrl` — detects `data:image/` data URLs and common image
extensions (`.png`, `.jpg`, `.jpeg`, `.gif`, `.webp`)
- `isAudioUrl` — detects `data:audio/` data URLs and common audio
extensions (`.mp3`, `.wav`, `.ogg`, `.m4a`, `.flac`)
- `isVideoUrl` — detects `data:video/` data URLs, common video
extensions (`.mp4`, `.webm`, `.ogg`), and the `fal.media` CDN host used
by fal.ai text-to-video outputs
**Changes to `result-table-frame.component.{ts,html}`:**
- Add `isImageCell` / `isAudioCell` / `isVideoCell` methods that
delegate to the detection helpers
- Show a media type icon (play/image/audio) in the table cell; the
actual `<img>`, `<audio controls>`, `<video controls>` elements render
inline in the row detail modal
- Precompute each cell's media type once per row when result data
arrives (`cellMediaTypes[rowIndex][columnIndex]`), instead of re-running
the detection helpers and getCell on every change-detection cycle
**Changes to `result-panel-modal.component.{ts,html}`:**
- Build `rowEntries` with per-field media metadata on modal open
- Render media fields inline in the row detail view with a
copy-to-clipboard fallback for the raw URL
- Fetch remote media through the backend's /huggingface/media-proxy
endpoint (with JWT auth) rather than loading cross-origin URLs directly
in the browser
- On a proxy failure (e.g. the backend's SSRF allowlist rejects the
URL), fall back to the plain-text view instead of loading the raw remote
URL directly
- Revoke allocated blob URLs on `ngOnDestroy` to avoid leaking object
URLs for the life of the page
**Changes to `result-panel-model.component.scss`:**
- Add modal-toolbar and row-detail styles for media display
**Changes to `operator-property-edit-frame.component.ts`:⋆
- Show validation messages (`validation.show = true`) for the
image/audio upload and prompt-column fields on HuggingFace operators
**New file — `media-type.util.spec.ts`:**
- 22 unit tests covering all three helpers across data URL prefixes,
file extensions (including case-insensitivity and query strings), the
`fal.media` CDN URL and empty/plain-string inputs
### Any related issues, documentation, discussions?
- Tracking issue: #5674
- Closes: #5674
- Stacked on: #5568
- Parent issue: #5041
### How was this PR tested?
- `media-type.util.spec.ts` (22 cases): data URL prefixes, file
extensions, case-insensitivity, query strings, the fal.media CDN URL,
cross-type rejection, and non-string input handling
- `result-table-frame.component.spec.ts`: media cell icon rendering —
Play Video/Play Audio/View Image indicators and plain-text fallback
- `result-panel-modal.component.spec.ts`: row-entry construction from
data URLs vs. remote URLs, blob-fetch success/failure, the SSRF-safe
proxy-failure fallback, clipboard copy, and inline video/image `src`
binding
- Run with `ng test`
### Was this PR authored or co-authored using generative AI tooling?
Co-authored with Claude Sonnet 4.6 in compliance with ASF guidelines
---------
Signed-off-by: Elliot Lin <36275109+ELin2025@users.noreply.github.com>
Signed-off-by: Julie Cao <116243642+juliethecao@users.noreply.github.com>
Co-authored-by: Elliot <36275109+Falcons-Royale@users.noreply.github.com>
Co-authored-by: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
Co-authored-by: Elliot Lin <36275109+ELin2025@users.noreply.github.com>
Co-authored-by: Copilot Autofix powered by AI <175728472+Copilot@users.noreply.github.com>
Co-authored-by: Anish Shivamurthy <anish@uci.edu>
Co-authored-by: Anish Shivamurthy <anishshiva7@gmail.com>
Co-authored-by: PG1204 <vidya0dhar@gmail.com>
Co-authored-by: Matthew B. <mgball@uci.edu>1 parent d8d87a9 commit 57f522f
15 files changed
Lines changed: 1340 additions & 46 deletions
File tree
- frontend/src/app
- common/util
- workspace/component
- hugging-face-audio-upload
- hugging-face
- property-editor/operator-property-edit-frame
- result-panel
- result-table-frame
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
| 1 | + | |
| 2 | + | |
| 3 | + | |
| 4 | + | |
| 5 | + | |
| 6 | + | |
| 7 | + | |
| 8 | + | |
| 9 | + | |
| 10 | + | |
| 11 | + | |
| 12 | + | |
| 13 | + | |
| 14 | + | |
| 15 | + | |
| 16 | + | |
| 17 | + | |
| 18 | + | |
| 19 | + | |
| 20 | + | |
| 21 | + | |
| 22 | + | |
| 23 | + | |
| 24 | + | |
| 25 | + | |
| 26 | + | |
| 27 | + | |
| 28 | + | |
| 29 | + | |
| 30 | + | |
| 31 | + | |
| 32 | + | |
| 33 | + | |
| 34 | + | |
| 35 | + | |
| 36 | + | |
| 37 | + | |
| 38 | + | |
| 39 | + | |
| 40 | + | |
| 41 | + | |
| 42 | + | |
| 43 | + | |
| 44 | + | |
| 45 | + | |
| 46 | + | |
| 47 | + | |
| 48 | + | |
| 49 | + | |
| 50 | + | |
| 51 | + | |
| 52 | + | |
| 53 | + | |
| 54 | + | |
| 55 | + | |
| 56 | + | |
| 57 | + | |
| 58 | + | |
| 59 | + | |
| 60 | + | |
| 61 | + | |
| 62 | + | |
| 63 | + | |
| 64 | + | |
| 65 | + | |
| 66 | + | |
| 67 | + | |
| 68 | + | |
| 69 | + | |
| 70 | + | |
| 71 | + | |
| 72 | + | |
| 73 | + | |
| 74 | + | |
| 75 | + | |
| 76 | + | |
| 77 | + | |
| 78 | + | |
| 79 | + | |
| 80 | + | |
| 81 | + | |
| 82 | + | |
| 83 | + | |
| 84 | + | |
| 85 | + | |
| 86 | + | |
| 87 | + | |
| 88 | + | |
| 89 | + | |
| 90 | + | |
| 91 | + | |
| 92 | + | |
| 93 | + | |
| 94 | + | |
| 95 | + | |
| 96 | + | |
| 97 | + | |
| 98 | + | |
| 99 | + | |
| 100 | + | |
| 101 | + | |
| 102 | + | |
| 103 | + | |
| 104 | + | |
| 105 | + | |
| 106 | + | |
| 107 | + | |
| 108 | + | |
| 109 | + | |
| 110 | + | |
| 111 | + | |
| 112 | + | |
| 113 | + | |
| 114 | + | |
| 115 | + | |
| 116 | + | |
| 117 | + | |
| 118 | + | |
| 119 | + | |
| 120 | + | |
| 121 | + | |
| 122 | + | |
| 123 | + | |
| 124 | + | |
| 125 | + | |
| 126 | + | |
| 127 | + | |
| 128 | + | |
| 129 | + | |
| 130 | + | |
| 131 | + | |
| 132 | + | |
| 133 | + | |
| 134 | + | |
| 135 | + | |
| 136 | + | |
| 137 | + | |
| 138 | + | |
| 139 | + | |
| 140 | + | |
| 141 | + | |
| 142 | + | |
| 143 | + | |
| 144 | + | |
| 145 | + | |
| 146 | + | |
| 147 | + | |
| 148 | + | |
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
| 1 | + | |
| 2 | + | |
| 3 | + | |
| 4 | + | |
| 5 | + | |
| 6 | + | |
| 7 | + | |
| 8 | + | |
| 9 | + | |
| 10 | + | |
| 11 | + | |
| 12 | + | |
| 13 | + | |
| 14 | + | |
| 15 | + | |
| 16 | + | |
| 17 | + | |
| 18 | + | |
| 19 | + | |
| 20 | + | |
| 21 | + | |
| 22 | + | |
| 23 | + | |
| 24 | + | |
| 25 | + | |
| 26 | + | |
| 27 | + | |
| 28 | + | |
| 29 | + | |
| 30 | + | |
| 31 | + | |
| 32 | + | |
| 33 | + | |
| 34 | + | |
| 35 | + | |
| 36 | + | |
| 37 | + | |
0 commit comments