Files
seaislee1209andClaude Opus 4.8 44e90233ff feat(models): 期1 模特库地基 — Model 顶级实体 + 模特库页 + 审核范围扩展
后端:
- 新增 Model(模特)团队级实体:形象图+三视图+声线(声线尾期),官方模板标签,软删
- Asset.Category 枚举一次加全(model_portrait/tri_view/voice/model_tryon/platform_kit/free_create/storyboard),逐期接线
- 送审范围 person → REVIEW_CATEGORIES{person,tri_view,storyboard}(review.py + adminpanel 队列),图片趴不送审;当前行为不变(forward-compat)
- /api/models/ ModelLibraryViewSet:本团队∪官方模板、官方/我的 tab、真人上传、软删(官方不可删)、跨团队资产引用防越权
- backfill_models 命令把历史成套模特(kind=model + 项目流命名配对)归集成 Model,dry-run 默认

前端:
- 左菜单新增「模特库」顶级入口(person 图标)+ 路由 /models
- 模特库页:全部/官方模板/我的模特 tab + 真人上传 + 模特卡(形象图+三视图缩略+官方标签),仅用 design token

测试:assets 10/10 绿;tsc+build 全绿;无头走查 0 console error(全部5/官方3/我的2,官方标签达标)
基线既有 7 失败(ai/projects provider mock 漂移)零新增

Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
2026-06-20 22:53:46 +08:00

55 lines
2.5 KiB
JavaScript

// 期1 模特库走查:登录 → /models → 断言卡片/官方标签/tab,逐态截图,抓 console/pageerror。
import { chromium } from "playwright";
import fs from "node:fs";
import path from "node:path";
const BASE = process.env.BASE || "http://localhost:5188";
const OUT = path.resolve("../../../_qa_shots/models-p1");
fs.mkdirSync(OUT, { recursive: true });
const browser = await chromium.launch({ headless: true });
const r = { consoleErrors: [], steps: {} };
const ctx = await browser.newContext({ viewport: { width: 1440, height: 900 } });
const p = await ctx.newPage();
p.on("console", (m) => { if (m.type() === "error") r.consoleErrors.push(m.text()); });
p.on("pageerror", (e) => r.consoleErrors.push("PAGEERR:" + e.message));
// 登录
await p.goto(BASE + "/login", { waitUntil: "load" });
await p.waitForTimeout(400);
await p.fill("#auth-username", "airshelf");
await p.fill("#auth-pwd", "Restraint2026");
await p.click("button.btn-cta");
await p.waitForFunction(() => !location.pathname.startsWith("/login"), { timeout: 12000 });
// 左菜单是否有「模特库」入口
r.steps.navHasModels = await p.locator("nav a, aside a, .sidebar a, button").filter({ hasText: "模特库" }).count();
// 进模特库
await p.goto(BASE + "/models", { waitUntil: "load" });
await p.waitForTimeout(2800);
r.steps.h1 = await p.locator("h1").first().innerText().catch(() => "");
r.steps.tabCount = await p.locator(".tabs .tab").count();
r.steps.cardCountAll = await p.locator(".model-card").count();
r.steps.officialPill = await p.locator(".model-official").count();
r.steps.triviewThumbs = await p.locator(".model-triview").count();
r.steps.uploadBtn = await p.locator(".actions button", { hasText: /上传/ }).count();
await p.screenshot({ path: path.join(OUT, "models-all.png"), fullPage: true });
// 官方模板 tab
await p.locator(".tabs .tab", { hasText: "官方模板" }).click();
await p.waitForTimeout(2200);
r.steps.cardCountOfficial = await p.locator(".model-card").count();
r.steps.officialPillInTab = await p.locator(".model-official").count();
await p.screenshot({ path: path.join(OUT, "models-official.png"), fullPage: true });
// 我的模特 tab
await p.locator(".tabs .tab", { hasText: "我的模特" }).click();
await p.waitForTimeout(2200);
r.steps.cardCountMine = await p.locator(".model-card").count();
await p.screenshot({ path: path.join(OUT, "models-mine.png"), fullPage: true });
await browser.close();
console.log(JSON.stringify(r, null, 2));
fs.writeFileSync(path.join(OUT, "summary.json"), JSON.stringify(r, null, 2));