Compare commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
cdf18e89ce | ||
|
|
7237bec315 |
@@ -2,6 +2,7 @@
|
||||
|
||||
Condensed version-by-version index of DEVLOG.md (each line: version + one-line summary of what changed and why). Full rationale, code details, and "How to apply" lessons live in the excluded DEVLOG.md itself; this index exists so graphify can extract a queryable semantic node per release without feeding the full log to the local Ollama model. Regenerate with `python tools/generate_doc_index.py devlog` whenever DEVLOG.md changes.
|
||||
|
||||
- **v0.7.2(2026-09-18)** — Workflowタブにソート機能追加(Date/Name 昇順降順)
|
||||
- **v0.7.1(2026-09-17)** — セキュリティ修正: Tagger VLM の Unsloth 経路でAPIキーがSSRFにより外部送信され得る不備を修正
|
||||
- **v0.7.0(2026-09-17)** — プレビュー枠の高さ固定・AssetサブタブをPlan/Editと並ぶ中央下部へ移設・トリムパネルにClipchamp風スクラバー追加・Frame保存のVideo Assets登録とAsset→Plan画像連携
|
||||
- **v0.6.3** — Send CCボタンでMP4動画をComic Creatorの新設「動画ツール」へ送れるように対応
|
||||
|
||||
@@ -2,6 +2,54 @@
|
||||
|
||||
---
|
||||
|
||||
## v0.7.2(2026-09-18)
|
||||
|
||||
### Workflowタブにソート機能追加(Date/Name 昇順降順)
|
||||
|
||||
Workflowタブのグループフィルター右隣に、Galleryタブと同じパターンのソートドロップダウン(Date Newest/Oldest、Name A-Z/Z-A)を追加した。`wf.mtime`(バックエンドが既に返していたファイル更新時刻)を使ったクライアント側ソートで、選択状態は`localStorage`(`wfm_workflow_sort`)に永続化する。
|
||||
|
||||
**変更ファイル**: `templates/index.html`(`#wfm-sort` select追加)、`static/js/workflow-tab.js`(`sortWorkflows()`追加、`renderGrid()`で`filterWorkflows()`の結果に適用)
|
||||
|
||||
### Videoタブ左ペイン幅調整・Editトリムパネルのバグ修正とUI調整
|
||||
|
||||
**左ペイン幅**: PlanサブタブのフォームパネルをGenerateUI寄りの380px固定から253px(約2/3)に縮小し、中央プレビュー/タイムラインを広げた(`.wfm-video-form-panel`の`width`のみの変更、`flex:1`の中央パネルが自動で広がる)。
|
||||
|
||||
**「現在位置を使用」ボタンでトリムスクラバーの見た目が更新されないバグを修正**: トリムのStart/End数値入力とスクラバー(ドラッグハンドル・ハイライト範囲)は同じ`commit()`関数を経由する設計だが、`commit()`はスクラバー自身の`updateRange()`(ハンドル位置・ハイライト帯の再描画)を呼んでいなかった。ハンドルをドラッグした場合のみ呼び出し元が直接`updateRange()`を叩いていたため気付かれておらず、数値入力や「現在位置を使用」ボタンではclipのtrimStart/trimEndは正しく更新されるのにスクラバーの表示だけ古いままになっていた。`_wireTrimScrubber()`が`updateRange`関数自体を返すようにし、`_renderTrimPanel()`側で`commit()`から必ずそれを呼べるようにして解消。
|
||||
|
||||
**トリムスクラバーのバッジ重なりを解消**: 開始/終了/再生位置の時刻バッジ(ハンドルから浮き上がるラベル)がクリップ名やルーラー目盛りと重なる、また再生位置がトリム開始/終了に近いとStart/EndバッジとPlayheadバッジ同士が重なって読めなくなる不具合をユーザーが発見。クリップ名とスクラバーの間隔を拡大、スクラバー上部にバッジ専用の余白(`padding-top`)を確保、トラック高さを36px→52pxに拡大した上で、Playheadバッジのみ`top`をStart/Endバッジより高い位置(2段目)にずらして重なりを回避した。
|
||||
|
||||
**変更ファイル**: `static/css/video-tab.css`(`.wfm-video-form-panel`, `.wfm-video-trim-scrubber/-track/-badge/-badge-playhead`)、`static/js/video-edit-tab.js`(`_wireTrimScrubber()`が`updateRange`を返すよう変更、`_renderTrimPanel()`の`commit()`から呼び出し、クリップ名/トリム行の余白調整)
|
||||
|
||||
**How to apply**: 同じ状態変更を複数の入力経路(数値入力・ボタン・ドラッグ)から行える場合、各経路が同じ「見た目を再描画する関数」を実際に呼んでいるかを確認すること——1経路(ドラッグ)だけがたまたま直接呼んでいたために、他の経路のバグが長く気付かれずに残っていた。
|
||||
|
||||
### Video Assetタブに動画/画像フィルタドロップダウン追加
|
||||
|
||||
Asset切替ドロップダウン(`__Video Assets__`/`__Video Temp__`/All Video Assets)の右隣に、幅を約半分にした動画/画像タイプフィルタ(All Types / Video Only / Image Only)を追加。既存の`isVideoFile()`判定を再利用してクライアント側でリストを絞り込む。
|
||||
|
||||
**変更ファイル**: `templates/index.html`(`#wfm-video-asset-kind` select追加)、`static/js/video-asset-tab.js`(`_s.kindFilter`追加、`_filteredImages()`で適用)
|
||||
|
||||
### Video Edit プロジェクト永続化(Phase 5)とサイドバーProjectのPlan/Editモード切替
|
||||
|
||||
[VIDEO_EDIT_TAB_PLAN.md](VIDEO_EDIT_TAB_PLAN.md)のPhase 5(永続化)を実装。他の未着手フェーズ(クロップ/テキストオーバーレイ/BGM合成)と比べ、`video_plan_service.py`と同型のCRUDパターンをほぼそのまま流用できるため最軽量(見積もり1〜1.5日相当)と判断し、最初に着手した。
|
||||
|
||||
**バックエンド**: `video_plan_service.py`と同じ形(パス安全性チェック付きlist/get/save/delete、`updated_at`自動付与)の`VideoEditProjectService`を新設し、`video_edit_project/`ディレクトリに`ws_videoeditproj_*.json`として保存する。`video_plan_service.py`との共通base化は行わず独立クラスのまま(両者のスキーマは無関係なので、無理に共通化しても行数が減るだけで得るものがないという既存の`VideoPlanService`のドキュメント方針を踏襲)。
|
||||
|
||||
**保存対象**: タイムラインのクリップ順序・トリム区間・各クリップが参照するアップロード済みサーバーファイル(`serverRef`)のみ。アップロード未完了のクリップは保存対象から除外する。
|
||||
|
||||
**読込方式**: 保存されたクリップをComfyUIの`/view`エンドポイントからBlobとして再取得し、`File`化した上で既存の「クリップ追加」経路(`addClipFromFile()`→アップロード→probe)にそのまま通してから、保存済みのトリム値を上書き適用する方式にした。`serverRef`とメタデータを信頼してプレビュー生成ロジックを別に書く(再アップロードを省く)選択肢もあったが、既存の十分テスト済みの1経路だけを通ることを優先し、実装量とリスクを抑えた。
|
||||
|
||||
**サイドバーProjectタブの切替**: 中央のPlan/Editどちらのサブタブがアクティブかを`video-tab.js`が`_centerSubtabMode`として記憶し、サイドバーのProjectパネルを開く/切り替えるたびにそのモードを渡すようにした。`video-project-tab.js`は元々Video Plan専用だったリスト表示・削除ロジックを、モードごとの設定テーブル(取得/削除エンドポイント、開く関数、件数ラベル等)に切り出して汎用化。Editモードでのアイテムクリックは新設した`video-edit-tab.js`の`openSavedVideoEditProject()`(`video-plan-tab.js`の`openSavedVideoPlan()`と同型)に委譲する。
|
||||
|
||||
**検証**: 全JS/Pythonファイルを`node --check`/`py_compile`で構文確認、開発元リポジトリと実行時`custom_nodes`フォルダ間でファイルのdiffが空になることを確認して同期。Python側(新規サービス・ルート追加)はComfyUI完全再起動が必須(インポートは起動時一度きりのため)である旨をユーザーに案内済み。
|
||||
|
||||
**変更ファイル**: `py/services/video_edit_project_service.py`(新規)、`py/config.py`(`VIDEO_EDIT_PROJECT_DIR`)、`py/routes/video_routes.py`(`/api/wfm/video/edit/projects`系4エンドポイント)、`static/js/video-edit-tab.js`(`_buildProjectData()`/`_saveProject()`/`_restoreClipFromSaved()`/`_loadProjectData()`/`openSavedVideoEditProject()`、Save/Save As/Loadボタン配線)、`static/js/video-project-tab.js`(`_MODES`設定テーブルによるPlan/Edit汎用化)、`static/js/video-tab.js`(`_centerSubtabMode`追跡)、`templates/index.html`(Save/Save As/Load UI)、`static/js/i18n.js`(新規メッセージキー・ヘルプ本文更新、英/日/中3言語)
|
||||
|
||||
**How to apply**: 新機能の永続化を設計する際、対象データを直接シリアライズしてサーバー参照込みで復元しようとすると(プレビュー生成・probe結果の整合性など)別経路のロジックを新たに書く必要が出やすい。既存の「新規追加」経路がテスト済みで十分軽ければ、保存データを最小限(サーバー参照+差分パラメータ)に絞り、読込時はその経路をそのまま再利用する方が実装・保守コストが低い。
|
||||
|
||||
関連: [[project_video_edit_tab_feature_branch]]
|
||||
|
||||
---
|
||||
|
||||
## v0.7.1(2026-09-17)
|
||||
|
||||
### セキュリティ修正: Tagger VLM の Unsloth 経路でAPIキーがSSRFにより外部送信され得る不備を修正
|
||||
|
||||
+4
-4
@@ -26,12 +26,12 @@ A comprehensive workflow, asset management, and generation UI plugin for [ComfyU
|
||||
- Built-in AI tools (translation and more)
|
||||
|
||||

|
||||

|
||||

|
||||
|
||||
## Features (tab -> feature names)
|
||||
|
||||
### Workflow Tab
|
||||
Thumbnail / Table views, Thumbnail side panel, Badge filtering, Search, Side panel tabs, Badge management, AI summary, Import / Export, Side panel toolbar buttons, Default view setting, Search clear (✕), Clear all filters (✕ Clear)
|
||||
Thumbnail / Table views, Thumbnail side panel, Badge filtering, Search, Side panel tabs, Badge management, AI summary, Import / Export, Side panel toolbar buttons, Default view setting, Search clear (✕), Clear all filters (✕ Clear), Sort
|
||||
|
||||
### Canvas Snapshot (v0.1.2)
|
||||
One-click capture, Auto-save as thumbnail, Embedded workflow metadata, Auto-import
|
||||
@@ -75,8 +75,8 @@ Model Browser, Thumbnail / Table views, Table column sort, Search & Filter, User
|
||||
### Image Edit Tab (v0.3.65)
|
||||
Layer-based image editor, Loading images, Open PSD button, Close button, New button, Tools, Layer panel, Duplicate layer (⧉), Layer lock, Text quality, Export, Canvas navigation, Undo / Redo
|
||||
|
||||
### Video Tab (v0.5.0 – v0.7.0)
|
||||
Dedicated video generation UI, independent of GenerateUI, Plan subtab, Base settings row, Edit subtab, Asset subtab, Project subtab, Two center previews, First Frame / Last Frame are both optional, Semantic node lookup, not hardcoded IDs, Field highlight color, Load in Video, Frame tab, GIF tab, Playback volume
|
||||
### Video Tab (v0.5.0 – v0.7.2)
|
||||
Dedicated video generation UI, independent of GenerateUI, Plan subtab, Base settings row, Edit subtab, Edit project persistence, Asset subtab, Project subtab, Two center previews, First Frame / Last Frame are both optional, Semantic node lookup, not hardcoded IDs, Field highlight color, Load in Video, Frame tab, GIF tab, Playback volume
|
||||
|
||||
### AI TOOL Tab (v0.3.14)
|
||||
4-pane layout, Translation pane, Chat pane, Chat pane — image generation via Tool Calling, Chat pane — generate_image extra parameters, TOOLS pane (VLM), TOOLS pane — shared Chat attachment, TOOLS pane (Wildcards), Chat pane — image-to-image (I2I), Chat pane — SVG generation, no ComfyUI workflow involved, Chat pane — Skills, Settings pane, Unsloth backend, Settings pane — Chat Image Generation, Settings pane — Chat I2I Generation, Settings pane — Generation, Model unload, Settings shared, Backend support, URL security, Lemonade's other endpoints (not integrated)
|
||||
|
||||
@@ -22,7 +22,7 @@ A comprehensive workflow, asset management, and generation UI plugin for [ComfyU
|
||||
- Built-in AI tools (translation and more)
|
||||
|
||||

|
||||

|
||||

|
||||
|
||||
## Screenshots
|
||||
|
||||
@@ -46,6 +46,10 @@ A comprehensive workflow, asset management, and generation UI plugin for [ComfyU
|
||||
| :----------------------------------: | :--------------------------------------: |
|
||||
|  |  |
|
||||
|
||||
| Video Tab - Edit | Video Tab - Asset |
|
||||
| :----------------------------------: | :-----------------------------------: |
|
||||
|  |  |
|
||||
|
||||
| Lab Tab | Lab Index Image |
|
||||
| :--------------------------------: | :------------------------------------------: |
|
||||
|  |  |
|
||||
@@ -69,6 +73,7 @@ A comprehensive workflow, asset management, and generation UI plugin for [ComfyU
|
||||
- **Default view setting** — persist your preferred view mode (Thumbnail / Table)
|
||||
- **Search clear (✕)** — inline ✕ button appears inside the search box whenever text is entered; click to clear immediately
|
||||
- **Clear all filters (✕ Clear)** — rightmost toolbar button; resets search text, group filter, and badge filter (ALL) in one click
|
||||
- **Sort** (v0.7.2) — Date (Newest/Oldest) / Name (A-Z/Z-A) dropdown next to the group filter, persisted via localStorage — same pattern as the Gallery tab's sort control
|
||||
|
||||
</details>
|
||||
|
||||
@@ -409,14 +414,15 @@ An experimental batch generator: runs the workflow currently loaded in GenerateU
|
||||
</details>
|
||||
|
||||
<details>
|
||||
<summary><h3>Video Tab (v0.5.0 – v0.7.0)</h3></summary>
|
||||
<summary><h3>Video Tab (v0.5.0 – v0.7.2)</h3></summary>
|
||||
|
||||
- **Dedicated video generation UI, independent of GenerateUI** — a purpose-built tab for MiniMax H3 (Image to Video), LTX-2.5 (Text / Image / First & Last Frame to Video), and Wan2.2 (Text to Video) workflows (LTX-2.5/Wan2.2: v0.5.4); does not share state with the GenerateUI tab, and model selection (UNet/CLIP/VAE/Audio VAE) is fixed to the loaded workflow's own defaults rather than editable here
|
||||
- **Plan subtab** (center panel, batch redesign in v0.5.5) — a **plan** is a sequence of timeline blocks, each a fully self-contained generation job with its own Prompt, Duration, and First/Last Image; split the timeline with **+ Split** / **+ Block** / **Delete**, then **Run** to generate every block in order (Pause/Cancel work mid-run) — a plan with a single block behaves exactly like the old one-shot form. First Image can be None, an explicit image, or "use previous block's last frame" (chaining — an explicit Last Image on the previous block always wins over extracting one from its generated output). Save / Save As / Clear a plan (`ws_videoplan_*.json`, with a PNG contact-sheet thumbnail that embeds the full plan data so dropping the image back on works too)
|
||||
- **Base settings row** (topbar, v0.5.7) — Aspect Ratio / Megapixels / Multiple / Duration (seconds) / Noise Seed on one row — Duration always reflects the currently selected block (each block keeps its own value), the rest are plan-wide — plus a second row of model-specific fields: Width / Height (become directly editable for workflows with no Resolution Selector node, e.g. Wan2.2 and LTX-2.5's First & Last Frame to Video), Turbo Mode / Strength / Steps (MiniMax H3's turbo LoRA — Turbo Mode doubles as Wan2.2's own turbo toggle, sharing one field), and Prompt Enhance (LTX-2.5 only). Every field in both rows is enabled only when the loaded workflow actually has it — see Field highlight color below (one exception: Wan2.2's Text-to-Video variant doesn't expose Noise Seed at all, so it alone leaves that field disabled)
|
||||
- **Edit subtab** (v0.7.0) — a lightweight clip timeline for trimming and concatenating video/image clips outside of generation: add clips via the Video Source panel's **Add to Edit** button or the Asset subtab's **Send to Edit** button, drag blocks to reorder (or use the ◀/▶ toolbar buttons), Duplicate/Delete the selected clip, Clear to empty the timeline. The trim panel for a selected video clip shows a Clipchamp-style scrubber — a time ruler, a draggable playhead synced to the Source preview, and draggable in/out handles with time badges (image clips get a simple hold-duration field instead). **▶ Preview** plays every ready clip back-to-back (trimmed to its in/out points) in the result preview, and **Export** builds and runs the actual ComfyUI graph (trim → concatenate if more than one clip → save), tagging the result into Video Temp automatically — exporting more than one clip currently drops audio, since ComfyUI's concatenation node requires uniform audio across all inputs
|
||||
- **Asset subtab** (center panel, next to Plan/Edit — moved here from the sidebar in v0.7.0) — browses generated videos/images through three groups: **Video Assets** (a manually-curated keeper group you organize yourself, on your own schedule), **Video Temp** (every plan run's output lands here automatically regardless of whether the plan itself was saved — a **Clear Video Temp** button in the Gallery tab's detail panel empties it in one click), and **All Video Assets** (the union of both); a filename search box and a thumbnail-grid/table (▦/☰) view toggle sit above the list (v0.7.0). Selecting an item shows it in the center preview and lets you tag/memo it, **Send to Edit** (queues it as a clip in the Edit subtab), jump straight to the full Gallery tab, or — for images only — **Set as First Image** / **Set as Last Image** (v0.7.0, uploads it straight into the currently-selected Plan block and switches to the Plan subtab)
|
||||
- **Project subtab** (sidebar) — lists every saved plan file (thumbnail, block count, last updated) — click one to load it into the Plan editor, or delete it with the × button; the panel collapses back down when its own tab is clicked again
|
||||
- **Edit subtab** (v0.7.0) — a lightweight clip timeline for trimming and concatenating video/image clips outside of generation: add clips via the Video Source panel's **Add to Edit** button or the Asset subtab's **Send to Edit** button, drag blocks to reorder (or use the ◀/▶ toolbar buttons), Duplicate/Delete the selected clip, Clear to empty the timeline. The trim panel for a selected video clip shows a Clipchamp-style scrubber — a time ruler, a draggable playhead synced to the Source preview, and draggable in/out handles with time badges (image clips get a simple hold-duration field instead); the playhead's own time badge sits a row above the in/out handle badges (v0.7.2) so it stays legible even when the playhead lands right on a trim point, and the scrubber has extra headroom/height and spacing from the clip name above it (v0.7.2). **▶ Preview** plays every ready clip back-to-back (trimmed to its in/out points) in the result preview, and **Export** builds and runs the actual ComfyUI graph (trim → concatenate if more than one clip → save), tagging the result into Video Temp automatically — exporting more than one clip currently drops audio, since ComfyUI's concatenation node requires uniform audio across all inputs
|
||||
- **Edit project persistence** (v0.7.2) — **Save** / **Save As** / **Load** buttons in the Edit subtab's export panel persist the timeline itself (clip order, trim points, and which uploaded server-side file each clip refers to) as a `ws_videoeditproj_*.json` project file; Load re-fetches and re-probes each clip from its saved server reference, so the original files need to still exist
|
||||
- **Asset subtab** (center panel, next to Plan/Edit — moved here from the sidebar in v0.7.0) — browses generated videos/images through three groups: **Video Assets** (a manually-curated keeper group you organize yourself, on your own schedule), **Video Temp** (every plan run's output lands here automatically regardless of whether the plan itself was saved — a **Clear Video Temp** button in the Gallery tab's detail panel empties it in one click), and **All Video Assets** (the union of both); a filename search box, a video/image type filter dropdown (All Types / Video Only / Image Only, v0.7.2), and a thumbnail-grid/table (▦/☰) view toggle sit above the list (v0.7.0). Selecting an item shows it in the center preview and lets you tag/memo it, **Send to Edit** (queues it as a clip in the Edit subtab), jump straight to the full Gallery tab, or — for images only — **Set as First Image** / **Set as Last Image** (v0.7.0, uploads it straight into the currently-selected Plan block and switches to the Plan subtab)
|
||||
- **Project subtab** (sidebar) — lists saved plan files while the center Plan subtab is active, or saved Edit projects while the center Edit subtab is active (v0.7.2 — thumbnail/block-or-clip-count/last-updated) — click one to load it into the matching editor, or delete it with the × button; the panel collapses back down when its own tab is clicked again, and switching Plan↔Edit while it's open refreshes the list in place
|
||||
- **Two center previews** (v0.5.5) — the left preview shows either the video currently selected in the Asset subtab or whatever's dropped/picked in the **Video Source** panel to its left (**Clear** resets it to empty); the right preview always shows the most recently generated clip; both preview frames are a fixed height (v0.7.0) so switching sources never shifts the Plan/Edit/Asset panel below them. The Frame/GIF tools act on whichever preview was touched most recently
|
||||
- **First Frame / Last Frame are both optional** — leaving First Image empty runs the workflow text-only (the node is simply left unconnected — a "bypass"); workflows that don't even include a LoadImage node for First Frame are supported out of the box (Wan2.2's Text-to-Video graph has neither slot at all), and a LoadImage node is only injected into the graph on the fly if an image is actually supplied
|
||||
- **Semantic node lookup, not hardcoded IDs** (generalized in v0.5.4) — detects which of the three families is loaded from its subgraph's internal node types (or, for Wan2.2, the subgraph's own name — it has no distinctive internal node type), then locates its Resolution Selector and LoadImage node(s) by the subgraph's *public input label* (`prompt`, `duration`, `width`, `first_frame`, `last_frame`) rather than a fixed slot index — so it keeps working even though the three families expose those inputs under different internal names; a workflow no longer needs to match any bundled reference file's exact node IDs, and no fallback test workflow is auto-loaded on tab open
|
||||
|
||||
Binary file not shown.
|
After Width: | Height: | Size: 279 KiB |
Binary file not shown.
|
After Width: | Height: | Size: 427 KiB |
@@ -72,6 +72,7 @@ WILDCARD_DIR = DATA_DIR / "wildcard"
|
||||
AI_SKILLS_DIR = DATA_DIR / "ai_skills"
|
||||
LAB_PLAN_DIR = DATA_DIR / "lab_plan"
|
||||
VIDEO_PLAN_DIR = DATA_DIR / "video_plan"
|
||||
VIDEO_EDIT_PROJECT_DIR = DATA_DIR / "video_edit_project"
|
||||
|
||||
# Tagger
|
||||
TAGGER_DB_FILE = DATA_DIR / "tagger.db"
|
||||
|
||||
@@ -6,14 +6,16 @@ import logging
|
||||
|
||||
from aiohttp import web
|
||||
|
||||
from ..config import VIDEO_PLAN_DIR
|
||||
from ..config import VIDEO_PLAN_DIR, VIDEO_EDIT_PROJECT_DIR
|
||||
from ..services.video_service import VideoService
|
||||
from ..services.video_plan_service import VideoPlanService
|
||||
from ..services.video_edit_project_service import VideoEditProjectService
|
||||
|
||||
logger = logging.getLogger(__name__)
|
||||
|
||||
_service = VideoService()
|
||||
_plan_service = VideoPlanService(VIDEO_PLAN_DIR)
|
||||
_edit_project_service = VideoEditProjectService(VIDEO_EDIT_PROJECT_DIR)
|
||||
|
||||
|
||||
def setup_routes(app: web.Application):
|
||||
@@ -27,6 +29,11 @@ def setup_routes(app: web.Application):
|
||||
app.router.add_post("/api/wfm/video/plans/delete", handle_delete_plan)
|
||||
app.router.add_post("/api/wfm/video/index-image/save-to-output", handle_save_index_to_output)
|
||||
|
||||
app.router.add_get("/api/wfm/video/edit/projects", handle_list_edit_projects)
|
||||
app.router.add_get("/api/wfm/video/edit/projects/content", handle_get_edit_project_content)
|
||||
app.router.add_post("/api/wfm/video/edit/projects/save", handle_save_edit_project)
|
||||
app.router.add_post("/api/wfm/video/edit/projects/delete", handle_delete_edit_project)
|
||||
|
||||
|
||||
async def handle_save_frame(request: web.Request) -> web.Response:
|
||||
try:
|
||||
@@ -139,6 +146,56 @@ async def handle_delete_plan(request: web.Request) -> web.Response:
|
||||
return web.json_response({"error": str(e)}, status=500)
|
||||
|
||||
|
||||
async def handle_list_edit_projects(request: web.Request) -> web.Response:
|
||||
try:
|
||||
result = await asyncio.to_thread(_edit_project_service.list_projects)
|
||||
return web.json_response(result)
|
||||
except Exception as e:
|
||||
logger.error("Error listing video edit projects: %s", e)
|
||||
return web.json_response({"error": str(e)}, status=500)
|
||||
|
||||
|
||||
async def handle_get_edit_project_content(request: web.Request) -> web.Response:
|
||||
filename = request.rel_url.query.get("filename", "")
|
||||
try:
|
||||
data = await asyncio.to_thread(_edit_project_service.get_project, filename)
|
||||
return web.json_response({"data": data})
|
||||
except FileNotFoundError:
|
||||
return web.json_response({"error": "not found"}, status=404)
|
||||
except ValueError as e:
|
||||
return web.json_response({"error": str(e)}, status=400)
|
||||
except Exception as e:
|
||||
logger.error("Error getting video edit project content: %s", e)
|
||||
return web.json_response({"error": str(e)}, status=500)
|
||||
|
||||
|
||||
async def handle_save_edit_project(request: web.Request) -> web.Response:
|
||||
try:
|
||||
body = await request.json()
|
||||
filename = body.get("filename", "")
|
||||
data = body.get("data", {})
|
||||
result = await asyncio.to_thread(_edit_project_service.save_project, filename, data)
|
||||
return web.json_response({"status": "ok", **result})
|
||||
except ValueError as e:
|
||||
return web.json_response({"error": str(e)}, status=400)
|
||||
except Exception as e:
|
||||
logger.error("Error saving video edit project: %s", e)
|
||||
return web.json_response({"error": str(e)}, status=500)
|
||||
|
||||
|
||||
async def handle_delete_edit_project(request: web.Request) -> web.Response:
|
||||
try:
|
||||
body = await request.json()
|
||||
filename = body.get("filename", "")
|
||||
await asyncio.to_thread(_edit_project_service.delete_project, filename)
|
||||
return web.json_response({"status": "ok"})
|
||||
except ValueError as e:
|
||||
return web.json_response({"error": str(e)}, status=400)
|
||||
except Exception as e:
|
||||
logger.error("Error deleting video edit project: %s", e)
|
||||
return web.json_response({"error": str(e)}, status=500)
|
||||
|
||||
|
||||
async def handle_save_index_to_output(request: web.Request) -> web.Response:
|
||||
try:
|
||||
body = await request.json()
|
||||
|
||||
@@ -0,0 +1,98 @@
|
||||
"""Video tab Edit subtab project file management (JSON timeline persistence).
|
||||
|
||||
Same CRUD shape as VideoPlanService (list/get/save/delete with a safe-path
|
||||
helper), kept as its own class rather than sharing a base because the two
|
||||
JSON schemas are unrelated (batch keyframe blocks vs. an ordered clip
|
||||
timeline) — see VideoPlanService's own docstring for the same reasoning.
|
||||
No index-image thumbnail support (unlike VideoPlanService) since the Edit
|
||||
project list is plain text/JSON only for now.
|
||||
"""
|
||||
|
||||
import json
|
||||
import logging
|
||||
from datetime import datetime, timezone
|
||||
from pathlib import Path
|
||||
|
||||
logger = logging.getLogger(__name__)
|
||||
|
||||
|
||||
class VideoEditProjectService:
|
||||
def __init__(self, project_dir: Path):
|
||||
self.project_dir = project_dir
|
||||
self.project_dir.mkdir(parents=True, exist_ok=True)
|
||||
|
||||
# ------------------------------------------------------------------
|
||||
# Path safety
|
||||
# ------------------------------------------------------------------
|
||||
|
||||
def _safe_path(self, filename: str, ext: str = ".json") -> Path | None:
|
||||
if not filename or not filename.strip():
|
||||
return None
|
||||
name = filename.strip()
|
||||
if not name.endswith(ext):
|
||||
name = name + ext
|
||||
if "/" in name or "\\" in name or name in (".", "..") or "\x00" in name:
|
||||
return None
|
||||
resolved = (self.project_dir / name).resolve()
|
||||
project_dir_resolved = self.project_dir.resolve()
|
||||
if resolved != project_dir_resolved and not str(resolved).startswith(str(project_dir_resolved) + "\\") and not str(resolved).startswith(str(project_dir_resolved) + "/"):
|
||||
return None
|
||||
return resolved
|
||||
|
||||
def _now_iso(self) -> str:
|
||||
return datetime.now(timezone.utc).isoformat().replace("+00:00", "Z")
|
||||
|
||||
# ------------------------------------------------------------------
|
||||
# CRUD
|
||||
# ------------------------------------------------------------------
|
||||
|
||||
def list_projects(self) -> list[dict]:
|
||||
if not self.project_dir.is_dir():
|
||||
return []
|
||||
result = []
|
||||
for path in sorted(self.project_dir.glob("*.json")):
|
||||
try:
|
||||
with open(path, "r", encoding="utf-8") as f:
|
||||
data = json.load(f)
|
||||
except Exception as e:
|
||||
logger.warning("Skipping unreadable video edit project %s: %s", path.name, e)
|
||||
continue
|
||||
|
||||
result.append({
|
||||
"filename": path.name,
|
||||
"name": data.get("name", path.stem),
|
||||
"clip_count": len(data.get("clips", [])),
|
||||
"updated_at": data.get("updated_at", ""),
|
||||
})
|
||||
result.sort(key=lambda p: p.get("updated_at", ""), reverse=True)
|
||||
return result
|
||||
|
||||
def get_project(self, filename: str) -> dict:
|
||||
path = self._safe_path(filename)
|
||||
if path is None:
|
||||
raise ValueError(f"Invalid filename: {filename}")
|
||||
if not path.is_file():
|
||||
raise FileNotFoundError(f"Project not found: {filename}")
|
||||
with open(path, "r", encoding="utf-8") as f:
|
||||
return json.load(f)
|
||||
|
||||
def save_project(self, filename: str, data: dict) -> dict:
|
||||
path = self._safe_path(filename)
|
||||
if path is None:
|
||||
raise ValueError(f"Invalid filename: {filename}")
|
||||
|
||||
data = dict(data)
|
||||
data["updated_at"] = self._now_iso()
|
||||
|
||||
path.parent.mkdir(parents=True, exist_ok=True)
|
||||
with open(path, "w", encoding="utf-8") as f:
|
||||
json.dump(data, f, ensure_ascii=False, indent=2)
|
||||
|
||||
return {"filename": path.name, "updated_at": data["updated_at"]}
|
||||
|
||||
def delete_project(self, filename: str) -> None:
|
||||
path = self._safe_path(filename)
|
||||
if path is None:
|
||||
raise ValueError(f"Invalid filename: {filename}")
|
||||
if path.is_file():
|
||||
path.unlink()
|
||||
+1
-1
@@ -1,7 +1,7 @@
|
||||
[project]
|
||||
name = "comfyui-workflow-studio"
|
||||
description = "A comprehensive workflow, asset management, and generation UI plugin for ComfyUI. Manage workflows, models, images, and prompts; batch generation and Image Feeder in the GenerateUI tab; library side panel with canvas drag & drop and AI tools."
|
||||
version = "0.7.1"
|
||||
version = "0.7.2"
|
||||
license = { file = "LICENSE" }
|
||||
requires-python = ">= 3.10"
|
||||
dependencies = ["jinja2"]
|
||||
|
||||
@@ -21,7 +21,7 @@
|
||||
|
||||
/* ── 左ペイン: フォーム ── */
|
||||
.wfm-video-form-panel {
|
||||
width: 380px;
|
||||
width: 253px;
|
||||
flex: none;
|
||||
display: flex;
|
||||
flex-direction: column;
|
||||
@@ -494,6 +494,12 @@
|
||||
すべて%位置指定(clip.duration基準)にすることでpx/秒換算を持たずに済ませている。 */
|
||||
.wfm-video-trim-scrubber {
|
||||
margin-top: 10px;
|
||||
/* start/end/playheadのバッジ(track上端から浮く)が上のクリップ名や
|
||||
目盛りと重ならないよう、あらかじめ専用の余白を確保しておく。
|
||||
playheadバッジはstart/endバッジより高い位置に2段目として出すため
|
||||
(再生位置がトリム開始/終了に近いとき同じ高さだと文字が重なるため)、
|
||||
その分も含めた高さを確保する。 */
|
||||
padding-top: 44px;
|
||||
user-select: none;
|
||||
}
|
||||
|
||||
@@ -513,7 +519,7 @@
|
||||
|
||||
.wfm-video-trim-track {
|
||||
position: relative;
|
||||
height: 36px;
|
||||
height: 52px;
|
||||
margin-top: 4px;
|
||||
background: var(--wfm-bg-hover, #111);
|
||||
border: 1px solid var(--wfm-border);
|
||||
@@ -571,7 +577,7 @@
|
||||
|
||||
.wfm-video-trim-badge {
|
||||
position: absolute;
|
||||
top: -22px;
|
||||
top: -24px;
|
||||
left: 50%;
|
||||
transform: translateX(-50%);
|
||||
background: #111;
|
||||
@@ -585,6 +591,10 @@
|
||||
|
||||
.wfm-video-trim-badge-playhead {
|
||||
background: #000;
|
||||
/* start/endバッジ(-24px)より上の2段目に出し、再生位置がトリム範囲の
|
||||
端に重なっても文字同士がぶつからないようにする */
|
||||
top: -42px;
|
||||
border: 1px solid var(--wfm-primary);
|
||||
}
|
||||
|
||||
.wfm-video-edit-export-panel {
|
||||
|
||||
+45
-9
@@ -1386,6 +1386,11 @@ const LANGUAGES = {
|
||||
videoPlanSaveFailed: "Failed to save plan",
|
||||
videoPlanLoaded: "Plan loaded",
|
||||
videoPlanLoadFailed: "Failed to load plan",
|
||||
videoEditProjectEnterName: "Enter a name for this project",
|
||||
videoEditProjectSaved: "Project saved",
|
||||
videoEditProjectSaveFailed: "Failed to save project",
|
||||
videoEditProjectLoaded: "Project loaded",
|
||||
videoEditProjectLoadFailed: "Failed to load project",
|
||||
videoConfirmClearPlan: "Clear the current plan?",
|
||||
videoPlanPause: "Pause",
|
||||
videoPlanResume: "Resume",
|
||||
@@ -1419,8 +1424,15 @@ const LANGUAGES = {
|
||||
videoProjectDeleted: "Plan deleted",
|
||||
videoProjectDeleteFailed: "Failed to delete plan",
|
||||
videoProjectLoadListFailed: "Failed to load plan list",
|
||||
videoEditProjectHint: "Saved edit projects",
|
||||
videoEditProjectEmpty: "No saved edit projects yet",
|
||||
videoEditProjectClipCount: (n) => `${n} clip${n === 1 ? "" : "s"}`,
|
||||
videoEditProjectDeleteConfirm: (name) => `Delete project "${name}"?`,
|
||||
videoEditProjectDeleted: "Project deleted",
|
||||
videoEditProjectDeleteFailed: "Failed to delete project",
|
||||
videoEditProjectLoadListFailed: "Failed to load project list",
|
||||
helpVideoTitle: "Video Tab",
|
||||
helpVideoDesc: "A dedicated video generation tab for MiniMax H3 (Image to Video), LTX-2.5 (Text / Image / First & Last Frame to Video), and Wan2.2 (Text to Video) workflows, independent of the GenerateUI tab. The center panel's Plan / Edit / Asset subtabs handle batch generation, clip editing, and browsing generated videos; the sidebar's Project subtab handles saved plans.",
|
||||
helpVideoDesc: "A dedicated video generation tab for MiniMax H3 (Image to Video), LTX-2.5 (Text / Image / First & Last Frame to Video), and Wan2.2 (Text to Video) workflows, independent of the GenerateUI tab. The center panel's Plan / Edit / Asset subtabs handle batch generation, clip editing, and browsing generated videos; the sidebar's Project subtab handles saved plans (while Plan is active) or saved Edit projects (while Edit is active).",
|
||||
helpVideo1: "Plan subtab: the topbar's settings row holds Aspect Ratio / Megapixels / Multiple / Duration (seconds) / Noise Seed as this plan's base settings — Duration always reflects the currently selected block (each block keeps its own value), the rest are plan-wide. A second row below adds Width / Height / Turbo Mode / Strength / Steps / Prompt Enhance, each enabled only for workflows that actually support it (see helpVideo2). Split the timeline into blocks with the + Split / + Block / Delete buttons — each block has its own Prompt, Duration, and First/Last Image — First Image can be None, an explicit image, or \"use previous block's last frame\" (an explicit Last Image on the previous block always wins over extracting one from its generated video). Click Run to generate every block in order; Pause/Cancel work mid-run.",
|
||||
helpVideo2: "A plan with a single block behaves exactly like the old one-shot form. Model selection (UNet / CLIP / VAE / Audio VAE) is fixed to the loaded workflow's defaults. For workflows with no ResolutionSelector node (e.g. Wan2.2, LTX-2.5 First & Last Frame to Video), the Aspect Ratio / Megapixels / Multiple fields are disabled and the workflow's own Width / Height become directly editable instead. Turbo Mode / Strength / Steps only apply to MiniMax H3's turbo LoRA, and Prompt Enhance only to LTX-2.5 — both stay disabled for other model families. Noise Seed is disabled for the one workflow that doesn't expose it: Wan2.2 Text-to-Video.",
|
||||
helpVideo3: "Use the \"Load in Video\" button in the Workflow tab's detail modal to load a workflow containing a MiniMax H3 Image-to-Video node, an LTX-2.5 Text/Image/First&Last-Frame-to-Video node, or a Wan2.2 Text-to-Video node — this starts a fresh single-block plan seeded from the workflow's own current values. Unsupported workflows show an error instead.",
|
||||
@@ -1429,9 +1441,9 @@ const LANGUAGES = {
|
||||
helpVideo6: "Frame tab (right panel): play/seek the preview video to the position you want, click Capture Frame to grab that frame client-side, then Save to Output to write it as a PNG into ComfyUI's output folder — check \"Add to Video Assets group\" first to also tag the saved frame into Gallery's Video Assets group.",
|
||||
helpVideo7: "GIF tab (right panel): set Start/End (seconds), FPS, and an optional Max Width, then Convert to GIF — the server decodes the video and encodes an animated GIF into ComfyUI's output folder.",
|
||||
helpVideo8: "Chaining: setting a block's First Image to \"use previous block's last frame\" continues smoothly from the previous clip — if that previous block has its own explicit Last Image, that image is used directly; otherwise the actual last frame of its generated video is extracted automatically.",
|
||||
helpVideo9: "Project tab (sidebar): browse every saved plan file (thumbnail, block count, last updated), click one to load it into the Plan editor, or delete it with the × button; clicking the same tab again collapses the panel.",
|
||||
helpVideo9: "Project tab (sidebar): lists saved Video Plans while the center Plan subtab is active, or saved Edit projects while the center Edit subtab is active (thumbnail/block or clip count, last updated) — click one to load it, or delete it with the × button; clicking the same tab again collapses the panel.",
|
||||
helpVideo10: "Highlight color: the Prompt / Duration / First Image / Last Image / Aspect Ratio / Megapixels / Multiple / Noise Seed / Width / Height / Turbo Mode / Strength / Steps / Prompt Enhance labels turn the same highlight color as the GenerateUI Model tab (customizable in the Settings tab) when the loaded workflow actually supports that field — e.g. for a Wan2.2 workflow (no ResolutionSelector node), the Aspect Ratio / Megapixels / Multiple labels stay unhighlighted while Width / Height light up instead.",
|
||||
helpVideo11: "Edit subtab: a lightweight clip timeline for trimming and concatenating video/image clips outside of generation. Add clips via the Video Source panel's \"Add to Edit\" button or the Asset subtab's \"Send to Edit\" button, then drag blocks to reorder (or use the ◀/▶ toolbar buttons), Duplicate/Delete the selected clip, and Clear to empty the timeline. The trim panel for the selected video clip shows a time ruler, a draggable playhead synced to the Source preview, and draggable in/out handles with time badges — image clips instead get a simple hold-duration field. ▶ Preview plays every ready clip back-to-back (trimmed to its in/out points) in the right-hand result preview; Export builds and runs the actual ComfyUI graph (trim → concatenate if more than one clip → save), tagging the result into the Video Temp group automatically. Exporting more than one clip currently drops audio, since ComfyUI's concatenation node requires uniform audio across all inputs.",
|
||||
helpVideo11: "Edit subtab: a lightweight clip timeline for trimming and concatenating video/image clips outside of generation. Add clips via the Video Source panel's \"Add to Edit\" button or the Asset subtab's \"Send to Edit\" button, then drag blocks to reorder (or use the ◀/▶ toolbar buttons), Duplicate/Delete the selected clip, and Clear to empty the timeline. The trim panel for the selected video clip shows a time ruler, a draggable playhead synced to the Source preview, and draggable in/out handles with time badges — image clips instead get a simple hold-duration field. ▶ Preview plays every ready clip back-to-back (trimmed to its in/out points) in the right-hand result preview; Export builds and runs the actual ComfyUI graph (trim → concatenate if more than one clip → save), tagging the result into the Video Temp group automatically. Exporting more than one clip currently drops audio, since ComfyUI's concatenation node requires uniform audio across all inputs. The export panel's Save/Save As/Load buttons persist the timeline itself (clip order, trim points, which uploaded file each clip refers to) as a JSON project file on the server — Load re-fetches each clip from its saved server reference and re-probes it, so the original files must still exist. These saved projects also show up in the sidebar's Project tab whenever the Edit subtab is active (see helpVideo9).",
|
||||
helpVideo12: "Asset subtab (center panel, next to Plan/Edit): browses every video/image tagged into Video Assets or Video Temp (via the group dropdown, or \"All Video Assets\" for both). Search filters by filename; the ▦/☰ buttons switch between a thumbnail grid and a table (filename/updated/tags). Selecting an item shows its tags/memo, loads it into the center preview, and offers \"Send to Edit\" (queues it as a clip in the Edit subtab) plus, for images only, \"Set as First Image\"/\"Set as Last Image\" (uploads it straight into the currently-selected Plan block, switching to the Plan subtab).",
|
||||
},
|
||||
|
||||
@@ -2815,6 +2827,11 @@ const LANGUAGES = {
|
||||
videoPlanSaveFailed: "Planの保存に失敗しました",
|
||||
videoPlanLoaded: "Planを読み込みました",
|
||||
videoPlanLoadFailed: "Planの読み込みに失敗しました",
|
||||
videoEditProjectEnterName: "プロジェクトの名前を入力してください",
|
||||
videoEditProjectSaved: "プロジェクトを保存しました",
|
||||
videoEditProjectSaveFailed: "プロジェクトの保存に失敗しました",
|
||||
videoEditProjectLoaded: "プロジェクトを読み込みました",
|
||||
videoEditProjectLoadFailed: "プロジェクトの読み込みに失敗しました",
|
||||
videoConfirmClearPlan: "現在のPlanをクリアしますか?",
|
||||
videoPlanPause: "一時停止",
|
||||
videoPlanResume: "再開",
|
||||
@@ -2848,8 +2865,15 @@ const LANGUAGES = {
|
||||
videoProjectDeleted: "Planを削除しました",
|
||||
videoProjectDeleteFailed: "Planの削除に失敗しました",
|
||||
videoProjectLoadListFailed: "Plan一覧の読み込みに失敗しました",
|
||||
videoEditProjectHint: "保存済みのEditプロジェクト",
|
||||
videoEditProjectEmpty: "保存済みのEditプロジェクトはまだありません",
|
||||
videoEditProjectClipCount: (n) => `${n}クリップ`,
|
||||
videoEditProjectDeleteConfirm: (name) => `プロジェクト「${name}」を削除しますか?`,
|
||||
videoEditProjectDeleted: "プロジェクトを削除しました",
|
||||
videoEditProjectDeleteFailed: "プロジェクトの削除に失敗しました",
|
||||
videoEditProjectLoadListFailed: "プロジェクト一覧の読み込みに失敗しました",
|
||||
helpVideoTitle: "Video タブ",
|
||||
helpVideoDesc: "MiniMax H3 (Image to Video)、LTX-2.5 (Text / Image / First & Last Frame to Video)、Wan2.2 (Text to Video) ワークフロー対応の動画生成タブ。GenerateUIタブとは独立して動作します。中央パネルのPlan/Edit/Assetサブタブがバッチ生成・クリップ編集・生成済み動画の閲覧を、左サイドバーのProjectサブタブが保存済みPlanの一覧を扱います。",
|
||||
helpVideoDesc: "MiniMax H3 (Image to Video)、LTX-2.5 (Text / Image / First & Last Frame to Video)、Wan2.2 (Text to Video) ワークフロー対応の動画生成タブ。GenerateUIタブとは独立して動作します。中央パネルのPlan/Edit/Assetサブタブがバッチ生成・クリップ編集・生成済み動画の閲覧を扱い、左サイドバーのProjectサブタブは中央がPlan選択中なら保存済みPlan一覧、Edit選択中なら保存済みEditプロジェクト一覧を扱います。",
|
||||
helpVideo1: "Planサブタブ: 上部の設定行にAspect Ratio/Megapixels/Multiple/Duration(秒)/Noise SeedがこのPlanの基本設定として並びます——Durationは常に現在選択中のブロックの値を表示・編集します(各ブロックが独自の値を持つ)が、それ以外はPlan全体で共通の値です。その下の2行目にはWidth/Height/Turbo Mode/Strength/Steps/Prompt Enhanceが並び、読み込んだワークフローが実際に対応する項目だけ入力可能になります(詳細はhelpVideo2)。「+ Split」「+ Block」「Delete」ボタンでタイムラインをブロックに分割すると、各ブロックは独自のPrompt・Duration・First/Last Imageを持ちます(First Imageは「なし」「画像を指定」「前ブロックの最終フレームを使用」から選択可能。前ブロックに明示的なLast Imageが設定されていれば、フレーム抽出よりそちらが優先されます)。Runを押すと全ブロックを順番に生成します。実行中もPause/Cancelが使えます。",
|
||||
helpVideo2: "ブロックが1個だけのPlanは、以前の単発生成フォームと同じ動作になります。モデル選択(UNet/CLIP/VAE/Audio VAE)は読み込んだワークフローの既定値に固定されます。ResolutionSelectorノードを持たないワークフロー(Wan2.2、LTX-2.5のFirst & Last Frame to Videoなど)はAspect Ratio/Megapixels/Multiple欄が無効化される代わりに、ワークフロー自体のWidth/Heightを直接編集できるようになります。Turbo Mode/Strength/StepsはMiniMax H3のturbo LoRA専用、Prompt EnhanceはLTX-2.5専用で、他のモデルファミリーでは無効のままです。Noise SeedはWan2.2のText to Videoのみ公開入力を持たないため無効化されます。",
|
||||
helpVideo3: "Workflowタブの詳細モーダルにある「Videoに読み込み」ボタンから、MiniMax H3のImage to Videoノード、LTX-2.5のText/Image/First&Last-Frame to Videoノード、またはWan2.2のText to Videoノードを含むワークフローを読み込めます。この操作でワークフローの現在値を反映したブロック1個の新規Planが作成されます。対応していないワークフローはエラー表示になります。",
|
||||
@@ -2858,9 +2882,9 @@ const LANGUAGES = {
|
||||
helpVideo6: "Frameタブ(右パネル): プレビュー動画を再生・シークして止めたい位置で「Capture Frame」を押すとその場でフレームをキャプチャし、「Save to Output」でPNGとしてComfyUIのOutputフォルダに保存します。保存前に「Add to Video Assets group」にチェックを入れると、保存したフレームをGalleryのVideo Assetsグループにも自動登録できます。",
|
||||
helpVideo7: "GIFタブ(右パネル): Start/End(秒)・FPS・Max Width(任意)を指定して「Convert to GIF」を押すと、サーバー側で動画をデコードしアニメーションGIFとしてComfyUIのOutputフォルダに保存します。",
|
||||
helpVideo8: "チェイン機能: ブロックのFirst Imageを「前ブロックの最終フレームを使用」に設定すると、前のクリップから連続した映像になります。前ブロックに明示的なLast Imageが設定されていればそれがそのまま使われ、無ければ生成された動画から実際の最終フレームが自動抽出されます。",
|
||||
helpVideo9: "Projectタブ(左サイドバー): 保存済みの全Planファイル(サムネイル・ブロック数・更新日時)を一覧表示し、クリックでPlanエディタへ読み込み、×ボタンで削除できます。同じタブをもう一度押すとパネルを閉じます。",
|
||||
helpVideo9: "Projectタブ(左サイドバー): 中央がPlanサブタブのときは保存済みPlan一覧、Editサブタブのときは保存済みEditプロジェクト一覧(サムネイル/ブロック数またはクリップ数・更新日時)を表示します。クリックで読み込み、×ボタンで削除できます。同じタブをもう一度押すとパネルを閉じます。",
|
||||
helpVideo10: "ハイライト表示: 読み込んだワークフローが実際にサポートしているフィールドに応じて、Prompt/Duration/First Image/Last Image/Aspect Ratio/Megapixels/Multiple/Noise Seed/Width/Height/Turbo Mode/Strength/Steps/Prompt Enhanceのラベルが、GenerateUI ModelタブのハイライトとSettingsタブで共通設定できる色に変わります。例えばWan2.2ワークフロー(ResolutionSelectorノードが無い)ではAspect Ratio/Megapixels/Multipleはハイライトされない代わりに、Width/Heightがハイライトされます。",
|
||||
helpVideo11: "Editサブタブ: 生成とは独立して動画/画像クリップをトリム・結合できる簡易タイムラインです。Video Sourceパネルの「Editに追加」ボタン、またはAssetサブタブの「Editへ送る」ボタンでクリップを追加し、ブロックをドラッグ(または◀/▶ツールバーボタン)で並べ替え、選択中クリップをDuplicate/Delete、Clearでタイムラインを空にできます。選択中の動画クリップのトリムパネルには時間目盛り・Sourceプレビューと同期するドラッグ可能な再生ヘッド・時刻バッジ付きのドラッグ可能なイン/アウトハンドルが表示されます(画像クリップは代わりにシンプルな保持時間の入力欄)。「▶ プレビュー」は準備済みの全クリップをイン/アウト点でトリムして右側の結果プレビューで連続再生し、「書き出し」は実際のComfyUIグラフ(トリム→2クリップ以上ならConcatenate→保存)を構築・実行して、結果をVideo Tempグループへ自動登録します。複数クリップの書き出しは現状音声が失われます(ComfyUIの結合ノードが全入力で音声形式の統一を要求するため)。",
|
||||
helpVideo11: "Editサブタブ: 生成とは独立して動画/画像クリップをトリム・結合できる簡易タイムラインです。Video Sourceパネルの「Editに追加」ボタン、またはAssetサブタブの「Editへ送る」ボタンでクリップを追加し、ブロックをドラッグ(または◀/▶ツールバーボタン)で並べ替え、選択中クリップをDuplicate/Delete、Clearでタイムラインを空にできます。選択中の動画クリップのトリムパネルには時間目盛り・Sourceプレビューと同期するドラッグ可能な再生ヘッド・時刻バッジ付きのドラッグ可能なイン/アウトハンドルが表示されます(画像クリップは代わりにシンプルな保持時間の入力欄)。「▶ プレビュー」は準備済みの全クリップをイン/アウト点でトリムして右側の結果プレビューで連続再生し、「書き出し」は実際のComfyUIグラフ(トリム→2クリップ以上ならConcatenate→保存)を構築・実行して、結果をVideo Tempグループへ自動登録します。複数クリップの書き出しは現状音声が失われます(ComfyUIの結合ノードが全入力で音声形式の統一を要求するため)。書き出しパネルのSave/Save As/Loadボタンは、タイムラインそのもの(クリップ順序・トリム区間・各クリップが参照するアップロード済みファイル)をサーバー上にJSONプロジェクトとして保存します。Loadは保存されたサーバー参照から各クリップを再取得・再プローブするため、元のファイルが存在している必要があります。保存済みプロジェクトは、中央がEditサブタブのときサイドバーのProjectタブにも一覧表示されます(helpVideo9参照)。",
|
||||
helpVideo12: "Assetサブタブ(中央パネル、Plan/Editの隣): グループ切替(または「All Video Assets」で両方まとめて)でVideo AssetsまたはVideo Tempに登録された動画/画像を一覧表示します。検索欄はファイル名でフィルタし、▦/☰ボタンでサムネイルグリッドとテーブル表示(ファイル名・更新日時・タグ)を切り替えられます。項目を選択するとタグ・メモが表示され中央プレビューに読み込まれ、「Editへ送る」(Editサブタブのクリップとして追加)に加え、画像の場合のみ「First Imageに設定」「Last Imageに設定」(選択中のPlanブロックへ直接アップロードし、Planサブタブへ切り替え)が使えます。",
|
||||
},
|
||||
|
||||
@@ -4244,6 +4268,11 @@ const LANGUAGES = {
|
||||
videoPlanSaveFailed: "Plan 保存失败",
|
||||
videoPlanLoaded: "Plan 已加载",
|
||||
videoPlanLoadFailed: "Plan 加载失败",
|
||||
videoEditProjectEnterName: "请输入该项目的名称",
|
||||
videoEditProjectSaved: "项目已保存",
|
||||
videoEditProjectSaveFailed: "项目保存失败",
|
||||
videoEditProjectLoaded: "项目已加载",
|
||||
videoEditProjectLoadFailed: "项目加载失败",
|
||||
videoConfirmClearPlan: "要清空当前 Plan 吗?",
|
||||
videoPlanPause: "暂停",
|
||||
videoPlanResume: "继续",
|
||||
@@ -4277,8 +4306,15 @@ const LANGUAGES = {
|
||||
videoProjectDeleted: "Plan 已删除",
|
||||
videoProjectDeleteFailed: "Plan 删除失败",
|
||||
videoProjectLoadListFailed: "Plan 列表加载失败",
|
||||
videoEditProjectHint: "已保存的 Edit 项目",
|
||||
videoEditProjectEmpty: "暂无已保存的 Edit 项目",
|
||||
videoEditProjectClipCount: (n) => `${n} 个片段`,
|
||||
videoEditProjectDeleteConfirm: (name) => `确定删除项目「${name}」吗?`,
|
||||
videoEditProjectDeleted: "项目已删除",
|
||||
videoEditProjectDeleteFailed: "项目删除失败",
|
||||
videoEditProjectLoadListFailed: "项目列表加载失败",
|
||||
helpVideoTitle: "Video 标签页",
|
||||
helpVideoDesc: "支持 MiniMax H3(Image to Video)、LTX-2.5(Text / Image / First & Last Frame to Video)、Wan2.2(Text to Video)工作流的视频生成标签页,独立于 GenerateUI 标签页运行。中央面板的 Plan/Edit/Asset 子标签负责批量生成、片段剪辑和浏览已生成的视频;侧边栏的 Project 子标签负责已保存的 Plan。",
|
||||
helpVideoDesc: "支持 MiniMax H3(Image to Video)、LTX-2.5(Text / Image / First & Last Frame to Video)、Wan2.2(Text to Video)工作流的视频生成标签页,独立于 GenerateUI 标签页运行。中央面板的 Plan/Edit/Asset 子标签负责批量生成、片段剪辑和浏览已生成的视频;侧边栏的 Project 子标签在中央选中 Plan 时显示已保存的 Plan 列表,选中 Edit 时显示已保存的 Edit 项目列表。",
|
||||
helpVideo1: "Plan 子标签:顶部设置行包含 Aspect Ratio/Megapixels/Multiple/Duration(秒)/Noise Seed,作为该 Plan 的基础设置——Duration 始终显示并可编辑当前选中区块的值(每个区块保留自己的值),其余字段则是整个 Plan 共用的。下方第二行是 Width/Height/Turbo Mode/Strength/Steps/Prompt Enhance,仅当所加载的工作流实际支持该项时才可输入(详见 helpVideo2)。用「+ Split」「+ Block」「Delete」按钮把时间线分割成多个区块后,每个区块都有自己的 Prompt、Duration 以及 First/Last Image(First Image 可选择“无”、“指定图片”或“使用前一个区块的最后一帧”——若前一个区块已明确设置了 Last Image,则优先使用该图片而非提取帧)。点击 Run 会按顺序生成所有区块,运行中也可以 Pause/Cancel。",
|
||||
helpVideo2: "只有一个区块的 Plan 与旧版单次生成表单效果完全相同。模型选择(UNet/CLIP/VAE/Audio VAE)固定为所加载工作流的默认值。没有 ResolutionSelector 节点的工作流(如 Wan2.2、LTX-2.5 的 First & Last Frame to Video)会禁用 Aspect Ratio/Megapixels/Multiple 字段,改为可以直接编辑工作流自身的 Width/Height。Turbo Mode/Strength/Steps 仅适用于 MiniMax H3 的 turbo LoRA,Prompt Enhance 仅适用于 LTX-2.5——其他模型系列中这些字段保持禁用。Noise Seed 仅在 Wan2.2 的 Text to Video 中会被禁用,因为该变体未公开此输入。",
|
||||
helpVideo3: "在 Workflow 标签页的详情弹窗中使用「加载到Video」按钮,可以加载包含 MiniMax H3 的 Image to Video 节点、LTX-2.5 的 Text/Image/First&Last-Frame to Video 节点、或 Wan2.2 的 Text to Video 节点的工作流——此操作会创建一个仅含一个区块、并以该工作流当前值为初始值的新 Plan。不受支持的工作流会显示错误提示。",
|
||||
@@ -4287,9 +4323,9 @@ const LANGUAGES = {
|
||||
helpVideo6: "Frame标签页(右侧面板):播放/拖动预览视频到想要的位置,点击「Capture Frame」在客户端截取该帧,再点击「Save to Output」将其保存为PNG到ComfyUI的输出文件夹——保存前勾选「Add to Video Assets group」还可以把保存的帧同时标记进 Gallery 的 Video Assets 分组。",
|
||||
helpVideo7: "GIF标签页(右侧面板):设置Start/End(秒)、FPS和可选的Max Width,点击「Convert to GIF」后,服务器会解码视频并将动画GIF保存到ComfyUI的输出文件夹。",
|
||||
helpVideo8: "链接功能:将某个区块的 First Image 设置为“使用前一个区块的最后一帧”,即可与上一个片段流畅衔接——如果前一个区块已明确设置了 Last Image,将直接使用该图片;否则会自动从其生成的视频中提取实际的最后一帧。",
|
||||
helpVideo9: "Project标签页(左侧边栏):浏览所有已保存的 Plan 文件(缩略图、区块数、最后更新时间),点击即可加载到 Plan 编辑器,或用 × 按钮删除;再次点击同一标签会收起面板。",
|
||||
helpVideo9: "Project标签页(左侧边栏):中央为 Plan 子标签时显示已保存的 Plan 列表,为 Edit 子标签时显示已保存的 Edit 项目列表(缩略图/区块数或片段数、最后更新时间),点击即可加载,或用 × 按钮删除;再次点击同一标签会收起面板。",
|
||||
helpVideo10: "高亮颜色:当所加载的工作流实际支持该字段时,Prompt / Duration / First Image / Last Image / Aspect Ratio / Megapixels / Multiple / Noise Seed / Width / Height / Turbo Mode / Strength / Steps / Prompt Enhance 标签会变为与 GenerateUI Model 标签页相同的高亮颜色(可在 Settings 标签页自定义)——例如 Wan2.2 工作流(没有 ResolutionSelector 节点)中,Aspect Ratio / Megapixels / Multiple 不会高亮,取而代之的是 Width / Height 会高亮。",
|
||||
helpVideo11: "Edit 子标签:独立于生成流程的轻量剪辑时间线,用于裁剪和拼接视频/图片片段。通过 Video Source 面板的「Add to Edit」按钮,或 Asset 子标签的「Send to Edit」按钮添加片段,拖动区块(或使用 ◀/▶ 工具栏按钮)重新排序,对选中片段执行 Duplicate/Delete,Clear 可清空时间线。选中视频片段的裁剪面板会显示时间刻度尺、与 Source 预览同步的可拖动播放头,以及带时间标签的可拖动入/出点手柄(图片片段则只有一个简单的保持时长输入框)。「▶ Preview」会按入/出点依次裁剪并在右侧结果预览区连续播放所有就绪片段;「Export」会构建并运行实际的 ComfyUI 图(裁剪→若多于一个片段则拼接→保存),并自动把结果标记进 Video Temp 分组。目前导出多个片段会丢失音频,因为 ComfyUI 的拼接节点要求所有输入的音频格式一致。",
|
||||
helpVideo11: "Edit 子标签:独立于生成流程的轻量剪辑时间线,用于裁剪和拼接视频/图片片段。通过 Video Source 面板的「Add to Edit」按钮,或 Asset 子标签的「Send to Edit」按钮添加片段,拖动区块(或使用 ◀/▶ 工具栏按钮)重新排序,对选中片段执行 Duplicate/Delete,Clear 可清空时间线。选中视频片段的裁剪面板会显示时间刻度尺、与 Source 预览同步的可拖动播放头,以及带时间标签的可拖动入/出点手柄(图片片段则只有一个简单的保持时长输入框)。「▶ Preview」会按入/出点依次裁剪并在右侧结果预览区连续播放所有就绪片段;「Export」会构建并运行实际的 ComfyUI 图(裁剪→若多于一个片段则拼接→保存),并自动把结果标记进 Video Temp 分组。目前导出多个片段会丢失音频,因为 ComfyUI 的拼接节点要求所有输入的音频格式一致。导出面板的 Save/Save As/Load 按钮会把时间线本身(片段顺序、裁剪区间、每个片段引用的已上传文件)作为 JSON 项目保存到服务器;Load 会根据保存的服务器引用重新获取并重新探测每个片段,因此原始文件必须仍然存在。已保存的项目在中央为 Edit 子标签时也会显示在侧边栏的 Project 标签中(参见 helpVideo9)。",
|
||||
helpVideo12: "Asset 子标签(中央面板,位于 Plan/Edit 旁):浏览标记到 Video Assets 或 Video Temp 分组的所有视频/图片(通过分组下拉框选择,或选择「All Video Assets」同时浏览两者)。搜索框按文件名过滤,▦/☰ 按钮可在缩略图网格和表格视图(文件名/更新时间/标签)之间切换。选中一项会显示其标签/备注并加载到中央预览,此外还提供「Send to Edit」(作为片段加入 Edit 子标签);仅图片还额外提供「Set as First Image」「Set as Last Image」(直接上传到当前选中的 Plan 区块,并切换到 Plan 子标签)。",
|
||||
},
|
||||
};
|
||||
|
||||
@@ -33,6 +33,7 @@ const _s = {
|
||||
loaded: false, // becomes true once the Asset subtab has been shown at least once
|
||||
searchQuery: "",
|
||||
viewMode: "grid", // "grid" | "table"
|
||||
kindFilter: "all", // "all" | "video" | "image"
|
||||
};
|
||||
|
||||
function _formatDate(mtime) {
|
||||
@@ -41,8 +42,11 @@ function _formatDate(mtime) {
|
||||
|
||||
function _filteredImages() {
|
||||
const q = _s.searchQuery.trim().toLowerCase();
|
||||
if (!q) return _s.images;
|
||||
return _s.images.filter((img) => img.filename.toLowerCase().includes(q));
|
||||
let list = _s.images;
|
||||
if (_s.kindFilter === "video") list = list.filter((img) => isVideoFile(img));
|
||||
else if (_s.kindFilter === "image") list = list.filter((img) => !isVideoFile(img));
|
||||
if (q) list = list.filter((img) => img.filename.toLowerCase().includes(q));
|
||||
return list;
|
||||
}
|
||||
|
||||
async function _fetchOutputDir() {
|
||||
@@ -389,6 +393,10 @@ export function initVideoAssetTab() {
|
||||
_loadImages();
|
||||
});
|
||||
document.getElementById("wfm-video-asset-refresh")?.addEventListener("click", () => _loadImages());
|
||||
document.getElementById("wfm-video-asset-kind")?.addEventListener("change", (e) => {
|
||||
_s.kindFilter = e.target.value;
|
||||
_renderList();
|
||||
});
|
||||
document.getElementById("wfm-video-asset-search")?.addEventListener("input", (e) => {
|
||||
_s.searchQuery = e.target.value;
|
||||
_renderList();
|
||||
|
||||
+194
-4
@@ -60,8 +60,15 @@ const _s = {
|
||||
exporting: false,
|
||||
nextId: 1,
|
||||
outputDir: "",
|
||||
projectFilename: null, // currently loaded/saved project's server filename, or null if unsaved
|
||||
};
|
||||
|
||||
// Save/load persists only the timeline's editorial state (order, trim points,
|
||||
// which server-side file each clip refers to) — not clip.file/probing/error,
|
||||
// which are re-derived on load the same way a fresh "add clip" does (see
|
||||
// _restoreClipFromSaved). Mirrors video-plan-tab.js's VIDEO_PLAN_PREFIX pattern.
|
||||
const VIDEO_EDIT_PROJECT_PREFIX = "ws_videoeditproj_";
|
||||
|
||||
// Pixel-per-second scale for the timeline track — clips are laid out at their
|
||||
// real (trimmed) duration and left-aligned, NOT stretched to fill the track
|
||||
// width like the Plan tab's blocks (whose widths are relative shares of a
|
||||
@@ -445,7 +452,7 @@ function _wireTrimScrubber(clip, startInput, endInput, commit) {
|
||||
const badgeStart = document.getElementById("wfm-video-trim-badge-start");
|
||||
const badgeEnd = document.getElementById("wfm-video-trim-badge-end");
|
||||
const badgePlayhead = document.getElementById("wfm-video-trim-badge-playhead");
|
||||
if (!track || !clip.duration) return;
|
||||
if (!track || !clip.duration) return undefined;
|
||||
|
||||
_renderRuler(ruler, clip.duration);
|
||||
|
||||
@@ -532,6 +539,8 @@ function _wireTrimScrubber(clip, startInput, endInput, commit) {
|
||||
playhead.addEventListener("pointermove", onMove);
|
||||
playhead.addEventListener("pointerup", onUp);
|
||||
});
|
||||
|
||||
return updateRange;
|
||||
}
|
||||
|
||||
function _renderTrimPanel() {
|
||||
@@ -578,7 +587,7 @@ function _renderTrimPanel() {
|
||||
}
|
||||
|
||||
panel.innerHTML = `
|
||||
<div class="wfm-video-edit-clip-name" id="wfm-video-edit-trim-clip-name" style="margin-bottom:6px;"></div>
|
||||
<div class="wfm-video-edit-clip-name" id="wfm-video-edit-trim-clip-name" style="margin-bottom:16px;"></div>
|
||||
<div class="wfm-video-trim-scrubber" id="wfm-video-trim-scrubber">
|
||||
<div class="wfm-video-trim-ruler" id="wfm-video-trim-ruler"></div>
|
||||
<div class="wfm-video-trim-track" id="wfm-video-trim-track">
|
||||
@@ -594,7 +603,7 @@ function _renderTrimPanel() {
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
<div class="wfm-video-edit-trim-row" style="margin-top:10px;">
|
||||
<div class="wfm-video-edit-trim-row" style="margin-top:20px;">
|
||||
<div class="wfm-video-edit-trim-field">
|
||||
<label>${t("videoEditTrimStart")}</label>
|
||||
<input type="number" id="wfm-video-edit-trim-start" class="wfm-input" step="0.1" min="0" max="${clip.duration}" value="${clip.trimStart.toFixed(2)}">
|
||||
@@ -613,6 +622,12 @@ function _renderTrimPanel() {
|
||||
const startInput = document.getElementById("wfm-video-edit-trim-start");
|
||||
const endInput = document.getElementById("wfm-video-edit-trim-end");
|
||||
|
||||
// _wireTrimScrubber fills this in with its own updateRange() once it's
|
||||
// wired below, so commit() (used by both the typed inputs and the "use
|
||||
// current position" buttons) can keep the scrubber's highlighted range
|
||||
// and handle positions in sync — not just the timeline blocks.
|
||||
let syncScrubber = () => {};
|
||||
|
||||
// skipTimelineRerender: the scrubber's handle-drag calls this on every
|
||||
// pointermove (see _wireTrimScrubber) — re-running _renderTimeline() that
|
||||
// often would rebuild every timeline block per mousemove for no visible
|
||||
@@ -625,6 +640,7 @@ function _renderTrimPanel() {
|
||||
clip.trimEnd = end;
|
||||
startInput.value = start.toFixed(2);
|
||||
endInput.value = end.toFixed(2);
|
||||
syncScrubber();
|
||||
if (!skipTimelineRerender) _renderTimeline();
|
||||
};
|
||||
startInput.addEventListener("change", commit);
|
||||
@@ -639,7 +655,7 @@ function _renderTrimPanel() {
|
||||
if (video) { endInput.value = video.currentTime.toFixed(2); commit(); }
|
||||
});
|
||||
|
||||
_wireTrimScrubber(clip, startInput, endInput, commit);
|
||||
syncScrubber = _wireTrimScrubber(clip, startInput, endInput, commit) || syncScrubber;
|
||||
}
|
||||
|
||||
// ============================================
|
||||
@@ -949,9 +965,183 @@ function _wireToolbar() {
|
||||
});
|
||||
}
|
||||
|
||||
// ============================================
|
||||
// Project persistence (Save/Save As/Load) — see VIDEO_EDIT_TAB_PLAN.md
|
||||
// section 5 "永続化". Only clips that already have a serverRef (i.e. finished
|
||||
// uploading+probing) are persisted; a clip still mid-upload when Save is
|
||||
// clicked is silently skipped rather than saved half-formed.
|
||||
// ============================================
|
||||
|
||||
function _buildProjectData() {
|
||||
return {
|
||||
clips: _s.clips
|
||||
.filter((c) => c.serverRef)
|
||||
.map((c) => ({
|
||||
name: c.name,
|
||||
kind: c.kind,
|
||||
serverRef: c.serverRef,
|
||||
trimStart: c.trimStart,
|
||||
trimEnd: c.trimEnd,
|
||||
duration: c.duration,
|
||||
width: c.width,
|
||||
height: c.height,
|
||||
fps: c.fps,
|
||||
})),
|
||||
};
|
||||
}
|
||||
|
||||
function _updateProjectNameUI() {
|
||||
const el = document.getElementById("wfm-video-edit-project-name");
|
||||
if (el) el.textContent = _s.projectFilename ? _s.projectFilename.replace(/\.json$/i, "") : "";
|
||||
}
|
||||
|
||||
async function _saveProject(filenameOverride, forceNewName = false) {
|
||||
let inputName = filenameOverride;
|
||||
if (!inputName) {
|
||||
if (forceNewName || !_s.projectFilename) {
|
||||
inputName = window.prompt(t("videoEditProjectEnterName"), "");
|
||||
if (!inputName) return;
|
||||
} else {
|
||||
inputName = _s.projectFilename;
|
||||
}
|
||||
}
|
||||
|
||||
const baseName = inputName.replace(/\.json$/i, "").replace(new RegExp(`^${VIDEO_EDIT_PROJECT_PREFIX}`, "i"), "");
|
||||
const filename = `${VIDEO_EDIT_PROJECT_PREFIX}${baseName}.json`;
|
||||
const data = _buildProjectData();
|
||||
|
||||
try {
|
||||
const res = await fetch("/api/wfm/video/edit/projects/save", {
|
||||
method: "POST",
|
||||
headers: { "Content-Type": "application/json" },
|
||||
body: JSON.stringify({ filename, data }),
|
||||
});
|
||||
const json = await res.json();
|
||||
if (!res.ok) throw new Error(json.error || `HTTP ${res.status}`);
|
||||
_s.projectFilename = json.filename;
|
||||
_updateProjectNameUI();
|
||||
showToast(t("videoEditProjectSaved"), "success");
|
||||
} catch (err) {
|
||||
showToast(`${t("videoEditProjectSaveFailed")}: ${err.message}`, "error");
|
||||
}
|
||||
}
|
||||
|
||||
// Waits for a just-added clip's async upload+probe (see _probeClip/_probeImageClip)
|
||||
// to finish, so the caller can then override the freshly-probed trimStart/trimEnd
|
||||
// with the values that were actually saved in the project file.
|
||||
function _waitForProbe(id) {
|
||||
return new Promise((resolve) => {
|
||||
const check = () => {
|
||||
const c = _s.clips.find((cl) => cl.id === id);
|
||||
if (!c || !c.probing) resolve(c);
|
||||
else setTimeout(check, 100);
|
||||
};
|
||||
check();
|
||||
});
|
||||
}
|
||||
|
||||
// Re-adds one saved clip by fetching its still-existing server-side file back
|
||||
// as a Blob and feeding it through the exact same addClipFromFile() path a
|
||||
// fresh drag-and-drop uses (re-upload + re-probe) — rather than trusting the
|
||||
// saved serverRef/duration/width/height directly, since the input file could
|
||||
// have been deleted or replaced since the project was saved. Once probing
|
||||
// settles, the saved trim points are applied on top of the freshly-probed
|
||||
// (full-length) defaults.
|
||||
async function _restoreClipFromSaved(entry) {
|
||||
if (!entry?.serverRef?.filename) return;
|
||||
try {
|
||||
const params = new URLSearchParams({
|
||||
filename: entry.serverRef.filename,
|
||||
subfolder: entry.serverRef.subfolder || "",
|
||||
type: entry.serverRef.type || "input",
|
||||
});
|
||||
const res = await fetch(`${comfyUI.baseUrl}/view?${params}`);
|
||||
if (!res.ok) throw new Error(`HTTP ${res.status}`);
|
||||
const blob = await res.blob();
|
||||
const mime = entry.kind === "image" ? "image/png" : "video/mp4";
|
||||
const file = new File([blob], entry.name || entry.serverRef.filename, { type: blob.type || mime });
|
||||
|
||||
const beforeIds = new Set(_s.clips.map((c) => c.id));
|
||||
addClipFromFile(file, entry.name);
|
||||
const newClip = _s.clips.find((c) => !beforeIds.has(c.id));
|
||||
if (!newClip) return;
|
||||
|
||||
await _waitForProbe(newClip.id);
|
||||
const c = _s.clips.find((cl) => cl.id === newClip.id);
|
||||
if (!c || c.error) return;
|
||||
if (c.kind === "video") {
|
||||
c.trimStart = Math.max(0, Math.min(entry.trimStart ?? 0, c.duration));
|
||||
c.trimEnd = Math.max(c.trimStart + 0.1, Math.min(entry.trimEnd ?? c.duration, c.duration));
|
||||
} else {
|
||||
c.trimEnd = Math.max(0.1, entry.trimEnd ?? c.trimEnd);
|
||||
}
|
||||
_renderTimeline();
|
||||
if (_s.selectedId === c.id) _renderTrimPanel();
|
||||
} catch (err) {
|
||||
showToast(t("errorWithMsg", `${entry.name || ""}: ${err.message}`), "error");
|
||||
}
|
||||
}
|
||||
|
||||
async function _loadProjectData(filename, data) {
|
||||
_stopPreview();
|
||||
_s.clips = [];
|
||||
_s.selectedId = null;
|
||||
setSourcePreview(null, null);
|
||||
|
||||
const entries = Array.isArray(data.clips) ? data.clips : [];
|
||||
// Sequential, not parallel: addClipFromFile() appends to _s.clips, so
|
||||
// restoring one at a time is what keeps the reloaded timeline in the
|
||||
// same clip order it was saved in.
|
||||
for (const entry of entries) {
|
||||
await _restoreClipFromSaved(entry);
|
||||
}
|
||||
|
||||
_s.projectFilename = filename;
|
||||
_updateProjectNameUI();
|
||||
_renderTimeline();
|
||||
_renderTrimPanel();
|
||||
showToast(t("videoEditProjectLoaded"), "success");
|
||||
}
|
||||
|
||||
async function _loadProjectFromFile(file) {
|
||||
try {
|
||||
const text = await file.text();
|
||||
const data = JSON.parse(text);
|
||||
const filename = file.name.toLowerCase().endsWith(".json") ? file.name : `${file.name}.json`;
|
||||
await _loadProjectData(filename, data);
|
||||
} catch (err) {
|
||||
showToast(`${t("videoEditProjectLoadFailed")}: ${err.message}`, "error");
|
||||
}
|
||||
}
|
||||
|
||||
// Entry point for the sidebar Project panel's saved-project list
|
||||
// (video-project-tab.js, "edit" mode) — mirrors video-plan-tab.js's
|
||||
// openSavedVideoPlan(): fetches the project by filename, loads it, then jumps
|
||||
// to the Edit subtab so the freshly-loaded timeline is actually visible.
|
||||
export async function openSavedVideoEditProject(filename) {
|
||||
try {
|
||||
const res = await fetch(`/api/wfm/video/edit/projects/content?filename=${encodeURIComponent(filename)}`);
|
||||
const json = await res.json();
|
||||
if (!res.ok) throw new Error(json.error || `HTTP ${res.status}`);
|
||||
await _loadProjectData(filename, json.data || {});
|
||||
document.querySelector('.wfm-video-subtab-btn[data-video-subtab="edit"]')?.click();
|
||||
} catch (err) {
|
||||
showToast(`${t("videoEditProjectLoadFailed")}: ${err.message}`, "error");
|
||||
}
|
||||
}
|
||||
|
||||
export function initVideoEditTab() {
|
||||
_wireToolbar();
|
||||
document.getElementById("wfm-video-edit-export-btn")?.addEventListener("click", _exportTimeline);
|
||||
document.getElementById("wfm-video-edit-save-btn")?.addEventListener("click", () => _saveProject());
|
||||
document.getElementById("wfm-video-edit-saveas-btn")?.addEventListener("click", () => _saveProject(null, true));
|
||||
const loadInput = document.getElementById("wfm-video-edit-load-file-input");
|
||||
document.getElementById("wfm-video-edit-load-btn")?.addEventListener("click", () => loadInput?.click());
|
||||
loadInput?.addEventListener("change", (e) => {
|
||||
const file = e.target.files?.[0];
|
||||
if (file) _loadProjectFromFile(file);
|
||||
e.target.value = "";
|
||||
});
|
||||
_renderTimeline();
|
||||
_renderTrimPanel();
|
||||
_updatePreviewBtn();
|
||||
|
||||
@@ -1,19 +1,57 @@
|
||||
/**
|
||||
* Video Tab - Sidebar "Project" subtab (next to Asset): browses saved Video
|
||||
* Plan files (ws_videoplan_*.json in video_plan/), independent of which plan
|
||||
* (if any) is currently loaded in the Plan editor.
|
||||
* Plan files (ws_videoplan_*.json in video_plan/) OR saved Video Edit
|
||||
* projects (ws_videoeditproj_*.json in video_edit_project/), depending on
|
||||
* which center subtab (Plan/Edit) is currently active — video-tab.js passes
|
||||
* that mode in on every refresh (Asset stays on whichever of the two was
|
||||
* last active, since it has no saved-list concept of its own).
|
||||
*
|
||||
* Deliberately thin, mirroring video-asset-tab.js's own scope — clicking an
|
||||
* item hands off to video-plan-tab.js's openSavedVideoPlan() rather than
|
||||
* re-implementing plan loading here.
|
||||
* item hands off to video-plan-tab.js's openSavedVideoPlan() or
|
||||
* video-edit-tab.js's openSavedVideoEditProject() rather than
|
||||
* re-implementing plan/project loading here.
|
||||
*/
|
||||
|
||||
import { showToast } from "./app.js";
|
||||
import { t } from "./i18n.js";
|
||||
import { escapeHtml } from "./util.js";
|
||||
import { openSavedVideoPlan } from "./video-plan-tab.js";
|
||||
import { openSavedVideoEditProject } from "./video-edit-tab.js";
|
||||
|
||||
// Per-mode config: which endpoints to hit, which loader/toast strings to use,
|
||||
// and how to read each item's count field — keeps _renderList/_makeItem/etc.
|
||||
// mode-agnostic instead of branching throughout.
|
||||
const _MODES = {
|
||||
plan: {
|
||||
listUrl: "/api/wfm/video/plans",
|
||||
deleteUrl: "/api/wfm/video/plans/delete",
|
||||
open: (filename) => openSavedVideoPlan(filename),
|
||||
countOf: (item) => item.block_count ?? 0,
|
||||
countLabel: (n) => t("videoProjectBlockCount", n),
|
||||
hintKey: "videoProjectHint",
|
||||
emptyKey: "videoProjectEmpty",
|
||||
deleteConfirmKey: "videoProjectDeleteConfirm",
|
||||
deletedKey: "videoProjectDeleted",
|
||||
deleteFailedKey: "videoProjectDeleteFailed",
|
||||
loadListFailedKey: "videoProjectLoadListFailed",
|
||||
},
|
||||
edit: {
|
||||
listUrl: "/api/wfm/video/edit/projects",
|
||||
deleteUrl: "/api/wfm/video/edit/projects/delete",
|
||||
open: (filename) => openSavedVideoEditProject(filename),
|
||||
countOf: (item) => item.clip_count ?? 0,
|
||||
countLabel: (n) => t("videoEditProjectClipCount", n),
|
||||
hintKey: "videoEditProjectHint",
|
||||
emptyKey: "videoEditProjectEmpty",
|
||||
deleteConfirmKey: "videoEditProjectDeleteConfirm",
|
||||
deletedKey: "videoEditProjectDeleted",
|
||||
deleteFailedKey: "videoEditProjectDeleteFailed",
|
||||
loadListFailedKey: "videoEditProjectLoadListFailed",
|
||||
},
|
||||
};
|
||||
|
||||
const _s = {
|
||||
mode: "plan",
|
||||
plans: [],
|
||||
activeFilename: null,
|
||||
loaded: false, // becomes true once the Project subtab has been shown at least once
|
||||
@@ -29,8 +67,9 @@ function _formatUpdatedAt(iso) {
|
||||
function _renderList() {
|
||||
const list = document.getElementById("wfm-video-project-list");
|
||||
if (!list) return;
|
||||
const cfg = _MODES[_s.mode];
|
||||
if (_s.plans.length === 0) {
|
||||
list.innerHTML = `<span class="wfm-placeholder">${t("videoProjectEmpty")}</span>`;
|
||||
list.innerHTML = `<span class="wfm-placeholder">${t(cfg.emptyKey)}</span>`;
|
||||
return;
|
||||
}
|
||||
list.innerHTML = "";
|
||||
@@ -38,6 +77,7 @@ function _renderList() {
|
||||
}
|
||||
|
||||
function _makeItem(plan) {
|
||||
const cfg = _MODES[_s.mode];
|
||||
const item = document.createElement("div");
|
||||
item.className = "wfm-video-project-item" + (plan.filename === _s.activeFilename ? " active" : "");
|
||||
item.dataset.filename = plan.filename;
|
||||
@@ -58,9 +98,9 @@ function _makeItem(plan) {
|
||||
|
||||
const meta = document.createElement("div");
|
||||
meta.className = "wfm-video-project-item-meta";
|
||||
const blockLabel = t("videoProjectBlockCount", plan.block_count ?? 0);
|
||||
const countLabel = cfg.countLabel(cfg.countOf(plan));
|
||||
const updated = _formatUpdatedAt(plan.updated_at);
|
||||
meta.textContent = updated ? `${blockLabel} · ${updated}` : blockLabel;
|
||||
meta.textContent = updated ? `${countLabel} · ${updated}` : countLabel;
|
||||
meta.title = plan.note || "";
|
||||
|
||||
info.append(name, meta);
|
||||
@@ -83,13 +123,14 @@ function _makeItem(plan) {
|
||||
async function _openPlan(plan) {
|
||||
_s.activeFilename = plan.filename;
|
||||
_renderList();
|
||||
await openSavedVideoPlan(plan.filename);
|
||||
await _MODES[_s.mode].open(plan.filename);
|
||||
}
|
||||
|
||||
async function _deletePlan(plan) {
|
||||
if (!window.confirm(t("videoProjectDeleteConfirm", plan.name || plan.filename))) return;
|
||||
const cfg = _MODES[_s.mode];
|
||||
if (!window.confirm(t(cfg.deleteConfirmKey, plan.name || plan.filename))) return;
|
||||
try {
|
||||
const res = await fetch("/api/wfm/video/plans/delete", {
|
||||
const res = await fetch(cfg.deleteUrl, {
|
||||
method: "POST",
|
||||
headers: { "Content-Type": "application/json" },
|
||||
body: JSON.stringify({ filename: plan.filename }),
|
||||
@@ -97,26 +138,34 @@ async function _deletePlan(plan) {
|
||||
const json = await res.json();
|
||||
if (!res.ok) throw new Error(json.error || `HTTP ${res.status}`);
|
||||
if (_s.activeFilename === plan.filename) _s.activeFilename = null;
|
||||
showToast(t("videoProjectDeleted"), "success");
|
||||
await refreshVideoProjectTab();
|
||||
showToast(t(cfg.deletedKey), "success");
|
||||
await refreshVideoProjectTab(_s.mode);
|
||||
} catch (err) {
|
||||
showToast(`${t("videoProjectDeleteFailed")}: ${err.message}`, "error");
|
||||
showToast(`${t(cfg.deleteFailedKey)}: ${err.message}`, "error");
|
||||
}
|
||||
}
|
||||
|
||||
// Called whenever the Project subtab becomes active (see video-tab.js's prop-tab
|
||||
// toggle) — always refetches rather than caching, so a plan saved elsewhere
|
||||
// (Plan pane's Save/Save As) shows up as soon as the user switches over to look.
|
||||
export async function refreshVideoProjectTab() {
|
||||
// toggle) — always refetches rather than caching, so a plan/project saved
|
||||
// elsewhere (Plan pane's Save/Save As, Edit's Save/Save As) shows up as soon
|
||||
// as the user switches over to look. `mode` ("plan"|"edit") is video-tab.js's
|
||||
// record of which center subtab is currently active; defaults to "plan" so
|
||||
// direct calls (e.g. from initVideoProjectTab) keep the original behavior.
|
||||
export async function refreshVideoProjectTab(mode = "plan") {
|
||||
const list = document.getElementById("wfm-video-project-list");
|
||||
if (!list) return;
|
||||
_s.mode = mode === "edit" ? "edit" : "plan";
|
||||
_s.activeFilename = null;
|
||||
const cfg = _MODES[_s.mode];
|
||||
const hintEl = document.getElementById("wfm-video-project-hint");
|
||||
if (hintEl) hintEl.textContent = t(cfg.hintKey);
|
||||
try {
|
||||
const res = await fetch("/api/wfm/video/plans");
|
||||
const res = await fetch(cfg.listUrl);
|
||||
if (!res.ok) throw new Error(String(res.status));
|
||||
_s.plans = await res.json();
|
||||
_renderList();
|
||||
} catch (err) {
|
||||
list.innerHTML = `<span class="wfm-placeholder" style="color:var(--wfm-danger)">${escapeHtml(t("videoProjectLoadListFailed"))}: ${escapeHtml(err.message)}</span>`;
|
||||
list.innerHTML = `<span class="wfm-placeholder" style="color:var(--wfm-danger)">${escapeHtml(t(cfg.loadListFailedKey))}: ${escapeHtml(err.message)}</span>`;
|
||||
}
|
||||
_s.loaded = true;
|
||||
}
|
||||
|
||||
+18
-1
@@ -36,6 +36,17 @@ export { loadWorkflowIntoVideoEditor };
|
||||
// what keeps clicking one from affecting the other.
|
||||
// ============================================
|
||||
|
||||
// Which of the center Plan/Edit subtabs was last active — the sidebar
|
||||
// Project panel uses this to decide whether to list saved Video Plans or
|
||||
// saved Video Edit projects (Asset has no saved-list concept, so selecting
|
||||
// it leaves this unchanged rather than resetting to "plan").
|
||||
let _centerSubtabMode = "plan";
|
||||
|
||||
function _isProjectPanelOpen() {
|
||||
const panel = document.getElementById("wfm-video-subtab-project");
|
||||
return !!panel && panel.style.display !== "none";
|
||||
}
|
||||
|
||||
function _initCenterSubtabToggle() {
|
||||
const scope = document.querySelector(".wfm-video-center-panel");
|
||||
if (!scope) return;
|
||||
@@ -48,6 +59,12 @@ function _initCenterSubtabToggle() {
|
||||
p.style.display = p.dataset.videoSubtabPanel === target ? "" : "none";
|
||||
});
|
||||
if (target === "asset") refreshVideoAssetTab();
|
||||
if (target === "plan" || target === "edit") {
|
||||
_centerSubtabMode = target;
|
||||
// Project panel may already be open (e.g. switching Plan<->Edit
|
||||
// while it's pinned) — keep its list in sync with the new mode.
|
||||
if (_isProjectPanelOpen()) refreshVideoProjectTab(_centerSubtabMode);
|
||||
}
|
||||
});
|
||||
});
|
||||
}
|
||||
@@ -69,7 +86,7 @@ function _initSidebarSubtabToggle() {
|
||||
if (willShow) {
|
||||
btn.classList.add("active");
|
||||
panel.style.display = "";
|
||||
if (target === "project") refreshVideoProjectTab();
|
||||
if (target === "project") refreshVideoProjectTab(_centerSubtabMode);
|
||||
}
|
||||
});
|
||||
});
|
||||
|
||||
@@ -31,6 +31,7 @@ const state = {
|
||||
groupFilter: "", // empty = all groups
|
||||
currentPage: 0,
|
||||
showBatchOnly: false,
|
||||
sortBy: localStorage.getItem("wfm_workflow_sort") || "date_desc",
|
||||
};
|
||||
|
||||
|
||||
@@ -449,6 +450,26 @@ function filterWorkflows() {
|
||||
});
|
||||
}
|
||||
|
||||
function sortWorkflows(list) {
|
||||
const sorted = [...list];
|
||||
switch (state.sortBy) {
|
||||
case "date_asc":
|
||||
sorted.sort((a, b) => a.mtime - b.mtime);
|
||||
break;
|
||||
case "name_asc":
|
||||
sorted.sort((a, b) => a.filename.localeCompare(b.filename));
|
||||
break;
|
||||
case "name_desc":
|
||||
sorted.sort((a, b) => b.filename.localeCompare(a.filename));
|
||||
break;
|
||||
case "date_desc":
|
||||
default:
|
||||
sorted.sort((a, b) => b.mtime - a.mtime);
|
||||
break;
|
||||
}
|
||||
return sorted;
|
||||
}
|
||||
|
||||
// ============================================
|
||||
// Grid Rendering (3 view modes)
|
||||
// ============================================
|
||||
@@ -459,7 +480,7 @@ function renderGrid() {
|
||||
|
||||
grid.className = `wfm-grid wfm-view-${state.viewMode}`;
|
||||
|
||||
const filtered = filterWorkflows();
|
||||
const filtered = sortWorkflows(filterWorkflows());
|
||||
|
||||
if (filtered.length === 0) {
|
||||
grid.innerHTML =
|
||||
@@ -1365,6 +1386,16 @@ export function initWorkflowTab() {
|
||||
renderGrid();
|
||||
});
|
||||
|
||||
// Toolbar: sort dropdown
|
||||
const sortSel = document.getElementById("wfm-sort");
|
||||
if (sortSel) sortSel.value = state.sortBy;
|
||||
sortSel?.addEventListener("change", (e) => {
|
||||
state.sortBy = e.target.value;
|
||||
localStorage.setItem("wfm_workflow_sort", state.sortBy);
|
||||
state.currentPage = 0;
|
||||
renderGrid();
|
||||
});
|
||||
|
||||
// Toolbar: Load in GenerateUI button
|
||||
document.getElementById("wfm-list-load-btn")?.addEventListener("click", async () => {
|
||||
if (!state.selectedWf) return;
|
||||
|
||||
+19
-1
@@ -55,6 +55,12 @@
|
||||
<select id="wfm-group-filter" class="wfm-select wfm-toolbar-select">
|
||||
<option value="">All Groups</option>
|
||||
</select>
|
||||
<select id="wfm-sort" class="wfm-select wfm-toolbar-select">
|
||||
<option value="date_desc">Date (Newest)</option>
|
||||
<option value="date_asc">Date (Oldest)</option>
|
||||
<option value="name_asc">Name A-Z</option>
|
||||
<option value="name_desc">Name Z-A</option>
|
||||
</select>
|
||||
<button id="wfm-list-load-btn" class="wfm-btn wfm-btn-sm wfm-btn-primary" disabled title="Select a card first">Load in GenerateUI</button>
|
||||
<button id="wfm-list-load-video-btn" class="wfm-btn wfm-btn-sm" disabled title="Select a card first">Load in Video</button>
|
||||
<button id="wfm-list-open-comfyui-btn" class="wfm-btn wfm-btn-sm" disabled title="Select a card first">Send to Canvas</button>
|
||||
@@ -2775,6 +2781,11 @@
|
||||
<div class="wfm-video-asset-list-col">
|
||||
<div class="wfm-video-asset-toolbar">
|
||||
<select id="wfm-video-asset-group" class="wfm-input" style="flex:1;"></select>
|
||||
<select id="wfm-video-asset-kind" class="wfm-input" style="flex:0.5;">
|
||||
<option value="all">All Types</option>
|
||||
<option value="video">Video Only</option>
|
||||
<option value="image">Image Only</option>
|
||||
</select>
|
||||
<input type="text" id="wfm-video-asset-search" class="wfm-input" placeholder="Search filename..." style="flex:1;">
|
||||
<button type="button" id="wfm-video-asset-view-grid" class="wfm-btn wfm-btn-sm wfm-video-asset-view-btn active" title="Thumbnail view">▦</button>
|
||||
<button type="button" id="wfm-video-asset-view-table" class="wfm-btn wfm-btn-sm wfm-video-asset-view-btn" title="Table view">☰</button>
|
||||
@@ -2940,7 +2951,14 @@
|
||||
<div class="wfm-video-edit-trim-panel" id="wfm-video-edit-trim-panel"></div>
|
||||
|
||||
<div class="wfm-video-edit-export-panel">
|
||||
<button type="button" id="wfm-video-edit-export-btn" class="wfm-btn wfm-btn-primary" style="width:100%;">Export</button>
|
||||
<div id="wfm-video-edit-project-name" class="wfm-i2i-status" style="min-height:14px;margin-bottom:4px;"></div>
|
||||
<div style="display:flex;gap:6px;">
|
||||
<button type="button" id="wfm-video-edit-save-btn" class="wfm-btn wfm-btn-sm" style="flex:1;">Save</button>
|
||||
<button type="button" id="wfm-video-edit-saveas-btn" class="wfm-btn wfm-btn-sm" style="flex:1;">Save As</button>
|
||||
<button type="button" id="wfm-video-edit-load-btn" class="wfm-btn wfm-btn-sm" style="flex:1;">Load</button>
|
||||
</div>
|
||||
<input type="file" id="wfm-video-edit-load-file-input" accept="application/json,.json" style="display:none;">
|
||||
<button type="button" id="wfm-video-edit-export-btn" class="wfm-btn wfm-btn-primary" style="width:100%;margin-top:8px;">Export</button>
|
||||
<div class="wfm-gen-progress-container" style="margin-top:8px;">
|
||||
<div class="wfm-gen-progress-track">
|
||||
<div id="wfm-video-edit-progress-bar" class="wfm-gen-progress-bar"></div>
|
||||
|
||||
Reference in New Issue
Block a user