MathieuGAL commited on
Commit
47ea5af
·
verified ·
1 Parent(s): 3b46223

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +6 -3
app.py CHANGED
@@ -360,7 +360,8 @@ def api_get_answer():
360
  session_id = data.get('session_id', 'archive')
361
 
362
  if not query_text:
363
- return jsonify({"error": "Champ 'query_text' manquant"}), 400
 
364
 
365
  # Récupère historique
366
  history = get_conversation_history(session_id)
@@ -379,7 +380,8 @@ def api_get_answer():
379
 
380
  except Exception as e:
381
  print(f"❌ Erreur générale de l'API: {e}")
382
- return jsonify({"error": str(e)}), 500
 
383
 
384
  @app.route('/api/clear_history', methods=['POST'])
385
  def api_clear_history():
@@ -391,7 +393,8 @@ def api_clear_history():
391
 
392
  return jsonify({"message": f"Historique effacé: {session_id}"})
393
  except Exception as e:
394
- return jsonify({"error": str(e)}), 500
 
395
 
396
  # ======================================================================
397
  # MAIN
 
360
  session_id = data.get('session_id', 'archive')
361
 
362
  if not query_text:
363
+ generic_message = "Problème avec l'API, veuillez réessayer plus tard."
364
+ return jsonify({"error": generic_message}), 500
365
 
366
  # Récupère historique
367
  history = get_conversation_history(session_id)
 
380
 
381
  except Exception as e:
382
  print(f"❌ Erreur générale de l'API: {e}")
383
+ generic_message = "Problème avec l'API, veuillez réessayer plus tard."
384
+ return jsonify({"error": generic_message}), 500
385
 
386
  @app.route('/api/clear_history', methods=['POST'])
387
  def api_clear_history():
 
393
 
394
  return jsonify({"message": f"Historique effacé: {session_id}"})
395
  except Exception as e:
396
+ generic_message = "Problème avec l'API, veuillez réessayer plus tard."
397
+ return jsonify({"error": generic_message}), 500
398
 
399
  # ======================================================================
400
  # MAIN