Update app.py
Browse files
app.py
CHANGED
|
@@ -434,9 +434,7 @@ class ChuckAgent:
|
|
| 434 |
|
| 435 |
try:
|
| 436 |
self.loop = asyncio.get_running_loop()
|
| 437 |
-
print(f"DEBUG: ChuckAgent obtained running event loop: {self.loop}")
|
| 438 |
except RuntimeError:
|
| 439 |
-
print("DEBUG: ChuckAgent - No current running event loop, creating a new one for this thread.")
|
| 440 |
self.loop = asyncio.new_event_loop()
|
| 441 |
asyncio.set_event_loop(self.loop)
|
| 442 |
|
|
@@ -485,11 +483,9 @@ class ChuckAgent:
|
|
| 485 |
|
| 486 |
print(f"DEBUG: ChuckAgent submitting task to event loop {self.loop} for question: '{question[:50]}...'")
|
| 487 |
if not self.loop.is_running():
|
| 488 |
-
print(f"DEBUG: WARNING - ChuckAgent event loop {self.loop} is not running. Attempting to run process_question directly.")
|
| 489 |
final_answer, reasoning_trace = self.loop.run_until_complete(self.agent_instance.process_question(question))
|
| 490 |
else:
|
| 491 |
future = asyncio.run_coroutine_threadsafe(self.agent_instance.process_question(question), self.loop)
|
| 492 |
-
print(f"DEBUG: ChuckAgent waiting for future.result() for question: '{question[:50]}...'")
|
| 493 |
final_answer, reasoning_trace = future.result(timeout=180)
|
| 494 |
|
| 495 |
print(f"DEBUG: ChuckAgent future.result() obtained for question: '{question[:50]}...'. Answer: '{final_answer[:50]}...'")
|
|
|
|
| 434 |
|
| 435 |
try:
|
| 436 |
self.loop = asyncio.get_running_loop()
|
|
|
|
| 437 |
except RuntimeError:
|
|
|
|
| 438 |
self.loop = asyncio.new_event_loop()
|
| 439 |
asyncio.set_event_loop(self.loop)
|
| 440 |
|
|
|
|
| 483 |
|
| 484 |
print(f"DEBUG: ChuckAgent submitting task to event loop {self.loop} for question: '{question[:50]}...'")
|
| 485 |
if not self.loop.is_running():
|
|
|
|
| 486 |
final_answer, reasoning_trace = self.loop.run_until_complete(self.agent_instance.process_question(question))
|
| 487 |
else:
|
| 488 |
future = asyncio.run_coroutine_threadsafe(self.agent_instance.process_question(question), self.loop)
|
|
|
|
| 489 |
final_answer, reasoning_trace = future.result(timeout=180)
|
| 490 |
|
| 491 |
print(f"DEBUG: ChuckAgent future.result() obtained for question: '{question[:50]}...'. Answer: '{final_answer[:50]}...'")
|