diff --git a/.github/media/chat.mp4 b/.github/media/chat.mp4 index 290257e..6851766 100644 Binary files a/.github/media/chat.mp4 and b/.github/media/chat.mp4 differ diff --git a/.github/media/chat.webp b/.github/media/chat.webp index 8fc385e..2447f8f 100644 Binary files a/.github/media/chat.webp and b/.github/media/chat.webp differ diff --git a/.github/media/image.mp4 b/.github/media/image.mp4 index 7a363ca..44a4b28 100644 Binary files a/.github/media/image.mp4 and b/.github/media/image.mp4 differ diff --git a/.github/media/image.webp b/.github/media/image.webp index ac7e0f5..45753ff 100644 Binary files a/.github/media/image.webp and b/.github/media/image.webp differ diff --git a/.github/media/mindmap.mp4 b/.github/media/mindmap.mp4 index 2f70b7e..0316225 100644 Binary files a/.github/media/mindmap.mp4 and b/.github/media/mindmap.mp4 differ diff --git a/.github/media/mindmap.webp b/.github/media/mindmap.webp index 0e579c7..60db5f7 100644 Binary files a/.github/media/mindmap.webp and b/.github/media/mindmap.webp differ diff --git a/.github/media/monitor.webp b/.github/media/monitor.webp new file mode 100644 index 0000000..44babab Binary files /dev/null and b/.github/media/monitor.webp differ diff --git a/.github/media/ocr.mp4 b/.github/media/ocr.mp4 index 7891717..58d0344 100644 Binary files a/.github/media/ocr.mp4 and b/.github/media/ocr.mp4 differ diff --git a/.github/media/ocr.webp b/.github/media/ocr.webp index 9f05270..4e89cde 100644 Binary files a/.github/media/ocr.webp and b/.github/media/ocr.webp differ diff --git a/.github/media/phone.webp b/.github/media/phone.webp new file mode 100644 index 0000000..5b6d725 Binary files /dev/null and b/.github/media/phone.webp differ diff --git a/.github/media/preset.webp b/.github/media/preset.webp new file mode 100644 index 0000000..7b1866e Binary files /dev/null and b/.github/media/preset.webp differ diff --git a/.github/media/setup.webp b/.github/media/setup.webp new file mode 100644 index 0000000..0dbfc87 Binary files /dev/null and b/.github/media/setup.webp differ diff --git a/.github/media/song.webp b/.github/media/song.webp new file mode 100644 index 0000000..c5d3ff9 Binary files /dev/null and b/.github/media/song.webp differ diff --git a/.github/media/theme.mp4 b/.github/media/theme.mp4 index 011e0d4..856fbe4 100644 Binary files a/.github/media/theme.mp4 and b/.github/media/theme.mp4 differ diff --git a/.github/media/theme.webp b/.github/media/theme.webp index bc6c3cc..9842981 100644 Binary files a/.github/media/theme.webp and b/.github/media/theme.webp differ diff --git a/.github/media/tour.mp4 b/.github/media/tour.mp4 index 9923e91..66103a6 100644 Binary files a/.github/media/tour.mp4 and b/.github/media/tour.mp4 differ diff --git a/.github/media/tour.webp b/.github/media/tour.webp index 5d721a4..ecfaf3c 100644 Binary files a/.github/media/tour.webp and b/.github/media/tour.webp differ diff --git a/.github/media/transcript.mp4 b/.github/media/transcript.mp4 index d0a6330..acb91df 100644 Binary files a/.github/media/transcript.mp4 and b/.github/media/transcript.mp4 differ diff --git a/.github/media/transcript.webp b/.github/media/transcript.webp index cd52081..4f1eb52 100644 Binary files a/.github/media/transcript.webp and b/.github/media/transcript.webp differ diff --git a/.github/media/translate.webp b/.github/media/translate.webp new file mode 100644 index 0000000..31b1260 Binary files /dev/null and b/.github/media/translate.webp differ diff --git a/.github/media/video.mp4 b/.github/media/video.mp4 index fdf29f9..3337c02 100644 Binary files a/.github/media/video.mp4 and b/.github/media/video.mp4 differ diff --git a/.github/media/video.webp b/.github/media/video.webp index 7b3d68c..046d606 100644 Binary files a/.github/media/video.webp and b/.github/media/video.webp differ diff --git a/.github/media/websearch.mp4 b/.github/media/websearch.mp4 index f85d9a9..47192fc 100644 Binary files a/.github/media/websearch.mp4 and b/.github/media/websearch.mp4 differ diff --git a/.github/media/websearch.webp b/.github/media/websearch.webp index 5ba79a1..6626e25 100644 Binary files a/.github/media/websearch.webp and b/.github/media/websearch.webp differ diff --git a/.github/media/workbench.mp4 b/.github/media/workbench.mp4 index 7b6f7f2..9b12ea9 100644 Binary files a/.github/media/workbench.mp4 and b/.github/media/workbench.mp4 differ diff --git a/.github/media/workbench.webp b/.github/media/workbench.webp index 2f6141a..b19671d 100644 Binary files a/.github/media/workbench.webp and b/.github/media/workbench.webp differ diff --git a/.github/media/workflow-editor.webp b/.github/media/workflow-editor.webp new file mode 100644 index 0000000..6313b96 Binary files /dev/null and b/.github/media/workflow-editor.webp differ diff --git a/.github/media/workflow-run.webp b/.github/media/workflow-run.webp new file mode 100644 index 0000000..5a911d7 Binary files /dev/null and b/.github/media/workflow-run.webp differ diff --git a/AGENTS.md b/AGENTS.md index b6b8a35..bfe51c2 100644 --- a/AGENTS.md +++ b/AGENTS.md @@ -113,8 +113,8 @@ Without a Spark, give the API a stack address so it skips setup (the services th profile remains for its id. - **Speech** picks its request from the model id (`asrProfile`): with a Parakeet id the app asks for word timestamps and `src/server/transcript-timing.ts` builds one transcript line per sentence and subtitle cues - (at most 7 s and 84 characters) from them, and the chunk target is capped at 30 s. Any other id keeps - Qwen3-ASR's plain request and one line per chunk. The Parakeet adapter takes WAV only. + (at most 7 s and 84 characters) from them, and the chunk target is capped at 30 s. Any other id gets the + plain request and one line per chunk. The Parakeet adapter takes WAV only. - **Image generation** asks the service for `/v1/capabilities` (sizes, default and maximum steps) and validates requests against it. - **Music generation** reads `/v1/capabilities` (lyrics and style limits, the license line) and gets a diff --git a/README.md b/README.md index 725bfcd..840f6cd 100644 --- a/README.md +++ b/README.md @@ -37,7 +37,7 @@ Every source and every result stays an ordinary file with its history, so one re Every use case below has its own model, and they all run on the same Spark at the same time: a recording can be transcribed while an image renders and a conversation gets its answer. Only heavy jobs, videos and songs, take turns ([Heavy jobs take turns](#heavy-jobs-take-turns)). -Each clip is the real app on a DGX Spark with demo files. Only the time spent waiting for a model is fast-forwarded. Click a clip for the full-quality MP4. +Each clip and screenshot is the real app on a DGX Spark with demo files. Only the time spent waiting for a model is fast-forwarded. Click a clip for the full-quality MP4. ### The Workbench @@ -55,7 +55,7 @@ Drop a PDF or a scan and get Markdown that keeps headings, tables and reading or #### Transcribe recordings -Parakeet-TDT-0.6B-v3 turns audio and video into a transcript with one line per sentence, and into subtitles (SRT and WebVTT) cut to a readable size from its word timestamps. Click a line and the player jumps there. On long files it runs 10 to 16 times faster than Qwen3-ASR, the model it replaced, in 1.7 GiB instead of 16.5 GiB. It covers 25 European languages. +Parakeet-TDT-0.6B-v3 turns audio and video into a transcript with one line per sentence, and into subtitles (SRT and WebVTT) cut to a readable size from its word timestamps. Click a line and the player jumps there. It needs 1.7 GiB and transcribes long files about 145 times faster than realtime. It covers 25 European languages. [![A transcript with one timed line per sentence; clicking a line moves the audio player (click for the MP4)](.github/media/transcript.webp)](.github/media/transcript.mp4) @@ -63,6 +63,8 @@ Parakeet-TDT-0.6B-v3 turns audio and video into a transcript with one line per s Hy-MT2-1.8B-FP8 translates between 38 languages. Paste text and the translation follows as you type; the live preview covers the first 2,000 characters, and **Save** starts a job that translates the whole text and keeps it. Documents, transcripts and dropped text files translate into a new document in the same job, linked to the original. +![Translating a paragraph into Italian as it is typed, with the live preview beside it](.github/media/translate.webp) + ### Create #### Generate images @@ -85,6 +87,8 @@ Write lyrics, mark the parts with `[Verse]`, `[Chorus]` and `[Bridge]`, describe YuE2's weights are non-commercial with a creator permission: you may publish and sell the songs you make, but a company needs a license from the authors ([model licenses](#model-licenses)). [YuE2](https://github.com/multimodal-art-projection/YuE) is made by the Multimodal Art Projection team (m-a-p). +![A finished song on its job page: the player, the song and its score in the file list, and the license line](.github/media/song.webp) + ### Ask and research #### Chat with your files @@ -111,18 +115,29 @@ Turn a typed topic, a document, a transcript or an image into an interactive map Run a saved instruction on a finished job's text. **Run a preset** on the job page sends it to the language model and saves the answer in the job as `summary..md`. Sparkfire comes with Meeting minutes, Clean document and Executive summary; edit them or add your own in **Settings → Prompts**. +![The Executive summary preset's result on the recognised report's job page](.github/media/preset.webp) + ### Automate #### Workflows Connect the same modules in a node editor and run the result again on a new file. Inputs are typed by artifact kind. The nodes are **Select**, **If** and **Switch** branches, **Merge** (all or any), **Save to file**, **End** and **Fail**, plus a node for every module, video, music, LLM prompts and **Create chat** included. Enabled workflows appear on the Workbench and under **Continue with**. Definitions are JSON files, each workflow run keeps a snapshot of the workflow it ran, and the run view shows which nodes ran, were skipped or failed. A video or song node waits in the GPU lane like any heavy job, but its workflow run keeps one of the queue's workers while it waits ([Heavy jobs take turns](#heavy-jobs-take-turns)). See [Workflow design and JSON contracts](docs/workflows.md). +![The Scan and translate workflow in the node editor: input, OCR, translation and Save](.github/media/workflow-editor.webp) + +![A finished run of the workflow on its job page, every node done](.github/media/workflow-run.webp) + ### Interface Pick dark, light or system in **Settings → General**; the whole interface follows, at any screen width, with a tab bar on phones. The sidebar shows the AI services' status and a compact Spark monitor. [![Switching the interface between dark and light in Settings (click for the MP4)](.github/media/theme.webp)](.github/media/theme.mp4) +

+ The Workbench on a phone, with the tab bar at the bottom + The sidebar's Spark monitor opened: memory, GPU, CUDA allocations and models online, above the AI services chip +

+ * * * ## Quick start @@ -173,6 +188,8 @@ Sparkfire has two layers that can run apart: the **models** (the stack and its s With `./scripts/start-sparkfire.sh --configure-later`, the first visit asks where the stack runs: **Run models locally** or **Run models remotely** (it checks the stack's ports 8330–8339 on the Spark; video on 8337 is optional). Reopen it from **Settings → General → Deployment**; it keeps your jobs, chats, workflows and files. In split mode, keep the Spark's ports 8330–8339 behind a firewall, LAN or VPN. +![The deployment setup page: run the models on this machine or on a Spark elsewhere](.github/media/setup.webp) + Each release also publishes a multi-platform image, `ghcr.io/moviemaker93/sparkfire`, for your own Compose file. To build from source instead: ```bash @@ -203,7 +220,7 @@ git pull The script rebuilds what changed and leaves `data/` alone. Every start points the services at the stack's models, so no setting needs changing after an upgrade, whatever was chosen before. -- **From the six-model stack or an earlier model set:** the start script removes the retired Qwen3.6 LLM, Qwen3-ASR, LocateAnything and Unlimited-OCR containers, and downloads the models the stack now uses. Earlier model files stay in `data/dgx-models` until you delete them; see [Upgrading from the six-model stack](docs/dgx-spark.md#upgrading-from-the-six-model-stack). +- **From the six-model stack or an earlier model set:** the start script removes the retired services' containers and downloads the models the stack now uses. Earlier model files stay in `data/dgx-models` until you delete them; see [Upgrading from the six-model stack](docs/dgx-spark.md#upgrading-from-the-six-model-stack). - **An install configured by hand:** the stack replaces services set up in Settings or with **Configure manually**, which is gone. A workspace that is not on the stack goes through setup in the browser again. - **From an install made before the rename to Sparkfire:** point your checkout at this repository and run the start script again. It removes the old containers and starts the `sparkfire-` ones, reusing your jobs, settings and downloaded models; only `SPARKFIRE_*` variables in `.env` are read. @@ -262,7 +279,7 @@ Parakeet grows to 1.6–1.8 GiB of GPU memory and up to 1.5 GiB of RAM while it | A video job (on top of the above) | +35–39 GiB for Fast at 480p, +41–48 GiB for Fast at 720p or longer, +44–57 GiB for Sharp; the weights stay loaded until 10 minutes without a job | | A song (on top of the above) | about +20 GiB at its peak, short or long; about 15 GiB stays loaded until 10 minutes without a song | -These are the measured figures from [docs/validation.md](docs/validation.md) minus the removed Qwen3.6 LLM (31 GiB) and LocateAnything (10.9 GiB); the Parakeet idle figure was measured on the full stack. The older 84–96 GiB figures in that file were measured with the Qwen3.6 LLM and Qwen3-ASR resident, before Sparkfire removed them. +These are the measured figures from [docs/validation.md](docs/validation.md) minus the removed Qwen3.6 LLM (31 GiB) and LocateAnything (10.9 GiB); the Parakeet idle figure was measured on the full stack. The older 84–96 GiB figures in that file were measured with the Qwen3.6 LLM and an earlier speech model resident, before Sparkfire removed them. Saluki's row was measured on its own next to the stack (docs/validation.md). Measured together with Saluki, the largest video job (Sharp, 1344 × 768, 10 s) brought the Spark to 106.6 of 121 GiB. diff --git a/docs/dgx-spark.md b/docs/dgx-spark.md index a62f82f..ffffeeb 100644 --- a/docs/dgx-spark.md +++ b/docs/dgx-spark.md @@ -53,8 +53,7 @@ The script: 1. verifies Linux ARM64, Docker Compose and NVIDIA GPU access; 2. builds Sparkfire and the thin model API adapters; 3. downloads the stack's models from their publishers into `data/dgx-models/`, at pinned revisions except Saluki's for now; -4. removes the containers left from before the rename to Sparkfire, retired services among them (the Qwen3.6 - LLM, Qwen3-ASR, LocateAnything, Unlimited-OCR); +4. removes the containers left from before the rename to Sparkfire, retired services among them; 5. on a fresh start, checks that about 64 GiB are free, which the stack needs while its models load, and stops otherwise (`--skip-memory-check` overrides it); 6. starts the model servers one at a time, Saluki first, and waits for each health endpoint; 7. starts SearXNG and the read-only system monitor; and @@ -85,7 +84,7 @@ Port 54321 is present only in an all-in-one deployment. The ports and co-residen ### Speech recognition backend -Port 8333 serves Parakeet; it replaced the earlier Qwen3-ASR backend (16.5 GiB, 52 languages). +Port 8333 serves Parakeet, the stack's only speech model. | Model | Container | Memory | Languages | | --- | --- | --- | --- | @@ -94,8 +93,7 @@ Port 8333 serves Parakeet; it replaced the earlier Qwen3-ASR backend (16.5 GiB, Parakeet downloads one 1.4 GB GGUF file at a pinned revision, and its image builds parakeet.cpp from pinned source for the GB10. The adapter accepts WAV only, which is what Sparkfire sends, and serves one request at a time. Parakeet returns word timestamps, from which -Sparkfire builds one transcript line per sentence and subtitle-sized cues; Qwen3-ASR gave one line per -chunk. +Sparkfire builds one transcript line per sentence and subtitle-sized cues. ### Video generation @@ -194,4 +192,4 @@ Sparkfire runs on this stack only: users do not pick models, URLs or keys, and S ### Upgrading from the six-model stack -`./scripts/start-dgx-spark.sh` removes the containers of the retired Qwen3.6 LLM, Qwen3-ASR, LocateAnything and Unlimited-OCR services, which would otherwise keep restarting and hold memory the stack's budget assumes is free. It downloads and starts the models the stack now uses, Saluki among them, and the app points its services at them on its next start, whatever the settings held. Their images and earlier model files stay on disk until you delete them. +`./scripts/start-dgx-spark.sh` removes the containers of retired services, which would otherwise keep restarting and hold memory the stack's budget assumes is free. It downloads and starts the models the stack now uses, Saluki among them, and the app points its services at them on its next start, whatever the settings held. Their images and earlier model files stay on disk until you delete them. diff --git a/docs/fork.md b/docs/fork.md index d444ccd..30a47b3 100644 --- a/docs/fork.md +++ b/docs/fork.md @@ -164,11 +164,9 @@ only video can be left out, where its license does not apply. Parakeet TDT 0.6B v3 is the default speech model, run by [parakeet.cpp](https://github.com/mudler/parakeet.cpp) (MIT) from the f16 GGUF in `mudler/parakeet-cpp-gguf`. The weights are NVIDIA's, under CC BY 4.0, which allows -commercial use with credit. It replaced this stack's earlier Qwen3-ASR backend: 1.7 GiB instead of -16.5 GiB, 10 to 16 times faster through the app on long files, and as accurate on short clips (3.6% -against 3.7% word error rate in English, 3.9% against 4.4% in Italian). Its limit is language: 25 -European languages against Qwen3-ASR's 52. Qwen3-ASR was removed from the stack; the app keeps its request -profile for that model id. +commercial use with credit. It takes 1.7 GiB, transcribes long files about 145 times faster than realtime +through the app, and scores 3.6% word error rate in English and 3.9% in Italian on short clips. Its limit is +language: 25 European languages. - **Service.** - `sparkfire-parakeet` (image `sparkfire/parakeet:parakeet.cpp-v0.5.0`) builds the engine from diff --git a/docs/validation.md b/docs/validation.md index d65b880..1728357 100644 --- a/docs/validation.md +++ b/docs/validation.md @@ -321,6 +321,35 @@ was only ever estimated. The 92.4 GiB peak belongs to the pass that ran before H Known issues): the LLM spent its whole 8192-token budget on a reasoning trace while every translation request hung. +## Fresh install (2026-10-13) + +A from-scratch install on a DGX Spark, done as the README's Quick start says: the previous install's +containers, images and model files removed and the Docker build cache pruned, then `git clone` and +`./scripts/start-dgx-spark.sh --accept-model-licenses` with the default video backend (FastH3) and no +Hugging Face token. + +- **Commit installed:** `c4604f5` (0.3.0). +- **Wall time:** 20 minutes from the start of the script to `Sparkfire is ready`, building every image + and downloading every model; `status` then showed all ten endpoints `ready`, video and music included. +- **Disk:** 106 GB, from 259 GB to 153 GB free. +- **Idle memory after start:** 51 GiB used and 70 GiB available (`free -g`), within the README's figure of + about 29 GiB for the stack plus 13–21.5 GiB for Saluki. GPU memory per process (`nvidia-smi`): + +| Container | GPU | +| --- | --- | +| `sparkfire-image-generation` | 17.5 GiB | +| `sparkfire-saluki` | 12.7 GiB | +| `sparkfire-paddleocr-vlm` | 5.4 GiB | +| `sparkfire-hy-mt2` | 2.1 GiB | +| `sparkfire-parakeet` | 1.5 GiB | +| `sparkfire-video-generation` (idle, no weights loaded) | 0.2 GiB | +| `sparkfire-music-generation` (idle, no weights loaded) | — | + +- **Problems:** the install itself needed no fix. Two problems turned up around it: + - The services chip had no row for music, so it read "6/6 online" while YuE2 ran; fixed in `7ae427f`. + - `scripts/media/populate-demo.sh` was committed without its executable bit, so the media README's + step 2 stopped with *Permission denied*; fixed in `61d590e`. + ## Known issues - **The stock LLM could crash on long generations** (historical: Saluki in llama.cpp replaced it, and the diff --git a/scripts/media/README.md b/scripts/media/README.md index 2459ba3..359a59f 100644 --- a/scripts/media/README.md +++ b/scripts/media/README.md @@ -12,9 +12,10 @@ them, and its own monitor and SearXNG. | `demo-pdf.py`, `demo-audio.py` | Build the demo inputs: a fictional three-page report and about a minute of read speech from LibriSpeech (CC BY 4.0) | | `demo.env`, `status-proxy.py` | An isolated demo copy of the app, so no real jobs, chats or host names appear on screen | | `test_status_proxy.py` | Checks that the status proxy only ever forwards the status route; CI runs it | -| `populate-demo.sh` | Fills the demo copy with real jobs on the real models (OCR, transcription, images, a video, translation, mind map) | -| `record-demo.mjs` | Playwright: Chromium's own screencast frames for each scene, with a visible pointer, plus screenshots and the moments spent waiting for a model. Playwright's built-in video recording is not used, because it compresses to about 1 Mbit/s and blurs text | -| `make-media.mjs` | ffmpeg: plays the frames back at their recorded times, fast-forwards the waits, writes an MP4 (1440 × 900) and an animated WebP (1280 px, 15 fps) per scene, and stitches the tour | +| `populate-demo.sh` | Fills the demo copy with real jobs on the real models (OCR, transcription, images, a video, translation, mind map), plus a song, a workflow run and a prompt preset result | +| `demo-workflow.json` | The *Scan and translate* workflow that `populate-demo.sh` creates and runs, for the Workflows stills | +| `record-demo.mjs` | Playwright: Chromium's own screencast frames for each clip, with a visible pointer, plus screenshots, the moments spent waiting for a model, and the README's stills. Playwright's built-in video recording is not used, because it compresses to about 1 Mbit/s and blurs text | +| `make-media.mjs` | ffmpeg: plays the frames back at their recorded times, fast-forwards the waits, writes an MP4 (1440 × 900) and an animated WebP (1280 px, 15 fps) per clip, turns each still into a WebP, and stitches the tour | ## Steps @@ -44,7 +45,8 @@ them, and its own monitor and SearXNG. ./scripts/media/populate-demo.sh ``` -3. **Record** every scene, or name some: `workbench ocr transcript image video websearch chat mindmap theme`. +3. **Record** every scene, or name some: the clips `workbench ocr transcript image video websearch chat mindmap theme` + and the stills `translate song preset workflow-editor workflow-run monitor setup phone`. ```bash docker run --rm --network host -v "$PWD/scripts/media:/m" -w /m mcr.microsoft.com/playwright:v1.64.0-noble \ @@ -70,8 +72,8 @@ Scenes wait for real model output, so the timings depend on the models running. first video through the API before it types its own, so the recording shows the second one *Waiting for the GPU*; it renders two videos and waits up to 15 minutes. The web search scene asks about something current, so its sources and answer change from one recording to the next. To change -the tour, edit `TOUR` in `make-media.mjs`. The README loads every WebP, so keep the tour around 4 MB and each -clip under 2 MB; a clip with a generated video in it is the largest, because its frames all change. +the tour, edit `TOUR` in `make-media.mjs`. The README loads every WebP, so keep the tour around 4 MB, each +clip under 2 MB and each still under 1 MB; a clip with a generated video in it is the largest, because its frames all change. Generated videos can come back with a made-up broadcaster logo in a corner when the prompt reads like a nature documentary, so the demo prompts avoid that style. Check the videos before publishing a recording. diff --git a/scripts/media/demo-workflow.json b/scripts/media/demo-workflow.json new file mode 100644 index 0000000..072b6f8 --- /dev/null +++ b/scripts/media/demo-workflow.json @@ -0,0 +1,20 @@ +{ + "schemaVersion": 1, + "id": "scan-and-translate", + "revision": 1, + "name": "Scan and translate", + "description": "Read a scanned document and translate it into Italian.", + "enabled": true, + "nodes": [ + { "id": "input", "type": "input", "position": { "x": 40, "y": 200 }, "config": { "accepts": ["source-image", "source-pdf"], "multiple": true, "maximumFiles": 20 } }, + { "id": "ocr", "type": "module", "position": { "x": 330, "y": 200 }, "config": { "moduleId": "ocr", "workflowId": "auto", "params": {}, "storeResult": true } }, + { "id": "translate", "type": "module", "position": { "x": 620, "y": 200 }, "config": { "moduleId": "translation", "workflowId": "auto", "params": { "sourceLanguage": "auto-detect", "targetLanguage": "Italian" } } }, + { "id": "save", "type": "save", "position": { "x": 910, "y": 200 }, "config": { "mode": "input", "fileName": "translated.md" } } + ], + "edges": [ + { "id": "input-ocr", "from": { "nodeId": "input", "portId": "files" }, "to": { "nodeId": "ocr", "portId": "input" }, "artifactKinds": ["source-image", "source-pdf"] }, + { "id": "ocr-translate", "from": { "nodeId": "ocr", "portId": "output" }, "to": { "nodeId": "translate", "portId": "input" }, "artifactKinds": ["document"] }, + { "id": "translate-save", "from": { "nodeId": "translate", "portId": "output" }, "to": { "nodeId": "save", "portId": "input" }, "artifactKinds": ["translation"] } + ], + "ui": { "viewport": { "x": 0, "y": 0, "zoom": 1 } } +} diff --git a/scripts/media/make-media.mjs b/scripts/media/make-media.mjs index 9995c34..33668e0 100644 --- a/scripts/media/make-media.mjs +++ b/scripts/media/make-media.mjs @@ -1,5 +1,5 @@ -// Turns the recordings from record-demo.mjs into README media: one MP4 and one animated WebP per clip, plus -// a short tour of the highlights. Waits for a model are fast-forwarded from the logged events. +// Turns the recordings from record-demo.mjs into README media: one MP4 and one animated WebP per clip, a WebP +// per still, and a short tour of the highlights. Waits for a model are fast-forwarded from the logged events. // // node make-media.mjs (needs ffmpeg with libx264 and libwebp) import { spawnSync } from "node:child_process"; @@ -109,6 +109,18 @@ for (const name of ["workbench", "ocr", "transcript", "image", "video", "websear console.log(`${name}: ${duration(edited[name]).toFixed(1)} s, MP4 ${megabytes(path.join(output, `${name}.mp4`))}, WebP ${megabytes(path.join(output, `${name}.webp`))}`); } +// The stills from record-demo.mjs. Lossless WebP keeps their text sharp; a still that would pass 1 MB is encoded +// lossy instead, so the README stays light. +const STILLS = ["translate", "song", "preset", "workflow-editor", "workflow-run", "monitor", "setup", "phone"]; +for (const name of STILLS) { + const source = path.join(input, `${name}.png`); + if (!existsSync(source)) continue; + const target = path.join(output, `${name}.webp`); + ffmpeg(["-i", source, "-c:v", "libwebp", "-lossless", "1", "-compression_level", "6", target]); + if (readFileSync(target).length > 1e6) ffmpeg(["-i", source, "-c:v", "libwebp", "-quality", "90", "-compression_level", "6", target]); + console.log(`${name}: WebP ${megabytes(target)}`); +} + // The tour stitches highlights of the processed clips together. const parts = TOUR.filter(([name]) => edited[name]).map(([name, start, end], index) => { const file = edited[name]; diff --git a/scripts/media/populate-demo.sh b/scripts/media/populate-demo.sh old mode 100644 new mode 100755 index 1197fbc..9a1d07a --- a/scripts/media/populate-demo.sh +++ b/scripts/media/populate-demo.sh @@ -9,6 +9,14 @@ wait_for() { until status=$(curl -s "$api/jobs/$id" | jq -r .status); [[ "$status" =~ ^(done|done_with_warnings|failed|cancelled)$ ]]; do sleep 4; done printf '%-14s %s %s\n' "$2" "$status" "$id" } +wait_file() { + local id="$1" file="$2" job + until job=$(curl -s "$api/jobs/$id"); jq -e --arg f "$file" '(.status | test("^done")) and (.outputFiles | index($f) != null)' <<<"$job" >/dev/null; do + if jq -e '.status == "failed" or .status == "cancelled"' <<<"$job" >/dev/null; then printf '%-14s failed %s\n' "$3" "$id"; return 1; fi + sleep 4 + done + printf '%-14s %s %s\n' "$3" "done" "$id" +} image() { jq -n --arg p "$1" --arg s "${2:-1024x1024}" '{prompt: $p, size: $s, seed: 7}' \ | curl -s -H 'Content-Type: application/json' --data-binary @- "$api/modules/text-to-image/jobs" | jq -r .id @@ -25,7 +33,28 @@ cup=$(image "Studio photo of a ceramic coffee cup with latte art on a walnut tab video=$(curl -s -F 'prompt=A steaming cup of coffee on a cafe table by a rainy window, slow push-in, warm evening light' \ -F 'sound=rain on the glass, quiet cafe chatter' -F size=864x480 -F duration=5 -F seed=7 \ "$api/modules/text-to-video/jobs" | jq -r .id) +# A short song for the Make songs still; YuE2 takes about as long as the song plays. +lyrics=$(cat <<'EOF' +[Verse] +Lanterns on the harbor wall +Fishing boats come home before the fall +Salt and rain on the window pane +We will build this town again + +[Chorus] +Hold the light, hold the line +Every tide will turn in time +Hold the light, don't let go +Harbor Point will bring us home +EOF +) +song=$(jq -n --arg l "$lyrics" --arg s "warm indie folk, gentle female vocal, acoustic guitar, soft piano, brushed drums, 92 bpm" '{lyrics: $l, style: $s, seed: 7}' \ + | curl -s -H 'Content-Type: application/json' --data-binary @- "$api/modules/text-to-music/jobs" | jq -r .id) +# The workflow for the Workflows stills, run once on the report. +workflow=$(curl -sf -H 'Content-Type: application/json' --data-binary @../demo-workflow.json "$api/workflows" | jq -er 'select(.validation.valid) | .definition.id') +workflow_run=$(curl -sf -F files=@harbor-point-feasibility.pdf "$api/workflows/$workflow/runs" | jq -r .job.id) wait_for "$ocr" ocr; wait_for "$asr" transcription +curl -sf -X POST "$api/jobs/$ocr/presets/executive-summary" >/dev/null wait_for "$wind" image; wait_for "$books" image; wait_for "$island" image; wait_for "$cup" image # Translation and a mind map from the OCR'd report. @@ -34,7 +63,8 @@ translation=$(jq -n --arg t "$(printf '%s' "$text" | head -c 1500)" '{text: $t, | curl -s -H 'Content-Type: application/json' --data-binary @- "$api/modules/translation/text" | jq -r .id) mindmap=$(jq -n --arg t "$text" '{subject: $t, depth: 3, breadth: 5}' \ | curl -s -H 'Content-Type: application/json' --data-binary @- "$api/modules/mindmap/jobs" | jq -r .id) -wait_for "$translation" translation; wait_for "$mindmap" mindmap; wait_for "$video" video +wait_for "$translation" translation; wait_for "$mindmap" mindmap; wait_file "$ocr" summary.executive-summary.md preset; wait_for "$workflow_run" workflow; wait_for "$video" video; wait_for "$song" song jq -n --arg ocr "$ocr" --arg asr "$asr" --arg wind "$wind" --arg books "$books" --arg island "$island" --arg cup "$cup" \ - --arg video "$video" --arg translation "$translation" --arg mindmap "$mindmap" '$ARGS.named' > jobs.json + --arg video "$video" --arg translation "$translation" --arg mindmap "$mindmap" \ + --arg song "$song" --arg workflow "$workflow" --arg workflowRun "$workflow_run" '$ARGS.named' > jobs.json cat jobs.json diff --git a/scripts/media/record-demo.mjs b/scripts/media/record-demo.mjs index 0a25380..d45a52c 100644 --- a/scripts/media/record-demo.mjs +++ b/scripts/media/record-demo.mjs @@ -1,11 +1,12 @@ -// Records the README demo clips and screenshots against a running Sparkfire with real models. +// Records the README demo clips and stills against a running Sparkfire with real models. // -// node record-demo.mjs [clip ...] (BASE_URL, ASSETS, JOBS and OUT override the defaults below) +// node record-demo.mjs [scene ...] (BASE_URL, ASSETS, JOBS and OUT override the defaults below) // // Each clip is its own browser session, saved as Chromium's own screencast frames with their times // (/frames.json); make-media.mjs turns them into video. Moments spent waiting for a model are logged in -// .events.json, and make-media.mjs fast-forwards them. Run it against a demo copy of the app with demo -// data only (see scripts/media/README.md): everything on screen ends up in the README. +// .events.json, and make-media.mjs fast-forwards them. Stills are single screenshots (.png) for the +// README sections without a clip. Run it against a demo copy of the app with demo data only (see +// scripts/media/README.md): everything on screen ends up in the README. import { mkdir, readFile, rm, writeFile } from "node:fs/promises"; import path from "node:path"; import { chromium } from "playwright"; @@ -16,6 +17,7 @@ const ASSETS = process.env.ASSETS || "work"; const jobs = JSON.parse(await readFile(process.env.JOBS || path.join(ASSETS, "jobs.json"), "utf8")); const VIEWPORT = { width: 1440, height: 900 }; const pause = (ms) => new Promise((resolve) => setTimeout(resolve, ms)); +const TRANSLATE_TEXT = "The Harbor Point feasibility study recommends a phased approach. The first phase turns the old ferry terminal into a public market that opens in spring 2028; the second adds forty affordable homes and a seawall that protects the waterfront from storm surges."; // Headless recordings show no pointer, so draw one that follows the mouse and pulses on click. const CURSOR = ` @@ -93,6 +95,26 @@ async function shot(page, name) { await page.screenshot({ path: path.join(OUT, `${name}.png`) }); } +// Stills are single screenshots for the README, each in its own browser session without a screencast. +const STILL_CONTEXTS = { + phone: { viewport: { width: 375, height: 812 }, deviceScaleFactor: 2, isMobile: true, hasTouch: true }, + monitor: { deviceScaleFactor: 2 }, + // The graphs fit four nodes into the canvas at about half size; at 2x their labels stay legible full size. + "workflow-editor": { deviceScaleFactor: 2 }, + "workflow-run": { deviceScaleFactor: 2 }, +}; + +async function still(name, scene) { + const context = await browser.newContext({ viewport: VIEWPORT, colorScheme: "dark", ...STILL_CONTEXTS[name] }); + const page = await context.newPage(); + try { + await scene(page); + console.log(`captured ${name}`); + } finally { + await context.close(); + } +} + const clips = { // The home screen while real jobs run: the Running now strip with images and a video, recent work, the services chip. async workbench(page) { @@ -288,12 +310,97 @@ const clips = { }, }; -const wanted = process.argv.slice(2).length ? process.argv.slice(2) : Object.keys(clips); +const outputItem = (page, name) => page.locator(".file-tree-item").filter({ has: page.locator("strong", { hasText: name }) }); + +const stills = { + // Text translation into Italian, with the live preview filled in. + async translate(page) { + await page.goto(`${BASE_URL}/tools/translation`); + await page.getByRole("combobox", { name: "To language" }).click(); + await page.getByLabel("Search languages").fill("Italian"); + await page.getByRole("option", { name: /^Italian/ }).click(); + await page.getByPlaceholder("Enter text").fill(TRANSLATE_TEXT); + await page.waitForFunction(() => { + const out = document.querySelector(".translation-pane.output textarea"); + return out instanceof HTMLTextAreaElement && out.value.trim().length > 0 && out.getAttribute("aria-busy") === "false"; + }, null, { timeout: 120_000 }); + // Filling leaves the source scrolled to its end; show both texts from their first line. + await page.locator(".translation-pane textarea").evaluateAll((areas) => areas.forEach((area) => { area.blur(); area.scrollTop = 0; })); + await pause(800); + await shot(page, "translate"); + }, + + // The finished song: its player, the files it came with and the license line. + async song(page) { + await page.goto(`${BASE_URL}/jobs/${jobs.song}`); + await glide(page, outputItem(page, /^Song$/)); + await page.locator(".source-media-preview audio").first().waitFor(); + await page.locator(".generated-disclosure").first().waitFor(); + await pause(1200); + await shot(page, "song"); + }, + + // The Executive summary preset's result on the OCR job. + async preset(page) { + await page.goto(`${BASE_URL}/jobs/${jobs.ocr}`); + await glide(page, outputItem(page, /^Executive Summary$/)); + await page.locator(".preview-content :is(h1, h2, p)").first().waitFor(); + await pause(1200); + await shot(page, "preset"); + }, + + // The demo workflow in the node editor, fitted to the canvas. + async "workflow-editor"(page) { + await page.goto(`${BASE_URL}/workflows/${jobs.workflow}`); + await page.locator(".workflow-canvas .workflow-node").nth(3).waitFor(); + await page.locator(".workflow-canvas .react-flow__controls-fitview").click(); + await pause(1000); + await shot(page, "workflow-editor"); + }, + + // The finished workflow run on its job page, every node done. + async "workflow-run"(page) { + await page.goto(`${BASE_URL}/jobs/${jobs.workflowRun}`); + await page.locator(".job-workflow-record").click(); + await page.locator(".workflow-status-graph .workflow-status-node").nth(3).waitFor(); + await pause(1200); + await shot(page, "workflow-run"); + }, + + // The sidebar's Spark monitor opened, above the services chip. + async monitor(page) { + await page.goto(`${BASE_URL}/`); + await page.locator(".spark-monitor-summary").click(); + await page.locator(".spark-monitor-details").waitFor(); + await pause(800); + await page.locator(".sidebar-status").screenshot({ path: path.join(OUT, "monitor.png") }); + }, + + // The deployment setup page. Nothing is clicked: verifying would probe the stack from the demo copy. + async setup(page) { + await page.goto(`${BASE_URL}/setup`); + await page.getByRole("heading", { name: "Connect your AI services" }).waitFor(); + await pause(1000); + await shot(page, "setup"); + }, + + // The Workbench on a phone, with the tab bar. + async phone(page) { + await page.goto(`${BASE_URL}/`); + await page.getByRole("navigation", { name: "Primary navigation" }).waitFor(); + await pause(2500); + await shot(page, "phone"); + }, +}; + +const wanted = process.argv.slice(2).length ? process.argv.slice(2) : [...Object.keys(clips), ...Object.keys(stills)]; for (const name of wanted) { try { - await clip(name, clips[name]); + if (clips[name]) await clip(name, clips[name]); + else if (stills[name]) await still(name, stills[name]); + else console.error(`unknown scene ${name}`); } catch (error) { - console.error(`clip ${name} failed: ${error.message.split("\n")[0]}`); + console.error(`${clips[name] ? "clip" : "still"} ${name} failed: ${error.message.split("\n")[0]}`); } } await browser.close(); diff --git a/src/client/components/AppShell.tsx b/src/client/components/AppShell.tsx index 4b61bde..865aadc 100644 --- a/src/client/components/AppShell.tsx +++ b/src/client/components/AppShell.tsx @@ -21,10 +21,11 @@ const services = [ { kind: "ocr" as const, label: "OCR", fallback: "Document recognition", icon: ScanText }, { kind: "llm" as const, label: "LLM", fallback: "Language model", icon: BrainCircuit }, { kind: "translation" as const, label: "Translation", fallback: "Not configured", icon: Languages }, - // The stack ships no grounding service, so its row shows only once an endpoint is enabled. + // The stack ships no grounding service, and music can be left out, so their rows show only once an endpoint is enabled. { kind: "grounding" as const, label: "Grounding", fallback: "Not configured", icon: ScanSearch, optional: true }, { kind: "image-generation" as const, label: "Image", fallback: "Not configured", icon: ImageIcon }, { kind: "video-generation" as const, label: "Video", fallback: "Not configured", icon: Film }, + { kind: "music-generation" as const, label: "Music", fallback: "Not configured", icon: Music, optional: true }, ]; const sidebarPreferenceKey = "sparkfire:sidebar-collapsed"; const monitorPreferenceKey = "sparkfire:monitor-expanded";