Commit Graph
7 Commits
Author SHA1 Message Date
Will Miao 9daa9d7dd8 fix(workflows): remove copy filename from the card context menu 2026-10-31 08:31:39 +08:00
Will Miao fed087eb8c fix(workflows): use workflow wording in card actions and dialogs
The workflow card menu reused the model-library copy ("Exclude Model",
"Delete Model", "Copy Model Filename"), and the shared delete dialog
hard-coded "Model:" in its info box.

- Workflow-specific labels for copy-filename / move / delete, and for the
  delete confirm dialog (title, message, info-box label, failure alert)
- Move dialog title, root label and hint now go through i18n instead of
  hard-coded English; bulk delete dialog switches to workflow copy
- Failed move / nothing-selected toasts use workflow wording
- "Copy Workflow Filename" now copies the file name; it used to click the
  card's copy icon, which copies the workflow document (duplicate of
  "Copy Workflow")
- Fix "Link to CivitAI" posting to /api/lm/loras/relink-civitai: the
  mixin's prefix map was keyed by singular type and missed the plural
  page type used by WorkflowContextMenu

Also drops the "Exclude Workflow" action: workflows, like recipes, have
no exclusion concept. The file has no consumer outside LM, and the
excluded view is only reachable from the global context menu, so
excluding a workflow was a one-way hide. The entry is removed from the
card menu, the global menu and the excluded-view banner; the backend
route stays available.
2026-10-30 20:10:45 +08:00
Will Miao f473678004 feat(workflows): restore a workflow to its downloaded state
New card context menu entry 'Restore Downloaded Version' discards local
edits made via the write-back flow:

- Container artifacts (.zip/images) were never modified — restore deletes
  the derived .workflow.json sidecar and re-extracts from the pristine
  archive, then re-syncs analysis metadata. Purely local, works for
  self-hosted workflows too.
- Bare .json artifacts are rewritten in place by write-backs, so restore
  re-downloads the recorded CivitAI version file (API-key auth, temp file
  + workflow validation + SHA256 check before the atomic replace).

The menu entry is disabled for local-only .json workflows that have no
restore source. On success the card is refreshed in place with the
shared 'Updated' cue.
2026-10-29 12:12:52 +08:00
Will Miao fa774de9ea feat(workflows): update managed workflows from the LM card context menu
Add an Update from ComfyUI entry to the workflow card context menu,
enabled only when the workflow is the active graph in a connected
ComfyUI tab and carries unsaved edits.

ComfyUI side (workflow_writeback.js): the first graphChanged after a
load/write-back flips a dirty flag inside the extra.lm_source marker
(ChangeTracker only dispatches on real state changes); the active
graph's link state (file_path, sha256, dirty) is reported to
POST /api/lm/workflows/comfyui-state on load, tab switch, dirty flip
and write-back. A new lm_collect_workflow WS handler answers LM-page
write-back requests: it reuses the regular PUT content flow and posts
the outcome to /api/lm/workflows/collect-result.

Backend: an in-memory WorkflowLinkRegistry holds per-client link states
(pruned against live websocket sids) and pending collect futures;
POST /api/lm/workflows/update-from-comfy targets the tab holding the
requested file (dirty holders win) and awaits the collect result,
mapping no_changes/cancelled to 200, timeout to 504.
2026-10-29 08:29:26 +08:00
Will Miao adc8713c0b feat(workflows): wire card icons and modal send button for workflows
The card send/copy icons and the model modal's Send to ComfyUI button
only had lora/checkpoint/embedding branches; workflows fell through to
a silent no-op (modal) or lora-ish behaviour with wrong tooltips (card).

- shared helpers sendWorkflowToComfy / copyWorkflowToClipboard in
  utils/workflowActions.js, reused by the context menu, card icons and
  the model modal
- card send icon opens the workflow in the running ComfyUI graph; the
  copy icon copies the workflow document JSON for paste-to-load
- correct tooltips (Open in ComfyUI / Copy workflow to clipboard)
- send entry points hidden in standalone mode (no graph to push into):
  card icon and modal button, matching the context menu
2026-10-28 20:09:10 +08:00
Will Miao 7efeb592fd feat(workflows): copy-to-clipboard flow and standalone-aware context menu
- GET /api/lm/workflows/content returns the extracted workflow document
  (json direct, zip/png/webp via the derived sidecar); no ComfyUI needed,
  so it also serves standalone mode where send-to-comfy is unavailable
- workflow cards gain a Copy Workflow context-menu action that puts the
  document JSON on the clipboard for paste-into-ComfyUI loading
- the Open in ComfyUI item is hidden in standalone mode, where pushing
  to a graph is impossible by definition
2026-10-28 19:19:36 +08:00
Will Miao 720440507c feat: add opt-in workflow library management
Add a Workflows page that manages ComfyUI workflow JSON files as a
first-class library alongside loras/checkpoints/embeddings:

- opt-in via the new 'Workflow Management' settings toggle (default off)
- dedicated workflow folder roots with sidecar/preview support, separate
  from ComfyUI's own workflow storage; 'Send to ComfyUI' loads a workflow
  straight into the graph
- workflow scanner parses the graph document (UI/API format sniffing,
  node classes, model/civitai refs) and persists the analysis in the
  SQLite model cache
- settings UI: workflow folder paths editor in the Library tab and the
  standalone Model Paths page

Fixes from sandbox E2E verification:

- include the workflow scanner in startup initialization so the page no
  longer hangs on 'initializing' when enabled without folders
- add the missing workflows entry to the frontend page-state map (page
  init crashed and the sidebar fell back to the loras tree without it)
- project workflow analysis fields through the scanner cache entry and
  persist them in the model cache (new columns with auto-migration)
- keep symlinked paths intact in the directory picker (abspath instead
  of resolve), so stored library paths match what the user sees on disk

Also rebuilds the vue-widgets bundle to sync it with web/comfyui/utils.js.
2026-10-28 11:45:01 +08:00