mirror of
https://github.com/FoundationAgents/MetaGPT.git
synced 2026-05-10 16:22:37 +02:00
feat: archive
This commit is contained in:
parent
d9a2626fde
commit
27c731d11a
4 changed files with 33 additions and 3 deletions
|
|
@ -12,7 +12,7 @@
|
|||
functionality is to be consolidated into the `Environment` class.
|
||||
"""
|
||||
import asyncio
|
||||
from typing import Iterable, Set
|
||||
from typing import Iterable, Optional, Set
|
||||
|
||||
from pydantic import BaseModel, Field
|
||||
|
||||
|
|
@ -20,6 +20,7 @@ from metagpt.logs import logger
|
|||
from metagpt.roles import Role
|
||||
from metagpt.schema import Message
|
||||
from metagpt.utils.common import is_subscribed
|
||||
from metagpt.utils.git_repository import GitRepository
|
||||
|
||||
|
||||
class Environment(BaseModel):
|
||||
|
|
@ -31,6 +32,7 @@ class Environment(BaseModel):
|
|||
roles: dict[str, Role] = Field(default_factory=dict)
|
||||
consumers: dict[Role, Set] = Field(default_factory=dict)
|
||||
history: str = Field(default="") # For debug
|
||||
git_repository: Optional[GitRepository] = None
|
||||
|
||||
class Config:
|
||||
arbitrary_types_allowed = True
|
||||
|
|
@ -111,3 +113,8 @@ class Environment(BaseModel):
|
|||
def set_subscription(self, obj, tags):
|
||||
"""Set the labels for message to be consumed by the object"""
|
||||
self.consumers[obj] = tags
|
||||
|
||||
def dict(self, *args, **kwargs):
|
||||
"""Generate a dictionary representation of the model, optionally specifying which fields to include or
|
||||
exclude."""
|
||||
return super(Environment, self).dict(exclude={"git_repository"})
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue