This commit is contained in:
shenchucheng 2023-12-26 19:09:00 +08:00
parent 4f52b47610
commit bbdbe93809

View file

@ -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)