Refactor generator completion checks for consistency.

Replaced `.is_complete()` method calls with direct `.complete` attribute access to streamline the code. Removed the redundant `is_complete()` method from `deepresearch.py` to reduce unnecessary indirection. This simplifies the logic and improves readability.
This commit is contained in:
ThomasTaroni 2025-04-25 19:53:59 +02:00
parent b16305e369
commit 79be94afd2
2 changed files with 2 additions and 5 deletions

View file

@ -42,7 +42,7 @@ async def get_report_endpoint(request: ReportRequest):
generator.generate_report()
yield "Report generation completed successfully!\n"
index = 0
while not generator.is_complete():
while not generator.complete:
# If there are more logs to send, yield them
if index < len(custom_logs_handler.logs):
log_entry = custom_logs_handler.logs[index]
@ -52,7 +52,7 @@ async def get_report_endpoint(request: ReportRequest):
# Wait briefly to avoid aggressive looping
await asyncio.sleep(0.1)
# Stop if processing is complete and no more logs remain
if generator.researcher.is_complete():
if generator.researcher.complete:
break
except Exception as e:

View file

@ -28,9 +28,6 @@ class ReportGenerator:
def init(self) -> CustomLogsHandler:
return self.custom_logs_handler
def is_complete(self):
return self.complete
async def generate_report(self) -> None:
"""
Conducts research and generates the report along with additional information.