Spaces:
Running
Running
Update app.py
Browse files
app.py
CHANGED
@@ -179,7 +179,14 @@ def delete_all_files(directory):
|
|
179 |
|
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")
|
|
|
179 |
|
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 |
+
with open("data.txt", "w") as file:
|
186 |
+
json.dump(data, file, indent=4)
|
187 |
+
return {"message": "Data saved successfully"}, 200
|
188 |
+
except Exception as e:
|
189 |
+
return {"error": str(e)}, 500# Get JSON data from the request (if provided)
|
190 |
|
191 |
# Extract data
|
192 |
chat_settings = data.get("chatSettings")
|