Upload backend/hue_portal/chatbot/slow_path_handler.py with huggingface_hub
Browse files
backend/hue_portal/chatbot/slow_path_handler.py
CHANGED
|
@@ -88,11 +88,20 @@ class SlowPathHandler:
|
|
| 88 |
# - trong câu hỏi không ghi rõ mã văn bản
|
| 89 |
# Thì: luôn trả về payload options để người dùng chọn văn bản trước,
|
| 90 |
# chưa generate câu trả lời chi tiết.
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 91 |
if (
|
| 92 |
intent == "search_legal"
|
| 93 |
and not selected_document_code_normalized
|
| 94 |
-
and not
|
| 95 |
):
|
|
|
|
| 96 |
canonical_candidates: List[Dict[str, Any]] = []
|
| 97 |
try:
|
| 98 |
canonical_docs = list(
|
|
|
|
| 88 |
# - trong câu hỏi không ghi rõ mã văn bản
|
| 89 |
# Thì: luôn trả về payload options để người dùng chọn văn bản trước,
|
| 90 |
# chưa generate câu trả lời chi tiết.
|
| 91 |
+
has_explicit_code = self._has_explicit_document_code_in_query(query)
|
| 92 |
+
logger.info(
|
| 93 |
+
"[WIZARD] Checking wizard conditions - intent=%s, selected_code=%s, has_explicit_code=%s, query='%s'",
|
| 94 |
+
intent,
|
| 95 |
+
selected_document_code_normalized,
|
| 96 |
+
has_explicit_code,
|
| 97 |
+
query[:50],
|
| 98 |
+
)
|
| 99 |
if (
|
| 100 |
intent == "search_legal"
|
| 101 |
and not selected_document_code_normalized
|
| 102 |
+
and not has_explicit_code
|
| 103 |
):
|
| 104 |
+
logger.info("[WIZARD] ✅ Wizard conditions met, returning options payload")
|
| 105 |
canonical_candidates: List[Dict[str, Any]] = []
|
| 106 |
try:
|
| 107 |
canonical_docs = list(
|