Compare commits

...
1 Commits
Author SHA1 Message Date
ketle-manandClaude Sonnet 4.6 8d48c2276f v0.3.0: Cross-type group filter & sidebar group display fix
- models-tab.js: group filter dropdown now shows groups from all model
  types with [TypeLabel] prefix; selecting a group auto-switches type
- node_sets_menu.js: fix TypeError in renderModelGroups caused by v0.2.9
  per-type group format; add type label badge to each group header

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
2026-04-18 14:23:50 +09:00
4 changed files with 122 additions and 27 deletions
+29
View File
@@ -1,5 +1,34 @@
# DEVLOG - ComfyUI-Workflow-Studio
## 2026-04-18: v0.3.0 モデルグループ表示改善(全タイプ横断・サイドパネル修正)
### 概要
- モデルタブのグループフィルタードロップダウンを全タイプ横断表示に改善
- ComfyUIサイドパネルのModel Groupsビューを v0.2.9 のタイプ別形式に対応させバグ修正
### 変更内容
#### `static/js/models-tab.js` — グループフィルター全タイプ横断表示
- `state.allModelGroups` 追加 — 全タイプのグループを `{ type: { groupName: [models] } }` 形式で保持
- `fetchAllModelGroups()` 追加 — `type` パラメータなしで全タイプのグループをAPIから一括取得
- `renderGroupFilter()` 改善 — ドロップダウンオプションを `[Checkpoint] GroupName` / `[LoRA] GroupName` 形式で全タイプ分表示。値は `type::groupName` としてエンコード
- グループフィルター `change` ハンドラ更新 — 選択したグループが現在と異なるタイプの場合、モデルタイプタブを自動切り替えしてモデルを再ロード
- `saveModelGroups()` — 保存時に `state.allModelGroups[type]` も更新
- `loadModelsForCurrentType()` — ロード時に `state.allModelGroups[type]` を同期
- `loadMetadataAndModels()` — 初回ロード時に `fetchAllModelGroups()` で全タイプのグループを一括取得
#### `web/comfyui/node_sets_menu.js` — サイドパネルのModel Groupsビュー修正
- `renderModelGroups()` を新タイプ別形式 `{ type: { groupName: [...] } }` に対応
- 旧: `groups[groupName]` が配列を期待 → `TypeError: .filter is not a function` でクラッシュ
- 新: `flatGroups = [{modelType, groupName, members}]` にフラット展開してから描画
- グループヘッダーに `[Checkpoint]` / `[LoRA]` 等のタイプラベルを追加(`wfm-nlp-model-type-badge`クラス)
- `typeOf[name] || modelType` — モデルリスト未取得時のフォールバックをグループのモデルタイプに変更
---
## 2026-04-18: v0.2.9 モデル有効/無効・複数選択・一括削除
### 概要
+5 -1
View File
@@ -5,7 +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.
![Workflow Studio](https://img.shields.io/badge/ComfyUI-Custom_Node-blue)
![Version](https://img.shields.io/badge/version-0.2.9-green)
![Version](https://img.shields.io/badge/version-0.3.0-green)
## Screenshots
@@ -210,6 +210,10 @@ Click the **camera icon** (next to the W button) in ComfyUI's top bar to capture
## Changelog
### v0.3.0
- **Cross-type group filter** — the group filter dropdown in the Models tab now shows groups from all model types simultaneously, each prefixed with a type label (`[Checkpoint]`, `[LoRA]`, etc.); selecting a group automatically switches to the corresponding model type
- **Sidebar group display fixed** — the ComfyUI sidebar "Model Groups" view now correctly renders per-type groups (introduced in v0.2.9) with a type label on each group header; fixes a crash where `.filter is not a function` was thrown on the new nested group structure
### v0.2.9
- **Model Enable/Disable** — hide models from ComfyUI by renaming the file extension to `.disabled`; toggle per model (⏸ button on each card/row), per group (Enable All / Disable All buttons in the Group panel), or filter the grid by status (All / Enabled only / Disabled only). Changes take effect after ComfyUI refresh.
- **Per-type model groups** — groups are now scoped to each model type; checkpoint groups only appear in the Checkpoint tab, LoRA groups only in the LoRA tab, etc. Existing flat groups are automatically migrated.
+67 -8
View File
@@ -23,6 +23,7 @@ const state = {
},
modelMetadata: {},
modelGroups: {},
allModelGroups: {}, // { type: { groupName: [models] } } — all types
civitaiCache: {},
disabledModels: {}, // { type: Set<modelName> }
selectMode: false,
@@ -657,11 +658,31 @@ function renderTagFilter() {
function renderGroupFilter() {
const select = document.getElementById("wfm-models-group-filter");
if (!select) return;
const groups = Object.keys(state.modelGroups).sort();
// Collect groups across all types with type labels
const options = [];
const typeOrder = Object.keys(TYPE_LABELS);
typeOrder.forEach((type) => {
const groups = state.allModelGroups[type];
if (!groups) return;
const names = Object.keys(groups).sort();
names.forEach((g) => {
options.push({ type, name: g });
});
});
const currentValue = state.groupFilter
? `${state.activeModelType}::${state.groupFilter}`
: "";
select.innerHTML =
`<option value="">${t("modelsAllGroups")}</option>` +
groups.map((g) => `<option value="${escapeHtml(g)}">${escapeHtml(g)}</option>`).join("");
select.value = state.groupFilter;
options.map(({ type, name }) => {
const typeLabel = TYPE_LABELS[type] || type;
const value = `${type}::${name}`;
const isActive = value === currentValue;
return `<option value="${escapeHtml(value)}"${isActive ? " selected" : ""}>[${typeLabel}] ${escapeHtml(name)}</option>`;
}).join("");
}
function renderDirFilter() {
@@ -685,8 +706,16 @@ async function fetchModelGroups() {
} catch { return {}; }
}
async function fetchAllModelGroups() {
try {
const res = await fetch("/api/wfm/models/groups");
return res.ok ? await res.json() : {};
} catch { return {}; }
}
async function saveModelGroups(groups) {
state.modelGroups = groups;
state.allModelGroups[state.activeModelType] = groups;
await fetch("/api/wfm/models/groups", {
method: "POST",
headers: { "Content-Type": "application/json" },
@@ -1501,6 +1530,7 @@ async function loadModelsForCurrentType() {
if (state.loaded[type] && state.modelsByType[type].length > 0) {
// Reload groups for this type (groups are per-type)
state.modelGroups = await fetchModelGroups();
state.allModelGroups[type] = state.modelGroups;
renderTagFilter();
renderDirFilter();
renderGroupFilter();
@@ -1520,6 +1550,7 @@ async function loadModelsForCurrentType() {
const disabledSet = new Set(Array.isArray(disabledList) ? disabledList : []);
state.disabledModels[type] = disabledSet;
state.modelGroups = groups;
state.allModelGroups[type] = groups;
// Merge enabled + disabled into one list (dedup)
// Guard: ensure models is an array (ComfyUI may return non-array on edge cases)
@@ -1628,11 +1659,12 @@ async function batchFetchCivitai() {
}
async function loadMetadataAndModels() {
const [metadata, civitaiCache] = await Promise.all([
fetchModelMetadata(), fetchCivitaiCache()
const [metadata, civitaiCache, allGroups] = await Promise.all([
fetchModelMetadata(), fetchCivitaiCache(), fetchAllModelGroups()
]);
state.modelMetadata = metadata;
state.civitaiCache = civitaiCache;
state.allModelGroups = allGroups;
// groups are loaded per-type inside loadModelsForCurrentType
await loadModelsForCurrentType();
}
@@ -1697,9 +1729,36 @@ export function initModelsTab() {
renderModelGrid();
});
// Group filter
document.getElementById("wfm-models-group-filter")?.addEventListener("change", (e) => {
state.groupFilter = e.target.value;
// Group filter — value is "type::groupName" or "" for all
document.getElementById("wfm-models-group-filter")?.addEventListener("change", async (e) => {
const value = e.target.value;
if (!value) {
state.groupFilter = "";
} else {
const sepIdx = value.indexOf("::");
const type = value.substring(0, sepIdx);
const groupName = value.substring(sepIdx + 2);
// Auto-switch model type if different
if (type !== state.activeModelType) {
document.querySelectorAll(".wfm-models-type-btn").forEach((b) => {
b.classList.toggle("active", b.dataset.modelType === type);
});
state.activeModelType = type;
state.searchText = "";
state.tagFilter = "";
state.badgeFilter = "";
state.dirFilter = "";
state.statusFilter = "all";
state.selectedModel = null;
const statusFilter = document.getElementById("wfm-models-status-filter");
if (statusFilter) statusFilter.value = "all";
const searchInput = document.getElementById("wfm-models-search");
if (searchInput) searchInput.value = "";
closeSidePanel();
await loadModelsForCurrentType();
}
state.groupFilter = groupName;
}
state.currentPage = 0;
renderModelGrid();
});
+21 -18
View File
@@ -1324,10 +1324,21 @@ const renderModelFavorites = async (container) => {
const renderModelGroups = async (container) => {
container.innerHTML = `<div class="wfm-nlp-empty">Loading...</div>`;
const groups = state.modelGroups;
const groupNames = Object.keys(groups);
// allGroups is { type: { groupName: [modelName, ...] } }
const allGroups = state.modelGroups;
if (groupNames.length === 0) {
// Flatten into [{ modelType, groupName, members }]
const flatGroups = [];
for (const [modelType, groups] of Object.entries(allGroups)) {
if (typeof groups !== "object" || Array.isArray(groups)) continue;
for (const [groupName, members] of Object.entries(groups)) {
if (Array.isArray(members) && members.length > 0) {
flatGroups.push({ modelType, groupName, members });
}
}
}
if (flatGroups.length === 0) {
container.innerHTML = `<div class="wfm-nlp-empty">No groups found.</div>`;
return;
}
@@ -1347,18 +1358,18 @@ const renderModelGroups = async (container) => {
container.innerHTML = "";
let hasAny = false;
for (const groupName of groupNames) {
const members = (groups[groupName] || []).filter(name => matchesModelSearch(name));
if (state.searchText && members.length === 0) continue;
if ((groups[groupName] || []).length === 0) continue;
for (const { modelType, groupName, members } of flatGroups) {
const filtered = members.filter(name => matchesModelSearch(name));
if (state.searchText && filtered.length === 0) continue;
hasAny = true;
const section = document.createElement("div");
section.className = "wfm-nlp-group-section";
const typeLabel = MODEL_TYPE_LABELS[modelType] || modelType;
const header = document.createElement("div");
header.className = "wfm-nlp-group-header collapsed";
header.innerHTML = `<span>${esc(groupName)}</span> <span class="wfm-nlp-badge">${members.length}</span>`;
header.innerHTML = `<span class="wfm-nlp-model-type-badge">[${esc(typeLabel)}]</span> <span>${esc(groupName)}</span> <span class="wfm-nlp-badge">${filtered.length}</span>`;
header.addEventListener("click", () => {
const listEl = section.querySelector(".wfm-nlp-group-list");
listEl.style.display = listEl.style.display === "none" ? "block" : "none";
@@ -1369,17 +1380,9 @@ const renderModelGroups = async (container) => {
const listEl = document.createElement("div");
listEl.className = "wfm-nlp-group-list";
listEl.style.display = "none";
for (const name of members) {
const type = typeOf[name] || "checkpoint";
for (const name of filtered) {
const type = typeOf[name] || modelType;
const item = createModelItem(name, type);
const typeLabel = MODEL_TYPE_LABELS[type] || type;
const typeBadgeEl = item.querySelector(".wfm-nlp-item-body");
if (typeBadgeEl) {
const tb = document.createElement("span");
tb.className = "wfm-nlp-model-type-badge";
tb.textContent = typeLabel;
typeBadgeEl.prepend(tb);
}
listEl.appendChild(item);
}
section.appendChild(listEl);