Spaces:
Runtime error
Runtime error
fix
Browse files
rag/analyze_and_expand.py
CHANGED
|
@@ -112,6 +112,7 @@ def analyze_and_expand_query(question: str) -> Dict[str, Any]:
|
|
| 112 |
except json.JSONDecodeError:
|
| 113 |
fixed_str = cleaned_json.replace("'", '"').replace("None", "null").replace("True", "true").replace("False", "false")
|
| 114 |
result = json.loads(fixed_str)
|
|
|
|
| 115 |
other_schools = [
|
| 116 |
"bách khoa", "bach khoa", "hust",
|
| 117 |
"neu", "kinh tế",
|
|
@@ -140,7 +141,6 @@ def analyze_and_expand_query(question: str) -> Dict[str, Any]:
|
|
| 140 |
# Logic an toàn: Nếu AI lỡ trả lời câu hỏi chuyên môn trong field "answer", ta xóa nó đi để ép hệ thống tìm docs
|
| 141 |
q_type = result.get("question_type", "simple")
|
| 142 |
ans = result.get("answer", None)
|
| 143 |
-
question_lower = question.lower()
|
| 144 |
|
| 145 |
academic_keywords = [
|
| 146 |
"tín chỉ", "học bổng", "bảo lưu", "thi", "điểm", "học vụ",
|
|
|
|
| 112 |
except json.JSONDecodeError:
|
| 113 |
fixed_str = cleaned_json.replace("'", '"').replace("None", "null").replace("True", "true").replace("False", "false")
|
| 114 |
result = json.loads(fixed_str)
|
| 115 |
+
question_lower = question.lower()
|
| 116 |
other_schools = [
|
| 117 |
"bách khoa", "bach khoa", "hust",
|
| 118 |
"neu", "kinh tế",
|
|
|
|
| 141 |
# Logic an toàn: Nếu AI lỡ trả lời câu hỏi chuyên môn trong field "answer", ta xóa nó đi để ép hệ thống tìm docs
|
| 142 |
q_type = result.get("question_type", "simple")
|
| 143 |
ans = result.get("answer", None)
|
|
|
|
| 144 |
|
| 145 |
academic_keywords = [
|
| 146 |
"tín chỉ", "học bổng", "bảo lưu", "thi", "điểm", "học vụ",
|