中文版 AI 姿势参考图库 · 1439 组 / 2878 张图片 / 完整汉化 · 零依赖静态画廊
feat(comfyui): add native ComfyUI custom_nodes plugin with 3-in-1 visual picker
Alone8874b2a0b6c3d2
diff --git a/.assetsignore b/.assetsignoreindex 8fafb13..41b6a96 100644--- a/.assetsignore+++ b/.assetsignore@@ -12,6 +12,8 @@ scriptssrcfunctionsskills+__init__.py+comfyui_pluginREADME.mdLICENSEdownload_failed.txtdiff --git a/README.md b/README.mdindex f53e8c9..a41ad22 100644--- a/README.md+++ b/README.md@@ -31,7 +31,8 @@3. **三合一 AI 角色合成工作台** —— 基于 **React 19 + Tailwind CSS 4 + TypeScript 7 + shadcn/ui + TanStack Router** 构建的响应式多页面应用(兼容 PC / 平板 / 手机):- 从三大图库任意挑选 **人像 + 服装 + 姿势** 组合配方,或一键随机捏人;- 支持拖拽 / 剪贴板粘贴(`Cmd+V` / `Ctrl+V`) / URL 添加多张自定义附加参考图;- - 内置 **4 大主流 AI 图像协议直连**(Gemini、OpenAI GPT、阿里千问 Qwen、字节豆包 Seedream),支持直接传递公网图片 URL 或 Base64,生成记录通过 **IndexedDB** 本地持久化保存。+ - 内置 **5 大 AI 图像协议直连**(Gemini、OpenAI GPT、阿里千问 Qwen、字节豆包 Seedream、**本地 ComfyUI 工作流引擎**),支持直接传递公网图片 URL、Base64 或自动上传至本地 ComfyUI,生成记录通过 **IndexedDB** 本地持久化保存。+4. **原生 ComfyUI 自定义节点插件(`custom_nodes`)** —— 本仓库同时是一个完整的 ComfyUI 插件!直接 `git clone` 到 `ComfyUI/custom_nodes/` 即可在 ComfyUI 内使用 **姿势 / 服装 / 人像 / 三合一角色配方** 4 个自定义节点与内置的 4,345 张中文可视化选图器。---@@ -52,8 +53,16 @@- **OpenAI GPT Image**:`gpt-image-1.5`、`gpt-image-1`、`gpt-image-1-mini`(支持 `/v1/images/edits` JSON URL 直传 / Multipart 上传、尺寸、质量、背景透明度)- **阿里千问 Qwen-Image**:`qwen-image-2.0-pro`、`qwen-image-2.0`、`qwen-image-edit-max`(支持 `multimodal-generation` 多图参考输入、智能改写 `prompt_extend`、水印开关)- **字节豆包 Seedream**:`doubao-seedream-5-0-260128`、`doubao-seedream-4-5-251128`、`doubao-seedream-4-0-250828`(支持多图融合 `image: [...]`、2K/4K 分辨率)+ - **本地 ComfyUI 直连**:支持一键把三合一参考拼图及单张人像/服装/姿势图自动上传至本地 ComfyUI(`/upload/image`),注入自定义 API 工作流占位符(`{{prompt}}`、`{{seed}}`、`{{width}}`、`{{height}}`、`{{composite_image}}`、`{{portrait_image}}`、`{{costume_image}}`、`{{pose_image}}`)或自动识别 `CLIPTextEncode` / `KSampler` / `LoadImage` 节点提交 `/prompt` 队列并轮询取回成品图;支持导出通用 `.api.json` 工作流模板。- **跨页面后台生图 & IndexedDB 历史记录**:切换页面不会中断正在进行的生图请求;生成结果自动存入浏览器 IndexedDB(避免 `localStorage` 容量限制),支持复用提示词与原图下载。+### 3. ComfyUI 原生自定义节点插件(`comfyui_plugin/`)+将本仓库克隆到 `ComfyUI/custom_nodes/ai-pose-gallery-zh` 后,ComfyUI 画布右键菜单 **「AI角色三合一参考图集」** 下自动提供 4 个节点:+- **AI 姿势参考图 (`PoseGalleryNode`)**:输出 `姿势图 (IMAGE)`、`图片ID`、`姿势提示词`+- **AI 服装参考图 (`CostumeGalleryNode`)**:输出 `服装图 (IMAGE)`、`图片ID`、`中文服装描述`、`英文服装Prompt`+- **AI 人像参考图 (`PortraitGalleryNode`)**:输出 `人像图 (IMAGE)`、`图片ID`、`人像发型描述`+- **AI 角色三合一合成配方 (`CharacterRecipeNode`)**:一个节点同时输出 `人像图`、`服装图`、`姿势图`、`三合一拼图` 以及自动组装的 `中文合成Prompt` 与 `英文合成Prompt`,并内置 **4,345 张中文可视化弹窗选图器**与节点内实时缩略图预览。+---## 数据规模@@ -163,6 +172,34 @@ npx wrangler pages deploy dist --project-name ai-pose-gallery-zh---+## 在 ComfyUI 中使用(双模式支持)++### 模式 A:作为 ComfyUI 原生插件安装(在 ComfyUI 画布内选图)++无需额外依赖(复用 ComfyUI 自带的 `torch`、`numpy`、`Pillow`、`aiohttp`):++```bash+cd /path/to/ComfyUI/custom_nodes+git clone --depth 1 https://github.com/anhao/ai-pose-gallery-zh.git+```++重启 ComfyUI 后:+1. 在画布空白处右键 → **新建节点** → **AI角色三合一参考图集**;+2. 选择 **「AI 角色三合一合成配方 (3-in-1 Recipe)」** 或单个姿势 / 服装 / 人像节点;+3. 点击节点上的 **「🎨 打开三合一选图器 (4,345张)」** 按钮(或直接点击节点上的缩略图),即可在弹窗中按分类、视角、发长筛选或中文搜索,一键填入节点并输出 `IMAGE` 张量与中英文 Prompt。++### 模式 B:从 Web 合成台直连本地 ComfyUI API++如果您使用线上网页端(或本地 `pnpm dev`)选图,希望直接调用本机 ComfyUI 生图:+1. 启动本地 ComfyUI 时开启跨域参数:+ ```bash+ python main.py --enable-cors-header "*"+ ```+2. 打开本工作台 **「接口配置」** 页面 → 切换到 **「本地 ComfyUI」** → 点击「检测连接」(默认 `http://127.0.0.1:8188`);+3. 可直接导入您在 ComfyUI 中通过 `工作流 -> 导出 (API)` 保存的 `.json` 文件,或在 **「合成台」** 一键导出内置通用工作流模板后点击生成。++---+## Agent 技能(Skills)`skills/` 下提供 5 个 `SKILL.md` 格式的 Agent 技能,让 AI Agent 按姿势名 + 视角检索本仓库的白模图,作为生图 / 生视频的姿势参考:diff --git a/__init__.py b/__init__.pynew file mode 100644index 0000000..32b8aa0--- /dev/null+++ b/__init__.py@@ -0,0 +1,17 @@+# -*- coding: utf-8 -*-+"""+ComfyUI 自定义节点入口:AI 角色三合一参考图集 (Pose + Costume + Portrait)+将本仓库克隆至 ComfyUI/custom_nodes/ai-pose-gallery-zh 即可直接在 ComfyUI 内使用。+"""++from .comfyui_plugin import (+ NODE_CLASS_MAPPINGS,+ NODE_DISPLAY_NAME_MAPPINGS,+ register_routes,+)++WEB_DIRECTORY = "./comfyui_plugin/web"++register_routes()++__all__ = ["NODE_CLASS_MAPPINGS", "NODE_DISPLAY_NAME_MAPPINGS", "WEB_DIRECTORY"]diff --git a/comfyui_plugin/__init__.py b/comfyui_plugin/__init__.pynew file mode 100644index 0000000..ccf2fce--- /dev/null+++ b/comfyui_plugin/__init__.py@@ -0,0 +1,7 @@+# -*- coding: utf-8 -*-+"""AI 角色三合一参考图集 ComfyUI 插件核心模块。"""++from .nodes import NODE_CLASS_MAPPINGS, NODE_DISPLAY_NAME_MAPPINGS+from .routes import register_routes++__all__ = ["NODE_CLASS_MAPPINGS", "NODE_DISPLAY_NAME_MAPPINGS", "register_routes"]diff --git a/comfyui_plugin/nodes.py b/comfyui_plugin/nodes.pynew file mode 100644index 0000000..384ed68--- /dev/null+++ b/comfyui_plugin/nodes.py@@ -0,0 +1,378 @@+# -*- coding: utf-8 -*-+"""ComfyUI 自定义节点:AI 角色三合一参考图集(姿势 + 服装 + 人像 + 三合一合成配方)。"""++from __future__ import annotations++from typing import TYPE_CHECKING++from .routes import find_item, resolve_safe_image_path++if TYPE_CHECKING:+ from PIL import Image++RESIZE_MODES = [+ "原图尺寸",+ "指定尺寸(居中裁剪)",+ "指定尺寸(留白填充)",+]++STYLE_PRESETS = {+ "高清日系动漫": (+ "日系二次元动漫插画风格,精致五官,赛璐璐与厚涂结合,光影通透,高画质杰作",+ "anime illustration, cel shading and soft lighting, clean lineart, masterpiece, best quality",+ ),+ "写实摄影人像": (+ "电影级写实人像摄影,85mm定焦镜头,真实皮肤质感,自然景深与柔美布光,8K超清",+ "photorealistic portrait photography, 85mm lens, realistic skin texture, cinematic lighting, 8k",+ ),+ "韩系半厚涂插画": (+ "韩系唯美半厚涂角色立绘,细腻丝滑高光,柔美体积感,高级色彩搭配",+ "semi-realistic anime character art, smooth rendering, luminous highlights, refined color palette",+ ),+ "干净角色设定图": (+ "游戏角色立绘设定图,干净浅灰/纯白背景,轮廓清晰,服装材质与褶皱细节丰富",+ "character design reference sheet, clean light background, crisp silhouette, detailed fabric folds",+ ),+}+++def _pil_to_comfy_tensor(img: Image.Image):+ import numpy as np+ import torch++ rgb = img.convert("RGB")+ arr = np.asarray(rgb, dtype=np.float32) / 255.0+ return torch.from_numpy(arr).unsqueeze(0)+++def _load_pil_image(+ rel_path: str,+ resize_mode: str = "原图尺寸",+ width: int = 1024,+ height: int = 1280,+ flip_horizontal: bool = False,+) -> Image.Image:+ from PIL import Image, ImageOps++ path = resolve_safe_image_path(rel_path)+ img = Image.open(path)+ img = ImageOps.exif_transpose(img).convert("RGB")++ if flip_horizontal:+ img = ImageOps.mirror(img)++ target_w = max(64, int(width))+ target_h = max(64, int(height))++ if resize_mode == "指定尺寸(居中裁剪)":+ img = ImageOps.fit(img, (target_w, target_h), method=Image.Resampling.LANCZOS)+ elif resize_mode == "指定尺寸(留白填充)":+ img = ImageOps.pad(+ img,+ (target_w, target_h),+ method=Image.Resampling.LANCZOS,+ color=(245, 245, 247),+ )++ return img+++def _build_pose_prompts(item: dict) -> tuple[str, str]:+ title = item.get("姿势名称") or item.get("标题") or "标准姿势"+ system = item.get("体系", "")+ cat = item.get("分类", "")+ angle = item.get("角度", "正面")+ zh = f"{angle}视角,动作:{title}({system}·{cat})"+ en = f"{angle} view, pose: {title} ({cat})"+ return zh, en+++def _build_costume_prompts(item: dict) -> tuple[str, str]:+ title = item.get("服装名称") or item.get("标题") or ""+ cat = item.get("分类", "")+ tags = "、".join(item.get("标签", [])[:8])+ desc_en = item.get("关键词", "") or title+ zh = f"身穿{cat}:{title}" + (f"(细节:{tags})" if tags else "")+ return zh, desc_en+++def _build_portrait_prompts(item: dict) -> tuple[str, str]:+ title = item.get("标题", "")+ section = item.get("分区", "")+ hair_len = item.get("发长", "")+ hair_style = item.get("发型名称") or item.get("发型") or ""+ zh = f"人物面部与发型:{hair_len}、{hair_style}({section},{title})"+ en = f"character hairstyle and face reference: {hair_len}, {hair_style}"+ return zh, en+++class PoseGalleryNode:+ """从 1,439 张 3D 素体姿势库中选择姿势参考图并输出 IMAGE 与提示词。"""++ @classmethod+ def INPUT_TYPES(cls):+ return {+ "required": {+ "image_id": (+ "STRING",+ {"default": "full_single_P001_front", "multiline": False},+ ),+ "resize_mode": (RESIZE_MODES, {"default": "原图尺寸"}),+ "width": ("INT", {"default": 1024, "min": 64, "max": 4096, "step": 8}),+ "height": ("INT", {"default": 1280, "min": 64, "max": 4096, "step": 8}),+ "flip_horizontal": ("BOOLEAN", {"default": False}),+ }+ }++ RETURN_TYPES = ("IMAGE", "STRING", "STRING")+ RETURN_NAMES = ("姿势图", "图片ID", "姿势提示词")+ FUNCTION = "load_pose"+ CATEGORY = "AI角色三合一参考图集"++ def load_pose(+ self,+ image_id: str = "full_single_P001_front",+ resize_mode: str = "原图尺寸",+ width: int = 1024,+ height: int = 1280,+ flip_horizontal: bool = False,+ ):+ item = find_item("pose", image_id)+ pil_img = _load_pil_image(+ item["原图"],+ resize_mode=resize_mode,+ width=width,+ height=height,+ flip_horizontal=flip_horizontal,+ )+ zh_prompt, _ = _build_pose_prompts(item)+ return (_pil_to_comfy_tensor(pil_img), item["id"], zh_prompt)+++class CostumeGalleryNode:+ """从 1,407 套穿搭服装库中选择服装参考图并输出 IMAGE 与中英文服装 Prompt。"""++ @classmethod+ def INPUT_TYPES(cls):+ return {+ "required": {+ "image_id": ("STRING", {"default": "SPR-0001", "multiline": False}),+ "resize_mode": (RESIZE_MODES, {"default": "原图尺寸"}),+ "width": ("INT", {"default": 1024, "min": 64, "max": 4096, "step": 8}),+ "height": ("INT", {"default": 1280, "min": 64, "max": 4096, "step": 8}),+ "flip_horizontal": ("BOOLEAN", {"default": False}),+ }+ }++ RETURN_TYPES = ("IMAGE", "STRING", "STRING", "STRING")+ RETURN_NAMES = ("服装图", "图片ID", "中文服装描述", "英文服装Prompt")+ FUNCTION = "load_costume"+ CATEGORY = "AI角色三合一参考图集"++ def load_costume(+ self,+ image_id: str = "SPR-0001",+ resize_mode: str = "原图尺寸",+ width: int = 1024,+ height: int = 1280,+ flip_horizontal: bool = False,+ ):+ item = find_item("costume", image_id)+ pil_img = _load_pil_image(+ item["原图"],+ resize_mode=resize_mode,+ width=width,+ height=height,+ flip_horizontal=flip_horizontal,+ )+ zh_prompt, en_prompt = _build_costume_prompts(item)+ return (_pil_to_comfy_tensor(pil_img), item["id"], zh_prompt, en_prompt)+++class PortraitGalleryNode:+ """从 1,499 张精细人像与发型库中选择人像参考图并输出 IMAGE 与发型描述。"""++ @classmethod+ def INPUT_TYPES(cls):+ return {+ "required": {+ "image_id": ("STRING", {"default": "f71f980dde3", "multiline": False}),+ "resize_mode": (RESIZE_MODES, {"default": "原图尺寸"}),+ "width": ("INT", {"default": 1024, "min": 64, "max": 4096, "step": 8}),+ "height": ("INT", {"default": 1280, "min": 64, "max": 4096, "step": 8}),+ "flip_horizontal": ("BOOLEAN", {"default": False}),+ }+ }++ RETURN_TYPES = ("IMAGE", "STRING", "STRING")+ RETURN_NAMES = ("人像图", "图片ID", "人像发型描述")+ FUNCTION = "load_portrait"+ CATEGORY = "AI角色三合一参考图集"++ def load_portrait(+ self,+ image_id: str = "f71f980dde3",+ resize_mode: str = "原图尺寸",+ width: int = 1024,+ height: int = 1280,+ flip_horizontal: bool = False,+ ):+ item = find_item("portrait", image_id)+ pil_img = _load_pil_image(+ item["原图"],+ resize_mode=resize_mode,+ width=width,+ height=height,+ flip_horizontal=flip_horizontal,+ )+ zh_prompt, _ = _build_portrait_prompts(item)+ return (_pil_to_comfy_tensor(pil_img), item["id"], zh_prompt)+++class CharacterRecipeNode:+ """三合一角色合成配方节点:同时输出人像图、服装图、姿势图、三合一横向拼图,以及自动组装的中英文合成 Prompt。"""++ @classmethod+ def INPUT_TYPES(cls):+ return {+ "required": {+ "portrait_id": (+ "STRING",+ {"default": "f71f980dde3", "multiline": False},+ ),+ "costume_id": ("STRING", {"default": "SPR-0001", "multiline": False}),+ "pose_id": (+ "STRING",+ {"default": "full_single_P001_front", "multiline": False},+ ),+ "style_preset": (+ list(STYLE_PRESETS.keys()),+ {"default": "高清日系动漫"},+ ),+ "extra_prompt": (+ "STRING",+ {+ "default": "",+ "multiline": True,+ "placeholder": "可选补充提示词(例如:银色双眸、教室窗边逆光、微风吹拂发丝)",+ },+ ),+ "resize_mode": (RESIZE_MODES, {"default": "指定尺寸(居中裁剪)"}),+ "width": ("INT", {"default": 1024, "min": 64, "max": 4096, "step": 8}),+ "height": ("INT", {"default": 1280, "min": 64, "max": 4096, "step": 8}),+ "flip_pose_horizontal": ("BOOLEAN", {"default": False}),+ }+ }++ RETURN_TYPES = ("IMAGE", "IMAGE", "IMAGE", "IMAGE", "STRING", "STRING")+ RETURN_NAMES = (+ "人像图",+ "服装图",+ "姿势图",+ "三合一拼图",+ "中文合成Prompt",+ "英文合成Prompt",+ )+ FUNCTION = "build_recipe"+ CATEGORY = "AI角色三合一参考图集"++ def build_recipe(+ self,+ portrait_id: str = "f71f980dde3",+ costume_id: str = "SPR-0001",+ pose_id: str = "full_single_P001_front",+ style_preset: str = "高清日系动漫",+ extra_prompt: str = "",+ resize_mode: str = "指定尺寸(居中裁剪)",+ width: int = 1024,+ height: int = 1280,+ flip_pose_horizontal: bool = False,+ ):+ portrait_item = find_item("portrait", portrait_id)+ costume_item = find_item("costume", costume_id)+ pose_item = find_item("pose", pose_id)++ portrait_pil = _load_pil_image(+ portrait_item["原图"], resize_mode=resize_mode, width=width, height=height+ )+ costume_pil = _load_pil_image(+ costume_item["原图"], resize_mode=resize_mode, width=width, height=height+ )+ pose_pil = _load_pil_image(+ pose_item["原图"],+ resize_mode=resize_mode,+ width=width,+ height=height,+ flip_horizontal=flip_pose_horizontal,+ )++ # 生成三合一横向参考拼图(人像 | 服装 | 姿势)+ from PIL import Image, ImageOps++ panel_h = max(256, int(height))+ panel_w = max(256, int(width))+ p1 = ImageOps.fit(+ portrait_pil, (panel_w, panel_h), method=Image.Resampling.LANCZOS+ )+ p2 = ImageOps.fit(+ costume_pil, (panel_w, panel_h), method=Image.Resampling.LANCZOS+ )+ p3 = ImageOps.fit(pose_pil, (panel_w, panel_h), method=Image.Resampling.LANCZOS)+ gap = 12+ composite = Image.new("RGB", (panel_w * 3 + gap * 2, panel_h), (24, 24, 29))+ composite.paste(p1, (0, 0))+ composite.paste(p2, (panel_w + gap, 0))+ composite.paste(p3, ((panel_w + gap) * 2, 0))++ portrait_zh, portrait_en = _build_portrait_prompts(portrait_item)+ costume_zh, costume_en = _build_costume_prompts(costume_item)+ pose_zh, pose_en = _build_pose_prompts(pose_item)+ style_zh, style_en = STYLE_PRESETS.get(+ style_preset, STYLE_PRESETS["高清日系动漫"]+ )++ extra_clean = (extra_prompt or "").strip()+ zh_parts = [+ f"请融合参考图生成一张完整的角色立绘:{style_zh}。",+ f"【人像与发型】{portrait_zh};",+ f"【服装与配饰】{costume_zh};",+ f"【身体姿势与构图】{pose_zh}。",+ ]+ if extra_clean:+ zh_parts.append(f"【补充细节】{extra_clean}。")+ zh_parts.append(+ "要求人物面部自然生动,服装穿戴贴合身体动态,肢体透视与手部结构准确,光影和谐统一。"+ )++ en_parts = [+ style_en,+ portrait_en,+ f"wearing {costume_en}",+ pose_en,+ ]+ if extra_clean:+ en_parts.append(extra_clean)++ return (+ _pil_to_comfy_tensor(portrait_pil),+ _pil_to_comfy_tensor(costume_pil),+ _pil_to_comfy_tensor(pose_pil),+ _pil_to_comfy_tensor(composite),+ "".join(zh_parts),+ ", ".join(en_parts),+ )+++NODE_CLASS_MAPPINGS = {+ "PoseGalleryNode": PoseGalleryNode,+ "CostumeGalleryNode": CostumeGalleryNode,+ "PortraitGalleryNode": PortraitGalleryNode,+ "CharacterRecipeNode": CharacterRecipeNode,+}++NODE_DISPLAY_NAME_MAPPINGS = {+ "PoseGalleryNode": "AI 姿势参考图 (Pose Gallery)",+ "CostumeGalleryNode": "AI 服装参考图 (Costume Gallery)",+ "PortraitGalleryNode": "AI 人像参考图 (Portrait Gallery)",+ "CharacterRecipeNode": "AI 角色三合一合成配方 (3-in-1 Recipe)",+}diff --git a/comfyui_plugin/routes.py b/comfyui_plugin/routes.pynew file mode 100644index 0000000..2a99ed4--- /dev/null+++ b/comfyui_plugin/routes.py@@ -0,0 +1,104 @@+# -*- coding: utf-8 -*-+"""ComfyUI 服务端路由:为 ComfyUI 前端选图器提供本地三库 JSON 与图片文件服务。"""++from __future__ import annotations++import json+import logging+from pathlib import Path++logger = logging.getLogger(__name__)++ROOT_DIR = Path(__file__).resolve().parent.parent+DATA_DIR = ROOT_DIR / "data"+THUMBS_DIR = (ROOT_DIR / "thumbs").resolve()+IMG_DIR = (ROOT_DIR / "img").resolve()++LIBRARY_FILES = {+ "pose": DATA_DIR / "pose-zh.json",+ "costume": DATA_DIR / "costume-zh.json",+ "portrait": DATA_DIR / "portrait-zh.json",+}++_CACHE: dict[str, list[dict]] = {}+++def load_library(lib: str) -> list[dict]:+ if lib not in LIBRARY_FILES:+ raise ValueError(f"未知图库类型: {lib}")+ if lib not in _CACHE:+ fp = LIBRARY_FILES[lib]+ if not fp.exists():+ raise FileNotFoundError(f"未找到数据文件: {fp}")+ with open(fp, encoding="utf-8") as f:+ _CACHE[lib] = json.load(f)+ return _CACHE[lib]+++def find_item(lib: str, item_id: str) -> dict:+ items = load_library(lib)+ clean_id = (item_id or "").strip()+ for it in items:+ if it.get("id") == clean_id:+ return it+ return items[0]+++def resolve_safe_image_path(rel_path: str) -> Path:+ clean = (rel_path or "").strip().lstrip("/")+ candidate = (ROOT_DIR / clean).resolve()+ if not (+ str(candidate).startswith(str(THUMBS_DIR) + "/")+ or str(candidate).startswith(str(IMG_DIR) + "/")+ ):+ raise ValueError("非法图片路径")+ if not candidate.is_file():+ raise FileNotFoundError(f"图片文件不存在: {clean}")+ return candidate+++def register_routes() -> None:+ try:+ from aiohttp import web+ from server import PromptServer+ except ImportError:+ # 非 ComfyUI 运行环境(如独立脚本检查)直接跳过+ return++ if getattr(PromptServer, "instance", None) is None:+ return++ routes = PromptServer.instance.routes++ @routes.get("/pose_character_atlas/catalogue")+ async def get_catalogue(request):+ lib = request.query.get("library", "pose")+ try:+ items = load_library(lib)+ return web.json_response(+ {"library": lib, "count": len(items), "items": items},+ headers={"Cache-Control": "public, max-age=300"},+ )+ except Exception as exc:+ return web.json_response({"error": str(exc)}, status=400)++ @routes.get("/pose_character_atlas/image")+ async def get_image(request):+ rel = request.query.get("path", "")+ lib = request.query.get("library", "")+ item_id = request.query.get("id", "")+ kind = request.query.get("kind", "thumb")+ try:+ if not rel and lib and item_id:+ item = find_item(lib, item_id)+ rel = item.get("缩略图" if kind == "thumb" else "原图", "")+ path = resolve_safe_image_path(rel)+ return web.FileResponse(+ path,+ headers={+ "Cache-Control": "public, max-age=86400",+ "X-Content-Type-Options": "nosniff",+ },+ )+ except Exception as exc:+ return web.json_response({"error": str(exc)}, status=404)diff --git a/comfyui_plugin/web/extension.js b/comfyui_plugin/web/extension.jsnew file mode 100644index 0000000..5299df7--- /dev/null+++ b/comfyui_plugin/web/extension.js@@ -0,0 +1,608 @@+import { app } from "../../scripts/app.js";+import { api } from "../../scripts/api.js";++const LIBRARIES = {+ pose: {+ key: "pose",+ label: "姿势库 (1,439)",+ shortLabel: "姿势",+ defaultId: "full_single_P001_front",+ titleField: "姿势名称",+ primaryField: "分类",+ secondaryField: "角度",+ primaryPlaceholder: "全部动作分类",+ secondaryPlaceholder: "全部视角",+ },+ costume: {+ key: "costume",+ label: "服装库 (1,407)",+ shortLabel: "服装",+ defaultId: "SPR-0001",+ titleField: "服装名称",+ primaryField: "分类",+ secondaryField: "",+ primaryPlaceholder: "全部穿搭大类",+ secondaryPlaceholder: "全部细分区",+ },+ portrait: {+ key: "portrait",+ label: "人像库 (1,499)",+ shortLabel: "人像",+ defaultId: "f71f980dde3",+ titleField: "发型名称",+ primaryField: "发长",+ secondaryField: "分区",+ primaryPlaceholder: "全部发长",+ secondaryPlaceholder: "全部分区",+ },+};++const NODE_LIB_MAP = {+ PoseGalleryNode: "pose",+ CostumeGalleryNode: "costume",+ PortraitGalleryNode: "portrait",+ CharacterRecipeNode: "recipe",+};++const catalogueCache = {};+const PAGE_SIZE = 60;++function injectStylesheet() {+ if (document.getElementById("pca-comfy-styles")) return;+ const link = document.createElement("link");+ link.id = "pca-comfy-styles";+ link.rel = "stylesheet";+ link.href = new URL("./style.css", import.meta.url).href;+ document.head.appendChild(link);+}++async function fetchCatalogue(lib) {+ if (catalogueCache[lib]) return catalogueCache[lib];+ const resp = await api.fetchApi(+ `/pose_character_atlas/catalogue?library=${encodeURIComponent(lib)}`+ );+ if (!resp.ok) {+ throw new Error(`加载 ${lib} 图库失败: HTTP ${resp.status}`);+ }+ const data = await resp.json();+ catalogueCache[lib] = data.items || [];+ return catalogueCache[lib];+}++function getThumbUrl(lib, id, relPath) {+ if (relPath) {+ return `/pose_character_atlas/image?path=${encodeURIComponent(relPath)}`;+ }+ return `/pose_character_atlas/image?library=${encodeURIComponent(lib)}&id=${encodeURIComponent(id)}&kind=thumb`;+}++function getItemTitle(lib, item) {+ const cfg = LIBRARIES[lib];+ return (+ item[cfg.titleField] ||+ item["标题"] ||+ item["姿势名称"] ||+ item["服装名称"] ||+ item["发型名称"] ||+ item.id+ );+}++function findWidget(node, name) {+ return (node.widgets || []).find((w) => w.name === name);+}++function setWidgetValue(node, name, value) {+ const w = findWidget(node, name);+ if (!w) return;+ w.value = value;+ if (typeof w.callback === "function") {+ w.callback(value);+ }+ app.graph.setDirtyCanvas(true, true);+}++class PoseAtlasModal {+ constructor() {+ this.backdrop = null;+ this.activeLib = "pose";+ this.targetNode = null;+ this.mode = "single"; // "single" | "recipe"+ this.searchQuery = "";+ this.primaryFilter = "";+ this.secondaryFilter = "";+ this.page = 1;+ this.recipeSelection = {+ portrait: LIBRARIES.portrait.defaultId,+ costume: LIBRARIES.costume.defaultId,+ pose: LIBRARIES.pose.defaultId,+ };+ }++ async open({ node = null, initialLib = "pose", mode = "single" } = {}) {+ injectStylesheet();+ this.targetNode = node;+ this.mode = mode;+ this.activeLib = initialLib;+ this.page = 1;++ if (node) {+ if (mode === "recipe") {+ this.recipeSelection.portrait =+ findWidget(node, "portrait_id")?.value ||+ LIBRARIES.portrait.defaultId;+ this.recipeSelection.costume =+ findWidget(node, "costume_id")?.value || LIBRARIES.costume.defaultId;+ this.recipeSelection.pose =+ findWidget(node, "pose_id")?.value || LIBRARIES.pose.defaultId;+ } else {+ const currentId =+ findWidget(node, "image_id")?.value ||+ LIBRARIES[initialLib].defaultId;+ this.recipeSelection[initialLib] = currentId;+ }+ }++ this.renderShell();+ await this.switchLibrary(this.activeLib);+ }++ close() {+ if (this.backdrop) {+ this.backdrop.remove();+ this.backdrop = null;+ }+ }++ renderShell() {+ this.close();+ const backdrop = document.createElement("div");+ backdrop.className = "pca-modal-backdrop";+ backdrop.addEventListener("click", (e) => {+ if (e.target === backdrop) this.close();+ });++ backdrop.innerHTML = `+ <div class="pca-modal">+ <div class="pca-header">+ <div class="pca-title-group">+ <div>+ <h3 class="pca-title">AI 角色三合一参考图集 (ComfyUI 选图器)</h3>+ <div class="pca-subtitle">4,345 张高清中文标签参考图 · 点击卡片即可填入节点</div>+ </div>+ </div>+ <div class="pca-tabs" id="pca-tabs"></div>+ <button class="pca-btn" id="pca-close-btn">关闭 ✕</button>+ </div>+ <div class="pca-toolbar">+ <input class="pca-search-input" id="pca-search" type="text" placeholder="搜索中文标题、动作、服装、发型、编号 (如: 坐姿 / 水手服 / 双马尾 / SPR-0001)..." />+ <select class="pca-select" id="pca-filter-primary"></select>+ <select class="pca-select" id="pca-filter-secondary"></select>+ <button class="pca-btn" id="pca-random-btn">🎲 随机抽一张</button>+ <button class="pca-btn" id="pca-reset-btn">重置筛选</button>+ </div>+ <div class="pca-grid-wrap">+ <div class="pca-grid" id="pca-grid"></div>+ </div>+ <div class="pca-footer">+ <div class="pca-recipe-slots" id="pca-recipe-slots"></div>+ <div style="display:flex;align-items:center;gap:8px;">+ <button class="pca-btn" id="pca-prev-page">上一页</button>+ <span id="pca-page-info" style="font-size:12px;color:#9ca3af;">1 / 1</span>+ <button class="pca-btn" id="pca-next-page">下一页</button>+ <button class="pca-btn pca-btn-primary" id="pca-apply-btn">确认应用到节点</button>+ </div>+ </div>+ </div>+ `;++ document.body.appendChild(backdrop);+ this.backdrop = backdrop;++ backdrop+ .querySelector("#pca-close-btn")+ .addEventListener("click", () => this.close());++ const searchInput = backdrop.querySelector("#pca-search");+ searchInput.addEventListener("input", (e) => {+ this.searchQuery = e.target.value.trim().toLowerCase();+ this.page = 1;+ this.renderGrid();+ });++ backdrop+ .querySelector("#pca-filter-primary")+ .addEventListener("change", (e) => {+ this.primaryFilter = e.target.value;+ this.page = 1;+ this.renderGrid();+ });++ backdrop+ .querySelector("#pca-filter-secondary")+ .addEventListener("change", (e) => {+ this.secondaryFilter = e.target.value;+ this.page = 1;+ this.renderGrid();+ });++ backdrop+ .querySelector("#pca-random-btn")+ .addEventListener("click", () => this.pickRandom());++ backdrop.querySelector("#pca-reset-btn").addEventListener("click", () => {+ this.searchQuery = "";+ this.primaryFilter = "";+ this.secondaryFilter = "";+ searchInput.value = "";+ this.page = 1;+ this.populateFilters();+ this.renderGrid();+ });++ backdrop.querySelector("#pca-prev-page").addEventListener("click", () => {+ if (this.page > 1) {+ this.page--;+ this.renderGrid();+ }+ });++ backdrop.querySelector("#pca-next-page").addEventListener("click", () => {+ const totalPages = Math.max(+ 1,+ Math.ceil(this.getFilteredItems().length / PAGE_SIZE)+ );+ if (this.page < totalPages) {+ this.page++;+ this.renderGrid();+ }+ });++ backdrop+ .querySelector("#pca-apply-btn")+ .addEventListener("click", () => this.applyAndClose());+ }++ renderTabs() {+ const tabsEl = this.backdrop.querySelector("#pca-tabs");+ tabsEl.innerHTML = "";+ Object.values(LIBRARIES).forEach((libCfg) => {+ const btn = document.createElement("button");+ btn.className = `pca-tab-btn ${this.activeLib === libCfg.key ? "active" : ""}`;+ btn.textContent = libCfg.label;+ btn.addEventListener("click", () => this.switchLibrary(libCfg.key));+ tabsEl.appendChild(btn);+ });+ }++ async switchLibrary(lib) {+ this.activeLib = lib;+ this.primaryFilter = "";+ this.secondaryFilter = "";+ this.page = 1;+ this.renderTabs();++ const gridEl = this.backdrop.querySelector("#pca-grid");+ gridEl.innerHTML = `<div style="padding:40px;color:#9ca3af;">正在加载 ${LIBRARIES[lib].label}...</div>`;++ await fetchCatalogue(lib);+ this.populateFilters();+ this.renderGrid();+ this.renderFooterSlots();+ }++ populateFilters() {+ const items = catalogueCache[this.activeLib] || [];+ const cfg = LIBRARIES[this.activeLib];++ const primarySet = new Set();+ const secondarySet = new Set();+ items.forEach((it) => {+ if (cfg.primaryField && it[cfg.primaryField]) {+ primarySet.add(it[cfg.primaryField]);+ }+ if (cfg.secondaryField && it[cfg.secondaryField]) {+ secondarySet.add(it[cfg.secondaryField]);+ }+ });++ const pSelect = this.backdrop.querySelector("#pca-filter-primary");+ pSelect.innerHTML = `<option value="">${cfg.primaryPlaceholder}</option>`;+ Array.from(primarySet).forEach((val) => {+ const opt = document.createElement("option");+ opt.value = val;+ opt.textContent = val;+ pSelect.appendChild(opt);+ });++ const sSelect = this.backdrop.querySelector("#pca-filter-secondary");+ if (!cfg.secondaryField) {+ sSelect.style.display = "none";+ } else {+ sSelect.style.display = "";+ sSelect.innerHTML = `<option value="">${cfg.secondaryPlaceholder}</option>`;+ Array.from(secondarySet).forEach((val) => {+ const opt = document.createElement("option");+ opt.value = val;+ opt.textContent = val;+ sSelect.appendChild(opt);+ });+ }+ }++ getFilteredItems() {+ const items = catalogueCache[this.activeLib] || [];+ const cfg = LIBRARIES[this.activeLib];+ const q = this.searchQuery;++ return items.filter((it) => {+ if (+ this.primaryFilter &&+ cfg.primaryField &&+ it[cfg.primaryField] !== this.primaryFilter+ ) {+ return false;+ }+ if (+ this.secondaryFilter &&+ cfg.secondaryField &&+ it[cfg.secondaryField] !== this.secondaryFilter+ ) {+ return false;+ }+ if (q) {+ const title = getItemTitle(this.activeLib, it);+ const hay =+ `${it.id || ""} ${title} ${it["检索"] || ""} ${it["分类"] || ""}`.toLowerCase();+ return hay.includes(q);+ }+ return true;+ });+ }++ renderGrid() {+ const filtered = this.getFilteredItems();+ const totalPages = Math.max(1, Math.ceil(filtered.length / PAGE_SIZE));+ if (this.page > totalPages) this.page = totalPages;++ const start = (this.page - 1) * PAGE_SIZE;+ const slice = filtered.slice(start, start + PAGE_SIZE);++ const pageInfo = this.backdrop.querySelector("#pca-page-info");+ pageInfo.textContent = `第 ${this.page} / ${totalPages} 页(共 ${filtered.length} 项)`;++ const gridEl = this.backdrop.querySelector("#pca-grid");+ gridEl.innerHTML = "";++ const selectedId = this.recipeSelection[this.activeLib];+ const cfg = LIBRARIES[this.activeLib];++ slice.forEach((item) => {+ const card = document.createElement("div");+ card.className = `pca-card ${item.id === selectedId ? "selected" : ""}`;+ const title = getItemTitle(this.activeLib, item);+ const badge =+ (cfg.secondaryField && item[cfg.secondaryField]) ||+ item[cfg.primaryField] ||+ "";+ const subText =+ (item[cfg.primaryField] || "") ++ (cfg.secondaryField && item[cfg.secondaryField]+ ? ` · ${item[cfg.secondaryField]}`+ : "");++ card.innerHTML = `+ <div class="pca-card-img-wrap">+ <img class="pca-card-img" loading="lazy" src="${getThumbUrl(this.activeLib, item.id, item["缩略图"])}" alt="${title}" />+ <span class="pca-card-id">#${item.id}</span>+ ${badge ? `<span class="pca-card-badge">${badge}</span>` : ""}+ </div>+ <div class="pca-card-meta">+ <div class="pca-card-title" title="${title}">${title}</div>+ <div class="pca-card-sub">${subText}</div>+ </div>+ `;++ card.addEventListener("click", () => {+ this.recipeSelection[this.activeLib] = item.id;+ if (this.mode === "single") {+ this.applyAndClose();+ } else {+ this.renderGrid();+ this.renderFooterSlots();+ }+ });++ gridEl.appendChild(card);+ });+ }++ renderFooterSlots() {+ const slotsEl = this.backdrop.querySelector("#pca-recipe-slots");+ slotsEl.innerHTML = "";+ ["portrait", "costume", "pose"].forEach((libKey) => {+ const id = this.recipeSelection[libKey];+ const pill = document.createElement("div");+ pill.className = `pca-slot-pill ${this.activeLib === libKey ? "active" : ""}`;+ pill.innerHTML = `+ <img src="${getThumbUrl(libKey, id)}" alt="${id}" />+ <div>+ <div style="font-weight:600;color:#fff;">${LIBRARIES[libKey].shortLabel}</div>+ <div style="color:#9ca3af;font-family:monospace;">#${id}</div>+ </div>+ `;+ pill.addEventListener("click", () => this.switchLibrary(libKey));+ slotsEl.appendChild(pill);+ });+ }++ pickRandom() {+ const filtered = this.getFilteredItems();+ if (!filtered.length) return;+ const rand = filtered[Math.floor(Math.random() * filtered.length)];+ this.recipeSelection[this.activeLib] = rand.id;+ this.renderGrid();+ this.renderFooterSlots();+ if (this.mode === "single") {+ this.applyAndClose();+ }+ }++ applyAndClose() {+ if (this.targetNode) {+ if (this.mode === "recipe") {+ setWidgetValue(+ this.targetNode,+ "portrait_id",+ this.recipeSelection.portrait+ );+ setWidgetValue(+ this.targetNode,+ "costume_id",+ this.recipeSelection.costume+ );+ setWidgetValue(this.targetNode, "pose_id", this.recipeSelection.pose);+ } else {+ setWidgetValue(+ this.targetNode,+ "image_id",+ this.recipeSelection[this.activeLib]+ );+ }+ if (typeof this.targetNode.pcaRefreshPreview === "function") {+ this.targetNode.pcaRefreshPreview();+ }+ } else if (window.LiteGraph) {+ const node = window.LiteGraph.createNode("CharacterRecipeNode");+ if (node) {+ app.graph.add(node);+ node.pos = [200, 200];+ setWidgetValue(node, "portrait_id", this.recipeSelection.portrait);+ setWidgetValue(node, "costume_id", this.recipeSelection.costume);+ setWidgetValue(node, "pose_id", this.recipeSelection.pose);+ if (typeof node.pcaRefreshPreview === "function") {+ node.pcaRefreshPreview();+ }+ }+ }+ this.close();+ }+}++const modalInstance = new PoseAtlasModal();++function attachNodePreviewWidget(node, nodeKind) {+ injectStylesheet();+ const container = document.createElement("div");+ container.className = "pca-node-preview";++ const refresh = () => {+ container.innerHTML = "";+ if (nodeKind === "recipe") {+ const slots = [+ {+ lib: "portrait",+ label: "人像",+ val:+ findWidget(node, "portrait_id")?.value ||+ LIBRARIES.portrait.defaultId,+ },+ {+ lib: "costume",+ label: "服装",+ val:+ findWidget(node, "costume_id")?.value ||+ LIBRARIES.costume.defaultId,+ },+ {+ lib: "pose",+ label: "姿势",+ val: findWidget(node, "pose_id")?.value || LIBRARIES.pose.defaultId,+ },+ ];+ slots.forEach((s) => {+ const card = document.createElement("div");+ card.className = "pca-node-thumb-card";+ card.title = `点击更换${s.label}参考图`;+ card.innerHTML = `+ <img src="${getThumbUrl(s.lib, s.val)}" alt="${s.val}" />+ <div class="pca-node-thumb-label">${s.label} #${s.val}</div>+ `;+ card.addEventListener("click", () => {+ modalInstance.open({ node, initialLib: s.lib, mode: "recipe" });+ });+ container.appendChild(card);+ });+ } else {+ const id =+ findWidget(node, "image_id")?.value || LIBRARIES[nodeKind].defaultId;+ const card = document.createElement("div");+ card.className = "pca-node-thumb-card";+ card.title = "点击打开图库选图";+ card.innerHTML = `+ <img src="${getThumbUrl(nodeKind, id)}" alt="${id}" />+ <div class="pca-node-thumb-label">${LIBRARIES[nodeKind].shortLabel} #${id}</div>+ `;+ card.addEventListener("click", () => {+ modalInstance.open({ node, initialLib: nodeKind, mode: "single" });+ });+ container.appendChild(card);+ }+ };++ node.pcaRefreshPreview = refresh;++ if (typeof node.addDOMWidget === "function") {+ node.addDOMWidget("pca_preview", "preview", container, {+ serialize: false,+ hideOnZoom: false,+ });+ }++ ["image_id", "portrait_id", "costume_id", "pose_id"].forEach((wName) => {+ const w = findWidget(node, wName);+ if (w) {+ const origCb = w.callback;+ w.callback = function () {+ if (typeof origCb === "function") origCb.apply(this, arguments);+ refresh();+ };+ }+ });++ refresh();+}++app.registerExtension({+ name: "PoseCharacterAtlas.Gallery",+ async beforeRegisterNodeDef(nodeType, nodeData) {+ const nodeKind = NODE_LIB_MAP[nodeData.name];+ if (!nodeKind) return;++ const origOnNodeCreated = nodeType.prototype.onNodeCreated;+ nodeType.prototype.onNodeCreated = function () {+ const r = origOnNodeCreated+ ? origOnNodeCreated.apply(this, arguments)+ : undefined;++ const btnLabel =+ nodeKind === "recipe"+ ? "🎨 打开三合一选图器 (4,345张)"+ : `🖼️ 打开${LIBRARIES[nodeKind].shortLabel}图库选图`;++ this.addWidget("button", btnLabel, null, () => {+ modalInstance.open({+ node: this,+ initialLib: nodeKind === "recipe" ? "portrait" : nodeKind,+ mode: nodeKind === "recipe" ? "recipe" : "single",+ });+ });++ attachNodePreviewWidget(this, nodeKind);+ if (this.size && this.size[1] < 340) {+ this.setSize([Math.max(this.size[0], 310), 360]);+ }+ return r;+ };+ },+});diff --git a/comfyui_plugin/web/style.css b/comfyui_plugin/web/style.cssnew file mode 100644index 0000000..61b9fb4--- /dev/null+++ b/comfyui_plugin/web/style.css@@ -0,0 +1,324 @@+/* AI 角色三合一参考图集 ComfyUI 前端插件样式 */+.pca-modal-backdrop {+ position: fixed;+ inset: 0;+ z-index: 99999;+ background: rgba(9, 10, 15, 0.82);+ backdrop-filter: blur(8px);+ display: flex;+ align-items: center;+ justify-content: center;+ padding: 20px;+ font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "PingFang SC", "Microsoft YaHei", sans-serif;+ color: #f3f4f6;+}++.pca-modal {+ width: min(1280px, 96vw);+ height: min(860px, 92vh);+ background: #14161f;+ border: 1px solid rgba(255, 255, 255, 0.12);+ border-radius: 16px;+ box-shadow: 0 24px 72px rgba(0, 0, 0, 0.65);+ display: flex;+ flex-direction: column;+ overflow: hidden;+}++.pca-header {+ display: flex;+ align-items: center;+ justify-content: space-between;+ gap: 16px;+ padding: 14px 20px;+ background: #191c28;+ border-bottom: 1px solid rgba(255, 255, 255, 0.08);+}++.pca-title-group {+ display: flex;+ align-items: center;+ gap: 12px;+}++.pca-title {+ font-size: 16px;+ font-weight: 700;+ color: #ffffff;+ margin: 0;+}++.pca-subtitle {+ font-size: 12px;+ color: #9ca3af;+}++.pca-tabs {+ display: flex;+ gap: 8px;+}++.pca-tab-btn {+ padding: 7px 14px;+ border-radius: 9px;+ border: 1px solid rgba(255, 255, 255, 0.1);+ background: rgba(255, 255, 255, 0.04);+ color: #d1d5db;+ font-size: 13px;+ font-weight: 600;+ cursor: pointer;+ transition: all 0.15s ease;+}++.pca-tab-btn:hover {+ background: rgba(255, 255, 255, 0.1);+ color: #fff;+}++.pca-tab-btn.active {+ background: linear-gradient(135deg, #6366f1, #8b5cf6);+ border-color: rgba(139, 92, 246, 0.7);+ color: #fff;+}++.pca-toolbar {+ display: flex;+ flex-wrap: wrap;+ align-items: center;+ gap: 10px;+ padding: 12px 20px;+ background: #161924;+ border-bottom: 1px solid rgba(255, 255, 255, 0.07);+}++.pca-search-input {+ flex: 1;+ min-width: 220px;+ padding: 8px 12px;+ border-radius: 8px;+ border: 1px solid rgba(255, 255, 255, 0.14);+ background: #0f1119;+ color: #f9fafb;+ font-size: 13px;+ outline: none;+}++.pca-search-input:focus {+ border-color: #8b5cf6;+}++.pca-select {+ padding: 8px 10px;+ border-radius: 8px;+ border: 1px solid rgba(255, 255, 255, 0.14);+ background: #0f1119;+ color: #f3f4f6;+ font-size: 12px;+ outline: none;+}++.pca-btn {+ padding: 7px 13px;+ border-radius: 8px;+ border: 1px solid rgba(255, 255, 255, 0.14);+ background: rgba(255, 255, 255, 0.06);+ color: #f3f4f6;+ font-size: 12px;+ font-weight: 600;+ cursor: pointer;+ transition: all 0.15s ease;+}++.pca-btn:hover {+ background: rgba(255, 255, 255, 0.14);+}++.pca-btn-primary {+ background: linear-gradient(135deg, #6366f1, #8b5cf6);+ border-color: transparent;+ color: #ffffff;+}++.pca-btn-primary:hover {+ filter: brightness(1.08);+}++.pca-grid-wrap {+ flex: 1;+ overflow-y: auto;+ padding: 16px 20px;+}++.pca-grid {+ display: grid;+ grid-template-columns: repeat(auto-fill, minmax(158px, 1fr));+ gap: 12px;+}++.pca-card {+ background: #1c202e;+ border: 1px solid rgba(255, 255, 255, 0.08);+ border-radius: 10px;+ overflow: hidden;+ cursor: pointer;+ transition: transform 0.14s ease, border-color 0.14s ease;+ display: flex;+ flex-direction: column;+}++.pca-card:hover {+ transform: translateY(-2px);+ border-color: rgba(139, 92, 246, 0.65);+}++.pca-card.selected {+ border: 2px solid #8b5cf6;+ box-shadow: 0 0 0 3px rgba(139, 92, 246, 0.25);+}++.pca-card-img-wrap {+ aspect-ratio: 4 / 5;+ background: #0f1118;+ position: relative;+ overflow: hidden;+}++.pca-card-img {+ width: 100%;+ height: 100%;+ object-fit: cover;+ display: block;+}++.pca-card-id {+ position: absolute;+ top: 6px;+ left: 6px;+ padding: 2px 6px;+ border-radius: 5px;+ background: rgba(0, 0, 0, 0.68);+ color: #e5e7eb;+ font-size: 10px;+ font-family: monospace;+}++.pca-card-badge {+ position: absolute;+ bottom: 6px;+ right: 6px;+ padding: 2px 6px;+ border-radius: 5px;+ background: rgba(99, 102, 241, 0.85);+ color: #fff;+ font-size: 10px;+}++.pca-card-meta {+ padding: 8px 10px;+}++.pca-card-title {+ font-size: 12px;+ font-weight: 600;+ color: #f3f4f6;+ white-space: nowrap;+ overflow: hidden;+ text-overflow: ellipsis;+}++.pca-card-sub {+ font-size: 11px;+ color: #9ca3af;+ margin-top: 2px;+ white-space: nowrap;+ overflow: hidden;+ text-overflow: ellipsis;+}++.pca-footer {+ display: flex;+ align-items: center;+ justify-content: space-between;+ gap: 12px;+ padding: 12px 20px;+ background: #191c28;+ border-top: 1px solid rgba(255, 255, 255, 0.08);+}++.pca-recipe-slots {+ display: flex;+ align-items: center;+ gap: 10px;+}++.pca-slot-pill {+ display: flex;+ align-items: center;+ gap: 8px;+ padding: 5px 10px;+ border-radius: 8px;+ background: #11131c;+ border: 1px solid rgba(255, 255, 255, 0.1);+ font-size: 12px;+ cursor: pointer;+}++.pca-slot-pill.active {+ border-color: #8b5cf6;+ background: rgba(139, 92, 246, 0.14);+}++.pca-slot-pill img {+ width: 26px;+ height: 32px;+ object-fit: cover;+ border-radius: 4px;+}++/* 节点内缩略图预览组件 */+.pca-node-preview {+ display: flex;+ gap: 6px;+ padding: 6px;+ background: rgba(15, 17, 25, 0.85);+ border: 1px solid rgba(255, 255, 255, 0.1);+ border-radius: 8px;+ margin-top: 4px;+ box-sizing: border-box;+}++.pca-node-thumb-card {+ flex: 1;+ display: flex;+ flex-direction: column;+ align-items: center;+ background: #181b26;+ border-radius: 6px;+ padding: 4px;+ cursor: pointer;+ border: 1px solid transparent;+ transition: border-color 0.15s ease;+}++.pca-node-thumb-card:hover {+ border-color: #8b5cf6;+}++.pca-node-thumb-card img {+ width: 100%;+ height: 112px;+ object-fit: contain;+ border-radius: 4px;+ background: #0d0f15;+}++.pca-node-thumb-label {+ font-size: 10px;+ color: #d1d5db;+ margin-top: 4px;+ text-align: center;+ white-space: nowrap;+ overflow: hidden;+ text-overflow: ellipsis;+ width: 100%;+}