🌟 The Multi-Agent Framework: First AI Software Company, Towards Natural Language Programming
add context mixin
geekan33db023e9448
diff --git a/metagpt/context.py b/metagpt/context.pyindex eb46ab19b..293beb9b5 100644--- a/metagpt/context.py+++ b/metagpt/context.py@@ -103,5 +103,23 @@ class Context(LLMMixin, BaseModel):# return llm+class ContextMixin:+ """Mixin class for configurable objects"""++ _context: Optional[Context] = None++ def __init__(self, context: Optional[Context] = None):+ self._context = context++ def set_context(self, context: Optional[Context] = None):+ """Set parent context"""+ self._context = context++ @property+ def context(self):+ """Get config"""+ return self._context++# Global context, not in Envcontext = Context()