Daly26 commited on
Commit
9b04ba1
·
1 Parent(s): e695c0d

Revert: Remettre tout comme c'était - images en majuscules et vérification obligatoire du rôle

Browse files
Files changed (2) hide show
  1. LesChatsDeSeatech.py +8 -0
  2. templates/index.html +7 -5
LesChatsDeSeatech.py CHANGED
@@ -889,6 +889,14 @@ def api_ask():
889
  "status": "role_selected"
890
  })
891
 
 
 
 
 
 
 
 
 
892
  # Ajout à l'historique de conversation
893
  conversation_history_global[session_id].append({"role": "user", "content": user_query})
894
 
 
889
  "status": "role_selected"
890
  })
891
 
892
+ # Vérifier si le rôle est confirmé
893
+ if not is_role_confirmed(session_id):
894
+ return jsonify({
895
+ "response": "<p>Veuillez d'abord sélectionner votre profil pour que je puisse mieux vous aider.</p>",
896
+ "role_confirmed": False,
897
+ "status": "role_required"
898
+ })
899
+
900
  # Ajout à l'historique de conversation
901
  conversation_history_global[session_id].append({"role": "user", "content": user_query})
902
 
templates/index.html CHANGED
@@ -224,20 +224,21 @@
224
  </div>
225
  </div>
226
 
227
- <form class="chat-form" id="chatForm"
228
  method="POST" action="/">
229
  <div class="chat-input-container">
230
  <img src="{{ url_for('static', filename='img/cat_walking.png') }}" alt="Chat qui marche"
231
  class="cat-walking">
232
  <input type="text" name="query" id="queryInput" class="chat-input"
233
- placeholder="Posez votre question sur SeaTech..."
234
- required autocomplete="off"
235
  aria-label="Votre question">
236
 
237
 
238
  </div>
239
  <!-- Bouton micro -->
240
- <button type="button" id="micButton" class="mic-button">
 
241
  <i class="fas fa-microphone"></i>
242
  </button>
243
 
@@ -246,7 +247,8 @@
246
  <i class="fas fa-comments"></i> Start conversation
247
  </button>
248
 
249
- <button type="submit" class="send-button">
 
250
  Envoyer
251
  <img src="{{ url_for('static', filename='img/cat-icon.png') }}" alt="Chat" class="cat-icon"
252
  width="20" height="20">
 
224
  </div>
225
  </div>
226
 
227
+ <form class="chat-form{% if not user_profile.get('confirmed') %} disabled{% endif %}" id="chatForm"
228
  method="POST" action="/">
229
  <div class="chat-input-container">
230
  <img src="{{ url_for('static', filename='img/cat_walking.png') }}" alt="Chat qui marche"
231
  class="cat-walking">
232
  <input type="text" name="query" id="queryInput" class="chat-input"
233
+ placeholder="{% if user_profile.get('confirmed') %}Posez votre question sur SeaTech...{% else %}Sélectionnez d'abord votre profil ci-dessus{% endif %}"
234
+ {% if not user_profile.get('confirmed') %}disabled{% endif %} required autocomplete="off"
235
  aria-label="Votre question">
236
 
237
 
238
  </div>
239
  <!-- Bouton micro -->
240
+ <button type="button" id="micButton" class="mic-button" {% if not user_profile.get('confirmed')
241
+ %}disabled{% endif %}>
242
  <i class="fas fa-microphone"></i>
243
  </button>
244
 
 
247
  <i class="fas fa-comments"></i> Start conversation
248
  </button>
249
 
250
+ <button type="submit" class="send-button" {% if not user_profile.get('confirmed') %}disabled{% endif
251
+ %}>
252
  Envoyer
253
  <img src="{{ url_for('static', filename='img/cat-icon.png') }}" alt="Chat" class="cat-icon"
254
  width="20" height="20">