gosign commited on
Commit
8d04284
·
verified ·
1 Parent(s): b200c60

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +10 -0
app.py CHANGED
@@ -180,6 +180,16 @@ def delete_all_files(directory):
180
  @app.route("/api/letterhead", methods=["POST"])
181
  def letterhead():
182
  data = request.get_json()
 
 
 
 
 
 
 
 
 
 
183
 
184
  # Extract data
185
  chat_settings = data.get("chatSettings")
 
180
  @app.route("/api/letterhead", methods=["POST"])
181
  def letterhead():
182
  data = request.get_json()
183
+ try:
184
+ # Save the data into 'data.txt' in JSON format
185
+ file_path = "./data.txt"
186
+ os.makedirs(os.path.dirname(file_path), exist_ok=True)
187
+
188
+ with open(file_path, "w") as file:
189
+ file.write(data)
190
+ except Exception as e:
191
+ return {"error": str(e)}, 500
192
+
193
 
194
  # Extract data
195
  chat_settings = data.get("chatSettings")