Compare commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
8a4d5c5fa8 | ||
|
|
1dcecc93cd | ||
|
|
adc59bf6ad | ||
|
|
a5e481a6a5 | ||
|
|
635522a689 | ||
|
|
3184060063 |
@@ -1,5 +1,129 @@
|
||||
# DEVLOG - ComfyUI-Workflow-Studio
|
||||
|
||||
## 2026-03-22: v0.1.4 App形式対応・プリセットコピー・分析バグ修正
|
||||
|
||||
### 概要
|
||||
- ComfyUI App形式(`.app.json`)ワークフローの識別・表示対応
|
||||
- プリセットタブにポジティブ/ネガティブプロンプトのクリップボードコピーボタン追加
|
||||
- ワークフロー分析のクラッシュバグ修正
|
||||
|
||||
### 変更内容
|
||||
|
||||
#### App形式ワークフロー対応
|
||||
- **背景:** ComfyUIの最新アップデートでAppモード(ノードを簡略化したWebアプリ風UI)が追加され、`.app.json`拡張子で保存される
|
||||
- **対応:**
|
||||
- `static/js/comfyui-workflow.js` — `detectFormat()`にファイル名ベースのApp形式判定を追加
|
||||
- `static/js/workflow-tab.js` — サイドパネルJSONタブのフォーマットバッジに「App形式」表示を追加
|
||||
- `static/js/generate-tab.js` — App形式ワークフローの生成UI読み込みをブロックし、「ComfyUIで開く」への誘導メッセージを表示
|
||||
- `static/css/main.css` — `.wfm-format-badge--app` スタイル追加(オレンジ色)
|
||||
- `static/js/i18n.js` — `appFormat` / `appFormatNotSupported` 翻訳キー追加(EN/JA/ZH)
|
||||
|
||||
#### プリセット クリップボードコピーボタン
|
||||
- **課題:** プリセットのプロンプトをComfyUI本体で使う際に手動コピーが必要だった
|
||||
- **対応:**
|
||||
- `templates/index.html` — プリセット保存ボタン行に「PP コピー」「NP コピー」ボタンを追加(flex:2/2/1比率)
|
||||
- `static/js/prompt-tab.js` — クリップボードコピー処理(`navigator.clipboard.writeText`)追加
|
||||
- `static/js/app.js` — コピーボタンのi18n適用
|
||||
- `static/js/i18n.js` — `copyPositivePrompt` / `copyNegativePrompt` / `copiedToClipboard` / `noTextToCopy` 翻訳キー追加
|
||||
|
||||
#### ワークフロー分析バグ修正
|
||||
- **問題:** UI形式ワークフローの`widgets_values[0]`が整数(例: EmptyLatentImageの`768`)の場合、`.lower()`で`AttributeError`が発生し、例外キャッチにより全分析結果がゼロになる
|
||||
- **修正:** `py/services/workflow_analyzer.py` — `_model_name_from_ui_node()`に`isinstance(val, str)`型チェックを追加
|
||||
|
||||
---
|
||||
|
||||
## 2026-03-21: v0.1.3 ヘルプ&サポートタブ追加
|
||||
|
||||
### 概要
|
||||
- ヘルプ&サポートタブを新規追加(機能一覧 + サポートリンク)
|
||||
|
||||
### 変更内容
|
||||
|
||||
#### ヘルプ&サポートタブ
|
||||
- **課題:** プラグインの機能概要を確認する場所がなく、サポートへの導線もなかった
|
||||
- **対応:** 新しいメインタブ「Help」を追加し、機能一覧とサポートセクションを設置
|
||||
|
||||
##### 機能一覧セクション
|
||||
- 各タブ(Workflow / GenerateUI / Prompt / Settings)の主要機能をカード形式で表示
|
||||
- Tipsセクション(ドラッグ&ドロップ、お気に入り、デフォルトワークフロー)
|
||||
|
||||
##### サポートセクション
|
||||
- GitHubリンク(バグ報告・機能リクエスト・コントリビュート)
|
||||
- Ko-fiリンク(開発支援)
|
||||
- SVGアイコン付きのリンクカード
|
||||
|
||||
#### 変更ファイル
|
||||
- `templates/index.html` — Helpタブボタン追加、ヘルプ&サポートセクションのHTML構造
|
||||
- `static/js/i18n.js` — 3言語(EN/JA/ZH)のヘルプ関連翻訳キー30項目追加
|
||||
- `static/js/app.js` — タブマップにhelp追加、`applyI18nToHtml()`にヘルプタブのi18n適用ロジック追加
|
||||
- `static/css/main.css` — `.wfm-help-*` スタイル追加(コンテナ、セクション、カード、リンク)
|
||||
|
||||
---
|
||||
|
||||
## 2026-03-19: v0.1.2 リリース
|
||||
|
||||
### 概要
|
||||
- キャンバススナップショット機能追加(ComfyUIトップバーにカメラボタン)
|
||||
- ワークフローサイドパネル・モーダルにサムネイルプレビュー追加
|
||||
|
||||
### 変更内容
|
||||
|
||||
#### Canvas Snapshot(キャンバススナップショット)
|
||||
- **課題:** ワークフローのキャンバス画像を保存するにはComfyUIのエクスポート機能を使い手動でファイル管理する必要があった
|
||||
- **対応:** ComfyUIトップバーにカメラボタンを追加し、ワンクリックでキャンバスをPNGキャプチャ→ワークフローデータフォルダに自動保存
|
||||
- `web/comfyui/top_menu_extension.js`:
|
||||
- カメラアイコンボタン追加(actionBarButtons API / legacy ComfyButtonGroup 両対応)
|
||||
- `captureCanvasSnapshot()` — LiteGraphキャンバスの状態保存→ノード範囲計算→レンダリング→Blob化→復元
|
||||
- PNG tEXtチャンク埋め込み (`n2b`, `joinArrayBuffer`, `crc32`, `embedWorkflowInPng`) — ComfyUIのドラッグ&ドロップインポート互換
|
||||
- タイムスタンプファイル名 `wf_YYYYMMDDHHmmss.json` 形式で自動生成
|
||||
- `py/routes/workflow_routes.py`:
|
||||
- `POST /api/wfm/workflows/save-canvas-image` ルート追加
|
||||
- `import_files` を利用してPNGからワークフローJSON抽出+サムネイル保存+自動インポート
|
||||
- 参考実装: [pythongosssss/ComfyUI-Custom-Scripts](https://github.com/pythongosssss/ComfyUI-Custom-Scripts) の workflowImage.js
|
||||
|
||||
#### サムネイルプレビュー
|
||||
- `templates/index.html` — サイドパネルにThumbnailタブ追加(デフォルトアクティブ)
|
||||
- `static/js/workflow-tab.js`:
|
||||
- `sidePanelThumbUpdate()` — 選択ワークフローのサムネイル・メタ情報表示
|
||||
- モーダル上部にサムネイルセクション追加
|
||||
- サムネイル変更時にサイドパネル・モーダル両方を同期更新
|
||||
- `static/css/main.css` — `.wfm-side-thumb-*` / `.wfm-modal-thumb-*` スタイル追加
|
||||
|
||||
### スクリーンショット
|
||||
| Workflow Tab | ComfyUI Top Bar |
|
||||
|:---:|:---:|
|
||||
|  |  |
|
||||
|
||||
### リリース
|
||||
- GitHub Release v0.1.2: https://github.com/ketle-man/ComfyUI-Workflow-Studio/releases/tag/v0.1.2
|
||||
|
||||
---
|
||||
|
||||
## 2026-03-19: v0.1.1 リリース
|
||||
|
||||
### 概要
|
||||
- ファビコン追加
|
||||
- プロンプトタブをサブタブ切り替え方式から左右2分割レイアウトに変更
|
||||
|
||||
### 変更内容
|
||||
|
||||
#### ファビコン追加
|
||||
- `static/favicon.svg` — 起動ボタンと同じ W + S Wave デザインの SVG ファビコンを新規作成
|
||||
- `templates/index.html` — `<link rel="icon">` タグ追加
|
||||
|
||||
#### プロンプトタブ 2分割レイアウト
|
||||
- **課題:** Assistant / Presets のサブタブ切り替え方式では画面幅が広い場合に視点移動が大きく使いづらい
|
||||
- **対応:** サブタブナビゲーションを廃止し、左パネル(AIアシスタント)・右パネル(プリセット)の同時表示レイアウトに変更
|
||||
- `templates/index.html` — サブタブ構造を `.wfm-prompt-split` 左右分割構造に変更
|
||||
- `static/css/main.css` — `.wfm-prompt-subtab-*` スタイルを `.wfm-prompt-split` / `.wfm-prompt-split-header` に置換
|
||||
- `static/js/prompt-tab.js` — サブタブ切り替えイベントリスナー削除
|
||||
- `static/js/app.js` — 翻訳対象をサブタブボタンからパネルヘッダーに変更
|
||||
|
||||
### スクリーンショット
|
||||

|
||||
|
||||
---
|
||||
|
||||
## 2026-03-18: プロジェクトリネーム & アイコン適用
|
||||
|
||||
### 概要
|
||||
@@ -79,13 +203,55 @@ ComfyUI-Workflow-Studio/
|
||||
│ ├── config.py # パス設定
|
||||
│ ├── routes/ # APIルート
|
||||
│ └── services/ # ビジネスロジック
|
||||
├── templates/index.html # SPA (Workflow/GenerateUI/Prompt/Settings)
|
||||
├── templates/index.html # SPA (Workflow/GenerateUI/Prompt/Settings/Help)
|
||||
├── static/ # CSS/JS
|
||||
├── web/comfyui/ # ComfyUIメニュー拡張
|
||||
└── data/ # ワークフロー・メタデータ・設定
|
||||
```
|
||||
|
||||
### 次のステップ
|
||||
- Promptタブの実装完了 (CSS・app.js登録)
|
||||
- GitHub公開準備
|
||||
- ComfyUI Manager登録
|
||||
---
|
||||
|
||||
## 2026-03-18: JSONシンタックスハイライト
|
||||
|
||||
### 概要
|
||||
ワークフロータブ・生成UIタブのJSON表示にシンタックスハイライトを追加
|
||||
|
||||
### 色分け (eagle_comic_creater_webと同じOne Atomテーマ風)
|
||||
- 黄 `#e5c07b` — name, scheduler
|
||||
- ピンク `#c678dd` — title
|
||||
- 緑 `#98c379` — width, height
|
||||
- 水色 `#61afef` — text, prompt
|
||||
- 赤 `#e06c75` — image, file
|
||||
- ベース `#abb2bf` — その他
|
||||
|
||||
### 変更ファイル
|
||||
- `static/js/json-highlight.js` — 新規: `highlightJSON`, `syncJsonHighlight`, `syncScroll`
|
||||
- `static/js/workflow-tab.js` — サイドパネルJSON表示に `highlightJSON` 適用
|
||||
- `templates/index.html` — Raw JSONを `<pre>` + `<textarea>` レイヤー構造に変更
|
||||
- `static/js/generate-tab.js` — ハイライト同期、input/scrollイベント追加
|
||||
- `static/js/comfyui-editor.js` — `_syncRawJson` にハイライト同期追加
|
||||
- `static/css/main.css` — `.wfm-json-container`, `.wfm-json-highlight`, `.json-key-*` スタイル追加
|
||||
|
||||
---
|
||||
|
||||
## 2026-03-18: プロンプトタブ 中国語↔英語翻訳追加
|
||||
|
||||
### 概要
|
||||
プロンプトタブの翻訳機能に ZH→EN / EN→ZH を追加
|
||||
|
||||
### 変更ファイル
|
||||
- `templates/index.html` — `ZH→EN` / `EN→ZH` ボタン追加
|
||||
- `static/js/prompt-tab.js` — `sendTranslate` に `zh2en` / `en2zh` プロンプト追加、イベントリスナー追加
|
||||
|
||||
---
|
||||
|
||||
## 2026-03-18: v0.1.0 リリース
|
||||
|
||||
### 概要
|
||||
GitHub公開・ComfyUI Manager登録・初回リリース
|
||||
|
||||
### 実施内容
|
||||
- GitHub リポジトリ作成: https://github.com/ketle-man/ComfyUI-Workflow-Studio
|
||||
- README.md 作成(スクリーンショット4枚付き)
|
||||
- ComfyUI Manager 登録PR: https://github.com/Comfy-Org/ComfyUI-Manager/pull/2706
|
||||
- GitHub Release v0.1.0: https://github.com/ketle-man/ComfyUI-Workflow-Studio/releases/tag/v0.1.0
|
||||
|
||||
@@ -5,6 +5,7 @@ A comprehensive workflow management and generation UI plugin for [ComfyUI](https
|
||||
Browse, organize, and execute workflows directly from a dedicated studio interface — without switching between windows or manually editing JSON.
|
||||
|
||||

|
||||

|
||||
|
||||
## Screenshots
|
||||
|
||||
@@ -16,20 +17,31 @@ Browse, organize, and execute workflows directly from a dedicated studio interfa
|
||||
|:---:|:---:|
|
||||
|  |  |
|
||||
|
||||
| Help & Support Tab | ComfyUI Integration |
|
||||
|:---:|:---:|
|
||||
|  |  |
|
||||
|
||||
---
|
||||
|
||||
## Features
|
||||
|
||||
### Workflow Tab
|
||||
- **Thumbnail / Card / Table views** — switch between view modes to browse your workflow library
|
||||
- **Thumbnail side panel** — preview workflow canvas snapshots in the side panel
|
||||
- **Tag-based filtering** — filter by base model (SD1.5, SDXL, etc.) and custom groups
|
||||
- **Search** — full-text search across workflow names and metadata
|
||||
- **Side panel** — view workflow JSON with syntax highlighting, format badge (UI/API), and copy button
|
||||
- **Side panel tabs** — Thumbnail preview, JSON viewer with syntax highlighting, and Group management
|
||||
- **Batch analysis** — auto-detect checkpoint, model type, prompt, and I/O node counts
|
||||
- **AI summary** — generate workflow descriptions using Ollama
|
||||
- **Import / Export** — import workflows from files or clipboard, open in ComfyUI directly
|
||||
- **Default view setting** — persist your preferred view mode (Thumbnail / Card / Table)
|
||||
|
||||
### Canvas Snapshot (v0.1.2)
|
||||
- **One-click capture** — click the camera button in ComfyUI's top bar to snapshot the current workflow canvas
|
||||
- **Auto-save as thumbnail** — the snapshot is saved directly to the workflow data folder as a PNG thumbnail
|
||||
- **Embedded workflow metadata** — workflow JSON is embedded in the PNG (tEXt chunk), compatible with ComfyUI's drag-and-drop import
|
||||
- **Auto-import** — the captured workflow is automatically imported and appears in the Workflow tab
|
||||
|
||||
### GenerateUI Tab
|
||||
- **Auto-generated parameter UI** — prompt, model, sampler, image, and other settings extracted from the workflow
|
||||
- **One-click generation** — queue prompts to ComfyUI without leaving the studio
|
||||
@@ -39,10 +51,12 @@ Browse, organize, and execute workflows directly from a dedicated studio interfa
|
||||
- **Eagle integration** — auto-save generated images to [Eagle](https://eagle.cool/) with metadata
|
||||
|
||||
### Prompt Tab
|
||||
- **Split-panel layout** — AI assistant and presets displayed side-by-side for simultaneous use
|
||||
- **AI chat assistant** — powered by [Ollama](https://ollama.com/), generate and refine prompts interactively
|
||||
- **Image attachment** — attach reference images for vision-capable models
|
||||
- **Translation** — JA/EN/ZH translation buttons for multilingual prompt creation
|
||||
- **Prompt presets** — save/load reusable prompt templates (positive & negative)
|
||||
- **Clipboard copy** — copy positive/negative prompts individually for use in ComfyUI
|
||||
- **Apply to GenerateUI** — send prompts directly to the generation interface
|
||||
|
||||
### Settings Tab
|
||||
@@ -52,6 +66,11 @@ Browse, organize, and execute workflows directly from a dedicated studio interfa
|
||||
- **Badge display** — toggle metadata badges on workflow cards
|
||||
- **Language** — English / Japanese / Chinese
|
||||
|
||||
### Help & Support Tab (v0.1.3)
|
||||
- **Feature list** — overview of all features organized by tab
|
||||
- **Tips** — quick tips for drag & drop import, favorites, and default workflow
|
||||
- **Support links** — GitHub repository and Ko-fi donation page
|
||||
|
||||
---
|
||||
|
||||
## Installation
|
||||
@@ -75,18 +94,22 @@ Restart ComfyUI after installation.
|
||||
|
||||
### Launch
|
||||
|
||||
Click the **WS** button in the ComfyUI top menu bar, or navigate to:
|
||||
Click the **W** button in the ComfyUI top menu bar, or navigate to:
|
||||
|
||||
```
|
||||
http://127.0.0.1:8188/wfm
|
||||
```
|
||||
|
||||
> **Tip:** Shift+Click the WS button to open in a new window.
|
||||
> **Tip:** Shift+Click the W button to open in a new window.
|
||||
|
||||
### Canvas Snapshot
|
||||
|
||||
Click the **camera icon** (next to the W button) in ComfyUI's top bar to capture the current workflow canvas as a thumbnail. The image is automatically saved to the workflow data folder and appears in Workflow Studio's workflow list.
|
||||
|
||||
### Quick Start
|
||||
|
||||
1. **Workflow Tab** — Your workflows from `ComfyUI/user/default/workflows/` are automatically listed
|
||||
2. **Click a workflow** — View JSON details and metadata in the side panel
|
||||
2. **Click a workflow** — View thumbnail, JSON details, and metadata in the side panel
|
||||
3. **Load in GenerateUI** — Click the button to load a workflow into the generation interface
|
||||
4. **Adjust parameters** — Modify prompts, models, seeds, and settings via the auto-generated UI
|
||||
5. **Generate** — Hit the Generate button to queue the prompt
|
||||
@@ -116,6 +139,28 @@ http://127.0.0.1:8188/wfm
|
||||
|
||||
---
|
||||
|
||||
## Changelog
|
||||
|
||||
### v0.1.4
|
||||
- **App format support** — detect `.app.json` workflows (ComfyUI App mode), show "App Format" badge, block loading in GenerateUI with guidance message
|
||||
- **Preset clipboard copy** — added PP Copy / NP Copy buttons to copy positive/negative prompts to clipboard
|
||||
- **Analysis bugfix** — fixed workflow analysis crash when `widgets_values` contains non-string values (e.g. integers)
|
||||
|
||||
### v0.1.3
|
||||
- Added **Help & Support tab** — feature list, tips, and support links (GitHub, Ko-fi)
|
||||
- Multi-language support (EN/JA/ZH) for all help content
|
||||
|
||||
### v0.1.2
|
||||
- Added **Canvas Snapshot** button to ComfyUI top bar — capture workflow canvas as PNG thumbnail with embedded workflow metadata
|
||||
- Added **Thumbnail tab** to the workflow side panel for quick visual preview
|
||||
- Added **Thumbnail section** to the workflow detail modal
|
||||
- Snapshot images are auto-imported as workflows with thumbnails
|
||||
|
||||
### v0.1.1
|
||||
- Initial feature set: Workflow management, GenerateUI, Prompt assistant, Settings
|
||||
|
||||
---
|
||||
|
||||
## Project Structure
|
||||
|
||||
```
|
||||
@@ -135,8 +180,9 @@ ComfyUI-Workflow-Studio/
|
||||
│ ├── settings_service.py # Settings persistence
|
||||
│ └── png_extractor.py # PNG metadata extraction
|
||||
├── templates/
|
||||
│ └── index.html # SPA template
|
||||
│ └── index.html # SPA template (Workflow/GenerateUI/Prompt/Settings/Help)
|
||||
├── static/
|
||||
│ ├── favicon.svg # Browser tab icon (W+S Wave)
|
||||
│ ├── css/main.css # Styles
|
||||
│ └── js/
|
||||
│ ├── app.js # App initialization & routing
|
||||
@@ -165,5 +211,7 @@ MIT License
|
||||
## Acknowledgements
|
||||
|
||||
- [ComfyUI](https://github.com/comfyanonymous/ComfyUI) by comfyanonymous
|
||||
- [ComfyUI-Custom-Scripts](https://github.com/pythongosssss/ComfyUI-Custom-Scripts) by pythongosssss — Canvas snapshot and PNG workflow embedding implementation reference
|
||||
- [ComfyUI-Lora-Manager](https://github.com/willchil/ComfyUI-Lora-Manager) — Plugin architecture and UI pattern reference
|
||||
- [Ollama](https://ollama.com/) for local LLM inference
|
||||
- [Eagle](https://eagle.cool/) for image management
|
||||
|
||||
|
After Width: | Height: | Size: 110 KiB |
|
Before Width: | Height: | Size: 24 KiB After Width: | Height: | Size: 33 KiB |
|
After Width: | Height: | Size: 61 KiB |
|
Before Width: | Height: | Size: 51 KiB After Width: | Height: | Size: 38 KiB |
|
Before Width: | Height: | Size: 32 KiB After Width: | Height: | Size: 45 KiB |
|
Before Width: | Height: | Size: 90 KiB After Width: | Height: | Size: 56 KiB |
@@ -27,6 +27,9 @@ def setup_routes(app: web.Application):
|
||||
app.router.add_post(
|
||||
"/api/wfm/workflows/change-thumbnail", handle_change_thumbnail
|
||||
)
|
||||
app.router.add_post(
|
||||
"/api/wfm/workflows/save-canvas-image", handle_save_canvas_image
|
||||
)
|
||||
|
||||
|
||||
async def handle_list(request: web.Request) -> web.Response:
|
||||
@@ -157,6 +160,44 @@ async def handle_reanalyze_all(request: web.Request) -> web.Response:
|
||||
return web.json_response({"error": str(e)}, status=500)
|
||||
|
||||
|
||||
async def handle_save_canvas_image(request: web.Request) -> web.Response:
|
||||
"""POST /api/wfm/workflows/save-canvas-image - Import canvas PNG as workflow + thumbnail."""
|
||||
try:
|
||||
reader = await request.multipart()
|
||||
filename = None
|
||||
image_data = None
|
||||
|
||||
while True:
|
||||
part = await reader.next()
|
||||
if part is None:
|
||||
break
|
||||
if part.name == "filename":
|
||||
filename = (await part.read()).decode("utf-8")
|
||||
elif part.name == "image":
|
||||
image_data = await part.read()
|
||||
|
||||
if not filename or not _service._validate_filename(filename):
|
||||
return web.json_response({"error": "invalid filename"}, status=400)
|
||||
if image_data is None:
|
||||
return web.json_response({"error": "image required"}, status=400)
|
||||
|
||||
# Use import_files to extract workflow from PNG and save both JSON + thumbnail
|
||||
stem = filename[:-5] if filename.endswith(".json") else filename
|
||||
png_name = stem + ".png"
|
||||
results = await asyncio.to_thread(
|
||||
_service.import_files, [(png_name, image_data)]
|
||||
)
|
||||
|
||||
if results and results[0].get("status") == "success":
|
||||
return web.json_response({"status": "ok", "filename": results[0].get("name", filename)})
|
||||
else:
|
||||
error_msg = results[0].get("message", "Import failed") if results else "Import failed"
|
||||
return web.json_response({"error": error_msg}, status=400)
|
||||
except Exception as e:
|
||||
logger.error("Error saving canvas image: %s", e)
|
||||
return web.json_response({"error": str(e)}, status=500)
|
||||
|
||||
|
||||
async def handle_change_thumbnail(request: web.Request) -> web.Response:
|
||||
"""POST /api/wfm/workflows/change-thumbnail - Change workflow thumbnail."""
|
||||
try:
|
||||
|
||||
@@ -7,7 +7,8 @@ import re
|
||||
def _model_name_from_ui_node(node):
|
||||
"""Extract model filename from UI format node (lowercase)."""
|
||||
widgets = node.get("widgets_values", [])
|
||||
return (widgets[0] if widgets else "").lower()
|
||||
val = widgets[0] if widgets else ""
|
||||
return val.lower() if isinstance(val, str) else ""
|
||||
|
||||
|
||||
def _model_name_from_api_node(node):
|
||||
|
||||
@@ -1018,6 +1018,11 @@ body {
|
||||
color: var(--wfm-primary);
|
||||
}
|
||||
|
||||
.wfm-format-badge--app {
|
||||
background: rgba(255, 165, 0, 0.15);
|
||||
color: #ff9800;
|
||||
}
|
||||
|
||||
.wfm-json-content {
|
||||
flex: 1;
|
||||
overflow: auto;
|
||||
@@ -1315,46 +1320,34 @@ body {
|
||||
============================================ */
|
||||
|
||||
/* Subtab navigation */
|
||||
.wfm-prompt-subtab-nav {
|
||||
.wfm-prompt-split {
|
||||
display: flex;
|
||||
flex: 1;
|
||||
min-height: 0;
|
||||
gap: 0;
|
||||
border-bottom: 1px solid var(--wfm-border);
|
||||
background: var(--wfm-surface);
|
||||
flex-shrink: 0;
|
||||
}
|
||||
|
||||
.wfm-prompt-subtab-btn {
|
||||
.wfm-prompt-split-left,
|
||||
.wfm-prompt-split-right {
|
||||
flex: 1;
|
||||
display: flex;
|
||||
flex-direction: column;
|
||||
min-height: 0;
|
||||
overflow: hidden;
|
||||
}
|
||||
|
||||
.wfm-prompt-split-left {
|
||||
border-right: 1px solid var(--wfm-border);
|
||||
}
|
||||
|
||||
.wfm-prompt-split-header {
|
||||
padding: 8px 12px;
|
||||
font-size: 13px;
|
||||
border: none;
|
||||
border-bottom: 2px solid transparent;
|
||||
background: transparent;
|
||||
color: var(--wfm-text-secondary);
|
||||
cursor: pointer;
|
||||
transition: color 0.15s, border-color 0.15s;
|
||||
}
|
||||
|
||||
.wfm-prompt-subtab-btn:hover {
|
||||
color: var(--wfm-text);
|
||||
}
|
||||
|
||||
.wfm-prompt-subtab-btn.active {
|
||||
color: var(--wfm-text);
|
||||
border-bottom-color: var(--wfm-primary);
|
||||
font-weight: bold;
|
||||
}
|
||||
|
||||
.wfm-prompt-subtab-content {
|
||||
display: none;
|
||||
flex-direction: column;
|
||||
flex: 1;
|
||||
overflow: hidden;
|
||||
min-height: 0;
|
||||
}
|
||||
|
||||
.wfm-prompt-subtab-content.active {
|
||||
display: flex;
|
||||
color: var(--wfm-text);
|
||||
background: var(--wfm-surface);
|
||||
border-bottom: 1px solid var(--wfm-border);
|
||||
flex-shrink: 0;
|
||||
}
|
||||
|
||||
/* Ollama Assistant */
|
||||
@@ -1660,3 +1653,208 @@ body {
|
||||
color: var(--wfm-text-secondary);
|
||||
line-height: 24px;
|
||||
}
|
||||
|
||||
/* ============================================
|
||||
Side Panel - Thumbnail Tab
|
||||
============================================ */
|
||||
|
||||
.wfm-side-thumb-container {
|
||||
display: flex;
|
||||
flex-direction: column;
|
||||
flex: 1;
|
||||
overflow-y: auto;
|
||||
padding: 10px;
|
||||
gap: 10px;
|
||||
}
|
||||
|
||||
.wfm-side-thumb-img-wrap {
|
||||
width: 100%;
|
||||
aspect-ratio: 1 / 1;
|
||||
background: var(--wfm-bg);
|
||||
border: 1px solid var(--wfm-border);
|
||||
border-radius: var(--wfm-radius);
|
||||
display: flex;
|
||||
align-items: center;
|
||||
justify-content: center;
|
||||
overflow: hidden;
|
||||
}
|
||||
|
||||
.wfm-side-thumb-img-wrap img {
|
||||
width: 100%;
|
||||
height: 100%;
|
||||
object-fit: contain;
|
||||
cursor: pointer;
|
||||
transition: transform 0.2s ease;
|
||||
}
|
||||
|
||||
.wfm-side-thumb-img-wrap img:hover {
|
||||
transform: scale(1.02);
|
||||
}
|
||||
|
||||
.wfm-side-thumb-placeholder {
|
||||
font-size: 13px;
|
||||
color: var(--wfm-text-secondary);
|
||||
}
|
||||
|
||||
.wfm-side-thumb-name {
|
||||
font-size: 13px;
|
||||
font-weight: 600;
|
||||
word-break: break-all;
|
||||
}
|
||||
|
||||
.wfm-side-thumb-meta {
|
||||
font-size: 12px;
|
||||
color: var(--wfm-text-secondary);
|
||||
display: flex;
|
||||
gap: 8px;
|
||||
flex-wrap: wrap;
|
||||
}
|
||||
|
||||
/* ============================================
|
||||
Modal - Thumbnail Section
|
||||
============================================ */
|
||||
|
||||
.wfm-modal-thumb-section {
|
||||
display: flex;
|
||||
align-items: center;
|
||||
justify-content: center;
|
||||
background: var(--wfm-bg);
|
||||
border: 1px solid var(--wfm-border);
|
||||
border-radius: var(--wfm-radius);
|
||||
margin-bottom: 16px;
|
||||
max-height: 280px;
|
||||
overflow: hidden;
|
||||
}
|
||||
|
||||
.wfm-modal-thumb-img {
|
||||
max-width: 100%;
|
||||
max-height: 280px;
|
||||
object-fit: contain;
|
||||
display: block;
|
||||
}
|
||||
|
||||
.wfm-modal-thumb-placeholder {
|
||||
padding: 32px;
|
||||
font-size: 13px;
|
||||
color: var(--wfm-text-secondary);
|
||||
}
|
||||
|
||||
/* ============================================
|
||||
Help & Support Tab
|
||||
============================================ */
|
||||
|
||||
.wfm-help-container {
|
||||
max-width: 800px;
|
||||
margin: 0 auto;
|
||||
padding: 24px 20px;
|
||||
overflow-y: auto;
|
||||
height: 100%;
|
||||
}
|
||||
|
||||
.wfm-help-section {
|
||||
margin-bottom: 32px;
|
||||
}
|
||||
|
||||
.wfm-help-section-title {
|
||||
font-size: 18px;
|
||||
font-weight: 700;
|
||||
color: var(--wfm-text);
|
||||
margin-bottom: 16px;
|
||||
padding-bottom: 8px;
|
||||
border-bottom: 2px solid var(--wfm-primary);
|
||||
}
|
||||
|
||||
.wfm-help-card {
|
||||
background: var(--wfm-surface);
|
||||
border: 1px solid var(--wfm-border);
|
||||
border-radius: var(--wfm-radius);
|
||||
padding: 16px;
|
||||
margin-bottom: 12px;
|
||||
}
|
||||
|
||||
.wfm-help-card h3 {
|
||||
font-size: 14px;
|
||||
font-weight: 600;
|
||||
color: var(--wfm-primary);
|
||||
margin-bottom: 8px;
|
||||
}
|
||||
|
||||
.wfm-help-card ul {
|
||||
margin: 0;
|
||||
padding-left: 20px;
|
||||
}
|
||||
|
||||
.wfm-help-card li {
|
||||
font-size: 13px;
|
||||
color: var(--wfm-text-secondary);
|
||||
line-height: 1.8;
|
||||
}
|
||||
|
||||
.wfm-help-support-card {
|
||||
text-align: center;
|
||||
padding: 24px;
|
||||
}
|
||||
|
||||
.wfm-help-support-card > p {
|
||||
font-size: 14px;
|
||||
color: var(--wfm-text-secondary);
|
||||
margin-bottom: 20px;
|
||||
}
|
||||
|
||||
.wfm-help-links {
|
||||
display: flex;
|
||||
gap: 16px;
|
||||
justify-content: center;
|
||||
flex-wrap: wrap;
|
||||
margin-bottom: 20px;
|
||||
}
|
||||
|
||||
.wfm-help-link {
|
||||
display: flex;
|
||||
align-items: center;
|
||||
gap: 12px;
|
||||
padding: 16px 24px;
|
||||
border-radius: var(--wfm-radius);
|
||||
text-decoration: none;
|
||||
transition: all 0.2s ease;
|
||||
min-width: 260px;
|
||||
}
|
||||
|
||||
.wfm-help-link-github {
|
||||
background: rgba(255, 255, 255, 0.05);
|
||||
border: 1px solid var(--wfm-border);
|
||||
color: var(--wfm-text);
|
||||
}
|
||||
|
||||
.wfm-help-link-github:hover {
|
||||
background: rgba(255, 255, 255, 0.1);
|
||||
border-color: var(--wfm-text-secondary);
|
||||
}
|
||||
|
||||
.wfm-help-link-kofi {
|
||||
background: rgba(255, 95, 95, 0.08);
|
||||
border: 1px solid rgba(255, 95, 95, 0.3);
|
||||
color: var(--wfm-text);
|
||||
}
|
||||
|
||||
.wfm-help-link-kofi:hover {
|
||||
background: rgba(255, 95, 95, 0.15);
|
||||
border-color: rgba(255, 95, 95, 0.5);
|
||||
}
|
||||
|
||||
.wfm-help-link-title {
|
||||
font-size: 15px;
|
||||
font-weight: 600;
|
||||
}
|
||||
|
||||
.wfm-help-link-desc {
|
||||
font-size: 12px;
|
||||
color: var(--wfm-text-secondary);
|
||||
margin-top: 2px;
|
||||
}
|
||||
|
||||
.wfm-help-thanks {
|
||||
font-size: 13px;
|
||||
color: var(--wfm-text-secondary);
|
||||
font-style: italic;
|
||||
}
|
||||
|
||||
@@ -0,0 +1,5 @@
|
||||
<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 24 24" fill="none" stroke="#4a9eff" stroke-linecap="round" stroke-linejoin="round">
|
||||
<rect width="24" height="24" rx="4" fill="#1a1a2e" stroke="none"/>
|
||||
<path d="M3 5 L7 17 L12 7 L17 17 L21 5" stroke-width="2.3"/>
|
||||
<path d="M5 20 Q9 17 12 20 Q15 23 19 20" stroke-width="1.8"/>
|
||||
</svg>
|
||||
|
After Width: | Height: | Size: 346 B |
@@ -90,7 +90,7 @@ function initTabs() {
|
||||
|
||||
function applyI18nToHtml() {
|
||||
// Tab labels
|
||||
const tabMap = { workflow: "tabWorkflow", generate: "tabGenerate", prompt: "tabPrompt", settings: "tabSettings" };
|
||||
const tabMap = { workflow: "tabWorkflow", generate: "tabGenerate", prompt: "tabPrompt", settings: "tabSettings", help: "tabHelp" };
|
||||
document.querySelectorAll(".wfm-tab").forEach((tab) => {
|
||||
const key = tabMap[tab.dataset.tab];
|
||||
if (key) tab.textContent = t(key);
|
||||
@@ -143,10 +143,10 @@ function applyI18nToHtml() {
|
||||
if (copyBtn) copyBtn.textContent = t("copy");
|
||||
|
||||
// Prompt tab
|
||||
document.querySelectorAll(".wfm-prompt-subtab-btn").forEach((btn) => {
|
||||
if (btn.dataset.promptSubtab === "assistant") btn.textContent = t("assistantSubtab");
|
||||
if (btn.dataset.promptSubtab === "presets") btn.textContent = t("presetsSubtab");
|
||||
});
|
||||
const assistantHeader = document.querySelector(".wfm-prompt-split-left .wfm-prompt-split-header");
|
||||
if (assistantHeader) assistantHeader.textContent = t("assistantSubtab");
|
||||
const presetsHeader = document.querySelector(".wfm-prompt-split-right .wfm-prompt-split-header");
|
||||
if (presetsHeader) presetsHeader.textContent = t("presetsSubtab");
|
||||
const ollamaRefreshBtn = document.getElementById("wfm-ollama-refresh-btn");
|
||||
if (ollamaRefreshBtn) ollamaRefreshBtn.textContent = t("refresh");
|
||||
const ollamaTestBtn = document.getElementById("wfm-ollama-test-btn");
|
||||
@@ -167,6 +167,10 @@ function applyI18nToHtml() {
|
||||
if (presetDeleteBtn) presetDeleteBtn.textContent = t("deletePreset");
|
||||
const presetSaveBtn = document.getElementById("wfm-preset-save-btn");
|
||||
if (presetSaveBtn) presetSaveBtn.textContent = t("savePreset");
|
||||
const presetCopyPosBtn = document.getElementById("wfm-preset-copy-pos-btn");
|
||||
if (presetCopyPosBtn) presetCopyPosBtn.textContent = t("copyPositivePrompt");
|
||||
const presetCopyNegBtn = document.getElementById("wfm-preset-copy-neg-btn");
|
||||
if (presetCopyNegBtn) presetCopyNegBtn.textContent = t("copyNegativePrompt");
|
||||
|
||||
// Group panel labels
|
||||
const propTitle = document.querySelector("#wfm-side-tab-group .wfm-group-section-title");
|
||||
@@ -193,6 +197,32 @@ function applyI18nToHtml() {
|
||||
|
||||
const removeBtn = document.getElementById("wfm-remove-group-btn");
|
||||
if (removeBtn) removeBtn.textContent = t("removeFromGroup");
|
||||
|
||||
// Help & Support tab
|
||||
const helpManualTitle = document.getElementById("wfm-help-manual-title");
|
||||
if (helpManualTitle) helpManualTitle.textContent = t("helpManualTitle");
|
||||
|
||||
const helpIdMap = {
|
||||
"wfm-help-wf-1": "helpWf1", "wfm-help-wf-2": "helpWf2", "wfm-help-wf-3": "helpWf3",
|
||||
"wfm-help-wf-4": "helpWf4", "wfm-help-wf-5": "helpWf5",
|
||||
"wfm-help-gen-1": "helpGen1", "wfm-help-gen-2": "helpGen2",
|
||||
"wfm-help-gen-3": "helpGen3", "wfm-help-gen-4": "helpGen4",
|
||||
"wfm-help-prompt-1": "helpPrompt1", "wfm-help-prompt-2": "helpPrompt2",
|
||||
"wfm-help-prompt-3": "helpPrompt3", "wfm-help-prompt-4": "helpPrompt4",
|
||||
"wfm-help-settings-1": "helpSettings1", "wfm-help-settings-2": "helpSettings2",
|
||||
"wfm-help-settings-3": "helpSettings3", "wfm-help-settings-4": "helpSettings4",
|
||||
"wfm-help-tips-title": "helpTipsTitle",
|
||||
"wfm-help-tips-1": "helpTips1", "wfm-help-tips-2": "helpTips2", "wfm-help-tips-3": "helpTips3",
|
||||
"wfm-help-support-title": "helpSupportTitle",
|
||||
"wfm-help-support-desc": "helpSupportDesc",
|
||||
"wfm-help-github-desc": "helpGithubDesc",
|
||||
"wfm-help-kofi-desc": "helpKofiDesc",
|
||||
"wfm-help-thanks": "helpThanks",
|
||||
};
|
||||
for (const [id, key] of Object.entries(helpIdMap)) {
|
||||
const el = document.getElementById(id);
|
||||
if (el) el.textContent = t(key);
|
||||
}
|
||||
}
|
||||
|
||||
// ============================================
|
||||
|
||||
@@ -250,8 +250,10 @@ function _flattenSubgraphs(workflow) {
|
||||
}
|
||||
|
||||
export const comfyWorkflow = {
|
||||
detectFormat(workflow) {
|
||||
detectFormat(workflow, filename) {
|
||||
if (!workflow || typeof workflow !== "object") return "unknown";
|
||||
// App format: detected by .app.json filename extension
|
||||
if (filename && /\.app\.json$/i.test(filename)) return "app";
|
||||
if (Array.isArray(workflow.nodes) && workflow.links !== undefined) return "ui";
|
||||
// API format: top-level keys are node IDs with class_type
|
||||
const keys = Object.keys(workflow);
|
||||
|
||||
@@ -72,9 +72,12 @@ function updateStatus(connected) {
|
||||
|
||||
export async function loadWorkflowIntoEditor(workflow, filename) {
|
||||
let apiWorkflow = workflow;
|
||||
const format = comfyWorkflow.detectFormat(workflow);
|
||||
const format = comfyWorkflow.detectFormat(workflow, filename);
|
||||
|
||||
if (format === "ui") {
|
||||
if (format === "app") {
|
||||
showToast(t("appFormatNotSupported"), "error");
|
||||
return;
|
||||
} else if (format === "ui") {
|
||||
apiWorkflow = await comfyWorkflow.convertUiToApi(workflow);
|
||||
} else if (format === "unknown") {
|
||||
showToast("Unknown workflow format", "error");
|
||||
|
||||
@@ -43,6 +43,8 @@ const LANGUAGES = {
|
||||
// -- Side panel --
|
||||
uiFormat: "UI Format",
|
||||
apiFormat: "API Format",
|
||||
appFormat: "App Format",
|
||||
appFormatNotSupported: "App format workflows cannot be loaded in GenerateUI. Please use 'Open in ComfyUI' instead.",
|
||||
noSelection: "No selection",
|
||||
groupsLabel: "Groups",
|
||||
groupsNone: "none",
|
||||
@@ -145,12 +147,46 @@ const LANGUAGES = {
|
||||
presetName: "Preset Name",
|
||||
positivePrompt: "Positive Prompt",
|
||||
negativePrompt: "Negative Prompt",
|
||||
savePreset: "Save Preset",
|
||||
savePreset: "Save",
|
||||
copyPositivePrompt: "PP Copy",
|
||||
copyNegativePrompt: "NP Copy",
|
||||
copiedToClipboard: "Copied to clipboard",
|
||||
noTextToCopy: "No text to copy",
|
||||
applyPreset: "Apply",
|
||||
deletePreset: "Delete",
|
||||
assistantSubtab: "AI Assistant",
|
||||
presetsSubtab: "Presets",
|
||||
|
||||
// -- Help & Support --
|
||||
tabHelp: "Help",
|
||||
helpManualTitle: "Features",
|
||||
helpWf1: "Browse, search, and filter your workflow collection",
|
||||
helpWf2: "Import workflows from JSON or PNG files",
|
||||
helpWf3: "Organize workflows into groups",
|
||||
helpWf4: "View thumbnails, JSON details, and properties",
|
||||
helpWf5: "Click a card to open the detail modal for analysis, tagging, and summarization",
|
||||
helpGen1: "Load a workflow and edit parameters (prompts, images, models, settings)",
|
||||
helpGen2: "Connect to ComfyUI and generate images directly",
|
||||
helpGen3: "Control seed behavior (random, fixed, increment, decrement)",
|
||||
helpGen4: "View generated results with thumbnail history",
|
||||
helpPrompt1: "Chat with AI assistant (Ollama) for prompt ideas and improvements",
|
||||
helpPrompt2: "Translate prompts between Japanese, English, and Chinese",
|
||||
helpPrompt3: "Save and manage prompt presets",
|
||||
helpPrompt4: "Apply presets directly to GenerateUI",
|
||||
helpSettings1: "Configure ComfyUI connection URL",
|
||||
helpSettings2: "Set up Ollama API for AI assistant features",
|
||||
helpSettings3: "Change UI language and summary language",
|
||||
helpSettings4: "Configure workflow data folder and Eagle integration",
|
||||
helpTipsTitle: "Tips",
|
||||
helpTips1: "Drag & drop PNG files with embedded workflow data to import them",
|
||||
helpTips2: "Use the star button to mark favorite workflows for quick access",
|
||||
helpTips3: "Set a default workflow to auto-load on startup from the detail modal",
|
||||
helpSupportTitle: "Support",
|
||||
helpSupportDesc: "If you find this plugin useful, please consider supporting its development!",
|
||||
helpGithubDesc: "Report issues, request features, and contribute",
|
||||
helpKofiDesc: "Buy me a coffee to support development",
|
||||
helpThanks: "Thank you for using Workflow Studio!",
|
||||
|
||||
// -- Settings --
|
||||
workflowsDir: "Workflow Data Folder",
|
||||
workflowsDirLabel: "Folder Path",
|
||||
@@ -232,6 +268,8 @@ const LANGUAGES = {
|
||||
// -- Side panel --
|
||||
uiFormat: "UI形式",
|
||||
apiFormat: "API形式",
|
||||
appFormat: "App形式",
|
||||
appFormatNotSupported: "App形式のワークフローは生成UIに読み込めません。「ComfyUIで開く」をご利用ください。",
|
||||
noSelection: "未選択",
|
||||
groupsLabel: "グループ",
|
||||
groupsNone: "なし",
|
||||
@@ -334,12 +372,46 @@ const LANGUAGES = {
|
||||
presetName: "プリセット名",
|
||||
positivePrompt: "ポジティブプロンプト",
|
||||
negativePrompt: "ネガティブプロンプト",
|
||||
savePreset: "プリセット保存",
|
||||
savePreset: "保存",
|
||||
copyPositivePrompt: "PP コピー",
|
||||
copyNegativePrompt: "NP コピー",
|
||||
copiedToClipboard: "クリップボードにコピーしました",
|
||||
noTextToCopy: "コピーするテキストがありません",
|
||||
applyPreset: "適用",
|
||||
deletePreset: "削除",
|
||||
assistantSubtab: "AIアシスタント",
|
||||
presetsSubtab: "プリセット",
|
||||
|
||||
// -- Help & Support --
|
||||
tabHelp: "ヘルプ",
|
||||
helpManualTitle: "機能一覧",
|
||||
helpWf1: "ワークフローの閲覧、検索、フィルタリング",
|
||||
helpWf2: "JSONやPNGファイルからワークフローをインポート",
|
||||
helpWf3: "グループでワークフローを整理",
|
||||
helpWf4: "サムネイル、JSON詳細、プロパティの表示",
|
||||
helpWf5: "カードをクリックして詳細モーダルで分析、タグ付け、要約を実行",
|
||||
helpGen1: "ワークフローを読み込み、パラメータ(プロンプト、画像、モデル、設定)を編集",
|
||||
helpGen2: "ComfyUIに接続して直接画像を生成",
|
||||
helpGen3: "シード動作の制御(ランダム、固定、増加、減少)",
|
||||
helpGen4: "サムネイル履歴付きで生成結果を表示",
|
||||
helpPrompt1: "AIアシスタント(Ollama)とチャットしてプロンプトのアイデアや改善を得る",
|
||||
helpPrompt2: "日本語、英語、中国語間でプロンプトを翻訳",
|
||||
helpPrompt3: "プロンプトプリセットの保存と管理",
|
||||
helpPrompt4: "プリセットを生成UIに直接適用",
|
||||
helpSettings1: "ComfyUI接続URLの設定",
|
||||
helpSettings2: "AIアシスタント機能用のOllama APIを設定",
|
||||
helpSettings3: "UI言語と要約言語の変更",
|
||||
helpSettings4: "ワークフローデータフォルダとEagle連携の設定",
|
||||
helpTipsTitle: "ヒント",
|
||||
helpTips1: "ワークフローデータが埋め込まれたPNGファイルをドラッグ&ドロップでインポート",
|
||||
helpTips2: "スターボタンでお気に入りワークフローをマークして素早くアクセス",
|
||||
helpTips3: "詳細モーダルからデフォルトワークフローを設定し、起動時に自動読み込み",
|
||||
helpSupportTitle: "サポート",
|
||||
helpSupportDesc: "このプラグインが役に立ったら、開発を支援していただけると嬉しいです!",
|
||||
helpGithubDesc: "バグ報告、機能リクエスト、コントリビュート",
|
||||
helpKofiDesc: "コーヒーを奢って開発を応援",
|
||||
helpThanks: "Workflow Studioをご利用いただきありがとうございます!",
|
||||
|
||||
// -- Settings --
|
||||
workflowsDir: "ワークフローデータフォルダ",
|
||||
workflowsDirLabel: "フォルダパス",
|
||||
@@ -421,6 +493,8 @@ const LANGUAGES = {
|
||||
// -- Side panel --
|
||||
uiFormat: "UI格式",
|
||||
apiFormat: "API格式",
|
||||
appFormat: "App格式",
|
||||
appFormatNotSupported: "App格式的工作流无法在生成UI中加载。请使用「在ComfyUI中打开」。",
|
||||
noSelection: "未选择",
|
||||
groupsLabel: "分组",
|
||||
groupsNone: "无",
|
||||
@@ -529,6 +603,36 @@ const LANGUAGES = {
|
||||
assistantSubtab: "AI助手",
|
||||
presetsSubtab: "预设",
|
||||
|
||||
// -- Help & Support --
|
||||
tabHelp: "帮助",
|
||||
helpManualTitle: "功能列表",
|
||||
helpWf1: "浏览、搜索和筛选工作流集合",
|
||||
helpWf2: "从JSON或PNG文件导入工作流",
|
||||
helpWf3: "将工作流整理到分组中",
|
||||
helpWf4: "查看缩略图、JSON详情和属性",
|
||||
helpWf5: "点击卡片打开详情弹窗进行分析、标签和摘要",
|
||||
helpGen1: "加载工作流并编辑参数(提示词、图片、模型、设置)",
|
||||
helpGen2: "连接ComfyUI直接生成图片",
|
||||
helpGen3: "控制种子行为(随机、固定、递增、递减)",
|
||||
helpGen4: "查看带缩略图历史的生成结果",
|
||||
helpPrompt1: "与AI助手(Ollama)聊天获取提示词创意和改进建议",
|
||||
helpPrompt2: "在日语、英语和中文之间翻译提示词",
|
||||
helpPrompt3: "保存和管理提示词预设",
|
||||
helpPrompt4: "将预设直接应用到生成UI",
|
||||
helpSettings1: "配置ComfyUI连接URL",
|
||||
helpSettings2: "设置AI助手功能的Ollama API",
|
||||
helpSettings3: "更改UI语言和摘要语言",
|
||||
helpSettings4: "配置工作流数据文件夹和Eagle集成",
|
||||
helpTipsTitle: "小贴士",
|
||||
helpTips1: "拖放嵌入工作流数据的PNG文件进行导入",
|
||||
helpTips2: "使用星标按钮标记收藏工作流以快速访问",
|
||||
helpTips3: "从详情弹窗设置默认工作流,启动时自动加载",
|
||||
helpSupportTitle: "支持",
|
||||
helpSupportDesc: "如果您觉得这个插件有用,请考虑支持它的开发!",
|
||||
helpGithubDesc: "报告问题、请求功能和贡献代码",
|
||||
helpKofiDesc: "请我喝杯咖啡来支持开发",
|
||||
helpThanks: "感谢您使用Workflow Studio!",
|
||||
|
||||
// -- Settings --
|
||||
workflowsDir: "工作流数据文件夹",
|
||||
workflowsDirLabel: "文件夹路径",
|
||||
|
||||
@@ -302,18 +302,6 @@ function renderPresets() {
|
||||
// ============================================
|
||||
|
||||
export function initPromptTab() {
|
||||
// Subtab switching
|
||||
document.querySelectorAll(".wfm-prompt-subtab-btn").forEach((btn) => {
|
||||
btn.addEventListener("click", () => {
|
||||
document.querySelectorAll(".wfm-prompt-subtab-btn").forEach((b) => b.classList.remove("active"));
|
||||
btn.classList.add("active");
|
||||
const tab = btn.dataset.promptSubtab;
|
||||
document.querySelectorAll(".wfm-prompt-subtab-content").forEach((c) => {
|
||||
c.classList.toggle("active", c.id === `wfm-prompt-subtab-${tab}`);
|
||||
});
|
||||
});
|
||||
});
|
||||
|
||||
// Ollama model refresh
|
||||
async function refreshModels() {
|
||||
const select = document.getElementById("wfm-ollama-model");
|
||||
@@ -412,6 +400,30 @@ export function initPromptTab() {
|
||||
}
|
||||
});
|
||||
|
||||
// Copy positive prompt to clipboard
|
||||
document.getElementById("wfm-preset-copy-pos-btn")?.addEventListener("click", () => {
|
||||
const text = presetPos?.value || "";
|
||||
if (!text.trim()) {
|
||||
showToast(t("noTextToCopy"), "error");
|
||||
return;
|
||||
}
|
||||
navigator.clipboard.writeText(text).then(() => {
|
||||
showToast(t("copiedToClipboard"), "success");
|
||||
});
|
||||
});
|
||||
|
||||
// Copy negative prompt to clipboard
|
||||
document.getElementById("wfm-preset-copy-neg-btn")?.addEventListener("click", () => {
|
||||
const text = presetNeg?.value || "";
|
||||
if (!text.trim()) {
|
||||
showToast(t("noTextToCopy"), "error");
|
||||
return;
|
||||
}
|
||||
navigator.clipboard.writeText(text).then(() => {
|
||||
showToast(t("copiedToClipboard"), "success");
|
||||
});
|
||||
});
|
||||
|
||||
// Save preset
|
||||
document.getElementById("wfm-preset-save-btn")?.addEventListener("click", () => {
|
||||
const name = presetName?.value.trim();
|
||||
|
||||
@@ -458,6 +458,9 @@ async function showSidePanel(wf, cardEl) {
|
||||
);
|
||||
if (cardEl) cardEl.classList.add("wfm-card-selected");
|
||||
|
||||
// Update thumbnail tab
|
||||
sidePanelThumbUpdate(wf);
|
||||
|
||||
// Update group tab
|
||||
sidePanelGroupUpdate();
|
||||
|
||||
@@ -465,8 +468,9 @@ async function showSidePanel(wf, cardEl) {
|
||||
try {
|
||||
const data = await getRawWorkflow(wf.filename);
|
||||
if (badgeEl) {
|
||||
const fmt = comfyWorkflow.detectFormat(data);
|
||||
badgeEl.textContent = fmt === "ui" ? t("uiFormat") : t("apiFormat");
|
||||
const fmt = comfyWorkflow.detectFormat(data, wf.filename);
|
||||
const formatLabels = { ui: t("uiFormat"), api: t("apiFormat"), app: t("appFormat") };
|
||||
badgeEl.textContent = formatLabels[fmt] || fmt;
|
||||
badgeEl.className = "wfm-format-badge wfm-format-badge--" + fmt;
|
||||
}
|
||||
const jsonStr = JSON.stringify(data, null, 2);
|
||||
@@ -495,6 +499,34 @@ function closeSidePanel() {
|
||||
sidePanelGroupUpdate();
|
||||
}
|
||||
|
||||
// ============================================
|
||||
// Thumbnail Tab in Side Panel
|
||||
// ============================================
|
||||
|
||||
function sidePanelThumbUpdate(wf) {
|
||||
const imgWrap = document.getElementById("wfm-side-thumb-img-wrap");
|
||||
const nameEl = document.getElementById("wfm-side-thumb-name");
|
||||
const metaEl = document.getElementById("wfm-side-thumb-meta");
|
||||
if (!imgWrap) return;
|
||||
|
||||
if (wf && wf.thumbnail) {
|
||||
imgWrap.innerHTML = `<img src="${wf.thumbnail}" alt="${wf.filename}" />`;
|
||||
} else {
|
||||
imgWrap.innerHTML = `<span class="wfm-side-thumb-placeholder">${t("noImage")}</span>`;
|
||||
}
|
||||
|
||||
if (nameEl) {
|
||||
nameEl.textContent = wf ? wf.filename.replace(/\.json$/, "") : "";
|
||||
}
|
||||
if (metaEl && wf) {
|
||||
const badges = (wf.analysis.modelTypes || []).map((mt) => badgeHtml(mt)).join(" ");
|
||||
const io = `P:${wf.analysis.inputs?.prompts || 0} I:${wf.analysis.inputs?.images || 0} → ${wf.analysis.outputs?.images || 0}`;
|
||||
metaEl.innerHTML = `${badges} <span style="margin-left:4px;">${io}</span>`;
|
||||
} else if (metaEl) {
|
||||
metaEl.innerHTML = "";
|
||||
}
|
||||
}
|
||||
|
||||
// ============================================
|
||||
// Group Tab in Side Panel
|
||||
// ============================================
|
||||
@@ -646,7 +678,14 @@ function openDetailModal(wf) {
|
||||
const overrideText = (meta.modelTypesOverride || []).join(", ");
|
||||
const isFav = !!meta.favorite;
|
||||
|
||||
const thumbSrc = wf.thumbnail || "";
|
||||
const html = `
|
||||
<div class="wfm-modal-thumb-section">
|
||||
${thumbSrc
|
||||
? `<img src="${thumbSrc}" class="wfm-modal-thumb-img" />`
|
||||
: `<div class="wfm-modal-thumb-placeholder">${t("noImage")}</div>`
|
||||
}
|
||||
</div>
|
||||
<div class="wfm-modal-two-col">
|
||||
<div class="wfm-modal-left">
|
||||
<section>
|
||||
@@ -893,6 +932,14 @@ function openDetailModal(wf) {
|
||||
const cached = state.workflows.find((w) => w.filename === wf.filename);
|
||||
if (cached) cached.thumbnail = newUrl;
|
||||
renderGrid();
|
||||
sidePanelThumbUpdate(wf);
|
||||
// Update modal thumbnail if visible
|
||||
const modalThumbImg = document.querySelector(".wfm-modal-thumb-img");
|
||||
if (modalThumbImg) modalThumbImg.src = newUrl;
|
||||
const modalThumbPlaceholder = document.querySelector(".wfm-modal-thumb-placeholder");
|
||||
if (modalThumbPlaceholder) {
|
||||
modalThumbPlaceholder.outerHTML = `<img src="${newUrl}" class="wfm-modal-thumb-img" />`;
|
||||
}
|
||||
showToast(t("thumbnailChanged"), "success");
|
||||
} catch (err) {
|
||||
showToast(t("thumbnailError") + ": " + err.message, "error");
|
||||
|
||||
@@ -4,6 +4,7 @@
|
||||
<meta charset="UTF-8">
|
||||
<meta name="viewport" content="width=device-width, initial-scale=1.0">
|
||||
<title>Workflow Studio</title>
|
||||
<link rel="icon" type="image/svg+xml" href="/wfm_static/favicon.svg">
|
||||
<link rel="stylesheet" href="/wfm_static/css/main.css">
|
||||
</head>
|
||||
<body>
|
||||
@@ -17,6 +18,7 @@
|
||||
<button class="wfm-tab" data-tab="generate">GenerateUI</button>
|
||||
<button class="wfm-tab" data-tab="prompt">Prompt</button>
|
||||
<button class="wfm-tab" data-tab="settings">Settings</button>
|
||||
<button class="wfm-tab" data-tab="help">Help</button>
|
||||
</nav>
|
||||
</header>
|
||||
|
||||
@@ -68,11 +70,24 @@
|
||||
<button id="wfm-side-panel-close" class="wfm-side-panel-close">×</button>
|
||||
</div>
|
||||
<div class="wfm-side-tab-nav">
|
||||
<button class="wfm-side-tab-btn active" data-side-tab="json">JSON</button>
|
||||
<button class="wfm-side-tab-btn active" data-side-tab="thumb">Thumbnail</button>
|
||||
<button class="wfm-side-tab-btn" data-side-tab="json">JSON</button>
|
||||
<button class="wfm-side-tab-btn" data-side-tab="group">Group</button>
|
||||
</div>
|
||||
<!-- Thumbnail Tab -->
|
||||
<div id="wfm-side-tab-thumb" class="wfm-side-tab-content active">
|
||||
<div class="wfm-side-thumb-container">
|
||||
<div id="wfm-side-thumb-img-wrap" class="wfm-side-thumb-img-wrap">
|
||||
<span class="wfm-side-thumb-placeholder">No thumbnail</span>
|
||||
</div>
|
||||
<div class="wfm-side-thumb-info">
|
||||
<div id="wfm-side-thumb-name" class="wfm-side-thumb-name"></div>
|
||||
<div id="wfm-side-thumb-meta" class="wfm-side-thumb-meta"></div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
<!-- JSON Tab -->
|
||||
<div id="wfm-side-tab-json" class="wfm-side-tab-content active">
|
||||
<div id="wfm-side-tab-json" class="wfm-side-tab-content" style="display:none;">
|
||||
<div class="wfm-side-json-meta">
|
||||
<span id="wfm-json-format-badge" class="wfm-format-badge"></span>
|
||||
<button id="wfm-json-copy-btn" class="wfm-btn wfm-btn-sm" style="margin-left:auto;">Copy</button>
|
||||
@@ -222,71 +237,74 @@
|
||||
|
||||
<!-- Prompt Tab -->
|
||||
<section id="wfm-tab-prompt" class="wfm-tab-content">
|
||||
<div class="wfm-prompt-subtab-nav">
|
||||
<button class="wfm-prompt-subtab-btn active" data-prompt-subtab="assistant">Assistant</button>
|
||||
<button class="wfm-prompt-subtab-btn" data-prompt-subtab="presets">Presets</button>
|
||||
</div>
|
||||
|
||||
<!-- Assistant Subtab -->
|
||||
<div id="wfm-prompt-subtab-assistant" class="wfm-prompt-subtab-content active">
|
||||
<div class="wfm-ollama-assistant">
|
||||
<div class="wfm-ollama-controls">
|
||||
<select id="wfm-ollama-model" class="wfm-select" style="flex:1;min-width:120px;">
|
||||
<option value="">Loading models...</option>
|
||||
</select>
|
||||
<button id="wfm-ollama-refresh-btn" class="wfm-btn wfm-btn-sm">Refresh</button>
|
||||
<button id="wfm-ollama-test-btn" class="wfm-btn wfm-btn-sm">Test</button>
|
||||
<span id="wfm-ollama-status" class="wfm-ollama-status">Disconnected</span>
|
||||
</div>
|
||||
<div class="wfm-ollama-controls" style="margin-top:6px;">
|
||||
<button id="wfm-ollama-attach-btn" class="wfm-btn wfm-btn-sm">Attach Image</button>
|
||||
<input type="file" id="wfm-ollama-file-input" accept="image/*" style="display:none">
|
||||
<button id="wfm-ollama-clear-btn" class="wfm-btn wfm-btn-sm" style="margin-left:auto;">Clear Chat</button>
|
||||
</div>
|
||||
<div id="wfm-ollama-attachments" class="wfm-ollama-attachments"></div>
|
||||
<div id="wfm-ollama-chat" class="wfm-ollama-chat">
|
||||
<div class="wfm-ollama-welcome">
|
||||
<p>AI Assistant (Ollama)</p>
|
||||
<p>Attach images, generate prompts, translate, or ask for improvements.</p>
|
||||
<div class="wfm-prompt-split">
|
||||
<!-- Left: Assistant -->
|
||||
<div class="wfm-prompt-split-left">
|
||||
<div class="wfm-prompt-split-header">Assistant</div>
|
||||
<div class="wfm-ollama-assistant">
|
||||
<div class="wfm-ollama-controls">
|
||||
<select id="wfm-ollama-model" class="wfm-select" style="flex:1;min-width:120px;">
|
||||
<option value="">Loading models...</option>
|
||||
</select>
|
||||
<button id="wfm-ollama-refresh-btn" class="wfm-btn wfm-btn-sm">Refresh</button>
|
||||
<button id="wfm-ollama-test-btn" class="wfm-btn wfm-btn-sm">Test</button>
|
||||
<span id="wfm-ollama-status" class="wfm-ollama-status">Disconnected</span>
|
||||
</div>
|
||||
<div class="wfm-ollama-controls" style="margin-top:6px;">
|
||||
<button id="wfm-ollama-attach-btn" class="wfm-btn wfm-btn-sm">Attach Image</button>
|
||||
<input type="file" id="wfm-ollama-file-input" accept="image/*" style="display:none">
|
||||
<button id="wfm-ollama-clear-btn" class="wfm-btn wfm-btn-sm" style="margin-left:auto;">Clear Chat</button>
|
||||
</div>
|
||||
<div id="wfm-ollama-attachments" class="wfm-ollama-attachments"></div>
|
||||
<div id="wfm-ollama-chat" class="wfm-ollama-chat">
|
||||
<div class="wfm-ollama-welcome">
|
||||
<p>AI Assistant (Ollama)</p>
|
||||
<p>Attach images, generate prompts, translate, or ask for improvements.</p>
|
||||
</div>
|
||||
</div>
|
||||
<div class="wfm-ollama-translate-row">
|
||||
<span style="font-size:12px;color:var(--wfm-text-secondary);">Translate:</span>
|
||||
<button id="wfm-ollama-ja2en-btn" class="wfm-btn wfm-btn-sm">JA→EN</button>
|
||||
<button id="wfm-ollama-en2ja-btn" class="wfm-btn wfm-btn-sm">EN→JA</button>
|
||||
<button id="wfm-ollama-zh2en-btn" class="wfm-btn wfm-btn-sm">ZH→EN</button>
|
||||
<button id="wfm-ollama-en2zh-btn" class="wfm-btn wfm-btn-sm">EN→ZH</button>
|
||||
</div>
|
||||
<div class="wfm-ollama-input-wrap">
|
||||
<textarea id="wfm-ollama-input" class="wfm-textarea" rows="3" placeholder="Ask AI... (Enter to send, Shift+Enter for newline)"></textarea>
|
||||
<button id="wfm-ollama-send-btn" class="wfm-btn wfm-btn-primary" style="width:72px;align-self:flex-end;">Send</button>
|
||||
</div>
|
||||
</div>
|
||||
<div class="wfm-ollama-translate-row">
|
||||
<span style="font-size:12px;color:var(--wfm-text-secondary);">Translate:</span>
|
||||
<button id="wfm-ollama-ja2en-btn" class="wfm-btn wfm-btn-sm">JA→EN</button>
|
||||
<button id="wfm-ollama-en2ja-btn" class="wfm-btn wfm-btn-sm">EN→JA</button>
|
||||
<button id="wfm-ollama-zh2en-btn" class="wfm-btn wfm-btn-sm">ZH→EN</button>
|
||||
<button id="wfm-ollama-en2zh-btn" class="wfm-btn wfm-btn-sm">EN→ZH</button>
|
||||
</div>
|
||||
<div class="wfm-ollama-input-wrap">
|
||||
<textarea id="wfm-ollama-input" class="wfm-textarea" rows="3" placeholder="Ask AI... (Enter to send, Shift+Enter for newline)"></textarea>
|
||||
<button id="wfm-ollama-send-btn" class="wfm-btn wfm-btn-primary" style="width:72px;align-self:flex-end;">Send</button>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<!-- Presets Subtab -->
|
||||
<div id="wfm-prompt-subtab-presets" class="wfm-prompt-subtab-content">
|
||||
<div class="wfm-preset-panel">
|
||||
<div style="display:flex;gap:6px;margin-bottom:10px;align-items:center;">
|
||||
<select id="wfm-preset-select" class="wfm-select" style="flex:1;">
|
||||
<option value="">New Preset (none selected)</option>
|
||||
</select>
|
||||
<button id="wfm-preset-apply-btn" class="wfm-btn wfm-btn-sm wfm-btn-primary">Apply to GenerateUI</button>
|
||||
<button id="wfm-preset-delete-btn" class="wfm-btn wfm-btn-sm wfm-btn-danger">Delete</button>
|
||||
<!-- Right: Presets -->
|
||||
<div class="wfm-prompt-split-right">
|
||||
<div class="wfm-prompt-split-header">Presets</div>
|
||||
<div class="wfm-preset-panel">
|
||||
<div style="display:flex;gap:6px;margin-bottom:10px;align-items:center;">
|
||||
<select id="wfm-preset-select" class="wfm-select" style="flex:1;">
|
||||
<option value="">New Preset (none selected)</option>
|
||||
</select>
|
||||
<button id="wfm-preset-apply-btn" class="wfm-btn wfm-btn-sm wfm-btn-primary">Apply to GenerateUI</button>
|
||||
<button id="wfm-preset-delete-btn" class="wfm-btn wfm-btn-sm wfm-btn-danger">Delete</button>
|
||||
</div>
|
||||
<div class="wfm-form-group">
|
||||
<label>Preset Name</label>
|
||||
<input type="text" id="wfm-preset-name" class="wfm-input" placeholder="Enter preset name...">
|
||||
</div>
|
||||
<div class="wfm-form-group">
|
||||
<label>Positive Prompt</label>
|
||||
<textarea id="wfm-preset-pos" class="wfm-textarea" rows="4" placeholder="Positive prompt..."></textarea>
|
||||
</div>
|
||||
<div class="wfm-form-group">
|
||||
<label>Negative Prompt</label>
|
||||
<textarea id="wfm-preset-neg" class="wfm-textarea" rows="3" placeholder="Negative prompt..."></textarea>
|
||||
</div>
|
||||
<div style="display:flex; gap:4px;">
|
||||
<button id="wfm-preset-copy-pos-btn" class="wfm-btn" style="flex:2;" title="Copy Positive Prompt">PP Copy</button>
|
||||
<button id="wfm-preset-copy-neg-btn" class="wfm-btn" style="flex:2;" title="Copy Negative Prompt">NP Copy</button>
|
||||
<button id="wfm-preset-save-btn" class="wfm-btn wfm-btn-primary" style="flex:1;">Save</button>
|
||||
</div>
|
||||
</div>
|
||||
<div class="wfm-form-group">
|
||||
<label>Preset Name</label>
|
||||
<input type="text" id="wfm-preset-name" class="wfm-input" placeholder="Enter preset name...">
|
||||
</div>
|
||||
<div class="wfm-form-group">
|
||||
<label>Positive Prompt</label>
|
||||
<textarea id="wfm-preset-pos" class="wfm-textarea" rows="4" placeholder="Positive prompt..."></textarea>
|
||||
</div>
|
||||
<div class="wfm-form-group">
|
||||
<label>Negative Prompt</label>
|
||||
<textarea id="wfm-preset-neg" class="wfm-textarea" rows="3" placeholder="Negative prompt..."></textarea>
|
||||
</div>
|
||||
<button id="wfm-preset-save-btn" class="wfm-btn wfm-btn-primary" style="width:100%;">Save Preset</button>
|
||||
</div>
|
||||
</div>
|
||||
</section>
|
||||
@@ -296,6 +314,95 @@
|
||||
<div class="wfm-settings-container">
|
||||
</div>
|
||||
</section>
|
||||
|
||||
<!-- Help & Support Tab -->
|
||||
<section id="wfm-tab-help" class="wfm-tab-content">
|
||||
<div class="wfm-help-container">
|
||||
<!-- Help Section -->
|
||||
<div class="wfm-help-section">
|
||||
<h2 class="wfm-help-section-title" id="wfm-help-manual-title">Features</h2>
|
||||
|
||||
<div class="wfm-help-card">
|
||||
<h3>Workflow Tab</h3>
|
||||
<ul>
|
||||
<li id="wfm-help-wf-1">Browse, search, and filter your workflow collection</li>
|
||||
<li id="wfm-help-wf-2">Import workflows from JSON or PNG files</li>
|
||||
<li id="wfm-help-wf-3">Organize workflows into groups</li>
|
||||
<li id="wfm-help-wf-4">View thumbnails, JSON details, and properties</li>
|
||||
<li id="wfm-help-wf-5">Click a card to open the detail modal for analysis, tagging, and summarization</li>
|
||||
</ul>
|
||||
</div>
|
||||
|
||||
<div class="wfm-help-card">
|
||||
<h3>GenerateUI Tab</h3>
|
||||
<ul>
|
||||
<li id="wfm-help-gen-1">Load a workflow and edit parameters (prompts, images, models, settings)</li>
|
||||
<li id="wfm-help-gen-2">Connect to ComfyUI and generate images directly</li>
|
||||
<li id="wfm-help-gen-3">Control seed behavior (random, fixed, increment, decrement)</li>
|
||||
<li id="wfm-help-gen-4">View generated results with thumbnail history</li>
|
||||
</ul>
|
||||
</div>
|
||||
|
||||
<div class="wfm-help-card">
|
||||
<h3>Prompt Tab</h3>
|
||||
<ul>
|
||||
<li id="wfm-help-prompt-1">Chat with AI assistant (Ollama) for prompt ideas and improvements</li>
|
||||
<li id="wfm-help-prompt-2">Translate prompts between Japanese, English, and Chinese</li>
|
||||
<li id="wfm-help-prompt-3">Save and manage prompt presets</li>
|
||||
<li id="wfm-help-prompt-4">Apply presets directly to GenerateUI</li>
|
||||
</ul>
|
||||
</div>
|
||||
|
||||
<div class="wfm-help-card">
|
||||
<h3>Settings Tab</h3>
|
||||
<ul>
|
||||
<li id="wfm-help-settings-1">Configure ComfyUI connection URL</li>
|
||||
<li id="wfm-help-settings-2">Set up Ollama API for AI assistant features</li>
|
||||
<li id="wfm-help-settings-3">Change UI language and summary language</li>
|
||||
<li id="wfm-help-settings-4">Configure workflow data folder and Eagle integration</li>
|
||||
</ul>
|
||||
</div>
|
||||
|
||||
<div class="wfm-help-card">
|
||||
<h3 id="wfm-help-tips-title">Tips</h3>
|
||||
<ul>
|
||||
<li id="wfm-help-tips-1">Drag & drop PNG files with embedded workflow data to import them</li>
|
||||
<li id="wfm-help-tips-2">Use the star button to mark favorite workflows for quick access</li>
|
||||
<li id="wfm-help-tips-3">Set a default workflow to auto-load on startup from the detail modal</li>
|
||||
</ul>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<!-- Support Section -->
|
||||
<div class="wfm-help-section">
|
||||
<h2 class="wfm-help-section-title" id="wfm-help-support-title">Support</h2>
|
||||
|
||||
<div class="wfm-help-card wfm-help-support-card">
|
||||
<p id="wfm-help-support-desc">If you find this plugin useful, please consider supporting its development!</p>
|
||||
|
||||
<div class="wfm-help-links">
|
||||
<a href="https://github.com/statsu-11/ComfyUI-Workflow-Studio" target="_blank" rel="noopener noreferrer" class="wfm-help-link wfm-help-link-github">
|
||||
<svg width="20" height="20" viewBox="0 0 24 24" fill="currentColor"><path d="M12 0c-6.626 0-12 5.373-12 12 0 5.302 3.438 9.8 8.207 11.387.599.111.793-.261.793-.577v-2.234c-3.338.726-4.033-1.416-4.033-1.416-.546-1.387-1.333-1.756-1.333-1.756-1.089-.745.083-.729.083-.729 1.205.084 1.839 1.237 1.839 1.237 1.07 1.834 2.807 1.304 3.492.997.107-.775.418-1.305.762-1.604-2.665-.305-5.467-1.334-5.467-5.931 0-1.311.469-2.381 1.236-3.221-.124-.303-.535-1.524.117-3.176 0 0 1.008-.322 3.301 1.23.957-.266 1.983-.399 3.003-.404 1.02.005 2.047.138 3.006.404 2.291-1.552 3.297-1.23 3.297-1.23.653 1.653.242 2.874.118 3.176.77.84 1.235 1.911 1.235 3.221 0 4.609-2.807 5.624-5.479 5.921.43.372.823 1.102.823 2.222v3.293c0 .319.192.694.801.576 4.765-1.589 8.199-6.086 8.199-11.386 0-6.627-5.373-12-12-12z"/></svg>
|
||||
<div>
|
||||
<div class="wfm-help-link-title">GitHub</div>
|
||||
<div class="wfm-help-link-desc" id="wfm-help-github-desc">Report issues, request features, and contribute</div>
|
||||
</div>
|
||||
</a>
|
||||
|
||||
<a href="https://ko-fi.com/ninnin90033" target="_blank" rel="noopener noreferrer" class="wfm-help-link wfm-help-link-kofi">
|
||||
<svg width="20" height="20" viewBox="0 0 24 24" fill="currentColor"><path d="M23.881 8.948c-.773-4.085-4.859-4.593-4.859-4.593H.723c-.604 0-.679.798-.679.798s-.082 7.324-.022 11.822c.164 2.424 2.586 2.672 2.586 2.672s8.267-.023 11.966-.049c2.438-.426 2.683-2.566 2.658-3.734 4.352.24 7.422-2.831 6.649-6.916zm-11.062 3.511c-1.246 1.453-4.011 3.976-4.011 3.976s-.121.119-.31.023c-.076-.057-.108-.09-.108-.09-.443-.441-3.368-3.049-4.034-3.954-.709-.965-1.041-2.7-.091-3.71.951-1.01 3.005-1.086 4.363.407 0 0 1.565-1.782 3.468-.963 1.904.82 1.832 3.011.723 4.311zm6.173.478c-.928.116-1.682.028-1.682.028V7.284h1.77s1.971.551 1.971 2.638c0 1.913-.985 2.667-2.059 3.015z"/></svg>
|
||||
<div>
|
||||
<div class="wfm-help-link-title">Ko-fi</div>
|
||||
<div class="wfm-help-link-desc" id="wfm-help-kofi-desc">Buy me a coffee to support development</div>
|
||||
</div>
|
||||
</a>
|
||||
</div>
|
||||
|
||||
<p class="wfm-help-thanks" id="wfm-help-thanks">Thank you for using Workflow Studio!</p>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</section>
|
||||
</main>
|
||||
|
||||
<!-- Workflow Detail Modal -->
|
||||
|
||||
@@ -1,6 +1,7 @@
|
||||
import { app } from "../../scripts/app.js";
|
||||
|
||||
const BUTTON_TOOLTIP = "Launch Workflow Studio (Shift+Click opens in new window)";
|
||||
const SNAPSHOT_TOOLTIP = "Save workflow canvas image as thumbnail";
|
||||
const WFM_PATH = "/wfm";
|
||||
const NEW_WINDOW_FEATURES = "width=1400,height=900,resizable=yes,scrollbars=yes,status=yes";
|
||||
const MAX_ATTACH_ATTEMPTS = 120;
|
||||
@@ -19,6 +20,239 @@ const openWorkflowStudio = (event) => {
|
||||
window.open(url, "_blank");
|
||||
};
|
||||
|
||||
// ============================================
|
||||
// Canvas Snapshot - Export workflow as PNG thumbnail
|
||||
// ============================================
|
||||
|
||||
const getWorkflowFilename = () => {
|
||||
const now = new Date();
|
||||
const pad = (n) => String(n).padStart(2, "0");
|
||||
const stamp = `${now.getFullYear()}${pad(now.getMonth() + 1)}${pad(now.getDate())}${pad(now.getHours())}${pad(now.getMinutes())}${pad(now.getSeconds())}`;
|
||||
return `wf_${stamp}.json`;
|
||||
};
|
||||
|
||||
// ---- PNG tEXt chunk embedding helpers ----
|
||||
|
||||
const n2b = (n) => new Uint8Array([(n >> 24) & 0xff, (n >> 16) & 0xff, (n >> 8) & 0xff, n & 0xff]);
|
||||
|
||||
const joinArrayBuffer = (...bufs) => {
|
||||
const result = new Uint8Array(bufs.reduce((total, buf) => total + buf.byteLength, 0));
|
||||
bufs.reduce((offset, buf) => {
|
||||
result.set(buf, offset);
|
||||
return offset + buf.byteLength;
|
||||
}, 0);
|
||||
return result;
|
||||
};
|
||||
|
||||
let _crcTable = null;
|
||||
const crc32 = (data) => {
|
||||
if (!_crcTable) {
|
||||
_crcTable = [];
|
||||
for (let n = 0; n < 256; n++) {
|
||||
let c = n;
|
||||
for (let k = 0; k < 8; k++) {
|
||||
c = c & 1 ? 0xedb88320 ^ (c >>> 1) : c >>> 1;
|
||||
}
|
||||
_crcTable[n] = c;
|
||||
}
|
||||
}
|
||||
let crc = 0 ^ -1;
|
||||
for (let i = 0; i < data.byteLength; i++) {
|
||||
crc = (crc >>> 8) ^ _crcTable[(crc ^ data[i]) & 0xff];
|
||||
}
|
||||
return (crc ^ -1) >>> 0;
|
||||
};
|
||||
|
||||
const embedWorkflowInPng = async (blob, workflowJson) => {
|
||||
const buffer = await blob.arrayBuffer();
|
||||
const typedArr = new Uint8Array(buffer);
|
||||
const view = new DataView(buffer);
|
||||
|
||||
// Create tEXt chunk: "tEXtworkflow\0{json}"
|
||||
const data = new TextEncoder().encode(`tEXtworkflow\0${workflowJson}`);
|
||||
const chunk = joinArrayBuffer(n2b(data.byteLength - 4), data, n2b(crc32(data)));
|
||||
|
||||
// Insert after IHDR chunk (8-byte signature + IHDR length field(4) + IHDR type(4) + IHDR data + CRC(4))
|
||||
const ihdrDataLen = view.getUint32(8);
|
||||
const sz = ihdrDataLen + 20; // 8(sig) + 4(len) + 4(type) + ihdrDataLen + 4(crc)
|
||||
const result = joinArrayBuffer(typedArr.subarray(0, sz), chunk, typedArr.subarray(sz));
|
||||
|
||||
return new Blob([result], { type: "image/png" });
|
||||
};
|
||||
|
||||
// ---- Canvas capture ----
|
||||
|
||||
const captureCanvasSnapshot = () => {
|
||||
return new Promise((resolve, reject) => {
|
||||
try {
|
||||
const graph = app.graph;
|
||||
const canvas = app.canvas;
|
||||
if (!graph || !canvas || !graph._nodes?.length) {
|
||||
reject(new Error("No workflow loaded"));
|
||||
return;
|
||||
}
|
||||
|
||||
// Serialize workflow data before changing canvas state
|
||||
const workflowJson = JSON.stringify(graph.serialize());
|
||||
|
||||
// Calculate bounds of all nodes
|
||||
const bounds = graph._nodes.reduce(
|
||||
(p, n) => {
|
||||
if (n.pos[0] < p[0]) p[0] = n.pos[0];
|
||||
if (n.pos[1] < p[1]) p[1] = n.pos[1];
|
||||
const b = n.getBounding();
|
||||
const r = n.pos[0] + b[2];
|
||||
const bot = n.pos[1] + b[3];
|
||||
if (r > p[2]) p[2] = r;
|
||||
if (bot > p[3]) p[3] = bot;
|
||||
return p;
|
||||
},
|
||||
[99999, 99999, -99999, -99999]
|
||||
);
|
||||
|
||||
// Add padding
|
||||
const padding = 80;
|
||||
bounds[0] -= padding;
|
||||
bounds[1] -= padding;
|
||||
bounds[2] += padding;
|
||||
bounds[3] += padding;
|
||||
|
||||
// Save current canvas state
|
||||
const savedState = {
|
||||
scale: canvas.ds.scale,
|
||||
width: canvas.canvas.width,
|
||||
height: canvas.canvas.height,
|
||||
offset: [...canvas.ds.offset],
|
||||
transform: canvas.canvas.getContext("2d").getTransform(),
|
||||
};
|
||||
|
||||
// Set canvas to render full workflow
|
||||
const dpr = window.devicePixelRatio || 1;
|
||||
canvas.ds.scale = 1;
|
||||
canvas.canvas.width = (bounds[2] - bounds[0]) * dpr;
|
||||
canvas.canvas.height = (bounds[3] - bounds[1]) * dpr;
|
||||
canvas.ds.offset = [-bounds[0], -bounds[1]];
|
||||
canvas.canvas.getContext("2d").setTransform(dpr, 0, 0, dpr, 0, 0);
|
||||
|
||||
// Render
|
||||
canvas.draw(true, true);
|
||||
|
||||
// Capture to blob
|
||||
canvas.canvas.toBlob(async (rawBlob) => {
|
||||
// Restore canvas state
|
||||
canvas.ds.scale = savedState.scale;
|
||||
canvas.canvas.width = savedState.width;
|
||||
canvas.canvas.height = savedState.height;
|
||||
canvas.ds.offset = savedState.offset;
|
||||
canvas.canvas.getContext("2d").setTransform(savedState.transform);
|
||||
canvas.draw(true, true);
|
||||
|
||||
if (!rawBlob) {
|
||||
reject(new Error("Failed to generate canvas image"));
|
||||
return;
|
||||
}
|
||||
|
||||
try {
|
||||
// Embed workflow JSON into PNG tEXt chunk
|
||||
const blob = await embedWorkflowInPng(rawBlob, workflowJson);
|
||||
resolve(blob);
|
||||
} catch (embedErr) {
|
||||
console.warn("Workflow Studio: failed to embed workflow metadata, saving without it:", embedErr);
|
||||
resolve(rawBlob);
|
||||
}
|
||||
}, "image/png");
|
||||
} catch (err) {
|
||||
reject(err);
|
||||
}
|
||||
});
|
||||
};
|
||||
|
||||
const saveCanvasToWorkflowStudio = async () => {
|
||||
const filename = getWorkflowFilename();
|
||||
|
||||
try {
|
||||
showNotification("Capturing workflow image...", "info");
|
||||
const blob = await captureCanvasSnapshot();
|
||||
|
||||
const fd = new FormData();
|
||||
fd.append("filename", filename);
|
||||
fd.append("image", blob, "canvas.png");
|
||||
|
||||
const res = await fetch("/api/wfm/workflows/save-canvas-image", {
|
||||
method: "POST",
|
||||
body: fd,
|
||||
});
|
||||
|
||||
const data = await res.json();
|
||||
if (data.error) {
|
||||
throw new Error(data.error);
|
||||
}
|
||||
|
||||
showNotification(`Workflow saved: ${filename.replace(/\.json$/, "")}`, "success");
|
||||
} catch (err) {
|
||||
showNotification("Error: " + err.message, "error");
|
||||
}
|
||||
};
|
||||
|
||||
const showNotification = (message, type = "info") => {
|
||||
// Try using ComfyUI's built-in toast if available
|
||||
try {
|
||||
if (app.ui?.dialog) {
|
||||
// Fallback: use a simple temporary notification
|
||||
}
|
||||
} catch (e) { /* ignore */ }
|
||||
|
||||
// Simple toast notification
|
||||
const existing = document.getElementById("wfm-snapshot-toast");
|
||||
if (existing) existing.remove();
|
||||
|
||||
const toast = document.createElement("div");
|
||||
toast.id = "wfm-snapshot-toast";
|
||||
const colors = {
|
||||
success: { bg: "rgba(46,213,115,0.95)", color: "#fff" },
|
||||
error: { bg: "rgba(255,71,87,0.95)", color: "#fff" },
|
||||
info: { bg: "rgba(74,158,255,0.95)", color: "#fff" },
|
||||
};
|
||||
const c = colors[type] || colors.info;
|
||||
Object.assign(toast.style, {
|
||||
position: "fixed",
|
||||
bottom: "24px",
|
||||
left: "50%",
|
||||
transform: "translateX(-50%)",
|
||||
padding: "10px 24px",
|
||||
background: c.bg,
|
||||
color: c.color,
|
||||
borderRadius: "8px",
|
||||
fontSize: "14px",
|
||||
fontWeight: "500",
|
||||
zIndex: "99999",
|
||||
boxShadow: "0 4px 16px rgba(0,0,0,0.3)",
|
||||
transition: "opacity 0.3s ease",
|
||||
whiteSpace: "nowrap",
|
||||
});
|
||||
toast.textContent = message;
|
||||
document.body.appendChild(toast);
|
||||
|
||||
if (type !== "info") {
|
||||
setTimeout(() => {
|
||||
toast.style.opacity = "0";
|
||||
setTimeout(() => toast.remove(), 300);
|
||||
}, 3000);
|
||||
} else {
|
||||
// Info messages will be replaced by success/error
|
||||
setTimeout(() => {
|
||||
if (toast.parentNode) {
|
||||
toast.style.opacity = "0";
|
||||
setTimeout(() => toast.remove(), 300);
|
||||
}
|
||||
}, 10000);
|
||||
}
|
||||
};
|
||||
|
||||
// ============================================
|
||||
// Version Detection & UI
|
||||
// ============================================
|
||||
|
||||
const getComfyUIFrontendVersion = async () => {
|
||||
try {
|
||||
if (window["__COMFYUI_FRONTEND_VERSION__"]) {
|
||||
@@ -87,6 +321,20 @@ const getWfmIcon = () => {
|
||||
`;
|
||||
};
|
||||
|
||||
const getSnapshotIcon = () => {
|
||||
return `
|
||||
<svg viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-linecap="round" stroke-linejoin="round" stroke-width="2">
|
||||
<rect x="3" y="5" width="18" height="14" rx="2"/>
|
||||
<circle cx="12" cy="12" r="3"/>
|
||||
<path d="M8 5 L9 3 L15 3 L16 5"/>
|
||||
</svg>
|
||||
`;
|
||||
};
|
||||
|
||||
// ============================================
|
||||
// Button Creation
|
||||
// ============================================
|
||||
|
||||
const createTopMenuButton = async () => {
|
||||
const { ComfyButton } = await import("../../scripts/ui/components/button.js");
|
||||
|
||||
@@ -111,6 +359,30 @@ const createTopMenuButton = async () => {
|
||||
return button;
|
||||
};
|
||||
|
||||
const createSnapshotButton = async () => {
|
||||
const { ComfyButton } = await import("../../scripts/ui/components/button.js");
|
||||
|
||||
const button = new ComfyButton({
|
||||
icon: "snapshot",
|
||||
tooltip: SNAPSHOT_TOOLTIP,
|
||||
app,
|
||||
enabled: true,
|
||||
classList: "comfyui-button comfyui-menu-mobile-collapse",
|
||||
});
|
||||
|
||||
button.element.setAttribute("aria-label", SNAPSHOT_TOOLTIP);
|
||||
button.element.title = SNAPSHOT_TOOLTIP;
|
||||
|
||||
if (button.iconElement) {
|
||||
button.iconElement.innerHTML = getSnapshotIcon();
|
||||
button.iconElement.style.width = "1.2rem";
|
||||
button.iconElement.style.height = "1.2rem";
|
||||
}
|
||||
|
||||
button.element.addEventListener("click", saveCanvasToWorkflowStudio);
|
||||
return button;
|
||||
};
|
||||
|
||||
const attachTopMenuButton = async (attempt = 0) => {
|
||||
if (document.querySelector(`.${BUTTON_GROUP_CLASS}`)) {
|
||||
return;
|
||||
@@ -128,9 +400,10 @@ const attachTopMenuButton = async (attempt = 0) => {
|
||||
}
|
||||
|
||||
const wfmButton = await createTopMenuButton();
|
||||
const snapshotButton = await createSnapshotButton();
|
||||
const { ComfyButtonGroup } = await import("../../scripts/ui/components/buttonGroup.js");
|
||||
|
||||
const buttonGroup = new ComfyButtonGroup(wfmButton);
|
||||
const buttonGroup = new ComfyButtonGroup(wfmButton, snapshotButton);
|
||||
buttonGroup.element.classList.add(BUTTON_GROUP_CLASS);
|
||||
|
||||
settingsGroup.element.before(buttonGroup.element);
|
||||
@@ -161,14 +434,22 @@ const createExtensionObject = (useActionBar) => {
|
||||
button[aria-label="${BUTTON_TOOLTIP}"].wfm-top-menu-button:hover {
|
||||
background-color: var(--primary-hover-bg) !important;
|
||||
}
|
||||
button[aria-label="${SNAPSHOT_TOOLTIP}"].wfm-snapshot-button {
|
||||
transition: all 0.2s ease;
|
||||
border: 1px solid transparent;
|
||||
}
|
||||
button[aria-label="${SNAPSHOT_TOOLTIP}"].wfm-snapshot-button:hover {
|
||||
background-color: var(--primary-hover-bg) !important;
|
||||
}
|
||||
`;
|
||||
document.head.appendChild(style);
|
||||
};
|
||||
injectStyles();
|
||||
|
||||
const replaceButtonIcon = () => {
|
||||
const buttons = document.querySelectorAll(`button[aria-label="${BUTTON_TOOLTIP}"]`);
|
||||
buttons.forEach((button) => {
|
||||
// WFM launch button
|
||||
const wfmButtons = document.querySelectorAll(`button[aria-label="${BUTTON_TOOLTIP}"]`);
|
||||
wfmButtons.forEach((button) => {
|
||||
button.classList.add("wfm-top-menu-button");
|
||||
button.innerHTML = getWfmIcon();
|
||||
button.style.borderRadius = "4px";
|
||||
@@ -180,7 +461,22 @@ const createExtensionObject = (useActionBar) => {
|
||||
svg.style.height = "20px";
|
||||
}
|
||||
});
|
||||
if (buttons.length === 0) {
|
||||
|
||||
// Snapshot button
|
||||
const snapButtons = document.querySelectorAll(`button[aria-label="${SNAPSHOT_TOOLTIP}"]`);
|
||||
snapButtons.forEach((button) => {
|
||||
button.classList.add("wfm-snapshot-button");
|
||||
button.innerHTML = getSnapshotIcon();
|
||||
button.style.borderRadius = "4px";
|
||||
button.style.padding = "6px";
|
||||
const svg = button.querySelector("svg");
|
||||
if (svg) {
|
||||
svg.style.width = "20px";
|
||||
svg.style.height = "20px";
|
||||
}
|
||||
});
|
||||
|
||||
if (wfmButtons.length === 0) {
|
||||
requestAnimationFrame(replaceButtonIcon);
|
||||
}
|
||||
};
|
||||
@@ -195,6 +491,11 @@ const createExtensionObject = (useActionBar) => {
|
||||
tooltip: BUTTON_TOOLTIP,
|
||||
onClick: openWorkflowStudio,
|
||||
},
|
||||
{
|
||||
icon: "icon-[mdi--camera] size-4",
|
||||
tooltip: SNAPSHOT_TOOLTIP,
|
||||
onClick: saveCanvasToWorkflowStudio,
|
||||
},
|
||||
];
|
||||
}
|
||||
|
||||
|
||||