merge: appearance/motive 全栈穿线 (P1 流B)

This commit is contained in:
Yaojia Wang
2026-07-06 14:38:17 +02:00
13 changed files with 297 additions and 15 deletions

View File

@@ -12,7 +12,7 @@ JSONB **dict**`traits`/`arc`/`speech_tics``tags`/`relations` 才是 JSO
- `speech_tics: list[str]` → `{"items": [...]}`JSONB dict
- `arc: str` → `{"text": "..."}`JSONB dict
- `tags: list` / `relations: list[dict]` → 直落 JSONB list
- `name` / `role` / `backstory` → Text 列直落
- `name` / `role` / `appearance` / `motive` / `backstory` → Text 列直落
**提交边界**`create` 只 `flush()` 不 `commit()`——提交交端点事务(入库端点末尾一次
`commit()`,与网关 ledger 一并落库;与项目其它写侧 repo 一致,见 memory/gotchas
@@ -66,6 +66,8 @@ class CharacterWriteRepo(Protocol):
name: str,
role: str,
traits: list[str],
appearance: str,
motive: str,
backstory: str,
arc: str,
speech_tics: list[str],
@@ -91,6 +93,8 @@ class SqlCharacterWriteRepo:
name: str,
role: str,
traits: list[str],
appearance: str,
motive: str,
backstory: str,
arc: str,
speech_tics: list[str],
@@ -105,6 +109,8 @@ class SqlCharacterWriteRepo:
if existing is not None:
existing.role = role
existing.traits = _traits_to_jsonb(traits)
existing.appearance = appearance
existing.motive = motive
existing.backstory = backstory
existing.arc = _arc_to_jsonb(arc)
existing.speech_tics = _traits_to_jsonb(speech_tics)
@@ -118,6 +124,8 @@ class SqlCharacterWriteRepo:
name=name,
role=role,
traits=_traits_to_jsonb(traits),
appearance=appearance,
motive=motive,
backstory=backstory,
arc=_arc_to_jsonb(arc),
speech_tics=_traits_to_jsonb(speech_tics),
@@ -139,6 +147,8 @@ class CharacterWriteFields(BaseModel):
name: str
role: str
traits: list[str] = Field(default_factory=list)
appearance: str = ""
motive: str = ""
backstory: str
arc: str
speech_tics: list[str] = Field(default_factory=list)