feat(sprint6b-F): guards в new_booking — require_legal_rep
- check_guards() в state_machine.py: проверяет guards_json шага при переходе; trigger_slot/trigger_value/required_slots; нормализует "true"/"false"-строки - qualify step: guard require_legal_rep — блокирует переход в present, если is_child=true и не заполнены legal_rep_name / legal_rep_phone - Промпт qualify обновлён: инструкции по is_child, legal_rep, requested_doctor, waitlist_flag, needs_surgologist_first - ensure_seed_guards() патчит guards_json существующих шагов при старте - Sandbox: блок валидации показывает guard_name + missing_slots + description - Settings: обновлён лейбл поля guards с примером формата Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
This commit is contained in:
+7
-1
@@ -834,7 +834,13 @@ function renderState(state, bounces, validationEvents, parseError, routingLoopTr
|
||||
: "";
|
||||
const validationHtml = (validationEvents && validationEvents.length)
|
||||
? `<div style="margin-top:8px;padding:6px 8px;border-radius:4px;background:#fef2f2;color:#991b1b;font-size:11px;">
|
||||
${validationEvents.map(v => `⚠️ модель просилась в <code>${esc(v.requested_step)}</code>, оставили на <code>${esc(v.current_step)}</code>. ${esc(v.reason)}`).join("<br>")}
|
||||
${validationEvents.map(v => {
|
||||
if (v.guard_name) {
|
||||
const missing = (v.missing_slots || []).map(s => `<code>${esc(s)}</code>`).join(", ");
|
||||
return `🔒 guard <b>${esc(v.guard_name)}</b> не пройден — ждём: ${missing}.<br><span style="opacity:.75">${esc(v.guard_description || "")}</span>`;
|
||||
}
|
||||
return `⚠️ модель просилась в <code>${esc(v.requested_step)}</code>, оставили на <code>${esc(v.current_step)}</code>. ${esc(v.reason)}`;
|
||||
}).join("<br>")}
|
||||
</div>`
|
||||
: "";
|
||||
const parseErrorHtml = parseError
|
||||
|
||||
@@ -821,7 +821,7 @@ function renderStepEditor() {
|
||||
<div class="allowed-next" id="f-step-allowed">${checkboxes}</div>
|
||||
</div>
|
||||
<div class="field">
|
||||
<label for="f-step-guards">Guards (JSON, наполняется в 6b — пока можно оставить <code>{}</code>)</label>
|
||||
<label for="f-step-guards">Guards (JSON) — условия, блокирующие переход до заполнения нужных слотов. Пример: <code>{"require_legal_rep": {"trigger_slot": "is_child", "trigger_value": true, "required_slots": ["legal_rep_name", "legal_rep_phone"], "description": "..."}}</code></label>
|
||||
<textarea id="f-step-guards" class="rules" spellcheck="false">${esc(JSON.stringify(step.guards || {}, null, 2))}</textarea>
|
||||
</div>
|
||||
<div class="editor-actions">
|
||||
|
||||
Reference in New Issue
Block a user