feat(sprint6b-D): soft-insertion counter + message meta_json
- thread_state.soft_insertion_count: растёт при боковом ответе (soft_insertion=true
в STATE_JSON без смены шага/слотов), сбрасывается при продвижении или handoff
- При soft_insertion_count >= 3 в системный промпт ветки добавляется SOFT_INSERTION_NUDGE
— явная инструкция вернуть пациента к вопросу текущего шага
- state_machine.parse_branch_response читает флаг soft_insertion из STATE_JSON
- Новая колонка message.meta_json: {router_intent_code, served_intent_code, step_code, events}
— хранит снимок маршрутизации каждой реплики ассистента
- «Песочница»: бейджи событий (sticky / soft_insertion / hard_handoff / resumed /
routing_loop / validation_blocked) над каждым ответом ассистента
Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
This commit is contained in:
@@ -75,4 +75,5 @@ async def chat(req: ChatRequest, session: AsyncSession = Depends(get_session)):
|
||||
parse_error=result.get("parse_error"),
|
||||
routing_loop_triggered=result.get("routing_loop_triggered", False),
|
||||
resumed_from_suspended=result.get("resumed_from_suspended", False),
|
||||
message_meta=result.get("message_meta"),
|
||||
)
|
||||
|
||||
@@ -51,6 +51,7 @@ async def get_thread(thread_id: int, session: AsyncSession = Depends(get_session
|
||||
assembled_prompt=m["assembled_prompt"],
|
||||
intent_code=m.get("intent_code", ""),
|
||||
intent_name=m.get("intent_name", ""),
|
||||
meta=m.get("meta"),
|
||||
)
|
||||
for m in data["messages"]
|
||||
],
|
||||
@@ -60,6 +61,7 @@ async def get_thread(thread_id: int, session: AsyncSession = Depends(get_session
|
||||
current_step_code=state.get("current_step_code"),
|
||||
slots=state.get("slots", {}),
|
||||
handoff_count=state.get("handoff_count", 0),
|
||||
soft_insertion_count=state.get("soft_insertion_count", 0),
|
||||
suspended_intent=state.get("suspended_intent"),
|
||||
resumable_step_code=state.get("resumable_step_code"),
|
||||
resumable_slots=state.get("resumable_slots", {}),
|
||||
|
||||
Reference in New Issue
Block a user