Skip to content

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

fix #560

shenchuchengbbdbe9380902
diff --git a/metagpt/roles/researcher.py b/metagpt/roles/researcher.py
index 27f046878..0f342de1c 100644
--- a/metagpt/roles/researcher.py
+++ b/metagpt/roles/researcher.py
@@ -5,6 +5,7 @@
"""
import asyncio
+import re
from pydantic import BaseModel
@@ -95,9 +96,11 @@ class Researcher(Role):
return msg
def write_report(self, topic: str, content: str):
+ filename = re.sub(r'[\\/:"*?<>|]+', " ", topic)
+ filename = filename.replace("\n", "")
if not RESEARCH_PATH.exists():
RESEARCH_PATH.mkdir(parents=True)
- filepath = RESEARCH_PATH / f"{topic}.md"
+ filepath = RESEARCH_PATH / f"{filename}.md"
filepath.write_text(content)