Spaces:
Runtime error
Runtime error
Srinivasulu kethanaboina
commited on
Update app.py
Browse files
app.py
CHANGED
@@ -110,17 +110,18 @@ def predict(message, history):
|
|
110 |
return response_with_logo
|
111 |
def save_chat_message(session_id, message_data):
|
112 |
# Reference based on sender's unique ID
|
113 |
-
|
114 |
|
115 |
# Define the structure of the message
|
116 |
message_entry = {
|
|
|
117 |
"Message": message_data['message'],
|
118 |
"Response": message_data['response'],
|
119 |
"Timestamp": message_data['timestamp']
|
120 |
}
|
121 |
|
122 |
# Save data to Firebase using session ID and sender ID
|
123 |
-
ref = db.reference(f'/chat_history/{session_id}
|
124 |
|
125 |
# Push the new message to the sender's chat history
|
126 |
ref.push().set(message_entry)
|
|
|
110 |
return response_with_logo
|
111 |
def save_chat_message(session_id, message_data):
|
112 |
# Reference based on sender's unique ID
|
113 |
+
|
114 |
|
115 |
# Define the structure of the message
|
116 |
message_entry = {
|
117 |
+
"sender_id"= message_data['sender'],
|
118 |
"Message": message_data['message'],
|
119 |
"Response": message_data['response'],
|
120 |
"Timestamp": message_data['timestamp']
|
121 |
}
|
122 |
|
123 |
# Save data to Firebase using session ID and sender ID
|
124 |
+
ref = db.reference(f'/chat_history/{session_id}')
|
125 |
|
126 |
# Push the new message to the sender's chat history
|
127 |
ref.push().set(message_entry)
|