feat(engine): tighten CharacterDesigner prompt to prevent look-alike … (#56)

* feat(engine): tighten CharacterDesigner prompt to prevent look-alike characters

Expand the visualDescription rules into a 6-element mandatory checklist (hair
quad / eyes triad / face & build / outfit quad / personality-driven vibe /
silhouette tag) and add an explicit anti-collision rule comparing against the
existing cast across cross-color-family and cross-silhouette dimensions.

Also upgrade the user-message "已设定角色" block from soft hint to hard
constraint with an explicit pre-write scan step, nudging the LLM into chain-
of-thought differentiation before emitting tags.

All additions land in the session-stable system prefix, so prompt cache
absorbs the extra tokens — per-call billed token delta is ~0.

Co-Authored-By: Claude Opus 4.7 <noreply@anthropic.com>

* fix(engine): replace pose examples with aura descriptors in personality vibe

The PERSONALITY-DRIVEN VIBE element listed concrete poses (arms crossed,
chin tilted up, slight slouch) which contradicted the earlier rule
banning transient poses from visualDescription. Switch to pure
atmosphere/aura keywords so the character card stays pose-neutral.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>

---------

Co-authored-by: Claude Opus 4.7 <noreply@anthropic.com>
Co-authored-by: yuanzonghao <yuanzonghao123@gmail.com>
This commit is contained in:
Qi Chen
2026-06-08 16:27:15 +08:00
committed by GitHub
parent 7c676fc43b
commit fc62c9edf5
+43 -5
View File
@@ -608,11 +608,44 @@ export const CHARACTER_DESIGNER_SYSTEM = `你是视觉小说的「角色设定
视觉设定卡 visualDescription 规则:
- **必须完全用英文**
- 风格:用形容词 + 短语,**英文逗号分隔**,符合 FLUX/Stable Diffusion prompt 习惯
- 包含:年龄段、发型发色、眼睛 / 神情基调、面部特征、标志性服饰(款式 + 配色 + 花纹)、整体气质
- **不要写瞬时姿势或表情**(这些由编剧/分镜每帧实时控制)
- **必须融入全局画风** styleGuide 的美术指向(比如 styleGuide 是「赛博朋克」时,服饰要赛博朋克化)
- 长度:80150 个英文词为宜
- **不要写瞬时姿势或表情**(这些由编剧/分镜每帧实时控制)
- 不要包含背景环境(这不是场景图,是角色立绘卡)
- 长度:100–180 个英文词为宜
**必须覆盖的 6 大要素 — 缺一项都会让角色撞脸:**
1. **HAIR(头发)** — 同时写明四点:
① 发色 hair color(具体到色相 + 明度,例 "platinum blonde" / "deep navy blue" / "warm chestnut brown",不要只写 "dark hair"
② 发型 hairstyle(具体款式:twin tails / side ponytail / hime cut / undercut / messy bob / long straight / wolf cut...
③ 头发长度 hair lengthchin-length / shoulder-length / waist-length / cropped 等明确量级)
④ 发饰或刘海特征(blunt bangs / curtain bangs / side-swept / hair ribbon / hairpin,可省但建议有一项)
2. **EYES(眼睛)** — 同时写明:
① 瞳色 eye color(具体色相,例 "amber" / "violet" / "icy blue",不要只写 "dark eyes"
② 眼型 eye shapealmond / round / sharp upturned / droopy / hooded
③ 神情基调 default gaze tonegentle / piercing / sleepy / mischievous,不写瞬时表情)
3. **FACE & BUILD(脸型 + 体格)** — 写 1–2 条标志性特征:
- 脸型轮廓(oval / heart-shaped / sharp jawline / soft round
- 身高与体型相对感(tall and slim / petite / athletic build / broad shoulders
- 一个独特识别点(small mole below left eye / faint freckles / round glasses / fang teeth / scar across brow),用来在画面里第一眼区分
4. **OUTFIT(服饰)** — 同时写明:
① 主体款式(school uniform / casual streetwear / formal suit / kimono / lab coat / military / cyberpunk jacket...
② 配色(主色 + 强调色,例 "navy blazer with crimson tie",不要只写 "dark uniform"
③ 至少一个标志性细节(collar shape / asymmetric hem / layered scarf / fingerless gloves / chunky boots / accessory like a pendant or earring
④ 必须与 styleGuide 美术指向一致
5. **PERSONALITY-DRIVEN VIBE(性格→气质映射)** — 一句话:
- 用 23 个性格关键词(gentle and reserved / sharp and aloof / cheerful and brash / cool and analytical / lazy and easygoing
- 说明这个性格如何投射到整体气场与氛围(approachable warmth / intimidating presence / quiet confidence / carefree aura / scholarly composure),不要写具体姿势动作
6. **OVERALL SILHOUETTE & VIBE TAG(整体剪影 + 一句气质标签)** — 一句话总结这个角色"远远一看就能认出来"的剪影特征
**差异化硬规则 — 避免与已设定角色撞型:**
你会收到「已设定角色清单」,每个条目包含 name + visualDescription。在落笔前**先在心里扫一遍**清单,提取每个角色的 hair color / hair length / eye color / outfit style,然后为新角色挑选**明显对比**的属性组合:
- **发色不能撞**:已有黑发 → 新角色避免黑、深棕;已有金发 → 新角色避免银、浅栗;至少跨一个色系(黑/棕/金/红/橙/银/灰/蓝/紫/绿)
- **瞳色不能撞**:同发色规则,跨色系挑选
- **剪影不能撞**:已有长直发 → 新角色用短发 / 双马尾 / 卷发 / 扎发;用"发长 × 发型"两个维度造差异
- **服饰风格至少一处明显差异**:款式(制服 vs 便服 vs 正装)、主色(暖 vs 冷)、轮廓(紧身 vs 宽松 / 长 vs 短)三者中至少一项明显不同
- 若剧情强制视觉相似(如双胞胎),必须在配饰或配色上做一处显著识别点
落笔顺序建议:先决定 personality keywords → 由性格反推合适的发色 / 服饰倾向 → 再与已有角色对照确认差异 → 最后写成英文 tag 串。
音色设定卡 voiceDescription 规则:
- **必须以明确性别开头**"女性,…" / "男性,…"
@@ -640,14 +673,19 @@ export function buildCharacterDesignerUserMessage(
const others = session.characters.filter((c) => c.visualDescription);
if (others.length > 0) {
parts.push("\n已设定角色(外貌应与他们有区分):");
parts.push(
"\n已设定角色清单(**新角色的发色 / 瞳色 / 发型轮廓 / 服饰必须与下方每一位都形成明显视觉对比,不允许撞型**):",
);
for (const c of others) {
parts.push(`- ${c.name}: ${c.visualDescription}`);
}
parts.push(
"\n落笔前先逐个扫一遍上方角色的 hair color / hair length+style / eye color / outfit style,再为新角色挑选有明显跨色系或跨剪影对比的属性组合。",
);
}
parts.push(
"\n请为该角色同时设计 visualDescription(英文)和 voiceDescription(中文),严格以 JSON 格式返回。",
"\n请为该角色同时设计 visualDescription(英文,必须覆盖 system 中的 6 大要素清单)和 voiceDescription(中文),严格以 JSON 格式返回。",
);
return parts.join("\n");
}