feat(web): 角色群像按定位配比生成(role_mix 缩减版)

- 契约: CharacterGenerateRequest 加 role_mix{定位:数量},model_validator 归一
  count=各值之和(每项≥1、总和≤12),缺省退回单一 role+count
- @llm: build_character_gen_context/run_character_gen 加 role_mix 参并注入配比块
  (确定性、无时间戳,守 assemble 纯函数);router 穿参
- character-gen.md 加"按配比严格分配 role"纪律 + regen prompt_hashes 金标准
- 前端: sanitizeRoleMix/roleMixTotal + buildCharacterGenerateRequest 第4参 +
  useCharacterGen 穿参 + RoleMixEditor + CharacterGenerator 单一/配比双模
This commit is contained in:
Yaojia Wang
2026-07-06 17:24:16 +02:00
parent 72b3c81146
commit 7babb4854b
16 changed files with 428 additions and 50 deletions

View File

@@ -997,6 +997,10 @@ export interface components {
/**
* CharacterGenerateRequest
* @description POST /projects/:id/characters/generate据需求生成角色卡预览群像防雷同
*
* `role_mix`(⑦ 群像按定位配比)与 `count` 的关系:`role_mix` 在场时 `count` 取各值之和
* (忽略客户端显式 count每项数量须 ≥ 1、总和须 ≤ `MAX_GENERATE_COUNT`;缺省则退回
* 单一 `role` + `count` 语义。
*/
CharacterGenerateRequest: {
/**
@@ -1006,7 +1010,7 @@ export interface components {
brief: string;
/**
* Count
* @description 生成数量
* @description 生成数量role_mix 在场时取各值之和)
* @default 1
*/
count: number;
@@ -1015,6 +1019,13 @@ export interface components {
* @description 角色定位(主角/CP/对手/导师/工具人 等)
*/
role?: string | null;
/**
* Role Mix
* @description 按定位配比生成 {定位: 数量};在场时 count=各值之和每项≥1、总和≤12
*/
role_mix?: {
[key: string]: number;
} | null;
};
/**
* CharacterIngestRequest