geekan / MetaGPT

🌟 The Multi-Agent Framework: First AI Software Company, Towards Natural Language Programming
https://deepwisdom.ai/
MIT License
41.71k stars 4.98k forks source link

Product Manager Prepare Documents causes multiple exceptions. #769

Open MrCredible opened 6 months ago

MrCredible commented 6 months ago

Bug description After running through quickstart of installing metagpt (both versions of 0.6.0 and 0.6.4), the initial run has multiple exceptions.

Environment information

Screenshots, logs, and comments

I also tried cloning and still ran into the same issue.

I tried both the instructions on quickstart guide and the tutorial code in the Agent 101 and still ran into the same issue.

2024-01-16` 21:50:12.534 | INFO     | metagpt.config:get_default_llm_provider_enum:124 - LLMProviderEnum.OPENAI Model: gpt-4-1106-preview
2024-01-16 21:50:12.538 | INFO     | metagpt.config:get_default_llm_provider_enum:126 - API: LLMProviderEnum.OPENAI
2024-01-16 21:50:12.576 | INFO     | metagpt.config:get_default_llm_provider_enum:124 - LLMProviderEnum.OPENAI Model: gpt-4-1106-preview
2024-01-16 21:50:12.579 | INFO     | metagpt.config:get_default_llm_provider_enum:126 - API: LLMProviderEnum.OPENAI
2024-01-16 21:50:12.598 | INFO     | metagpt.config:get_default_llm_provider_enum:124 - LLMProviderEnum.OPENAI Model: gpt-4-1106-preview
2024-01-16 21:50:12.603 | INFO     | metagpt.config:get_default_llm_provider_enum:126 - API: LLMProviderEnum.OPENAI
2024-01-16 21:50:12.631 | INFO     | metagpt.config:get_default_llm_provider_enum:124 - LLMProviderEnum.OPENAI Model: gpt-4-1106-preview
2024-01-16 21:50:12.635 | INFO     | metagpt.config:get_default_llm_provider_enum:126 - API: LLMProviderEnum.OPENAI
2024-01-16 21:50:12.658 | INFO     | metagpt.team:invest:87 - Investment: $3.0.
2024-01-16 21:50:12.662 | INFO     | metagpt.roles.role:_act:360 - Alice(Product Manager): to do PrepareDocuments(PrepareDocuments)
2024-01-16 21:50:12.744 | WARNING  | metagpt.utils.common:wrapper:510 - There is a exception in role's execution, in order to resume, we delete the newest role communication message in the role's memory.
2024-01-16 21:50:12.748 | ERROR    | metagpt.utils.common:wrapper:492 - Exception occurs, start to serialize the project, exp:
Traceback (most recent call last):
  File "C:\Users\justi\AppData\Roaming\Python\Python310\site-packages\metagpt\utils\common.py", line 501, in wrapper
    return await func(self, *args, **kwargs)
  File "C:\Users\justi\AppData\Roaming\Python\Python310\site-packages\metagpt\roles\role.py", line 485, in run
    rsp = await self.react()
TypeError: Commit.__init__() missing 2 required positional arguments: 'repo' and 'binsha'

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
  File "C:\Users\justi\AppData\Roaming\Python\Python310\site-packages\metagpt\utils\common.py", line 487, in wrapper
    result = await func(self, *args, **kwargs)
  File "C:\Users\justi\AppData\Roaming\Python\Python310\site-packages\metagpt\team.py", line 134, in run
    await self.env.run()
Exception: Traceback (most recent call last):
  File "C:\Users\justi\AppData\Roaming\Python\Python310\site-packages\metagpt\utils\common.py", line 501, in wrapper
    return await func(self, *args, **kwargs)
  File "C:\Users\justi\AppData\Roaming\Python\Python310\site-packages\metagpt\roles\role.py", line 485, in run
    rsp = await self.react()
  File "C:\Users\justi\AppData\Roaming\Python\Python310\site-packages\metagpt\roles\role.py", line 453, in react
    rsp = await self._react()
  File "C:\Users\justi\AppData\Roaming\Python\Python310\site-packages\metagpt\roles\role.py", line 432, in _react
    rsp = await self._act()  # 这个rsp是否需要publish_message?
  File "C:\Users\justi\AppData\Roaming\Python\Python310\site-packages\metagpt\roles\role.py", line 361, in _act
    response = await self.rc.todo.run(self.rc.history)
  File "C:\Users\justi\AppData\Roaming\Python\Python310\site-packages\metagpt\actions\prepare_documents.py", line 42, in run
    self._init_repo()
  File "C:\Users\justi\AppData\Roaming\Python\Python310\site-packages\metagpt\actions\prepare_documents.py", line 38, in _init_repo
    CONFIG.git_repo = GitRepository(local_path=path, auto_init=True)
  File "C:\Users\justi\AppData\Roaming\Python\Python310\site-packages\metagpt\utils\git_repository.py", line 55, in __init__
    self.open(local_path=local_path, auto_init=auto_init)
  File "C:\Users\justi\AppData\Roaming\Python\Python310\site-packages\metagpt\utils\git_repository.py", line 71, in open
    return self._init(local_path)
  File "C:\Users\justi\AppData\Roaming\Python\Python310\site-packages\metagpt\utils\git_repository.py", line 85, in _init
    self._repository.index.commit("Add .gitignore")
  File "C:\Users\justi\AppData\Roaming\Python\Python310\site-packages\git\index\base.py", line 1050, in commit
    rval = Commit.create_from_tree(
  File "C:\Users\justi\AppData\Roaming\Python\Python310\site-packages\git\objects\commit.py", line 590, in create_from_tree
    new_commit = cls(
  File "C:\Users\justi\AppData\Roaming\Python\Python310\site-packages\git\objects\commit.py", line 146, in __init__
    super(Commit, self).__init__(repo, binsha)
  File "C:\Users\justi\AppData\Roaming\Python\Python310\site-packages\git\objects\base.py", line 63, in __init__
    super(Object, self).__init__()
  File "C:\Program Files\Python310\lib\typing.py", line 1422, in _no_init_or_replace_init
    cls.__init__(self, *args, **kwargs)
TypeError: Commit.__init__() missing 2 required positional arguments: 'repo' and 'binsha'
voidking commented 6 months ago

Did you install git and config it in the PATH? MetaGPT depends on git.

MrCredible commented 6 months ago

Yes, I have git in my path env variables

C:\Users\justi\AppData\Local\Programs\Git\cmd

voidking commented 6 months ago

OK, I guess it is a dependency problem. You can try install metagpt by git clonet https://github.com/geekan/MetaGPT and install dependencies mannaully.

cd MetaGPT
pip install -r requirements.txt
pip install -e.
MrCredible commented 6 months ago

all of the modules in the requirements have been installed already.

Only the product manager role does this. when I checked in the workspace/storage/team/environment/roles the ProductManager_Alice memory.json is pretty much empty.

If I comment out product manager lines mentioned in the quickstart guide, the errors that I mention in my original post no longer come up.

Commenting out the other roles does not remove the issue, only the product manager.

geekan commented 3 months ago

@MrCredible Will this problem still occur in the latest main branch?

MrCredible commented 1 month ago

@geekan , Unknown. I have not retried since I posted the original issue.