Spaces:
Sleeping
Sleeping
Update main.py
Browse files
main.py
CHANGED
|
@@ -528,13 +528,20 @@ def _build_clarifying_message() -> str:
|
|
| 528 |
|
| 529 |
def _build_tracking_descriptions(issue_text: str, resolved_text: str) -> Tuple[str, str]:
|
| 530 |
"""
|
| 531 |
-
ShortDescription
|
| 532 |
-
|
|
|
|
| 533 |
"""
|
| 534 |
issue = (issue_text or "").strip()
|
| 535 |
resolved = (resolved_text or "").strip()
|
| 536 |
|
| 537 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 538 |
|
| 539 |
long_desc = (
|
| 540 |
f'User reported: "{issue}". '
|
|
@@ -545,6 +552,7 @@ def _build_tracking_descriptions(issue_text: str, resolved_text: str) -> Tuple[s
|
|
| 545 |
return short_desc, long_desc
|
| 546 |
|
| 547 |
|
|
|
|
| 548 |
def _is_incident_intent(msg_norm: str) -> bool:
|
| 549 |
intent_phrases = [
|
| 550 |
"create ticket", "create a ticket", "raise ticket", "raise a ticket", "open ticket", "open a ticket",
|
|
|
|
| 528 |
|
| 529 |
def _build_tracking_descriptions(issue_text: str, resolved_text: str) -> Tuple[str, str]:
|
| 530 |
"""
|
| 531 |
+
ShortDescription:
|
| 532 |
+
- For process/SOP queries: "Process Steps – <user query>"
|
| 533 |
+
- For error queries: just the user query (e.g., "getting putaway error")
|
| 534 |
"""
|
| 535 |
issue = (issue_text or "").strip()
|
| 536 |
resolved = (resolved_text or "").strip()
|
| 537 |
|
| 538 |
+
# Detect if it's a process/SOP query (heuristic: contains 'how to', 'steps', etc.)
|
| 539 |
+
is_process_query = bool(re.search(r"\b(how to|steps|procedure|process)\b", issue.lower()))
|
| 540 |
+
|
| 541 |
+
if is_process_query:
|
| 542 |
+
short_desc = f"Process Steps – {issue[:80]}"
|
| 543 |
+
else:
|
| 544 |
+
short_desc = issue[:100]
|
| 545 |
|
| 546 |
long_desc = (
|
| 547 |
f'User reported: "{issue}". '
|
|
|
|
| 552 |
return short_desc, long_desc
|
| 553 |
|
| 554 |
|
| 555 |
+
|
| 556 |
def _is_incident_intent(msg_norm: str) -> bool:
|
| 557 |
intent_phrases = [
|
| 558 |
"create ticket", "create a ticket", "raise ticket", "raise a ticket", "open ticket", "open a ticket",
|