Skip to content

中文版 AI 姿势参考图库 · 1439 组 / 2878 张图片 / 完整汉化 · 零依赖静态画廊

Merge branch 'pr-38' into test-all-prs

Alone883e3885ff8787
diff --cc .gitattributes
index 76787ad,ae44749..8ad800a
--- a/.gitattributes
+++ b/.gitattributes
@@@ -1,2 -1,4 +1,5 @@@
data/charadb/*.json text eol=lf
+data/gia-anime/costume-anime.json -text
+ data/shisei/costumes.json -text
+ data/shisei/LICENSE-images -text
+ data/shisei/NOTICE -text
diff --cc comfyui_plugin/routes.py
index 179a5d1,18049a0..1481d4d
--- a/comfyui_plugin/routes.py
+++ b/comfyui_plugin/routes.py
@@@ -35,7 -35,7 +35,7 @@@ def load_library(lib: str) -> list[dict
with open(fp, encoding="utf-8") as f:
_CACHE[lib] = json.load(f)
if lib == "costume":
- for name in ("costume-anime-zh.json", "costume-gia-anime-zh.json"):
- for name in ("costume-anime-zh.json", "costume-shisei-zh.json"):
++ for name in ("costume-anime-zh.json", "costume-gia-anime-zh.json", "costume-shisei-zh.json"):
with open(DATA_DIR / name, encoding="utf-8") as f:
_CACHE[lib] += json.load(f)
return _CACHE[lib]
@@@ -47,14 -47,26 +47,26 @@@ def find_item(lib: str, item_id: str) -
for it in items:
if it.get("id") == clean_id:
return it
- if clean_id.startswith(("charadb-", "gia-anime-")):
- if clean_id.startswith(("charadb-", "shisei-")):
++ if clean_id.startswith(("charadb-", "gia-anime-", "shisei-")):
raise ValueError("未知外部来源服装 ID")
return items[0]
+ def select_costume_view(item: dict, view: str = "front") -> dict:
+ views = item.get("views", [])
+ if not views:
+ return item
+ selected = next((v for v in views if v["id"] == view), None)
+ if selected is None:
+ if view != "front":
+ raise ValueError(f"服装没有该视角: {view}")
+ selected = views[0]
+ return dict(item, selectedView=selected["id"], **{k: selected[k] for k in ("缩略图", "预览图", "原图")})
+
+
class _NoRedirect(urllib.request.HTTPRedirectHandler):
def redirect_request(self, req, fp, code, msg, headers, newurl):
- raise ValueError("CharaDB 图片地址不允许重定向")
+ raise ValueError("远程图片地址不允许重定向")
def open_reference_image(rel_path: str):
diff --cc comfyui_plugin/web/extension.js
index ea98d48,3f3f4d2..cfb2e5f
--- a/comfyui_plugin/web/extension.js
+++ b/comfyui_plugin/web/extension.js
@@@ -15,7 -15,7 +15,7 @@@ const LIBRARIES =
},
costume: {
key: "costume",
- label: "服装库 (3,167)",
- label: "服装库 (1,904)",
++ label: "服装库 (3,224)",
shortLabel: "服装",
defaultId: "SPR-0001",
titleField: "服装名称",
@@@ -70,8 -70,8 +70,9 @@@ async function fetchCatalogue(lib)
}
function getThumbUrl(lib, id, relPath, useDepth = false) {
+ if (!relPath && lib === "costume") relPath = catalogueCache.costume?.find((r) => r.id === id)?.缩略图;
if (lib === "costume" && /^charadb-O\d{3}$/.test(id)) return `https://charadb-2fi.pages.dev/thumb/${id.slice(8)}.webp`;
+ if (lib === "costume" && relPath?.startsWith("https://ai-costume-anime-gallery.pages.dev/")) return relPath;
const depthParam = lib === "pose" && useDepth ? "&depth=1" : "";
if (relPath) {
return `/pose_character_atlas/image?path=${encodeURIComponent(relPath)}${depthParam}`;
@@@ -125,8 -125,9 +126,9 @@@ class PoseAtlasModal
this.searchQuery = "";
this.primaryFilter = "";
this.secondaryFilter = "";
- this.page = 1;
this.sourceFilter = "";
+ this.page = 1;
+ this.costumeView = "front";
this.recipeSelection = {
portrait: LIBRARIES.portrait.defaultId,
costume: LIBRARIES.costume.defaultId,
@@@ -184,7 -186,7 +187,7 @@@
<div class="pca-title-group">
<div>
<h3 class="pca-title">AI 角色三合一参考图集 (ComfyUI 选图器)</h3>
- <div class="pca-subtitle">6,105 条中文参考索引 · 二次元图片需联网 · <a href="https://github.com/taki-ttt/charadb/blob/main/LICENSE" target="_blank" rel="noopener noreferrer">CharaDB来源条款</a></div>
- <div class="pca-subtitle">4,842 条中文参考索引 · Shisei / wquguru CC0 · 二次元图片需联网 · <a href="https://github.com/taki-ttt/charadb/blob/main/LICENSE" target="_blank" rel="noopener noreferrer">CharaDB来源条款</a></div>
++ <div class="pca-subtitle">6,162 条中文参考索引 · Shisei / wquguru CC0 · 二次元图片需联网 · <a href="https://github.com/taki-ttt/charadb/blob/main/LICENSE" target="_blank" rel="noopener noreferrer">CharaDB来源条款</a></div>
</div>
</div>
<div class="pca-tabs" id="pca-tabs"></div>
@@@ -194,7 -196,7 +197,7 @@@
<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>
- <select class="pca-select" aria-label="服装来源" id="pca-filter-source"><option value="">全部来源</option><option value="gia">ギア · 写实</option><option value="gia-anime">ギア · 动漫</option><option value="charadb">CharaDB</option></select>
- <select class="pca-select" aria-label="服装来源" id="pca-filter-source"><option value="">全部来源</option><option value="gia">ギア · 写实</option><option value="charadb">CharaDB</option><option value="shisei">Shisei · 中国历代</option></select>
++ <select class="pca-select" aria-label="服装来源" id="pca-filter-source"><option value="">全部来源</option><option value="gia">ギア · 写实</option><option value="gia-anime">ギア · 动漫</option><option value="charadb">CharaDB</option><option value="shisei">Shisei · 中国历代</option></select>
<button class="pca-btn" id="pca-depth-btn">${this.useDepth ? "🌗 深度图 (Depth)" : "🗿 素体白模"}</button>
<button class="pca-btn" id="pca-sfw-btn">${this.safeMode ? "🛡️ 安全模式 (SFW)" : "🔞 18+ 完整模式"}</button>
<button class="pca-btn" id="pca-random-btn">🎲 随机抽一张</button>
diff --cc src/api/gallery.ts
index bb4bf4d,750d281..be09065
--- a/src/api/gallery.ts
+++ b/src/api/gallery.ts
@@@ -89,7 -89,7 +89,7 @@@ export const costumesQuery = queryOptio
queryKey: ['gallery', 'costumes'],
staleTime: Infinity,
queryFn: async () => {
- const lists = await Promise.all(['/data/costume-zh.json', '/data/costume-anime-zh.json', '/data/costume-gia-anime-zh.json'].map(async (url) => {
- const lists = await Promise.all(['/data/costume-zh.json', '/data/costume-anime-zh.json', '/data/costume-shisei-zh.json'].map(async (url) => {
++ const lists = await Promise.all(['/data/costume-zh.json', '/data/costume-anime-zh.json', '/data/costume-gia-anime-zh.json', '/data/costume-shisei-zh.json'].map(async (url) => {
const res = await fetch(url)
if (!res.ok) throw new Error(`加载服装数据失败: HTTP ${res.status}`)
return (await res.json()) as CostumeItem[]
diff --cc src/lib/costumeSources.ts
index 719eab8,d43df44..2c2bea1
--- a/src/lib/costumeSources.ts
+++ b/src/lib/costumeSources.ts
@@@ -1,9 -1,17 +1,18 @@@
import type { CostumeItem } from '@/types/gallery'
+ const SHISEI_REPOSITORY = 'https://github.com/wquguru/shisei'
+ const SHISEI_REVISION = '8f61ceab10e45f8d3afd254900903733a0ba76ee'
+ export const SHISEI_SOURCE_URLS = {
+ repository: SHISEI_REPOSITORY,
+ catalog: `${SHISEI_REPOSITORY}/blob/${SHISEI_REVISION}/data/costumes.json`,
+ license: `${SHISEI_REPOSITORY}/blob/${SHISEI_REVISION}/LICENSE-images`,
+ }
+
export const COSTUME_SOURCES = [
{ id: 'gia', label: 'ギア · 写实', url: 'https://ai-costume-gallery.pages.dev/', notice: 'ギア(@giaaibusi)AI 服装参考。' },
+ { id: 'gia-anime', label: 'ギア · 动漫', url: 'https://ai-costume-anime-gallery.pages.dev/', notice: '仅收录元数据,图片由ギア原站提供;使用请遵守原站说明。' },
{ id: 'charadb', label: 'たき AI · CharaDB', url: 'https://github.com/taki-ttt/charadb/blob/main/LICENSE', notice: '仅供参考,须遵守原作者限制;请阅读来源条款。' },
+ { id: 'shisei', label: 'Shisei · 中国历代', url: 'https://github.com/wquguru/shisei', notice: 'wquguru 的 AI 生成服装参考,CC0;标注来源。并非专业历史服饰复原。' },
] as const
export function costumeSourceId(item: CostumeItem): string {
diff --cc src/routes/costumes.tsx
index db2b8fb,fcf4a6c..3b0afe5
--- a/src/routes/costumes.tsx
+++ b/src/routes/costumes.tsx
@@@ -25,10 -25,9 +25,10 @@@ import { Select, SelectContent, SelectI
import { Skeleton } from '@/components/ui/skeleton'
import { cn } from '@/lib/utils'
import { referenceImageUrl } from '@/lib/recipeImages'
- import { COSTUME_SOURCES, costumeSourceId } from '@/lib/costumeSources'
+ import { COSTUME_SOURCES, SHISEI_SOURCE_URLS, costumeSourceId, selectCostumeView } from '@/lib/costumeSources'
import { CHARADB_NOTICE_URL } from '@/lib/charadb'
import { useStudio } from '@/store/studioStore'
+import type { CostumeItem } from '@/types/gallery'
export const Route = createFileRoute('/costumes')({
staticData: { title: '服装穿搭库' },
@@@ -372,9 -389,9 +383,9 @@@ function CostumesPage()
</a>
</Button>
<Button variant="outline" size="sm" asChild>
- <a href={currentItem.来源地址 || referenceImageUrl(currentItem.原图)} target="_blank" rel="noopener noreferrer">
+ <a href={currentItem.source === 'shisei' ? referenceImageUrl(currentItem.原图) : currentItem.来源地址 || referenceImageUrl(currentItem.原图)} target="_blank" rel="noopener noreferrer">
<ExternalLinkIcon className="size-3.5" />
- {currentItem.source === 'charadb' ? '原作者站点' : '新窗口原图'}
+ {['charadb', 'gia-anime'].includes(currentItem.source || '') ? '原作者站点' : '新窗口原图'}
</a>
</Button>
</div>
diff --cc src/routes/studio.tsx
index e67a838,ad7f3e8..d5b69b4
--- a/src/routes/studio.tsx
+++ b/src/routes/studio.tsx
@@@ -59,7 -57,7 +59,8 @@@ import
} from '@/services/aiGenerator'
import { poseImagePath, poseThumbPath, referenceImageUrl, uploadedReferences } from '@/lib/recipeImages'
import { useStudio } from '@/store/studioStore'
+import type { RandomScope, ReferenceSlot } from '@/lib/randomRecipe'
+ import { selectCostumeView } from '@/lib/costumeSources'
import type {
ComfyUiParams,
DoubaoParams,
@@@ -119,8 -113,7 +120,9 @@@ function StudioPage()
const slotInputRef = useRef<HTMLInputElement | null>(null)
const uploadSlotRef = useRef<'portrait' | 'costume' | 'pose'>('portrait')
const [uploadingSlot, setUploadingSlot] = useState<string | null>(null)
+ const [randomizingSlot, setRandomizingSlot] = useState<ReferenceSlot | null>(null)
+ const [randomScopes, setRandomScopes] = useState<Record<ReferenceSlot, RandomScope>>({ portrait: 'similar', costume: 'similar', pose: 'similar' })
+ const costumeViews = recipe.costume?.views?.filter((view) => view.原图 && view.缩略图) || []
const [showReferenceErrors, setShowReferenceErrors] = useState(false)
const referenceErrorsRef = useRef<HTMLDivElement | null>(null)
@@@ -562,6 -529,16 +564,16 @@@
<div className="line-clamp-2 text-xs font-medium leading-snug" title={recipe.costume.服装名称}>
{recipe.costume.服装名称}
</div>
+ {costumeViews.length > 0 && <Select
+ value={costumeViews.find((view) => view.id === recipe.costume?.selectedView)?.id || costumeViews.find((view) => view.id === 'front')?.id || costumeViews[0].id}
- disabled={uploadingSlot !== null}
++ disabled={uploadingSlot !== null || randomizingSlot !== null}
+ onValueChange={(value) => {
- if (recipe.costume && uploadingSlot === null) setCostume(selectCostumeView(recipe.costume, value))
++ if (recipe.costume && uploadingSlot === null && randomizingSlot === null) setCostume(selectCostumeView(recipe.costume, value))
+ }}
+ >
+ <SelectTrigger aria-label="已选服装视角" className="h-8 w-full text-xs"><SelectValue /></SelectTrigger>
+ <SelectContent>{costumeViews.map((view) => <SelectItem key={view.id} value={view.id}>{view.label}</SelectItem>)}</SelectContent>
+ </Select>}
</div>
</>
) : (
diff --cc src/types/gallery.ts
index 14bd16d,2b11033..5f1d1c3
--- a/src/types/gallery.ts
+++ b/src/types/gallery.ts
@@@ -24,8 -24,18 +24,18 @@@ export interface PoseGroup
order: PoseItem[]
}
+ export interface CostumeView {
+ id: string
+ label: string
+ 缩略图: string
+ 预览图: string
+ 原图: string
+ }
+
export interface CostumeItem {
- source?: 'upload' | 'charadb' | 'gia-anime'
- source?: 'upload' | 'charadb' | 'shisei'
++ source?: 'upload' | 'charadb' | 'gia-anime' | 'shisei'
+ views?: CostumeView[]
+ selectedView?: string
一级分类?: '现实' | '二次元'
来源?: string
来源地址?: string