Spaces:
Sleeping
Sleeping
Update app.py
Browse files
app.py
CHANGED
@@ -240,20 +240,17 @@ def create_app():
|
|
240 |
socketio.emit("log", {"message": "[ERROR]: No DB file uploaded."})
|
241 |
socketio.emit("final", {"message": "No database available. Please upload one and try again."})
|
242 |
return
|
|
|
243 |
try:
|
244 |
if agent_app is None:
|
245 |
socketio.emit("log", {"message": "[INFO]: Initializing agent for the first time..."})
|
246 |
try:
|
247 |
agent_app = create_agent_app(abs_file_path)
|
248 |
socketio.emit("log", {"message": "[INFO]: Agent initialized."})
|
249 |
-
with app.app_context():
|
250 |
-
flash("Agent initialized.", "info")
|
251 |
except Exception as e:
|
252 |
error_message = f"Agent initialization failed: {str(e)}"
|
253 |
socketio.emit("log", {"message": f"[ERROR]: {error_message}"})
|
254 |
socketio.emit("final", {"message": "Agent initialization failed."})
|
255 |
-
with app.app_context():
|
256 |
-
flash(error_message, "error")
|
257 |
return
|
258 |
|
259 |
query = {"messages": [("user", prompt)]}
|
|
|
240 |
socketio.emit("log", {"message": "[ERROR]: No DB file uploaded."})
|
241 |
socketio.emit("final", {"message": "No database available. Please upload one and try again."})
|
242 |
return
|
243 |
+
|
244 |
try:
|
245 |
if agent_app is None:
|
246 |
socketio.emit("log", {"message": "[INFO]: Initializing agent for the first time..."})
|
247 |
try:
|
248 |
agent_app = create_agent_app(abs_file_path)
|
249 |
socketio.emit("log", {"message": "[INFO]: Agent initialized."})
|
|
|
|
|
250 |
except Exception as e:
|
251 |
error_message = f"Agent initialization failed: {str(e)}"
|
252 |
socketio.emit("log", {"message": f"[ERROR]: {error_message}"})
|
253 |
socketio.emit("final", {"message": "Agent initialization failed."})
|
|
|
|
|
254 |
return
|
255 |
|
256 |
query = {"messages": [("user", prompt)]}
|