Populate CallRecord from new slim caller backgrounds
Replace the CallerBackground isinstance branching in _summarize_ai_call with direct reads from the new slim caller background dict (emotional_register, situation, specific_details). Decouples CallRecord population from caller_styles/caller_shapes so those fields can be deleted in a later commit. CallRecord schema preserved for backward-compat with existing session_checkpoint.json. topic_category, emotional_state, energy_level are now always empty strings (obsolete under slim architecture).
This commit is contained in:
+16
-18
@@ -8572,30 +8572,28 @@ async def _summarize_ai_call(caller_key: str, caller_name: str, conversation: li
|
|||||||
print(f"[AI Summary] Failed to generate summary: {e}")
|
print(f"[AI Summary] Failed to generate summary: {e}")
|
||||||
summary = f"{caller_name} called in."
|
summary = f"{caller_name} called in."
|
||||||
|
|
||||||
# Extract structured data from CallerBackground for inter-caller awareness
|
# Populate from slim caller background dict
|
||||||
bg = session.caller_backgrounds.get(caller_key)
|
bg = session.caller_backgrounds.get(caller_key) or {}
|
||||||
if isinstance(bg, CallerBackground):
|
if isinstance(bg, dict):
|
||||||
topic_cat = bg.pool_name
|
comm_style = bg.get("emotional_register", "")
|
||||||
sit_summary = bg.situation_summary
|
sit_summary = bg.get("situation", "")
|
||||||
emo_state = bg.emotional_state
|
key_dets = list(bg.get("specific_details") or [])
|
||||||
energy = bg.energy_level
|
|
||||||
comm_style = bg.communication_style
|
|
||||||
key_dets = [bg.signature_detail] if bg.signature_detail else []
|
|
||||||
else:
|
else:
|
||||||
topic_cat = ""
|
# Legacy CallerBackground object from stale checkpoint — removed in later commit
|
||||||
sit_summary = ""
|
comm_style = getattr(bg, "communication_style", "")
|
||||||
emo_state = ""
|
sit_summary = getattr(bg, "situation_summary", "")
|
||||||
energy = ""
|
sig = getattr(bg, "signature_detail", "")
|
||||||
comm_style = session.caller_styles.get(caller_key, "")
|
key_dets = [sig] if sig else []
|
||||||
key_dets = []
|
topic_cat = ""
|
||||||
|
emo_state = ""
|
||||||
|
energy = ""
|
||||||
|
|
||||||
call_shape = session.caller_shapes.get(caller_key, "standard")
|
|
||||||
quality_signals = _assess_call_quality(
|
quality_signals = _assess_call_quality(
|
||||||
conversation,
|
conversation,
|
||||||
caller_hangup=caller_hangup,
|
caller_hangup=caller_hangup,
|
||||||
shape=call_shape,
|
shape="",
|
||||||
style=comm_style,
|
style=comm_style,
|
||||||
pool_name=topic_cat,
|
pool_name="",
|
||||||
)
|
)
|
||||||
session.call_quality_signals.append(quality_signals)
|
session.call_quality_signals.append(quality_signals)
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user