Phase 2 and 3 of the platform rework. - Neutral request/response contract: external_id, metadata, X-AI-Key, run_id in the response; client-specific fields removed. - AI profile is a revision table: saving creates an inactive revision, activation is separate, try-run does not store a run. One chat-completions gateway serves AIHub and OpenAI-compatible profiles. - Add between and in rule operators. - Contracts moved to contracts/lead-scoring/ with a score-response fixture. - Admin Web updated for revisions, runs and the neutral fixture. - Consolidate tests; remove rewrite_architect.md and the stale handoff doc; rewrite spec, CONTEXT and ARCHITECTURE for the current design. Not verified: live AIHub/OpenAI behavior, Omni/EMS integration.
118 lines
4.6 KiB
JSON
118 lines
4.6 KiB
JSON
{
|
|
"snapshot": {
|
|
"captured_at": "2025-09-25T10:00:00Z",
|
|
"lead_profile": {
|
|
"custom_fields": {
|
|
"inquiry_type": "course_dates",
|
|
"region": "north"
|
|
},
|
|
"external_id": "lead-123"
|
|
},
|
|
"conversations": [
|
|
{
|
|
"conversation_id": "conversation-456",
|
|
"channel": "webchat",
|
|
"messages": [
|
|
{
|
|
"message_id": "message-789",
|
|
"sender_type": "contact",
|
|
"content": "Chào trung tâm, mình muốn tìm khóa IELTS buổi tối ở Hà Nội. Tháng tới có lớp khai giảng không?",
|
|
"sent_at": "2025-09-24T09:30:00Z"
|
|
},
|
|
{
|
|
"message_id": "message-790",
|
|
"sender_type": "agent",
|
|
"content": "Chào bạn, lịch mẫu có lớp khai giảng ngày 6/10. Bạn đang ở trình độ nào và muốn đạt mục tiêu bao nhiêu?",
|
|
"sent_at": "2025-09-24T09:31:00Z"
|
|
},
|
|
{
|
|
"message_id": "message-791",
|
|
"sender_type": "contact",
|
|
"content": "Mình khoảng 4.5, muốn đạt 6.0 để chuẩn bị hồ sơ du học trong sáu tháng tới.",
|
|
"sent_at": "2025-09-24T09:32:00Z"
|
|
},
|
|
{
|
|
"message_id": "message-792",
|
|
"sender_type": "agent",
|
|
"content": "Bạn có thể làm bài kiểm tra đầu vào để xác định lớp phù hợp. Lớp mẫu học thứ Hai, Tư, Sáu từ 19 giờ đến 21 giờ.",
|
|
"sent_at": "2025-09-24T09:33:00Z"
|
|
},
|
|
{
|
|
"message_id": "message-793",
|
|
"sender_type": "contact",
|
|
"content": "Khung giờ đó phù hợp với công việc của mình. Khóa học kéo dài bao lâu và học phí thế nào?",
|
|
"sent_at": "2025-09-24T09:34:00Z"
|
|
},
|
|
{
|
|
"message_id": "message-794",
|
|
"sender_type": "agent",
|
|
"content": "Khóa mẫu kéo dài 12 tuần, học phí minh họa là 6 triệu đồng, đã gồm tài liệu. Đây là thông tin giả lập để kiểm thử.",
|
|
"sent_at": "2025-09-24T09:35:00Z"
|
|
},
|
|
{
|
|
"message_id": "message-795",
|
|
"sender_type": "contact",
|
|
"content": "Ngân sách của mình khoảng 6 đến 7 triệu. Có thể chia học phí thành hai đợt không?",
|
|
"sent_at": "2025-09-24T09:36:00Z"
|
|
},
|
|
{
|
|
"message_id": "message-796",
|
|
"sender_type": "agent",
|
|
"content": "Trong tình huống mẫu này, bạn có thể đóng hai đợt. Bạn muốn kiểm tra đầu vào vào tối thứ Năm hay sáng thứ Bảy?",
|
|
"sent_at": "2025-09-24T09:37:00Z"
|
|
},
|
|
{
|
|
"message_id": "message-797",
|
|
"sender_type": "contact",
|
|
"content": "Mình chọn sáng thứ Bảy. Sau khi kiểm tra mình muốn đăng ký lớp khai giảng ngày 6/10.",
|
|
"sent_at": "2025-09-24T09:38:00Z"
|
|
},
|
|
{
|
|
"message_id": "message-798",
|
|
"sender_type": "agent",
|
|
"content": "Mình ghi nhận lịch kiểm tra mẫu lúc 9 giờ thứ Bảy tại cơ sở Hà Nội. Bạn có cần thông tin gì thêm trước khi đăng ký không?",
|
|
"sent_at": "2025-09-24T09:39:00Z"
|
|
},
|
|
{
|
|
"message_id": "message-799",
|
|
"sender_type": "contact",
|
|
"content": "Bạn gửi giúp mình hướng dẫn kiểm tra và thủ tục đăng ký nhé. Nếu kết quả đầu vào phù hợp, mình sẽ đăng ký trong tuần này.",
|
|
"sent_at": "2025-09-24T09:40:00Z"
|
|
},
|
|
{
|
|
"message_id": "message-800",
|
|
"sender_type": "agent",
|
|
"content": "Mình sẽ gửi hướng dẫn theo tình huống mẫu. Cảm ơn bạn, hẹn gặp bạn vào buổi kiểm tra đầu vào.",
|
|
"sent_at": "2025-09-24T09:41:00Z"
|
|
}
|
|
]
|
|
}
|
|
]
|
|
},
|
|
"scoring_config": {
|
|
"rules": [
|
|
{
|
|
"id": "asked-course-dates",
|
|
"description": "Khách chủ động hỏi ngày khai giảng khóa học",
|
|
"field": "custom_fields.inquiry_type",
|
|
"operator": "eq",
|
|
"value": "course_dates",
|
|
"points": 35
|
|
},
|
|
{
|
|
"id": "north-region",
|
|
"field": "custom_fields.region",
|
|
"operator": "eq",
|
|
"value": "north",
|
|
"points": 15
|
|
}
|
|
],
|
|
"rule_weight": 1.0,
|
|
"ai_weight": 0.0
|
|
},
|
|
"metadata": {
|
|
"account_id": "3",
|
|
"config_version": "17"
|
|
}
|
|
}
|