From 811f8b2742a891b2f00f9c4a212ac25b64f6a9ef Mon Sep 17 00:00:00 2001 From: let5sne Date: Tue, 14 Jul 2026 04:35:19 +0800 Subject: [PATCH] chore(aihr): gate prompt traceability schema --- scripts/demo-check.sh | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/scripts/demo-check.sh b/scripts/demo-check.sh index 4f12194e..3429c524 100755 --- a/scripts/demo-check.sh +++ b/scripts/demo-check.sh @@ -79,7 +79,7 @@ check_pilot_samples() { [[ "$(pilot_sql_scalar "SELECT DATE('$pilot_end') IS NOT NULL")" == "1" ]] || fail "invalid AIHR_PILOT_END_DATE: $pilot_end" [[ "$pilot_start" > "$pilot_end" ]] && fail "pilot start date must not be after end date" - local scenario_count completed_people pilot_people org_active org_phone_linked org_pilot_people org_pilot_projects org_completed_people audio_table_count + local scenario_count completed_people pilot_people org_active org_phone_linked org_pilot_people org_pilot_projects org_completed_people audio_table_count prompt_version_schema_count local calibration_stats calibration_count calibration_matched sop_total sop_usable sop_pending satisfaction_count satisfaction_average local org_identity_cte=" WITH active_org AS ( @@ -123,6 +123,7 @@ check_pilot_samples() { )" scenario_count="$(pilot_sql_scalar "SELECT COUNT(*) FROM aihr_practice_scenario WHERE tenant_id = '000000' AND position = '生活顾问' AND enabled = 1")" audio_table_count="$(pilot_sql_scalar "SELECT COUNT(*) FROM information_schema.tables WHERE table_schema = DATABASE() AND table_name = 'aihr_practice_audio'")" + prompt_version_schema_count="$(pilot_sql_scalar "SELECT COUNT(*) FROM information_schema.columns WHERE table_schema = DATABASE() AND table_name = 'aihr_sop_answer_review' AND column_name = 'prompt_version'")" completed_people="$(pilot_sql_scalar " SELECT COUNT(*) FROM ( @@ -244,11 +245,12 @@ check_pilot_samples() { sop_pending="$(pilot_sql_scalar "SELECT COUNT(*) FROM aihr_sop_answer_review WHERE tenant_id = '000000' AND status <> '已评审' AND create_time >= '${pilot_start} 00:00:00' AND create_time < DATE_ADD('${pilot_end}', INTERVAL 1 DAY)")" satisfaction_count="$(pilot_sql_scalar "SELECT COUNT(*) FROM aihr_practice_session s WHERE s.tenant_id = '000000' AND s.mode = 'mobile' AND s.finished_time >= '${pilot_start} 00:00:00' AND s.finished_time < DATE_ADD('${pilot_end}', INTERVAL 1 DAY) AND s.satisfaction_score IS NOT NULL AND EXISTS (SELECT 1 FROM aihr_org_snapshot o WHERE o.tenant_id = s.tenant_id AND o.employment_status = 'active' AND (o.ext_party_id = s.ext_party_id OR o.person_phone = s.ext_party_id))")" satisfaction_average="$(pilot_sql_scalar "SELECT COALESCE(AVG(s.satisfaction_score), 0) FROM aihr_practice_session s WHERE s.tenant_id = '000000' AND s.mode = 'mobile' AND s.finished_time >= '${pilot_start} 00:00:00' AND s.finished_time < DATE_ADD('${pilot_end}', INTERVAL 1 DAY) AND s.satisfaction_score IS NOT NULL AND EXISTS (SELECT 1 FROM aihr_org_snapshot o WHERE o.tenant_id = s.tenant_id AND o.employment_status = 'active' AND (o.ext_party_id = s.ext_party_id OR o.person_phone = s.ext_party_id))")" - echo "OK: pilot gates window=${pilot_start}..${pilot_end} scenarios=${scenario_count}/12 ten_sessions=${completed_people}/${pilot_people} org_login=${org_phone_linked}/${org_active} org_pilot=${org_pilot_people}/20 projects=${org_pilot_projects}/1-2 org_ten_sessions=${org_completed_people}/${org_pilot_people} calibration=${calibration_count}/20 consistency=${calibration_matched}/${calibration_count} sop_usable=${sop_usable}/${sop_total} sop_pending=${sop_pending} satisfaction=${satisfaction_average}/5 responses=${satisfaction_count} audio_schema=${audio_table_count}" + echo "OK: pilot gates window=${pilot_start}..${pilot_end} scenarios=${scenario_count}/12 ten_sessions=${completed_people}/${pilot_people} org_login=${org_phone_linked}/${org_active} org_pilot=${org_pilot_people}/20 projects=${org_pilot_projects}/1-2 org_ten_sessions=${org_completed_people}/${org_pilot_people} calibration=${calibration_count}/20 consistency=${calibration_matched}/${calibration_count} sop_usable=${sop_usable}/${sop_total} sop_pending=${sop_pending} satisfaction=${satisfaction_average}/5 responses=${satisfaction_count} audio_schema=${audio_table_count} prompt_version_schema=${prompt_version_schema_count}" [[ "${AIHR_PILOT_STRICT:-false}" != "true" ]] || { (( scenario_count >= 12 )) || fail "pilot enabled scenarios ${scenario_count}/12" (( audio_table_count == 1 )) || fail "pilot audio schema unavailable (aihr_practice_audio missing)" + (( prompt_version_schema_count == 1 )) || fail "pilot RAG traceability schema unavailable (aihr_sop_answer_review.prompt_version missing)" (( org_phone_linked >= 20 )) || fail "pilot mobile-login org members ${org_phone_linked}/20 (active org ${org_active})" (( org_pilot_people >= 20 )) || fail "pilot activity matched to active org ${org_pilot_people}/20" (( org_pilot_projects >= 1 && org_pilot_projects <= 2 )) || fail "pilot project scope must be 1-2 projects (actual ${org_pilot_projects})"