Skip to content

🌟 The Multi-Agent Framework: First AI Software Company, Towards Natural Language Programming

stop llm stream report if task done

shenchuchengec36d298f05c
diff --git a/metagpt/report.py b/metagpt/report.py
index 5bc0ec03d..db755d803 100644
--- a/metagpt/report.py
+++ b/metagpt/report.py
@@ -146,14 +146,14 @@ class ResourceReporter(BaseModel):
async def __aexit__(self, *args, **kwargs):
"""Exit the asynchronous streaming callback context."""
- await self.async_report(None, END_MARKER_NAME)
self.is_chunk = False
if self.enable_llm_stream:
self._llm_task.cancel()
self._llm_task = None
+ await self.async_report(None, END_MARKER_NAME)
async def _llm_stream_report(self, queue: asyncio.Queue):
- while True:
+ while self.is_chunk:
await self.async_report(await queue.get(), "content")
async def wait_llm_stream_report(self):