Spaces:
Sleeping
Sleeping
Update main.py
Browse files
main.py
CHANGED
|
@@ -964,6 +964,35 @@ async def chat_with_ai(input_data: ChatInput):
|
|
| 964 |
context_found = True
|
| 965 |
|
| 966 |
elif best_doc and detected_intent == "errors":
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 967 |
full_errors = get_best_errors_section_text(best_doc)
|
| 968 |
if full_errors:
|
| 969 |
ctx_err = _extract_errors_only(full_errors, max_lines=30)
|
|
|
|
| 964 |
context_found = True
|
| 965 |
|
| 966 |
elif best_doc and detected_intent == "errors":
|
| 967 |
+
|
| 968 |
+
# --- NEW: detect explicit "not resolved" phrases ---
|
| 969 |
+
said_not_resolved = (
|
| 970 |
+
_has_negation_resolved(msg_norm) or
|
| 971 |
+
bool(re.search(
|
| 972 |
+
r"\b(issue not resolved|still not working|doesn't work|didn't work|no change|not fixed|failed|broken)\b",
|
| 973 |
+
msg_norm
|
| 974 |
+
))
|
| 975 |
+
)
|
| 976 |
+
|
| 977 |
+
if said_not_resolved:
|
| 978 |
+
# Suppress the long error bullets reply; let the frontend card handle this flow.
|
| 979 |
+
return {
|
| 980 |
+
"bot_response": "", # no text (UI will show the card)
|
| 981 |
+
"status": "OK",
|
| 982 |
+
"context_found": False,
|
| 983 |
+
"ask_resolved": False,
|
| 984 |
+
"suggest_incident": False, # we avoid backend-driven prompt here
|
| 985 |
+
"show_incident_form": False,
|
| 986 |
+
"show_status_form": False,
|
| 987 |
+
"followup": None,
|
| 988 |
+
"top_hits": [],
|
| 989 |
+
"sources": [],
|
| 990 |
+
"debug": {
|
| 991 |
+
"intent": "errors_not_resolved",
|
| 992 |
+
"best_doc": best_doc,
|
| 993 |
+
},
|
| 994 |
+
}
|
| 995 |
+
|
| 996 |
full_errors = get_best_errors_section_text(best_doc)
|
| 997 |
if full_errors:
|
| 998 |
ctx_err = _extract_errors_only(full_errors, max_lines=30)
|