mirror of
https://github.com/FoundationAgents/MetaGPT.git
synced 2026-05-07 14:52:37 +02:00
Revert "feat(core): Add stream data return and reception"
This reverts commit 7706b88f03.
This commit is contained in:
parent
29fecffa3f
commit
923150b2f3
13 changed files with 3 additions and 211 deletions
|
|
@ -39,8 +39,6 @@ from metagpt.strategy.planner import Planner
|
|||
from metagpt.utils.common import any_to_name, any_to_str, role_raise_decorator
|
||||
from metagpt.utils.project_repo import ProjectRepo
|
||||
from metagpt.utils.repair_llm_raw_output import extract_state_value_from_output
|
||||
from metagpt.utils.stream_pipe import StreamPipe
|
||||
|
||||
|
||||
if TYPE_CHECKING:
|
||||
from metagpt.environment import Environment # noqa: F401
|
||||
|
|
@ -141,8 +139,6 @@ class Role(SerializationMixin, ContextMixin, BaseModel):
|
|||
role_id: str = ""
|
||||
states: list[str] = []
|
||||
|
||||
stream_pipe: Optional[StreamPipe] = None
|
||||
|
||||
# scenarios to set action system_prompt:
|
||||
# 1. `__init__` while using Role(actions=[...])
|
||||
# 2. add action to role while using `role.set_action(action)`
|
||||
|
|
|
|||
|
|
@ -10,7 +10,7 @@ from datetime import datetime
|
|||
from typing import Dict
|
||||
|
||||
from metagpt.actions.write_tutorial import WriteContent, WriteDirectory
|
||||
from metagpt.const import TUTORIAL_PATH, METAGPT_ROOT
|
||||
from metagpt.const import TUTORIAL_PATH
|
||||
from metagpt.logs import logger
|
||||
from metagpt.roles.role import Role, RoleReactMode
|
||||
from metagpt.schema import Message
|
||||
|
|
@ -40,7 +40,7 @@ class TutorialAssistant(Role):
|
|||
|
||||
def __init__(self, **kwargs):
|
||||
super().__init__(**kwargs)
|
||||
self.set_actions([WriteDirectory(language=self.language, stream_pipe=self.stream_pipe)])
|
||||
self.set_actions([WriteDirectory(language=self.language)])
|
||||
self._set_react_mode(react_mode=RoleReactMode.BY_ORDER.value)
|
||||
|
||||
async def _handle_directory(self, titles: Dict) -> Message:
|
||||
|
|
@ -58,7 +58,7 @@ class TutorialAssistant(Role):
|
|||
self.total_content += f"# {self.main_title}"
|
||||
actions = list()
|
||||
for first_dir in titles.get("directory"):
|
||||
actions.append(WriteContent(language=self.language, directory=first_dir, stream_pipe=self.stream_pipe))
|
||||
actions.append(WriteContent(language=self.language, directory=first_dir))
|
||||
key = list(first_dir.keys())[0]
|
||||
directory += f"- {key}\n"
|
||||
for second_dir in first_dir[key]:
|
||||
|
|
@ -91,8 +91,4 @@ class TutorialAssistant(Role):
|
|||
root_path = TUTORIAL_PATH / datetime.now().strftime("%Y-%m-%d_%H-%M-%S")
|
||||
await File.write(root_path, f"{self.main_title}.md", self.total_content.encode("utf-8"))
|
||||
msg.content = str(root_path / f"{self.main_title}.md")
|
||||
|
||||
if self.stream_pipe:
|
||||
self.stream_pipe.set_k_message("file_name", msg.content.replace(str(METAGPT_ROOT), ""))
|
||||
self.stream_pipe.with_finish()
|
||||
return msg
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue