Compare commits

...
4 Commits
Author SHA1 Message Date
ketle-manandClaude Sonnet 4.6 c3bee0ee09 docs: ギャラリータブの画像ダウンロード・エクスポート機能のドキュメント更新
- README.md: Gallery Tabセクションに機能説明を追加
- DEVLOG.md: v0.3.48エントリを追加(新機能の実装詳細)
- templates/index.html: ヘルプテキストを更新(wfm-help-gallery-6, -7)

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
2026-06-22 10:57:11 +09:00
ketle-manandClaude Sonnet 4.6 3dc593da4e feat: ギャラリータブに画像ダウンロードと一括エクスポート機能を追加
- 詳細パネルのプレビュー画像にマウスホバーでダウンロードアイコンをオーバーレイ表示
- 詳細パネルから単一画像をダウンロード可能に
- 複数選択メニューに「エクスポート」ボタンを追加
- 複数選択した画像をZIPファイルにしてエクスポート
- Backend: POST /wfm/gallery/images/export-zip エンドポイント実装
- Frontend: ダウンロード・ZIPエクスポート機能実装
- i18n対応: 英語/日本語/中国語

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
2026-06-22 10:36:09 +09:00
ketle-manandClaude Sonnet 4.6 aa8c8f73fe fix: update JS group state after model file move (v0.3.47)
When models were moved to a subdirectory via bulkMoveModels, state.modelGroups
was not updated to reflect the new model paths, causing moved models to
disappear from group filter views immediately after the operation.

Added in-place rename of group members (from → to) inside the moved.forEach
loop, mirroring the server-side rename already performed by move_models in
models_service.py. Generate tab Batch groups are unaffected as they fetch
fresh from the server on each tab open.

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
2026-06-22 08:34:59 +09:00
ketle-manandClaude Sonnet 4.6 281fba373c feat: Prompt tab AI Assistant LM Studio support + Settings AI Assistant section (v0.3.46)
- Settings tab: rename "Ollama Settings" to "AI Assistant Settings (Prompt Tab)";
  add backend selector (Ollama / LM Studio), URL input, model select, Test button;
  save to localStorage wfm_prompt_ai_settings (independent of AI TOOL tab)
