mirror of
https://github.com/FoundationAgents/MetaGPT.git
synced 2026-04-27 17:56:23 +02:00
Merge pull request #5 from iorisa/feature/patch1
fixbug: cannot get query
This commit is contained in:
commit
882c66ba2a
3 changed files with 18 additions and 1 deletions
|
|
@ -131,6 +131,8 @@ class Config(metaclass=Singleton):
|
|||
|
||||
def set_context(self, options: dict):
|
||||
"""Update current config"""
|
||||
if not options:
|
||||
return
|
||||
opts = deepcopy(OPTIONS.get())
|
||||
opts.update(options)
|
||||
OPTIONS.set(opts)
|
||||
|
|
|
|||
|
|
@ -85,3 +85,11 @@ class Memory:
|
|||
continue
|
||||
rsp += self.index[action]
|
||||
return rsp
|
||||
|
||||
def get_by_tags(self, tags: list) -> list[Message]:
|
||||
"""Return messages with specified tags"""
|
||||
result = []
|
||||
for m in self.storage:
|
||||
if m.is_contain_tags(tags):
|
||||
result.append(m)
|
||||
return result
|
||||
|
|
|
|||
|
|
@ -92,6 +92,13 @@ class RoleContext(BaseModel):
|
|||
def history(self) -> list[Message]:
|
||||
return self.memory.get()
|
||||
|
||||
@property
|
||||
def prerequisite(self):
|
||||
"""Retrieve information with `prerequisite` tag"""
|
||||
if self.memory and hasattr(self.memory, 'get_by_tags'):
|
||||
return self.memory.get_by_tags([MessageTag.Prerequisite.value])
|
||||
return ""
|
||||
|
||||
|
||||
class Role:
|
||||
"""Role/Proxy"""
|
||||
|
|
@ -201,7 +208,7 @@ class Role:
|
|||
# history=self.history)
|
||||
|
||||
logger.info(f"{self._setting}: ready to {self._rc.todo}")
|
||||
requirement = self._rc.important_memory
|
||||
requirement = self._rc.important_memory or self._rc.prerequisite
|
||||
response = await self._rc.todo.run(requirement)
|
||||
# logger.info(response)
|
||||
if isinstance(response, ActionOutput):
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue