2023-06-30 17:10:48 +08:00
|
|
|
#!/usr/bin/env python
|
|
|
|
|
# -*- coding: utf-8 -*-
|
2023-08-20 17:33:13 +08:00
|
|
|
"""
|
|
|
|
|
@Modified By: mashenquan, 2023/8/20. Remove global configuration `CONFIG`, enable configuration support for business isolation;
|
|
|
|
|
Change cost control from global to company level.
|
|
|
|
|
"""
|
|
|
|
|
|
2023-06-30 17:10:48 +08:00
|
|
|
import asyncio
|
2023-08-22 17:34:53 +02:00
|
|
|
import platform
|
2023-06-30 17:10:48 +08:00
|
|
|
import fire
|
2023-07-22 11:28:22 +08:00
|
|
|
|
2023-07-25 22:57:24 +08:00
|
|
|
from metagpt.roles import Architect, Engineer, ProductManager, ProjectManager, QaEngineer
|
2023-06-30 17:10:48 +08:00
|
|
|
from metagpt.software_company import SoftwareCompany
|
|
|
|
|
|
|
|
|
|
|
2023-08-04 12:20:30 +08:00
|
|
|
async def startup(idea: str, investment: float = 3.0, n_round: int = 5,
|
|
|
|
|
code_review: bool = False, run_tests: bool = False):
|
2023-06-30 17:10:48 +08:00
|
|
|
"""Run a startup. Be a boss."""
|
2023-08-20 17:33:13 +08:00
|
|
|
|
2023-06-30 17:10:48 +08:00
|
|
|
company = SoftwareCompany()
|
2023-08-20 17:33:13 +08:00
|
|
|
company.hire([ProductManager(options=company.options, cost_manager=company.cost_manager),
|
|
|
|
|
Architect(options=company.options, cost_manager=company.cost_manager),
|
|
|
|
|
ProjectManager(options=company.options, cost_manager=company.cost_manager),
|
|
|
|
|
Engineer(n_borg=5, use_code_review=code_review, options=company.options, cost_manager=company.cost_manager)])
|
2023-08-04 12:20:30 +08:00
|
|
|
if run_tests:
|
|
|
|
|
# developing features: run tests on the spot and identify bugs (bug fixing capability comes soon!)
|
2023-08-20 17:33:13 +08:00
|
|
|
company.hire([QaEngineer(options=company.options, cost_manager=company.cost_manager)])
|
2023-06-30 17:10:48 +08:00
|
|
|
company.invest(investment)
|
|
|
|
|
company.start_project(idea)
|
|
|
|
|
await company.run(n_round=n_round)
|
|
|
|
|
|
|
|
|
|
|
2023-08-04 12:20:30 +08:00
|
|
|
def main(idea: str, investment: float = 3.0, n_round: int = 5, code_review: bool = False, run_tests: bool = False):
|
2023-06-30 17:10:48 +08:00
|
|
|
"""
|
|
|
|
|
We are a software startup comprised of AI. By investing in us, you are empowering a future filled with limitless possibilities.
|
|
|
|
|
:param idea: Your innovative idea, such as "Creating a snake game."
|
|
|
|
|
:param investment: As an investor, you have the opportunity to contribute a certain dollar amount to this AI company.
|
2023-07-22 09:47:42 +08:00
|
|
|
:param n_round:
|
|
|
|
|
:param code_review: Whether to use code review.
|
2023-06-30 17:10:48 +08:00
|
|
|
:return:
|
|
|
|
|
"""
|
2023-08-22 17:34:53 +02:00
|
|
|
if platform.system() == "Windows":
|
|
|
|
|
asyncio.set_event_loop_policy(asyncio.WindowsSelectorEventLoopPolicy())
|
2023-08-04 12:20:30 +08:00
|
|
|
asyncio.run(startup(idea, investment, n_round, code_review, run_tests))
|
2023-06-30 17:10:48 +08:00
|
|
|
|
|
|
|
|
|
|
|
|
|
if __name__ == '__main__':
|
|
|
|
|
fire.Fire(main)
|