Make the report output directory if it doesn't exist.

This commit is contained in:
shenchucheng 2023-08-17 17:14:43 +08:00
parent 625342199a
commit 7e329a478a

View file

@ -84,10 +84,17 @@ class Researcher(Role):
return msg
def write_report(self, topic: str, content: str):
if not RESEARCH_PATH.exists():
RESEARCH_PATH.mkdir(parents=True)
filepath = RESEARCH_PATH / f"{topic}.md"
filepath.write_text(content)
if __name__ == "__main__":
role = Researcher(language="en-us")
asyncio.run(role.run("dataiku vs. datarobot"))
import fire
async def main(topic: str, language="en-us"):
role = Researcher(topic, language=language)
await role.run(topic)
fire.Fire(main)