- Prompt tab: replace Python proxy (/api/wfm/ollama/*) with direct browser-to-backend
  calls; supports Ollama (/api/chat) and LM Studio (/v1/chat/completions);
  image attachments auto-converted to correct format per backend
- Auto-refresh model list when backend changes: sendMessage() detects mismatch
  between current backend setting and what was used to populate the dropdown,
  then re-fetches before sending to avoid stale model name errors
- i18n (EN/JA/ZH): ollamaSettings, ollamaUrl, saveOllama, ollamaSaved,
  helpPrompt1, helpSettings5, helpTrouble2 updated for dual-backend support

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
2026-06-21 18:17:12 +09:00
11 changed files with 476 additions and 121 deletions
+95
View File
@@ -1,5 +1,100 @@
# DEVLOG - ComfyUI-Workflow-Studio
## 2026-06-22: v0.3.48 — ギャラリータブ 画像ダウンロード・一括エクスポート機能追加
**変更ファイル**: `templates/index.html`, `static/js/gallery-tab.js`, `static/css/gallery-tab.css`, `py/routes/gallery_routes.py`, `static/js/i18n.js`
### 詳細パネルの画像プレビューにダウンロード機能を追加
- プレビュー画像にマウスホバーでダウンロードアイコン(⬇)をオーバーレイ表示
- クリックで単一画像をダウンロード(ファイル名はオリジナルを保持)
- CSS: `.wfm-gallery-preview-wrapper`, `.wfm-gallery-preview-overlay`, `.wfm-gallery-download-btn` を追加
### 複数選択バーに「エクスポート」ボタンを追加
- 複数選択した画像をZIPファイルにしてダウンロード可能
- ファイル名: `gallery_export_<タイムスタンプ>.zip`
- Backend: `POST /wfm/gallery/images/export-zip` エンドポイント実装
- リクエスト: `{ "paths": [...] }` (画像パスリスト)
- レスポンス: ZIP ファイルをバイナリで返送
- セキュリティ: `_check_path_allowed()` でパストラバーサル防止
### i18n対応
- 英語: "Export" / "Download started" / "Export completed. ZIP file is downloading."
- 日本語: "エクスポート" / "ダウンロード開始" / "エクスポート完了。ZIPファイルをダウンロード中です。"
- 中国語: "导出" / "下载开始" / "导出完成。正在下载 ZIP 文件。"
### ヘルプテキスト更新
- ヘルプ wfm-help-gallery-6: 複数選択バー説明に "Export" を追加
- ヘルプ wfm-help-gallery-7: 詳細パネル説明にダウンロードアイコンについての記述を追加
---
## 2026-06-22: v0.3.47 — モデルタブ ファイル移動後グループ状態修正
**変更ファイル**: `static/js/models-tab.js`
### モデル移動後のグループ状態不整合を修正
`bulkMoveModels` でモデルをサブディレクトリ間移動した際、Python側(`move_models`)はグループメンバーの名前を `from → to` に更新していたが、JS の `state.modelGroups` が更新されていなかった。
このため移動直後にグループフィルターで絞り込むと、移動したモデルが消えてしまう(旧名で参照されるため一致しなくなる)問題があった。
- `data.moved.forEach` ループ内で `state.modelGroups` の各グループメンバーを `from → to` でリネーム
- サーバーが `_groups` を更新する処理と対称的なクライアント側更新
- `state.modelGroups` と `state.allModelGroups[type]` は同一オブジェクト参照のためインプレース更新で両方に反映される
- Generate タブ Batch の `_batchGroupState.groups` はサーバーから毎回取得するため影響なし
---
## 2026-06-21: v0.3.46 — プロンプトタブ AI Assistant LM Studio対応・設定タブ AI Assistant設定に変更
**変更ファイル**: `static/js/settings-tab.js`, `static/js/prompt-tab.js`, `static/js/i18n.js`, `templates/index.html`
### 設定タブ「AI Assistant設定(プロンプトタブ)」
設定タブの「Ollama設定(プロンプトタブ)」セクションを AI TOOL タブの SETTINGS ペインと同等の内容に変更。
- セクション名を **「AI Assistant設定(プロンプトタブ)」** に変更
- **バックエンド選択ラジオ(Ollama / LM Studio)** を追加
- **API URL 入力** — バックエンド切替時にプレースホルダーが自動変更(Ollama: `http://localhost:11434`、LM Studio: `http://localhost:1234`)
- **モデル選択 + Refresh** — 選択中のバックエンドへ直接接続してモデル一覧を取得
- **Test ボタン** — バックエンドへ直接接続テスト
- **Save ボタン** — 設定を localStorage `wfm_prompt_ai_settings` に保存(サーバーAPI不要)
- AI TOOL タブの設定(`wfm_ai_settings`)とは独立した設定キーを使用
### プロンプトタブ AI Assistant LM Studio対応
Python プロキシルート(`/api/wfm/ollama/*`)依存を廃止し、AI TOOL タブと同方式のブラウザから直接バックエンドAPIを呼び出す実装に変更。
- Ollama: `{url}/api/tags`(モデル一覧)、`{url}/api/chat`(チャット)
- LM Studio: `{url}/v1/models`(モデル一覧)、`{url}/v1/chat/completions`(チャット)
- 画像添付(ビジョンモデル)も両バックエンド対応 — Ollama形式(`images`フィールド)を LM Studio形式(`content`配列の`image_url`)に自動変換
- 設定タブで保存したモデルを初期選択として表示
- ウェルカムメッセージの "AI Assistant (Ollama)" 表記を削除
### バックエンド変更時の自動モデル再取得
設定タブでバックエンドを変更した後にプロンプトタブですぐ送信しようとすると、ドロップダウンに旧バックエンドのモデル名が残ったまま送信されモデル未認識エラーが発生する問題を修正。
- `_promptAiBackendForModels` 変数にモデル一覧取得時のバックエンドを記録
- `sendMessage()` の冒頭で現在設定と比較し、バックエンドが変わっていた場合は自動でモデル一覧をリフレッシュしてから送信
- モデル一覧表示に `[ollama]` / `[lmstudio]` のバックエンド名を付記
### i18n 更新(EN/JA/ZH)
- `ollamaSettings` → "AI Assistant Settings (Prompt Tab)"
- `ollamaUrl` → "API URL"(汎用)
- `saveOllama` → "Save AI Assistant Settings"
- `ollamaSaved` → "AI Assistant settings saved"
- `helpPrompt1` — "Ollama" → "Ollama / LM Studio"・設定場所の説明を追記
- `helpSettings5` — バックエンド選択・URL・モデル・接続テストの説明に更新
- `helpTrouble2` — "Ollamaに接続できない" → "AIアシスタントに接続できない(Ollama/LM Studio両対応)"
---
## 2026-06-21: v0.3.45 — グループ孤立エントリ自動クリーンアップ・Galleryタブ Shift+クリック範囲選択
**変更ファイル**: `py/services/models_service.py`, `py/services/gallery_service.py`, `py/services/gallery_metadata.py`, `static/js/gallery-tab.js`, `static/js/i18n.js`
+13 -3
View File
@@ -18,7 +18,7 @@ A comprehensive workflow, asset management, and generation UI plugin for [ComfyU
- Built-in AI tools (translation and more)
![Workflow Studio](https://img.shields.io/badge/ComfyUI-Custom_Node-blue)
![Version](https://img.shields.io/badge/version-0.3.45-green)
![Version](https://img.shields.io/badge/version-0.3.47-green)
## Screenshots
@@ -151,8 +151,9 @@ Two independent modes selectable via **[Image Loop] / [Gallery]** toggle buttons
- **Image browser** — browse ComfyUI output images (Thumbnail / Table views) with server-side scanning optimized for 6,000+ image libraries
- **Thumbnail / Table views** — switch view modes; Favorites column shown leftmost in Table view
- **Folder management** — create subfolders ("+ New") or delete the selected folder with all contents ("Del") from the folder tree header
- **File operations** — move or delete individual images from the detail panel's Info tab; bulk Move To... and Delete File from the multi-select bar
- **Multi-select** — Ctrl+click to select multiple images; Bulk Bar appears for batch operations: select group → "Add to Group" / "Remove from Group"; Favorite All / Unfavorite All; Compare (2–4 images); Move To...; Delete File
- **File operations** — move or delete individual images from the detail panel's Info tab; bulk Move To..., Export, and Delete File from the multi-select bar
- **Download** — hover over the image preview in the detail panel to reveal a download icon (⬇); click to download the single image
- **Multi-select** — Ctrl+click to select multiple images; Bulk Bar appears for batch operations: select group → "Add to Group" / "Remove from Group"; Favorite All / Unfavorite All; Compare (2–4 images); Move To...; **Export** (downloads all selected images as a ZIP file); Delete File
- **Image Compare** — select 2–4 images with Ctrl+click, then click "Compare" in the Bulk Bar to open a side-by-side lightbox; grid adapts to the number of selected images
- **Prompt search** — text search covers filename, tags, memo, and prompt text (A1111 `parameters` field cached on first detail panel open)
- **Server-side filtering** — filter by group, favorites, or tags with fast server-side set lookup (no full rescan)
@@ -333,6 +334,15 @@ Click the **camera icon** (next to the W button) in ComfyUI's top bar to capture
## Changelog
### v0.3.47
- **Models tab — fix stale group state after file move** — when models were moved to a subdirectory via "Move To...", `state.modelGroups` in the JS client was not updated to reflect the new model paths; the group filter view would lose the moved models immediately after the operation. Now the client-side group membership is updated in sync with the server-side rename (mirrors the existing Python `move_models` logic). Generate tab Batch groups are unaffected as they always fetch fresh from the server.
### v0.3.46
- **Prompt tab AI Assistant — LM Studio support** — switched from Python proxy (`/api/wfm/ollama/*`) to direct browser-to-backend API calls (same pattern as the AI TOOL tab); supports Ollama (`/api/chat`) and LM Studio (`/v1/chat/completions`); image attachments are automatically converted to the correct format per backend
- **Settings tab — AI Assistant Settings (Prompt Tab)** — renamed from "Ollama Settings"; added backend selector (Ollama / LM Studio), URL input with per-backend placeholder, model select with Refresh, and Test button; settings saved to localStorage `wfm_prompt_ai_settings` (independent of AI TOOL tab settings)
- **Auto-refresh on backend change** — if the backend is switched in Settings tab while Prompt tab is already open, `sendMessage()` now detects the mismatch and automatically re-fetches the model list before sending; model status shows the active backend name (`[ollama]` / `[lmstudio]`)
- **Help text updated** (EN/JA/ZH) — Prompt tab, Settings tab, and Troubleshooting sections updated to reflect Ollama / LM Studio dual-backend support
### v0.3.45
- **Group auto-cleanup — Models tab** — stale group entries (models that no longer exist on disk) are automatically removed when the Models tab is loaded or the model type is switched; models moved within the app via "Move To..." also update their group membership immediately
- **Group auto-cleanup — Gallery tab (folder view)** — metadata entries for missing files are cleaned up each time a folder is scanned (`list_images`), synchronized with the 60s TTL + folder-mtime cache
+35
View File
@@ -70,6 +70,7 @@ def setup_routes(app: web.Application):
app.router.add_delete("/wfm/gallery/folder", delete_folder_route)
app.router.add_post("/wfm/gallery/images/delete", delete_images_route)
app.router.add_post("/wfm/gallery/images/move", move_images_route)
app.router.add_post("/wfm/gallery/images/export-zip", export_images_zip)
# ──────────────────────────────────────────────────────────────
@@ -408,3 +409,37 @@ async def move_images_route(request: web.Request) -> web.Response:
return web.json_response(result)
except Exception as e:
return web.json_response({"moved": [], "errors": [str(e)]}, status=500)
async def export_images_zip(request: web.Request) -> web.Response:
"""POST /wfm/gallery/images/export-zip - 複数画像をZIPファイルにしてダウンロード"""
import zipfile
import io
try:
body = await request.json()
paths = body.get("paths", [])
if not paths:
return web.json_response({"error": "paths required"}, status=400)
# ZIPファイルをメモリ上に作成
zip_buffer = io.BytesIO()
with zipfile.ZipFile(zip_buffer, "w", zipfile.ZIP_DEFLATED) as zf:
for path in paths:
file_path = Path(path)
# セキュリティ: 許可されたディレクトリ内のみ
if not _service._check_path_allowed(file_path):
continue
if file_path.exists() and file_path.is_file():
# ファイル名のみをアーカイブに入れる(パス情報は含めない)
zf.write(file_path, arcname=file_path.name)
zip_buffer.seek(0)
return web.Response(
body=zip_buffer.getvalue(),
content_type="application/zip",
headers={"Content-Disposition": "attachment; filename=gallery_export.zip"}
)
except Exception as e:
logger.error("Error exporting images to ZIP: %s", e)
return web.json_response({"error": str(e)}, status=500)
+1 -1
View File
@@ -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.3.44"
version = "0.3.47"
license = "MIT"
requires-python = ">= 3.10"
dependencies = ["jinja2"]
+46
View File
@@ -415,6 +415,15 @@
flex-shrink: 0;
}
.wfm-gallery-preview-wrapper {
position: relative;
width: 100%;
height: 100%;
display: flex;
align-items: center;
justify-content: center;
}
.wfm-gallery-detail-img {
max-width: 100%;
max-height: 200px;
@@ -422,6 +431,43 @@
cursor: pointer;
}
.wfm-gallery-preview-overlay {
position: absolute;
top: 0;
left: 0;
right: 0;
bottom: 0;
background: rgba(0,0,0,0.5);
display: flex;
align-items: center;
justify-content: center;
opacity: 0;
transition: opacity 0.2s;
}
.wfm-gallery-preview-wrapper:hover .wfm-gallery-preview-overlay {
opacity: 1;
}
.wfm-gallery-download-btn {
background: var(--wfm-accent, #4f8ef7);
border: none;
border-radius: 50%;
width: 40px;
height: 40px;
font-size: 20px;
cursor: pointer;
display: flex;
align-items: center;
justify-content: center;
color: #fff;
transition: background 0.2s;
}
.wfm-gallery-download-btn:hover {
background: var(--wfm-accent-hover, #3f7fe7);
}
/* タブコンテンツ */
.wfm-gallery-detail-tab-content {
flex: 1;
+58 -1
View File
@@ -36,6 +36,7 @@ const API = {
folderDelete: `/wfm/gallery/folder`,
imagesDelete: `/wfm/gallery/images/delete`,
imagesMove: `/wfm/gallery/images/move`,
imagesExportZip: `/wfm/gallery/images/export-zip`,
};
export const FEEDER_GROUP = "__Feeder__";
@@ -95,6 +96,49 @@ async function openImageInMetadataTab(img) {
}
}
async function downloadImage(img) {
try {
const res = await fetch(API.serveImage(img.path));
if (!res.ok) throw new Error(`HTTP ${res.status}`);
const blob = await res.blob();
const url = URL.createObjectURL(blob);
const a = document.createElement("a");
a.href = url;
a.download = img.filename;
document.body.appendChild(a);
a.click();
document.body.removeChild(a);
URL.revokeObjectURL(url);
showToast(t("downloadStarted"), "success");
} catch (e) {
showToast(t("errorWithMsg", e.message), "error");
}
}
async function exportSelectedImagesToZip(paths) {
if (paths.length === 0) return;
try {
const res = await fetch(API.imagesExportZip, {
method: "POST",
headers: { "Content-Type": "application/json" },
body: JSON.stringify({ paths }),
});
if (!res.ok) throw new Error(`HTTP ${res.status}`);
const blob = await res.blob();
const url = URL.createObjectURL(blob);
const a = document.createElement("a");
a.href = url;
a.download = `gallery_export_${Date.now()}.zip`;
document.body.appendChild(a);
a.click();
document.body.removeChild(a);
URL.revokeObjectURL(url);
showToast(t("exportCompleted"), "success");
} catch (e) {
showToast(t("errorWithMsg", e.message), "error");
}
}
// ── フォルダツリー ────────────────────────────────────────────
function _getExpandedPaths() {
@@ -666,8 +710,16 @@ async function loadImageDetail(img) {
// プレビュー
const preview = document.getElementById("wfm-gallery-detail-preview");
preview.innerHTML = `<img src="${API.serveImage(img.path)}" class="wfm-gallery-detail-img" alt="${escapeHtml(img.filename)}" title="Double-click to enlarge">`;
preview.innerHTML = `
<div class="wfm-gallery-preview-wrapper">
<img src="${API.serveImage(img.path)}" class="wfm-gallery-detail-img" alt="${escapeHtml(img.filename)}" title="Double-click to enlarge">
<div class="wfm-gallery-preview-overlay">
<button class="wfm-gallery-download-btn" title="Download image">⬇</button>
</div>
</div>
`;
preview.querySelector("img").addEventListener("dblclick", () => openLightbox(img));
preview.querySelector(".wfm-gallery-download-btn").addEventListener("click", () => downloadImage(img));
// ファイル名
document.getElementById("wfm-gallery-detail-filename").textContent = img.filename;
@@ -1555,6 +1607,11 @@ function bindEvents() {
openMoveModal([...state.selectedImages]);
});
document.getElementById("wfm-gallery-bulk-export")?.addEventListener("click", () => {
if (state.selectedImages.size === 0) return;
exportSelectedImagesToZip([...state.selectedImages]);
});
document.getElementById("wfm-gallery-bulk-delete")?.addEventListener("click", () => {
if (state.selectedImages.size === 0) return;
const count = state.selectedImages.size;
+30 -21
View File
@@ -478,7 +478,10 @@ const LANGUAGES = {
galleryBulkUnfavAll: "☆ Unfavorite All",
galleryBulkCompare: "Compare",
galleryBulkMoveTo: "Move To...",
galleryBulkExport: "Export",
galleryBulkDelete: "Delete File",
downloadStarted: "Download started",
exportCompleted: "Export completed. ZIP file is downloading.",
tabAi: "AI TOOL",
tabTagger: "Tagger",
@@ -632,7 +635,7 @@ const LANGUAGES = {
helpFeederGal5: "__Feeder__ group: reserved group pre-created automatically; cannot be renamed or deleted; add images to it from the Gallery tab using the F overlay button on each thumbnail",
helpFeederGal6: "WFS_GalleryFeeder canvas controls: the node also has Run / Stop / After Gen widgets added directly on the ComfyUI canvas — these work the same as the WFM UI controls and allow running the gallery feeder loop without opening WFM",
helpSearchPlaceholder: "Search help...",
helpPrompt1: "AI assistant (Ollama): model selection, chat for prompt consultation, image attachment (vision models)",
helpPrompt1: "AI assistant (Ollama / LM Studio): model selection, chat for prompt consultation, image attachment (vision models); backend and URL configured in Settings tab",
helpPrompt2: "Apply AI responses to GenerateUI prompts",
helpPrompt3: "Translation: JA\u2194EN, ZH\u2194EN",
helpPrompt4: "Preset management: create, edit, positive/negative prompt clipboard copy (PP/NP)",
@@ -645,7 +648,7 @@ const LANGUAGES = {
helpSettings2: "Theme selection (13 presets) with customization: color overrides, background patterns (stripes, polka dot, checkerboard, SVG tiling), and font selection (16 Google Fonts including Japanese display fonts)",
helpSettings3: "Workflow data folder path",
helpSettings4: "ComfyUI connection URL and test",
helpSettings5: "Ollama URL, default model, and connection test",
helpSettings5: "AI Assistant (Prompt Tab): backend (Ollama / LM Studio), API URL, default model, and connection test",
helpSettings6: "Default workflow setting",
helpSettings7: "Eagle integration URL and auto-save toggle",
helpSettings8: "Data Management: export all plugin data (settings, metadata, prompts, etc.) to a JSON file, or import to restore. After importing, restart ComfyUI.",
@@ -732,7 +735,7 @@ const LANGUAGES = {
helpShortcuts4: "Double-click: Open detail modal",
helpTroubleTitle: "Troubleshooting",
helpTrouble1: "Cannot connect to ComfyUI: Check if ComfyUI can generate images, verify URL in Settings, try refreshing or restarting",
helpTrouble2: "Cannot connect to Ollama: Use connection test button, check if Ollama is running and models are downloaded",
helpTrouble2: "Cannot connect to AI assistant: Use the connection test button in Settings tab; for Ollama check it is running and models are downloaded; for LM Studio check the server is running and a model is loaded",
helpTrouble3: "Workflows not showing: Click refresh button, check if loadable in ComfyUI, try restarting browser/ComfyUI",
helpTrouble4: "Image generation fails: Check if specified models exist in ComfyUI, verify connection, try restarting",
helpTrouble5: "LoRA Stack fails with 'No such file or directory' error: The LoRA may not be recognized by comfyui-lora-manager (known issue). Try a different LoRA or check if the file appears in Lora Manager's own UI",
@@ -763,13 +766,13 @@ const LANGUAGES = {
comfyuiUrlHint: "When running as ComfyUI plugin, leave empty to use same origin. Only set if ComfyUI is on a different server.",
connectedCheck: "Connected \u2713",
failedConnect: "Failed to connect \u2717",
ollamaSettings: "Ollama Settings (Prompt Tab)",
ollamaUrl: "Ollama API URL",
ollamaSettings: "AI Assistant Settings (Prompt Tab)",
ollamaUrl: "API URL",
ollamaDefaultModel: "Default Model",
selectModel: "Select model...",
noModelsFound: "No models found",
failedLoadModels: "Failed to load models",
saveOllama: "Save Ollama Settings",
saveOllama: "Save AI Assistant Settings",
testConnection: "Test Connection",
ollamaConnected: "Connected \u2713",
ollamaFailed: "Failed",
@@ -791,7 +794,7 @@ const LANGUAGES = {
importError: "Import failed",
saveSettings: "Save Settings",
settingsSaved: "Settings saved",
ollamaSaved: "Ollama settings saved",
ollamaSaved: "AI Assistant settings saved",
// -- Theme --
themeLabel: "Theme",
themeDefault: "Deep Ocean Dark (Default)",
@@ -1353,7 +1356,10 @@ const LANGUAGES = {
galleryBulkUnfavAll: "☆ お気に入り解除(全件)",
galleryBulkCompare: "比較",
galleryBulkMoveTo: "移動先...",
galleryBulkExport: "エクスポート",
galleryBulkDelete: "ファイル削除",
downloadStarted: "ダウンロード開始",
exportCompleted: "エクスポート完了。ZIPファイルをダウンロード中です。",
tabAi: "AI TOOL",
tabTagger: "Tagger",
@@ -1507,7 +1513,7 @@ const LANGUAGES = {
helpFeederGal5: "__Feeder__ グループ:自動で作成される予約グループ;名前変更・削除不可;ギャラリータブの各サムネイル上の F ボタンでこのグループに画像を追加",
helpFeederGal6: "WFS_GalleryFeeder キャンバスコントロール:このノードには ComfyUI キャンバス上に直接 Run / Stop / After Gen ウィジェットが追加されており、WFM を開かずにギャラリーフィーダーループを実行できます",
helpSearchPlaceholder: "ヘルプを検索...",
helpPrompt1: "AIアシスタント(Ollama):モデル選択、チャットでプロンプト相談、画像添付(ビジョンモデル対応)",
helpPrompt1: "AIアシスタント(Ollama / LM Studio):モデル選択、チャットでプロンプト相談、画像添付(ビジョンモデル対応);バックエンドとURLは設定タブで設定",
helpPrompt2: "AIの応答をGenerateUIのプロンプトに適用",
helpPrompt3: "翻訳機能:日⇔英、中⇔英",
helpPrompt4: "プリセット管理:作成・編集、ポジティブ/ネガティブプロンプトのクリップボードコピー(PP/NP)",
@@ -1520,7 +1526,7 @@ const LANGUAGES = {
helpSettings2: "テーマ選択(13種プリセット)+カスタマイズ:カラー調整、背景パターン(ストライプ、ポルカドット、チェック、SVGタイリング)、フォント選択(日本語デザインフォント含む16種のGoogle Fonts)",
helpSettings3: "ワークフローデータフォルダのパス変更・リセット",
helpSettings4: "ComfyUI接続URL設定と接続テスト",
helpSettings5: "Ollama URL、デフォルトモデル、接続テスト",
helpSettings5: "AI Assistant(プロンプトタブ):バックエンド(Ollama / LM Studio)・API URL・デフォルトモデル・接続テスト",
helpSettings6: "デフォルトワークフローの設定・解除",
helpSettings7: "Eagle連携URL、自動保存の有効/無効",
helpSettings8: "データ管理:設定・メタデータ・プロンプトなど全データをJSONにエクスポート、またはインポートして復元。インポート後はComfyUIを再起動してください。",
@@ -1607,7 +1613,7 @@ const LANGUAGES = {
helpShortcuts4: "ダブルクリック:詳細モーダルを開く",
helpTroubleTitle: "トラブルシューティング",
helpTrouble1: "ComfyUIに接続できない:ComfyUIで画像生成できるか確認、設定タブでURL確認、ブラウザ更新・再起動",
helpTrouble2: "Ollamaに接続できない:接続テストボタンで確認、Ollamaの起動・モデルのダウンロードを確認",
helpTrouble2: "AIアシスタントに接続できない:設定タブの接続テストボタンで確認;Ollamaの場合は起動とモデルのダウンロードを確認;LM Studioの場合はサーバー起動とモデルのロードを確認",
helpTrouble3: "ワークフローが表示されない:更新ボタン押下、ComfyUIで読み込めるか確認、ブラウザ・ComfyUI再起動",
helpTrouble4: "画像生成が失敗する:指定モデルの存在確認、ComfyUI接続確認、再起動",
helpTrouble5: "LoRAスタック実行時に「No such file or directory」エラー:comfyui-lora-managerが該当LoRAを認識していない可能性があります(既知の問題)。別のLoRAを試すか、Lora Manager自体のUIで該当ファイルが表示されるか確認してください",
@@ -1638,13 +1644,13 @@ const LANGUAGES = {
comfyuiUrlHint: "ComfyUIプラグインとして動作する場合は空欄(同一オリジン推奨)。別サーバーの場合のみ設定してください。",
connectedCheck: "接続成功 \u2713",
failedConnect: "接続失敗 \u2717",
ollamaSettings: "Ollama 設定(プロンプトタブ)",
ollamaUrl: "Ollama API URL",
ollamaSettings: "AI Assistant設定(プロンプトタブ)",
ollamaUrl: "API URL",
ollamaDefaultModel: "デフォルトモデル",
selectModel: "モデルを選択...",
noModelsFound: "モデルが見つかりません",
failedLoadModels: "モデル一覧の取得に失敗",
saveOllama: "Ollama設定を保存",
saveOllama: "AI Assistant設定を保存",
testConnection: "接続テスト",
ollamaConnected: "接続成功 \u2713",
ollamaFailed: "失敗",
@@ -1666,7 +1672,7 @@ const LANGUAGES = {
importError: "インポート失敗",
saveSettings: "設定を保存",
settingsSaved: "設定を保存しました",
ollamaSaved: "Ollama設定を保存しました",
ollamaSaved: "AI Assistant設定を保存しました",
// -- Theme --
themeLabel: "テーマ",
themeDefault: "Deep Ocean Dark (デフォルト)",
@@ -2228,7 +2234,10 @@ const LANGUAGES = {
galleryBulkUnfavAll: "☆ 全部取消收藏",
galleryBulkCompare: "对比",
galleryBulkMoveTo: "移动到...",
galleryBulkExport: "导出",
galleryBulkDelete: "删除文件",
downloadStarted: "下载开始",
exportCompleted: "导出完成。正在下载 ZIP 文件。",
tabAi: "AI TOOL",
tabTagger: "Tagger",
@@ -2382,7 +2391,7 @@ const LANGUAGES = {
helpFeederGal5: "__Feeder__ 分组:自动预先创建的保留分组;不可重命名或删除;在图库标签页中点击每个缩略图上的 F 按钮可将图片添加到此分组",
helpFeederGal6: "WFS_GalleryFeeder 画布控件:该节点在 ComfyUI 画布上直接添加了 Run / Stop / After Gen 组件——与 WFM 界面中的控件功能相同,无需打开 WFM 即可运行图库供给循环",
helpSearchPlaceholder: "搜索帮助...",
helpPrompt1: "AI助手(Ollama):模型选择、聊天咨询提示词、图片附件(视觉模型)",
helpPrompt1: "AI助手(Ollama / LM Studio):模型选择、聊天咨询提示词、图片附件(视觉模型);后端和URL在设置标签页配置",
helpPrompt2: "将AI回复应用到生成UI的提示词",
helpPrompt3: "翻译功能:日\u2194英、中\u2194英",
helpPrompt4: "预设管理:创建、编辑、正面/负面提示词剪贴板复制(PP/NP)",
@@ -2395,7 +2404,7 @@ const LANGUAGES = {
helpSettings2: "主题选择(13种预设)+ 自定义:颜色调整、背景图案(条纹、波点、棋盘格、SVG平铺)、字体选择(含日文显示字体在内的16种Google Fonts)",
helpSettings3: "工作流数据文件夹路径更改/重置",
helpSettings4: "ComfyUI连接URL设置和测试",
helpSettings5: "Ollama URL、默认模型、连接测试",
helpSettings5: "AI助手(提示词标签页):后端(Ollama / LM Studio)、API URL、默认模型、连接测试",
helpSettings6: "默认工作流设置/取消",
helpSettings7: "Eagle集成URL、自动保存开关",
helpSettings8: "数据管理:将所有插件数据(设置、元数据、提示词等)导出为JSON文件,或导入以恢复。导入后请重启ComfyUI。",
@@ -2482,7 +2491,7 @@ const LANGUAGES = {
helpShortcuts4: "双击:打开详情弹窗",
helpTroubleTitle: "故障排除",
helpTrouble1: "无法连接ComfyUI:确认ComfyUI能否生成图片、在设置中验证URL、尝试刷新或重启",
helpTrouble2: "无法连接Ollama:使用连接测试按钮、确认Ollama运行中且已下载模型",
helpTrouble2: "无法连接AI助手:使用设置标签页的连接测试按钮;Ollama需确认已启动且模型已下载;LM Studio需确认服务器已启动且模型已加载",
helpTrouble3: "工作流不显示:点击刷新按钮、确认能在ComfyUI中加载、尝试重启浏览器/ComfyUI",
helpTrouble4: "图片生成失败:确认指定模型存在、验证ComfyUI连接、尝试重启",
helpTrouble5: "LoRA Stack出现「No such file or directory」错误:该LoRA可能未被comfyui-lora-manager识别(已知问题)。请尝试其他LoRA,或检查该文件是否显示在Lora Manager自身的界面中",
@@ -2513,13 +2522,13 @@ const LANGUAGES = {
comfyuiUrlHint: "作为ComfyUI插件运行时留空(推荐同源)。仅在不同服务器时设置。",
connectedCheck: "已连接 \u2713",
failedConnect: "连接失败 \u2717",
ollamaSettings: "Ollama 设置(提示词标签页)",
ollamaUrl: "Ollama API URL",
ollamaSettings: "AI助手设置(提示词标签页)",
ollamaUrl: "API URL",
ollamaDefaultModel: "默认模型",
selectModel: "选择模型...",
noModelsFound: "未找到模型",
failedLoadModels: "获取模型列表失败",
saveOllama: "保存Ollama设置",
saveOllama: "保存AI助手设置",
testConnection: "测试连接",
ollamaConnected: "已连接 \u2713",
ollamaFailed: "失败",
@@ -2541,7 +2550,7 @@ const LANGUAGES = {
importError: "导入失败",
saveSettings: "保存设置",
settingsSaved: "设置已保存",
ollamaSaved: "Ollama设置已保存",
ollamaSaved: "AI助手设置已保存",
// -- Theme --
themeLabel: "主题",
themeDefault: "Deep Ocean Dark (默认)",
+4
View File
@@ -556,6 +556,10 @@ async function bulkMoveModels(destSubdir) {
const ds = state.disabledModels[state.activeModelType];
if (ds && ds.has(from)) { ds.delete(from); ds.add(to); }
state.selectedModels.delete(from);
for (const members of Object.values(state.modelGroups)) {
const gi = members.indexOf(from);
if (gi !== -1) members[gi] = to;
}
});
if (state.selectedModel && data.moved.some((m) => m.from === state.selectedModel)) {
state.selectedModel = null;
+101 -49
View File
@@ -378,26 +378,70 @@ function renderPmGroups(container) {
}
// ============================================
// Ollama API helpers
// AI Assistant helpers (Ollama / LM Studio)
// ============================================
async function ollamaModels() {
const res = await fetch("/api/wfm/ollama/models");
return await res.json();
const PROMPT_AI_KEY = "wfm_prompt_ai_settings";
function loadPromptAiSettings() {
try { return JSON.parse(localStorage.getItem(PROMPT_AI_KEY) || "{}"); } catch { return {}; }
}
async function ollamaTest() {
const res = await fetch("/api/wfm/ollama/test", { method: "POST" });
return await res.json();
// バックエンド変更検知用: モデル一覧を取得した時点のバックエンド名を記録
let _promptAiBackendForModels = null;
function getPromptAiConfig() {
const s = loadPromptAiSettings();
const backend = s.backend || "ollama";
const url = (s.backendUrl || (backend === "ollama" ? "http://localhost:11434" : "http://localhost:1234")).replace(/\/$/, "");
return { backend, url };
}
async function ollamaChat(model, messages) {
const res = await fetch("/api/wfm/ollama/chat", {
method: "POST",
headers: { "Content-Type": "application/json" },
body: JSON.stringify({ model, messages }),
});
return await res.json();
async function fetchAiModels() {
const { backend, url } = getPromptAiConfig();
if (backend === "ollama") {
const res = await fetch(`${url}/api/tags`);
if (!res.ok) throw new Error(`HTTP ${res.status}`);
return (await res.json()).models?.map(m => m.name) || [];
} else {
const res = await fetch(`${url}/v1/models`);
if (!res.ok) throw new Error(`HTTP ${res.status}`);
return ((await res.json()).data || []).map(m => m.id);
}
}
async function chatWithAi(model, messages) {
const { backend, url } = getPromptAiConfig();
if (backend === "ollama") {
const res = await fetch(`${url}/api/chat`, {
method: "POST",
headers: { "Content-Type": "application/json" },
body: JSON.stringify({ model, messages, stream: false }),
});
if (!res.ok) throw new Error(`HTTP ${res.status}`);
return (await res.json()).message?.content || "";
} else {
// LM Studio: convert Ollama-style messages (with .images) to OpenAI content arrays
const openAiMessages = messages.map(msg => {
if (msg.images?.length) {
return {
role: msg.role,
content: [
{ type: "text", text: msg.content },
...msg.images.map(b64 => ({ type: "image_url", image_url: { url: `data:image/jpeg;base64,${b64}` } })),
],
};
}
return { role: msg.role, content: msg.content };
});
const res = await fetch(`${url}/v1/chat/completions`, {
method: "POST",
headers: { "Content-Type": "application/json" },
body: JSON.stringify({ model, messages: openAiMessages, stream: false }),
});
if (!res.ok) throw new Error(`HTTP ${res.status}`);
return (await res.json()).choices?.[0]?.message?.content || "";
}
}
// ============================================
@@ -462,7 +506,7 @@ function clearChat() {
if (chat) {
chat.innerHTML = `
<div class="wfm-ollama-welcome">
<p>AI Assistant (Ollama)</p>
<p>AI Assistant</p>
<p>${t("assistantWelcome")}</p>
</div>
`;
@@ -526,6 +570,24 @@ async function sendMessage() {
const message = input.value.trim();
if (!message) return;
// バックエンドが変更されていたらモデル一覧を自動更新
const { backend } = getPromptAiConfig();
if (backend !== _promptAiBackendForModels) {
const status = document.getElementById("wfm-ollama-status");
if (status) { status.textContent = `Switching to ${backend}...`; status.className = "wfm-ollama-status"; }
try {
const models = await fetchAiModels();
const savedModel = loadPromptAiSettings().model || "";
modelSelect.innerHTML = models.length
? models.map(name => `<option value="${name}" ${name === savedModel ? "selected" : ""}>${name}</option>`).join("")
: `<option value="">${t("noModelsFound")}</option>`;
_promptAiBackendForModels = backend;
if (status) { status.textContent = `${models.length} models [${backend}]`; status.className = "wfm-ollama-status connected"; }
} catch {
if (status) { status.textContent = t("failedConnect"); status.className = "wfm-ollama-status error"; }
}
}
const model = modelSelect.value;
if (!model) {
showToast(t("selectModelFirst"), "error");
@@ -545,16 +607,11 @@ async function sendMessage() {
if (sendBtn) sendBtn.disabled = true;
try {
const data = await ollamaChat(model, ollamaState.chatHistory);
if (data.status === "success" && data.message) {
const reply = data.message.content;
addChatMessage("assistant", reply);
ollamaState.chatHistory.push({ role: "assistant", content: reply });
ollamaState.attachedImage = null;
updateAttachmentDisplay();
} else {
showToast(t("error") + ": " + (data.error || data.message || "No response"), "error");
}
const reply = await chatWithAi(model, ollamaState.chatHistory);
addChatMessage("assistant", reply);
ollamaState.chatHistory.push({ role: "assistant", content: reply });
ollamaState.attachedImage = null;
updateAttachmentDisplay();
} catch (err) {
showToast(t("error") + ": " + err.message, "error");
} finally {
@@ -597,12 +654,8 @@ async function sendTranslate(direction) {
};
const prompt = prompts[direction];
const data = await ollamaChat(model, [{ role: "user", content: prompt }]);
if (data.status === "success" && data.message) {
addChatMessage("assistant", data.message.content);
} else {
showToast(t("error") + ": No response", "error");
}
const reply = await chatWithAi(model, [{ role: "user", content: prompt }]);
addChatMessage("assistant", reply);
} catch (err) {
showToast(t("error") + ": " + err.message, "error");
} finally {
@@ -858,20 +911,23 @@ function wcUpdateFilePicker() {
// ============================================
export function initPromptTab() {
// Ollama model refresh
// AI model refresh
async function refreshModels() {
const select = document.getElementById("wfm-ollama-model");
const status = document.getElementById("wfm-ollama-status");
const { backend } = getPromptAiConfig();
try {
const data = await ollamaModels();
if (data.status === "success" && data.models) {
select.innerHTML = data.models
.map((m) => `<option value="${m.name}">${m.name}</option>`)
.join("");
if (status) {
status.textContent = `${data.models.length} models`;
status.className = "wfm-ollama-status connected";
}
const models = await fetchAiModels();
const savedModel = loadPromptAiSettings().model || "";
if (select) {
select.innerHTML = models.length
? models.map(name => `<option value="${name}" ${name === savedModel ? "selected" : ""}>${name}</option>`).join("")
: `<option value="">${t("noModelsFound")}</option>`;
}
_promptAiBackendForModels = backend;
if (status) {
status.textContent = `${models.length} models [${backend}]`;
status.className = "wfm-ollama-status connected";
}
} catch {
if (status) {
@@ -891,15 +947,11 @@ export function initPromptTab() {
const status = document.getElementById("wfm-ollama-status");
if (status) { status.textContent = "Testing..."; status.className = "wfm-ollama-status"; }
try {
const data = await ollamaTest();
if (data.connected) {
if (status) { status.textContent = t("connected"); status.className = "wfm-ollama-status connected"; }
await refreshModels();
} else {
if (status) { status.textContent = t("failedConnect"); status.className = "wfm-ollama-status error"; }
}
await fetchAiModels();
if (status) { status.textContent = t("connectedCheck"); status.className = "wfm-ollama-status connected"; }
await refreshModels();
} catch {
if (status) { status.textContent = t("error"); status.className = "wfm-ollama-status error"; }
if (status) { status.textContent = t("failedConnect"); status.className = "wfm-ollama-status error"; }
}
});
+88 -42
View File
@@ -637,28 +637,38 @@ export async function initSettingsTab() {
<div id="wfm-settings-url-status" style="font-size:12px;margin-top:4px;"></div>
</details>
<!-- Ollama Settings -->
<!-- AI Assistant Settings (Prompt Tab) -->
<details class="wfm-settings-section">
<summary class="wfm-settings-summary">${t("ollamaSettings")}</summary>
<div class="wfm-form-group">
<label>${t("aiSettingsBackend")}</label>
<div class="wfm-ai-backend-row">
<label class="wfm-ai-radio-label">
<input type="radio" name="wfm-prompt-ai-backend" value="ollama"> Ollama
</label>
<label class="wfm-ai-radio-label">
<input type="radio" name="wfm-prompt-ai-backend" value="lmstudio"> LM Studio
</label>
</div>
</div>
<div class="wfm-form-group">
<label>${t("ollamaUrl")}</label>
<input type="text" class="wfm-input" id="wfm-settings-ollama-url"
value="${serverSettings.ollama_url || "http://localhost:11434"}"
<input type="text" class="wfm-input" id="wfm-settings-prompt-ai-url"
placeholder="http://localhost:11434">
</div>
<div class="wfm-form-group">
<label>${t("ollamaDefaultModel")}</label>
<div style="display:flex;gap:8px;">
<select class="wfm-select" id="wfm-settings-ollama-model" style="flex:1;">
<select class="wfm-select" id="wfm-settings-prompt-ai-model" style="flex:1;">
<option value="">${t("selectModel")}</option>
</select>
<button class="wfm-btn wfm-btn-sm" id="wfm-settings-ollama-refresh">${t("refresh")}</button>
<button class="wfm-btn wfm-btn-sm" id="wfm-settings-prompt-ai-refresh">${t("refresh")}</button>
</div>
</div>
<div style="display:flex;gap:8px;margin-top:8px;">
<button class="wfm-btn wfm-btn-primary wfm-btn-sm" id="wfm-settings-ollama-save">${t("saveOllama")}</button>
<button class="wfm-btn wfm-btn-sm" id="wfm-settings-ollama-test">${t("testConnection")}</button>
<span id="wfm-settings-ollama-status" style="font-size:12px;line-height:28px;"></span>
<button class="wfm-btn wfm-btn-primary wfm-btn-sm" id="wfm-settings-prompt-ai-save">${t("saveOllama")}</button>
<button class="wfm-btn wfm-btn-sm" id="wfm-settings-prompt-ai-test">${t("testConnection")}</button>
<span id="wfm-settings-prompt-ai-status" style="font-size:12px;line-height:28px;"></span>
</div>
</details>
@@ -1054,54 +1064,90 @@ export async function initSettingsTab() {
}
});
// --- Ollama model list loader ---
async function loadOllamaModels() {
const select = document.getElementById("wfm-settings-ollama-model");
// --- AI Assistant (Prompt Tab) settings ---
const PROMPT_AI_KEY = "wfm_prompt_ai_settings";
const loadPromptAiCfg = () => {
try { return JSON.parse(localStorage.getItem(PROMPT_AI_KEY) || "{}"); } catch { return {}; }
};
const savePromptAiCfg = (patch) => {
const data = { ...loadPromptAiCfg(), ...patch };
localStorage.setItem(PROMPT_AI_KEY, JSON.stringify(data));
};
// Restore saved values into UI
const promptAiSaved = loadPromptAiCfg();
const promptAiBackendSaved = promptAiSaved.backend || "ollama";
document.querySelectorAll('input[name="wfm-prompt-ai-backend"]').forEach(r => {
r.checked = r.value === promptAiBackendSaved;
});
const promptAiUrlEl = document.getElementById("wfm-settings-prompt-ai-url");
if (promptAiUrlEl) {
promptAiUrlEl.value = promptAiSaved.backendUrl || "";
promptAiUrlEl.placeholder = promptAiBackendSaved === "ollama" ? "http://localhost:11434" : "http://localhost:1234";
}
// Backend change → update URL placeholder
document.querySelectorAll('input[name="wfm-prompt-ai-backend"]').forEach(r => {
r.addEventListener("change", () => {
const backend = document.querySelector('input[name="wfm-prompt-ai-backend"]:checked')?.value || "ollama";
if (promptAiUrlEl) promptAiUrlEl.placeholder = backend === "ollama" ? "http://localhost:11434" : "http://localhost:1234";
});
});
// Load models directly from the selected backend
async function loadPromptAiModels() {
const select = document.getElementById("wfm-settings-prompt-ai-model");
if (!select) return;
const backend = document.querySelector('input[name="wfm-prompt-ai-backend"]:checked')?.value || "ollama";
const url = (promptAiUrlEl?.value.trim() || (backend === "ollama" ? "http://localhost:11434" : "http://localhost:1234")).replace(/\/$/, "");
try {
const res = await fetch("/api/wfm/ollama/models");
const data = await res.json();
const models = data.models || [];
const savedModel = serverSettings.ollama_model || "llava";
let models = [];
if (backend === "ollama") {
const res = await fetch(`${url}/api/tags`);
models = (await res.json()).models?.map(m => m.name) || [];
} else {
const res = await fetch(`${url}/v1/models`);
models = ((await res.json()).data || []).map(m => m.id);
}
const saved = loadPromptAiCfg().model || "";
select.innerHTML = models.length
? models.map((m) => `<option value="${m.name}" ${m.name === savedModel ? "selected" : ""}>${m.name}</option>`).join("")
? models.map(name => `<option value="${name}" ${name === saved ? "selected" : ""}>${name}</option>`).join("")
: `<option value="">${t("noModelsFound")}</option>`;
} catch {
select.innerHTML = `<option value="">${t("failedLoadModels")}</option>`;
}
}
await loadOllamaModels();
await loadPromptAiModels();
// Refresh Ollama models
document.getElementById("wfm-settings-ollama-refresh")?.addEventListener("click", loadOllamaModels);
document.getElementById("wfm-settings-prompt-ai-refresh")?.addEventListener("click", loadPromptAiModels);
// Test Ollama connection
document.getElementById("wfm-settings-ollama-test")?.addEventListener("click", async () => {
const statusEl = document.getElementById("wfm-settings-ollama-status");
statusEl.textContent = "Testing...";
statusEl.style.color = "var(--wfm-text-secondary)";
document.getElementById("wfm-settings-prompt-ai-test")?.addEventListener("click", async () => {
const statusEl = document.getElementById("wfm-settings-prompt-ai-status");
const backend = document.querySelector('input[name="wfm-prompt-ai-backend"]:checked')?.value || "ollama";
const url = (promptAiUrlEl?.value.trim() || (backend === "ollama" ? "http://localhost:11434" : "http://localhost:1234")).replace(/\/$/, "");
if (statusEl) { statusEl.textContent = t("aiStatusConnecting"); statusEl.style.color = "var(--wfm-text-secondary)"; }
try {
const res = await fetch("/api/wfm/ollama/test", { method: "POST" });
const data = await res.json();
statusEl.textContent = data.connected ? t("ollamaConnected") : `${t("ollamaFailed")}: ${data.message}`;
statusEl.style.color = data.connected ? "var(--wfm-success)" : "var(--wfm-danger)";
let count = 0;
if (backend === "ollama") {
const res = await fetch(`${url}/api/tags`);
count = ((await res.json()).models || []).length;
} else {
const res = await fetch(`${url}/v1/models`);
count = ((await res.json()).data || []).length;
}
if (statusEl) { statusEl.textContent = `${t("ollamaConnected")} (${count} models)`; statusEl.style.color = "var(--wfm-success)"; }
await loadPromptAiModels();
} catch (err) {
statusEl.textContent = `${t("error")}: ${err.message}`;
statusEl.style.color = "var(--wfm-danger)";
if (statusEl) { statusEl.textContent = `${t("ollamaFailed")}: ${err.message}`; statusEl.style.color = "var(--wfm-danger)"; }
}
});
// Save Ollama settings (to server)
document.getElementById("wfm-settings-ollama-save")?.addEventListener("click", async () => {
const ollamaUrl = document.getElementById("wfm-settings-ollama-url")?.value.trim() || "http://localhost:11434";
const ollamaModel = document.getElementById("wfm-settings-ollama-model")?.value || "";
try {
await saveServerSettings({ ollama_url: ollamaUrl, ollama_model: ollamaModel });
serverSettings.ollama_url = ollamaUrl;
serverSettings.ollama_model = ollamaModel;
showToast(t("ollamaSaved"), "success");
} catch (err) {
showToast(`${t("saveError")}: ${err.message}`, "error");
}
document.getElementById("wfm-settings-prompt-ai-save")?.addEventListener("click", () => {
const backend = document.querySelector('input[name="wfm-prompt-ai-backend"]:checked')?.value || "ollama";
const url = promptAiUrlEl?.value.trim() || "";
const model = document.getElementById("wfm-settings-prompt-ai-model")?.value || "";
savePromptAiCfg({ backend, backendUrl: url, model });
showToast(t("ollamaSaved"), "success");
});
// CivitAI host select
+5 -4
View File
@@ -736,7 +736,7 @@
<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>AI Assistant</p>
<p>Attach images, generate prompts, translate, or ask for improvements.</p>
</div>
</div>
@@ -1157,8 +1157,8 @@
<li id="wfm-help-gallery-3">Thumbnail and Table view modes; double-click any image to open fullscreen lightbox</li>
<li id="wfm-help-gallery-4">Toolbar filters: favorites (★), text search (filename / tag / prompt), tag filter, group filter, sort by date/name</li>
<li id="wfm-help-gallery-5">Folder tree: click to load images, expand with ▶; "+ New" creates a subfolder inside the selected folder, "Del" deletes it with all contents</li>
<li id="wfm-help-gallery-6">Multi-select with Ctrl+click — bulk bar: select group → 'Add to Group' / 'Remove from Group'; 'Favorite All' / 'Unfavorite All'; 'Compare' (2–4 images); 'Move To...'; 'Delete File'</li>
<li id="wfm-help-gallery-7">Detail panel — Info tab: filename, size, date, tags (add/remove), memo; "Move To..." moves the image to another folder, "Delete File" removes it permanently</li>
<li id="wfm-help-gallery-6">Multi-select with Ctrl+click — bulk bar: select group → 'Add to Group' / 'Remove from Group'; 'Favorite All' / 'Unfavorite All'; 'Compare' (2–4 images); 'Move To...'; '<b>Export</b>' (downloads all selected images as a ZIP file); 'Delete File'</li>
<li id="wfm-help-gallery-7">Detail panel — Info tab: filename, size, date, tags (add/remove), memo; <b>download icon</b> (on image hover) to download the single image; "Move To..." moves the image to another folder, "Delete File" removes it permanently</li>
<li id="wfm-help-gallery-8">Detail panel — JSON tab: displays workflow JSON from PNG embedded data (prompt / workflow keys) or from metadata saved by the Generate UI tab; 'Copy &amp; Send Canvas' button copies to clipboard and stores the workflow for title-drag to canvas</li>
<li id="wfm-help-gallery-9">Detail panel — Groups tab: create, assign, remove, rename, and delete groups per image; the <b>__Feeder__</b> group is reserved (shown with 🔒) and cannot be renamed or deleted — rename and delete buttons are disabled when it is selected</li>
<li id="wfm-help-gallery-15"><b>F button</b> (cyan overlay, top-left of each thumbnail): toggle the image in/out of the <b>__Feeder__</b> group with a single click; active state stays visible (cyan) when the image is already in the group; use this to quickly queue images for the Feeder tab Gallery mode</li>
@@ -1343,6 +1343,7 @@
<button id="wfm-gallery-bulk-unfav" class="wfm-btn wfm-btn-sm"></button>
<button id="wfm-gallery-bulk-compare" class="wfm-btn wfm-btn-sm" style="display:none;"></button>
<button id="wfm-gallery-bulk-move" class="wfm-btn wfm-btn-sm"></button>
<button id="wfm-gallery-bulk-export" class="wfm-btn wfm-btn-sm"></button>
<button id="wfm-gallery-bulk-delete" class="wfm-btn wfm-btn-sm wfm-btn-danger"></button>
</div>
</div>
@@ -1376,7 +1377,7 @@
<span id="wfm-gallery-detail-filename" class="wfm-gallery-detail-filename"></span>
</div>
<!-- サムネイルプレビュー -->
<div id="wfm-gallery-detail-preview" class="wfm-gallery-detail-preview">
<div id="wfm-gallery-detail-preview" class="wfm-gallery-detail-preview wfm-gallery-preview-container">
<span class="wfm-placeholder">No selection</span>
</div>
<!-- タブナビ -->