WebashalarForML commited on
Commit
7f7f33b
·
verified ·
1 Parent(s): 4a062d3

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +6 -0
app.py CHANGED
@@ -253,7 +253,9 @@ def create_app():
253
 
254
  print("final_answer------>", result)
255
  socketio.emit("final", {"message": f"{result}"})
 
256
  except Exception as e:
 
257
  socketio.emit("log", {"message": f"[ERROR]: {str(e)}"})
258
  socketio.emit("final", {"message": "Generation failed."})
259
 
@@ -270,9 +272,11 @@ def create_app():
270
  socketio.emit("log", {"message": f"[INFO]: Received prompt: {prompt}\n"})
271
  # Run the agent in a separate thread
272
  thread = threading.Thread(target=run_agent, args=(prompt, socketio))
 
273
  thread.start()
274
  return "OK", 200
275
  except Exception as e:
 
276
  socketio.emit("log", {"message": f"[ERROR]: {str(e)}"})
277
 
278
  @flask_app.route("/upload", methods=["POST", "GET"])
@@ -286,6 +290,7 @@ def create_app():
286
  if file and file.filename.endswith('.db'):
287
  # Save file using flask_app.config
288
  db_path = os.path.join(flask_app.config['UPLOAD_FOLDER'], 'uploaded.db')
 
289
  print("Saving file to:", db_path)
290
  file.save(db_path)
291
 
@@ -300,6 +305,7 @@ def create_app():
300
  # For GET, render upload form:
301
  return render_template("upload.html")
302
  except Exception as e:
 
303
  socketio.emit("log", {"message": f"[ERROR]: {str(e)}"})
304
  return render_template("upload.html")
305
 
 
253
 
254
  print("final_answer------>", result)
255
  socketio.emit("final", {"message": f"{result}"})
256
+
257
  except Exception as e:
258
+ print(f"[ERROR]: {str(e)}")
259
  socketio.emit("log", {"message": f"[ERROR]: {str(e)}"})
260
  socketio.emit("final", {"message": "Generation failed."})
261
 
 
272
  socketio.emit("log", {"message": f"[INFO]: Received prompt: {prompt}\n"})
273
  # Run the agent in a separate thread
274
  thread = threading.Thread(target=run_agent, args=(prompt, socketio))
275
+ socketio.emit("log", {"message": f"[INFO]: thread info: {thread}\n"})
276
  thread.start()
277
  return "OK", 200
278
  except Exception as e:
279
+ print(f"[ERROR]: {str(e)}")
280
  socketio.emit("log", {"message": f"[ERROR]: {str(e)}"})
281
 
282
  @flask_app.route("/upload", methods=["POST", "GET"])
 
290
  if file and file.filename.endswith('.db'):
291
  # Save file using flask_app.config
292
  db_path = os.path.join(flask_app.config['UPLOAD_FOLDER'], 'uploaded.db')
293
+ socketio.emit("log", {"message": f"[INFO]: Saving file to: {db_path}\n"})
294
  print("Saving file to:", db_path)
295
  file.save(db_path)
296
 
 
305
  # For GET, render upload form:
306
  return render_template("upload.html")
307
  except Exception as e:
308
+ print(f"[ERROR]: {str(e)}")
309
  socketio.emit("log", {"message": f"[ERROR]: {str(e)}"})
310
  return render_template("upload.html")
311