feat: per-POV summary and edge summary update on scene close
This commit is contained in:
@@ -6,14 +6,19 @@ be reversed by emitting an inverse ``manual_edit`` later. This module
|
||||
applies the new value to the appropriate target table; the snapshot of
|
||||
``prior_value`` is taken by the route handler before this fires.
|
||||
|
||||
Phase 1 covers three target kinds:
|
||||
Phase 1 covers four target kinds:
|
||||
- ``edge_affinity`` and ``edge_trust`` — slider edits on a specific edge,
|
||||
clamped to 0..100.
|
||||
- ``memory_significance`` — dropdown edit, clamped to 0..3.
|
||||
- ``memory_pov_summary`` — textarea edit (string).
|
||||
- ``memory_pov_summary`` — textarea edit (string). Also reused by T27's
|
||||
scene-close pipeline to rewrite per-turn raw narratives into a proper
|
||||
per-POV scene summary.
|
||||
- ``edge_summary`` — string overwrite of the directed edge's ``summary``
|
||||
field. Driven by T27 from the classifier's ``relationship_summary``
|
||||
output combined with the prior summary.
|
||||
|
||||
Other §6.4 editable fields (activity verb / attention / posture, edge
|
||||
summary, knowledge_facts list manipulation) are deferred to Phase 1.5.
|
||||
Other §6.4 editable fields (activity verb / attention / posture,
|
||||
knowledge_facts list manipulation) are deferred to Phase 1.5.
|
||||
|
||||
Pin toggles intentionally use the existing ``memory_pin_changed`` event
|
||||
(registered in :mod:`chat.state.memory`) rather than ``manual_edit`` so
|
||||
@@ -69,5 +74,18 @@ def _apply_manual_edit(conn: Connection, e: Event) -> None:
|
||||
"UPDATE memories SET pov_summary = ? WHERE id = ?",
|
||||
(str(new_value), int(target_id)),
|
||||
)
|
||||
elif kind == "edge_summary":
|
||||
# ``target_id`` here is a {"source_id", "target_id"} pair like
|
||||
# the affinity/trust edits, since edges are keyed by the
|
||||
# directed pair, not a single rowid.
|
||||
conn.execute(
|
||||
"UPDATE edges SET summary = ? "
|
||||
"WHERE source_id = ? AND target_id = ?",
|
||||
(
|
||||
str(new_value),
|
||||
target_id["source_id"],
|
||||
target_id["target_id"],
|
||||
),
|
||||
)
|
||||
# Unknown target_kind: silently no-op for v1. Future kinds (activity
|
||||
# fields, edge summary, knowledge_facts) extend the dispatch above.
|
||||
# fields, knowledge_facts list manipulation) extend the dispatch above.
|
||||
|
||||
Reference in New Issue
Block a user