Merge pull request #803 from iorisa/feature/return_project_repo

feat: generate_repo return project repo
This commit is contained in:
geekan 2024-01-30 10:05:27 +08:00 committed by GitHub
commit 9e49e2252d
No known key found for this signature in database
GPG key ID: B5690EEEBB952194

View file

@ -1,5 +1,6 @@
#!/usr/bin/env python
# -*- coding: utf-8 -*-
import asyncio
import shutil
from pathlib import Path
@ -9,6 +10,7 @@ import typer
from metagpt.config2 import config
from metagpt.const import CONFIG_ROOT, METAGPT_ROOT
from metagpt.context import Context
from metagpt.utils.project_repo import ProjectRepo
app = typer.Typer(add_completion=False, pretty_exceptions_show_locals=False)
@ -26,7 +28,7 @@ def generate_repo(
reqa_file,
max_auto_summarize_code,
recover_path,
):
) -> ProjectRepo:
"""Run the startup logic. Can be called from CLI or other Python scripts."""
from metagpt.roles import (
Architect,
@ -67,6 +69,8 @@ def generate_repo(
company.run_project(idea)
asyncio.run(company.run(n_round=n_round))
return ctx.repo
@app.command("", help="Start a new project.")
def startup(