Spaces:
Build error
Build error
Update app.py
Browse files
app.py
CHANGED
|
@@ -277,13 +277,13 @@ def log_history(email: str,chat_history: list) -> None:
|
|
| 277 |
}))
|
| 278 |
|
| 279 |
|
| 280 |
-
def log_action(
|
| 281 |
# Save the log to the file
|
| 282 |
with log_scheduler.lock:
|
| 283 |
# Open the log file in append mode
|
| 284 |
with log_file.open("a") as f:
|
| 285 |
f.write(json.dumps({
|
| 286 |
-
"
|
| 287 |
"task": task,
|
| 288 |
"details": details
|
| 289 |
}))
|
|
@@ -307,7 +307,7 @@ def register_feedback(intent, customer_id, feedback, rating):
|
|
| 307 |
"feedback": feedback,
|
| 308 |
"rating": rating
|
| 309 |
}
|
| 310 |
-
log_action("register_feedback", details)
|
| 311 |
#print("register_feedback success")
|
| 312 |
#return "Feedback registered successfully!"
|
| 313 |
|
|
@@ -330,7 +330,7 @@ def defer_to_human(customer_id, query, intent, reason):
|
|
| 330 |
"intent": intent
|
| 331 |
}
|
| 332 |
|
| 333 |
-
log_action("defer_to_human", details)
|
| 334 |
#return "Case deferred to human agent and logged successfully!"
|
| 335 |
|
| 336 |
|
|
|
|
| 277 |
}))
|
| 278 |
|
| 279 |
|
| 280 |
+
def log_action(customer_id: str,task: str, details: str) -> None:
|
| 281 |
# Save the log to the file
|
| 282 |
with log_scheduler.lock:
|
| 283 |
# Open the log file in append mode
|
| 284 |
with log_file.open("a") as f:
|
| 285 |
f.write(json.dumps({
|
| 286 |
+
"customer_id": customer_id,
|
| 287 |
"task": task,
|
| 288 |
"details": details
|
| 289 |
}))
|
|
|
|
| 307 |
"feedback": feedback,
|
| 308 |
"rating": rating
|
| 309 |
}
|
| 310 |
+
log_action(customer_id,"register_feedback", details)
|
| 311 |
#print("register_feedback success")
|
| 312 |
#return "Feedback registered successfully!"
|
| 313 |
|
|
|
|
| 330 |
"intent": intent
|
| 331 |
}
|
| 332 |
|
| 333 |
+
log_action(customer_id,"defer_to_human", details)
|
| 334 |
#return "Case deferred to human agent and logged successfully!"
|
| 335 |
|
| 336 |
|