diff --git a/examples/example.pkl b/examples/example.pkl index 0469a2e46..7c6ab901b 100644 Binary files a/examples/example.pkl and b/examples/example.pkl differ diff --git a/metagpt/actions/action.py b/metagpt/actions/action.py index a7eb838b0..addc672bc 100644 --- a/metagpt/actions/action.py +++ b/metagpt/actions/action.py @@ -35,6 +35,8 @@ class Action(SerializationMixin, ContextMixin, BaseModel): @property def repo(self) -> ProjectRepo: + if not self.context.repo: + self.context.repo = ProjectRepo(self.context.git_repo) return self.context.repo @property diff --git a/tests/metagpt/test_context.py b/tests/metagpt/test_context.py index d662a906a..d90d0b686 100644 --- a/tests/metagpt/test_context.py +++ b/tests/metagpt/test_context.py @@ -48,7 +48,6 @@ def test_context_1(): assert ctx.git_repo is None assert ctx.src_workspace is None assert ctx.cost_manager is not None - assert ctx.options is not None def test_context_2(): diff --git a/tests/metagpt/test_context_mixin.py b/tests/metagpt/test_context_mixin.py index a098ff0dc..a8a096d69 100644 --- a/tests/metagpt/test_context_mixin.py +++ b/tests/metagpt/test_context_mixin.py @@ -95,7 +95,7 @@ def test_config_mixin_4_multi_inheritance_override_config(): print(obj.__dict__.keys()) assert "private_config" in obj.__dict__.keys() - assert obj.llm.model == "mock_zhipu_model" + assert obj.config.llm.model == "mock_zhipu_model" @pytest.mark.asyncio