feat: 운영 안정성과 세션 음성 경험 개선

This commit is contained in:
Yun Chan 2026-07-31 00:13:08 +09:00
parent facc4ad2d9
commit c788343467
95 changed files with 8431 additions and 1785 deletions

View file

@ -105,7 +105,7 @@ async def record_completed_turn(
*,
context_prefix: str,
counselor_turn: TurnRecord | None = None,
) -> None:
) -> TurnRecord:
"""상담자 발화와 내담자 응답을 한 번에 기록하고 상태를 갱신한다."""
assert ctx.state_after is not None
learner_turn = counselor_turn or TurnRecord(
@ -144,6 +144,7 @@ async def record_completed_turn(
result.state_after,
context=f"{context_prefix} state update",
)
return learner_turn
async def record_safety_event(
@ -267,17 +268,20 @@ async def finalize_completed_turn(
*,
context_prefix: str,
counselor_turn: TurnRecord | None = None,
) -> None:
recharge_live_coach: bool = True,
) -> TurnRecord:
"""Persist a completed turn and emit any derived safety alert in route-safe order."""
await record_completed_turn(
learner_turn = await record_completed_turn(
sess,
ctx,
result,
context_prefix=context_prefix,
counselor_turn=counselor_turn,
)
await maybe_recharge_live_coach_credit(sess, ctx, result)
if recharge_live_coach:
await maybe_recharge_live_coach_credit(sess, ctx, result)
await record_safety_event(sess, ctx, result)
return learner_turn
__all__ = [