Spaces:
Runtime error
Runtime error
Update app.py
Browse files
app.py
CHANGED
@@ -236,24 +236,30 @@ def handle_accuse_click(request: gr.Request, accuse_button):
|
|
236 |
user_id = dict(request.query_params).get("user_id")
|
237 |
if not user_id:
|
238 |
print ("Vous devez vous connecter pour accéder au bot.")
|
|
|
239 |
history = load_history(user_id)
|
240 |
else:
|
241 |
user_id = ""
|
|
|
|
|
242 |
if user_id == "":
|
243 |
# Handle the case where request is None
|
244 |
print ("User Id is Empty")
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
245 |
else:
|
246 |
-
|
247 |
-
|
248 |
-
|
249 |
-
|
250 |
-
|
251 |
-
accuse_button = gr.Button("Félicitations, tu as trouvé le coupable ! Clique pour recommencer🔁")
|
252 |
-
print("win")
|
253 |
-
else:
|
254 |
-
accuse_button = gr.Button("Désolé, tu as accusé le mauvais personnage. Tu as perdu. Clique pour recommencer🔁")
|
255 |
-
print("loose")
|
256 |
-
accuse_button.click(fn=delete_user_data,user_id,js=js_func)
|
257 |
|
258 |
|
259 |
def chatbot_interface(request: gr.Request,accuse_button):
|
@@ -268,7 +274,7 @@ def chatbot_interface(request: gr.Request,accuse_button):
|
|
268 |
css="footer {visibility: hidden !important} .gradio-container {background-color: #2D4059 !important; color: #FFD460 !important;}",
|
269 |
js=js_func
|
270 |
)
|
271 |
-
accuse_button.click(handle_accuse_click,request)
|
272 |
return chatbot_interface
|
273 |
|
274 |
|
|
|
236 |
user_id = dict(request.query_params).get("user_id")
|
237 |
if not user_id:
|
238 |
print ("Vous devez vous connecter pour accéder au bot.")
|
239 |
+
return
|
240 |
history = load_history(user_id)
|
241 |
else:
|
242 |
user_id = ""
|
243 |
+
return
|
244 |
+
|
245 |
if user_id == "":
|
246 |
# Handle the case where request is None
|
247 |
print ("User Id is Empty")
|
248 |
+
return
|
249 |
+
|
250 |
+
accused_character = "troubadour" # Le personnage accusé (le troubadour dans ce cas)
|
251 |
+
# Supprimer l'historique et le contexte dynamique de tous les personnages dans tous les espaces
|
252 |
+
delete_user_data(user_id)
|
253 |
+
|
254 |
+
if accused_character == "troubadour": # Vérifier si le personnage accusé est le coupable
|
255 |
+
accuse_button.value = "Félicitations, tu as trouvé le coupable ! Clique pour recommencer🔁"
|
256 |
+
print("win")
|
257 |
else:
|
258 |
+
accuse_button.value = "Désolé, tu as accusé le mauvais personnage. Tu as perdu. Clique pour recommencer🔁"
|
259 |
+
print("loose")
|
260 |
+
|
261 |
+
accuse_button.click(fn=delete_user_data, inputs=[user_id], js=js_func)
|
262 |
+
|
|
|
|
|
|
|
|
|
|
|
|
|
263 |
|
264 |
|
265 |
def chatbot_interface(request: gr.Request,accuse_button):
|
|
|
274 |
css="footer {visibility: hidden !important} .gradio-container {background-color: #2D4059 !important; color: #FFD460 !important;}",
|
275 |
js=js_func
|
276 |
)
|
277 |
+
accuse_button.click(fn=handle_accuse_click, inputs=[request, accuse_button], js=js_func)
|
278 |
return chatbot_interface
|
279 |
|
280 |
|