Spaces:
Running
Running
Yara Kyrychenko
commited on
Commit
·
fd7e4d8
1
Parent(s):
721a5e3
pymonog upd2
Browse files
app.py
CHANGED
@@ -176,7 +176,8 @@ def form():
|
|
176 |
with MongoClient(st.secrets["mongo"],server_api=ServerApi('1')) as client:
|
177 |
db = client.chat
|
178 |
collection = db.app
|
179 |
-
|
|
|
180 |
st.session_state.inserted += 1
|
181 |
st.session_state.submitted = True
|
182 |
setup_messages()
|
@@ -211,15 +212,16 @@ def submit():
|
|
211 |
st.session_state.user_data.update({key: st.session_state[key] for key in keys})
|
212 |
|
213 |
st.session_state.user_data["convo_end_time"] = datetime.now()
|
214 |
-
|
215 |
st.write(st.session_state.user_data)
|
|
|
216 |
from pymongo.mongo_client import MongoClient
|
217 |
from pymongo.server_api import ServerApi
|
218 |
with MongoClient(st.secrets["mongo"],server_api=ServerApi('1')) as client:
|
219 |
db = client.chat
|
220 |
collection = db.app
|
221 |
-
|
222 |
-
collection.insert_one(
|
223 |
st.session_state.inserted += 1
|
224 |
|
225 |
st.success('**Your conversation has been submitted! Please proceed with the survey.**', icon="✅")
|
|
|
176 |
with MongoClient(st.secrets["mongo"],server_api=ServerApi('1')) as client:
|
177 |
db = client.chat
|
178 |
collection = db.app
|
179 |
+
user_data = st.session_state.user_data
|
180 |
+
collection.insert_one(user_data)
|
181 |
st.session_state.inserted += 1
|
182 |
st.session_state.submitted = True
|
183 |
setup_messages()
|
|
|
212 |
st.session_state.user_data.update({key: st.session_state[key] for key in keys})
|
213 |
|
214 |
st.session_state.user_data["convo_end_time"] = datetime.now()
|
215 |
+
|
216 |
st.write(st.session_state.user_data)
|
217 |
+
|
218 |
from pymongo.mongo_client import MongoClient
|
219 |
from pymongo.server_api import ServerApi
|
220 |
with MongoClient(st.secrets["mongo"],server_api=ServerApi('1')) as client:
|
221 |
db = client.chat
|
222 |
collection = db.app
|
223 |
+
user_data = st.session_state.user_data
|
224 |
+
collection.insert_one(user_data)
|
225 |
st.session_state.inserted += 1
|
226 |
|
227 |
st.success('**Your conversation has been submitted! Please proceed with the survey.**', icon="✅")
|