Spaces:
Sleeping
Sleeping
Update query.py
Browse files
query.py
CHANGED
|
@@ -79,15 +79,15 @@ class VectaraQuery():
|
|
| 79 |
response_set = res['responseSet']
|
| 80 |
|
| 81 |
if response_set:
|
| 82 |
-
for result in response_set:
|
| 83 |
if 'text' not in result:
|
| 84 |
continue
|
| 85 |
text = result['text']
|
| 86 |
print(f"Processing text: {text}") # Debugging line
|
| 87 |
|
| 88 |
-
reason_match = re.search(r"Reason Why it Can't be Used:
|
| 89 |
-
alternative_match = re.search(r"Alternative:
|
| 90 |
-
notes_match = re.search(r"Notes:
|
| 91 |
|
| 92 |
reason = reason_match.group(1).strip() if reason_match else "Not available"
|
| 93 |
alternative = alternative_match.group(1).strip() if alternative_match else "Not available"
|
|
|
|
| 79 |
response_set = res['responseSet']
|
| 80 |
|
| 81 |
if response_set:
|
| 82 |
+
for result in response_set['response']:
|
| 83 |
if 'text' not in result:
|
| 84 |
continue
|
| 85 |
text = result['text']
|
| 86 |
print(f"Processing text: {text}") # Debugging line
|
| 87 |
|
| 88 |
+
reason_match = re.search(r"Reason Why it Can't be Used:\s*(.*?)(?:\n|$)", text, re.DOTALL)
|
| 89 |
+
alternative_match = re.search(r"Alternative:\s*(.*?)(?:\n|$)", text, re.DOTALL)
|
| 90 |
+
notes_match = re.search(r"Notes:\s*(.*?)(?:\n|$)", text, re.DOTALL)
|
| 91 |
|
| 92 |
reason = reason_match.group(1).strip() if reason_match else "Not available"
|
| 93 |
alternative = alternative_match.group(1).strip() if alternative_match else "Not available"
|