Spaces:
Sleeping
Sleeping
Update app.py
Browse files
app.py
CHANGED
@@ -126,22 +126,11 @@ def save_chat_message(session_id, message_data):
|
|
126 |
def chat_interface(message, history):
|
127 |
try:
|
128 |
# Generate a unique session ID for this chat session
|
129 |
-
|
130 |
|
131 |
# Process the user message and generate a response (your chatbot logic)
|
132 |
response = handle_query(message)
|
133 |
|
134 |
-
# Capture the message data
|
135 |
-
message_data = {
|
136 |
-
"sender": "user",
|
137 |
-
"message": message,
|
138 |
-
"response": response,
|
139 |
-
"timestamp": datetime.datetime.now().isoformat() # Use a library like datetime
|
140 |
-
}
|
141 |
-
|
142 |
-
# Call the save function to store in Firebase with the generated session ID
|
143 |
-
save_chat_message(session_id, message_data)
|
144 |
-
|
145 |
# Return the bot response
|
146 |
return response
|
147 |
except Exception as e:
|
|
|
126 |
def chat_interface(message, history):
|
127 |
try:
|
128 |
# Generate a unique session ID for this chat session
|
129 |
+
|
130 |
|
131 |
# Process the user message and generate a response (your chatbot logic)
|
132 |
response = handle_query(message)
|
133 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
134 |
# Return the bot response
|
135 |
return response
|
136 |
except Exception as e:
|