Skip to content

Commit ec535fc

Browse files
Workflow: reuse Playground form for AI Task and defParams; Execution Monitor row click toggles
- AI Task: use getFormFieldsFromModel + FormField when model loaded (same as Playground) - defParams: paramDefToFormFieldConfig + FormField for all node types; DefParamControl only for outputDir picker - Seed: 0-65535 range, Dices icon, tooltip, optional placeholder (workflow.seedRandomPlaceholder) - Execution Monitor: click entire header row to toggle expand/collapse - CLAUDE.md and en.json updates Co-authored-by: Cursor <[email protected]>
1 parent 0d15bad commit ec535fc

5 files changed

Lines changed: 230 additions & 25 deletions

File tree

CLAUDE.md

Lines changed: 17 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@ This file provides guidance for Claude Code when working with this repository.
66

77
WaveSpeed Desktop is an Electron-based cross-platform desktop application that provides a playground interface for [WaveSpeedAI](https://wavespeed.ai) models. It allows users to browse models, run predictions, view their history, and manage saved assets.
88

9-
**Workflow** is a node-based visual editor (under `src/workflow/`) for chaining WaveSpeed AI Task nodes, free-tool nodes, and I/O nodes. Workflows are persisted via the Electron main process (sql.js DB), with execution, cost estimation, and per-node history.
9+
**Workflow** is a node-based visual editor (under `src/workflow/`) for chaining WaveSpeed AI Task nodes, free-tool nodes, and I/O nodes. Workflows are persisted via the Electron main process (sql.js DB), with execution and per-node history. Workflows can run in Electron (main process) or in the browser (in-process executor using apiClient + free-tool runners when workflow IPC is unavailable). Cost is informational only (no estimate UI or budget blocking).
1010

1111
**Z-Image** is the local image generation flow backed by stable-diffusion.cpp with model and auxiliary downloads, progress reporting, and log streaming.
1212

@@ -48,7 +48,8 @@ wavespeed-desktop/
4848
│ │ ├── types/ # workflow, node-defs, execution, ipc
4949
│ │ ├── ipc/ # ipc-client.ts (invoke workflow/execution/models/cost/history IPC)
5050
│ │ ├── hooks/ # useUndoRedo, useFreeToolListener
51-
│ │ └── lib/ # free-tool-runner, constants
51+
│ │ ├── browser/ # run-in-browser.ts (in-process executor for browser mode)
52+
│ │ └── lib/ # free-tool-runner, model-converter, outputDisplay, topological
5253
│ └── workers/ # Web Workers (upscaler, backgroundRemover, imageEraser, faceEnhancer, segmentAnything, ffmpeg)
5354
├── .github/workflows/ # GitHub Actions for CI/CD
5455
│ ├── build.yml # Build on push/tag/PR
@@ -71,14 +72,18 @@ wavespeed-desktop/
7172
- **`src/workflow/stores/execution.store.ts`**: Execution state (running, results, history, progress)
7273
- **`src/workflow/stores/ui.store.ts`**: Workflow UI state (selected node, panels, add-node palette)
7374
- **`src/workflow/components/panels/NodeConfigPanel.tsx`**: Model selector for AI Task nodes; categories sorted by popularity (model count), recent models, search
74-
- **`src/workflow/components/panels/ResultsPanel.tsx`**: Execution results and per-node history
75-
- **`src/workflow/components/panels/CostPanel.tsx`**: Cost estimate and budget config
75+
- **`src/workflow/components/panels/ResultsPanel.tsx`**: Execution results and per-node history; shows lastResults when history is empty (e.g. browser run)
76+
- **`src/workflow/components/panels/CostPanel.tsx`**: Cost display (informational; no estimate UI or budget blocking)
7677
- **`src/workflow/components/panels/SettingsPanel.tsx`**: Workflow settings (API keys, etc.)
7778
- **`src/workflow/components/canvas/WorkflowCanvas.tsx`**: React Flow canvas, add-node palette, node/edge rendering
7879
- **`src/workflow/components/canvas/NodePalette.tsx`**: Add-node palette (input, ai-task, free-tool, output, etc.)
7980
- **`src/workflow/components/canvas/CustomNode.tsx`**: Custom node UI (AI Task, free-tool, I/O, annotation)
8081
- **`src/workflow/components/canvas/CustomEdge.tsx`**: Custom edge rendering
8182
- **`src/workflow/components/canvas/AnnotationNode.tsx`**: Annotation node for notes
83+
- **`src/workflow/components/canvas/RunMonitor.tsx`**: Execution Monitor (bottom, collapsible); session cards and node rows with output preview (image/video/audio/text via outputDisplay); Lucide ChevronUp/ChevronDown for expand/collapse
84+
- **`src/workflow/lib/outputDisplay.ts`**: Shared output type classification (image/video/audio/text/3d/file) and data: URL handling for Results panel and RunMonitor
85+
- **`src/workflow/lib/topological.ts`**: Shared topological sort for workflow execution order (browser and main)
86+
- **`src/workflow/browser/run-in-browser.ts`**: In-process workflow executor for browser mode (AI task via apiClient, free-tool nodes, I/O nodes)
8287
- **`src/workflow/ipc/ipc-client.ts`**: Typed IPC client for workflow, execution, models, cost, history, registry, settings
8388
- **`src/workflow/types/node-defs.ts`**: NodeTypeDefinition, WaveSpeedModel, ParamDefinition
8489
- **`src/workflow/types/ipc.ts`**: IPC channel types (workflow:*, execution:*, models:*, cost:*, history:*, etc.)
@@ -182,7 +187,7 @@ npm run build:all # Build for all platforms
182187
### Adding a new page
183188
1. Create component in `src/pages/`
184189
2. Add route in `src/App.tsx`
185-
3. Add navigation item in `src/components/layout/Sidebar.tsx`
190+
3. Add navigation item in `src/components/layout/Sidebar.tsx` under the appropriate section (Create, Manage, or Tools)
186191

187192
### Adding a new API method
188193
1. Add method to `WaveSpeedClient` class in `src/api/client.ts`
@@ -253,9 +258,14 @@ The app converts API schema properties to form fields using `src/lib/schemaToFor
253258
- Asset metadata is stored in `{userData}/assets-metadata.json` with tags, favorites, and file references
254259
- Asset file naming format: `{model-slug}_{predictionId}_{resultindex}.{ext}` (e.g., `flux-schnell_pred-abc123_0.png`)
255260
- Layout.tsx handles unified API key login screen - pages don't need individual ApiKeyRequired checks
256-
- Workflow page is at `/workflow`; rendered persistently in Layout (like free-tools). Sidebar has "Workflow" (nav.workflow) with GitBranch icon. Layout auto-collapses sidebar when entering workflow.
257-
- Workflow uses IPC from main: `workflow:create|save|load|list|rename|delete`, `execution:run-all|run-node|continue-from|retry|cancel`, `models:list|search|refresh|get-schema`, `cost:estimate|get-budget|set-budget|get-daily-spend`, `history:list|set-current|star|score`, `registry:get-all`, `settings:get-api-keys|set-api-keys`. Electron main initializes workflow module (sql.js DB, node registry, IPC handlers) on app load.
261+
- Sidebar navigation sections are ordered: **Create** (Home, Featured Models, Models, Playground), **Manage** (Templates, History, Assets), **Tools** (Workflow, Free Tools, Z-Image). Settings is at the bottom.
262+
- Workflow page is at `/workflow`; rendered persistently in Layout (like free-tools). Sidebar has "Workflow" (nav.workflow) with GitBranch icon under Tools. Layout auto-collapses sidebar when entering workflow.
263+
- Workflow uses IPC from main: `workflow:create|save|load|list|rename|delete`, `execution:run-all|run-node|continue-from|retry|cancel`, `models:list|search|refresh|get-schema`, `cost:get-budget|set-budget|get-daily-spend`, `history:list|set-current|star|score`, `registry:get-all`, `settings:get-api-keys|set-api-keys`. Electron main initializes workflow module (sql.js DB, node registry, IPC handlers) on app load. Approximate cost estimate UI has been removed; cost is informational only.
264+
- Execution Monitor is a bottom bar (collapsible via header chevron). When expanded it shows run sessions with node rows; expanding a node shows output preview (image/video/audio/text) from persisted history or lastResults. Uses `src/workflow/lib/outputDisplay.ts` for output type classification.
265+
- Workflow can run in browser: `runAllInBrowser` in execution store uses `src/workflow/browser/run-in-browser.ts` and topological sort; no execution history persisted in browser, but lastResults and RunMonitor show latest run output.
266+
- Playground tab switching preserves form values: URL→model sync only runs when the active tab has no model (so switching tabs never overwrites the tab's model or wipes form).
258267
- Workflow model selector (NodeConfigPanel): categories are sorted by popularity (model count per category, descending), then alphabetically for ties; "全部" / "All" stays first.
268+
- AI Task node (electron/workflow/nodes/ai-task/run.ts) normalizes API outputs: if the API returns `outputs: [{ url: "..." }]` (e.g. z-image/turbo), resultUrls are extracted from object.url so Results and Execution Monitor show correct previews.
259269
- useFreeToolListener is mounted in Layout so workflow execution can trigger free-tool runs and receive results via IPC.
260270
- Settings page (`/settings`) is a public path accessible without API key
261271
- Free Tools pages are public paths accessible without API key: `/free-tools`, `/free-tools/image-enhancer`, `/free-tools/video-enhancer`, `/free-tools/background-remover`, `/free-tools/face-enhancer`, `/free-tools/face-swapper`, `/free-tools/image-eraser`, `/free-tools/segment-anything`, `/free-tools/video-converter`, `/free-tools/audio-converter`, `/free-tools/image-converter`, `/free-tools/media-trimmer`, `/free-tools/media-merger`

package.json

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"name": "wavespeed-desktop",
3-
"version": "2.0.2",
3+
"version": "2.0.3",
44
"description": "WaveSpeedAI Desktop Application - A playground for AI models",
55
"main": "./out/main/index.js",
66
"author": {
@@ -215,4 +215,4 @@
215215
"releaseType": "release"
216216
}
217217
}
218-
}
218+
}

src/i18n/locales/en.json

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1082,6 +1082,7 @@
10821082
"clickAnywhereToClose": "Click anywhere to close",
10831083
"runNode": "Run Node",
10841084
"modelSelection": "Model Selection",
1085+
"seedRandomPlaceholder": "Random",
10851086
"annotationHint": "Double-click the note on the canvas to edit it.",
10861087
"continueFrom": "Continue From",
10871088
"retry": "Retry",

0 commit comments

Comments
 (0)