humanvprojectceo commited on
Commit
6b39864
·
verified ·
1 Parent(s): 4433e44

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +4 -4
app.py CHANGED
@@ -503,12 +503,12 @@ def api_confirm_order():
503
  new_id = cur.fetchone()[0]
504
  conn.commit()
505
 
506
- # Clear session
507
- table_chat_histories.pop(table_number, None)
 
508
  global_drafts.pop(table_number, None)
509
- active_tasks.pop(table_number, None)
510
 
511
- return jsonify({"success": True, "message": "سفارش ثبت شد و سشن میز کاملاً آزاد گردید."})
512
  except Exception as e:
513
  conn.rollback()
514
  return jsonify({"error": f"خطا در ثبت سفارش: {str(e)}"}), 500
 
503
  new_id = cur.fetchone()[0]
504
  conn.commit()
505
 
506
+ # --- MODIFICATION: Do NOT clear the session so the customer can continue chatting ---
507
+ # The draft is already used, but the chat history remains intact.
508
+ # Remove the draft for this table (a new draft will be created for subsequent orders).
509
  global_drafts.pop(table_number, None)
 
510
 
511
+ return jsonify({"success": True, "message": "سفارش ثبت شد. می‌توانید همچنان با من گفتگو کنید."})
512
  except Exception as e:
513
  conn.rollback()
514
  return jsonify({"error": f"خطا در ثبت سفارش: {str(e)}"}), 500