diff --git a/metagpt/memory/brain_memory.py b/metagpt/memory/brain_memory.py index 422c096f3..9d1b038bb 100644 --- a/metagpt/memory/brain_memory.py +++ b/metagpt/memory/brain_memory.py @@ -53,6 +53,6 @@ class BrainMemory(pydantic.BaseModel): @property def last_talk(self): if len(self.history) == 0 or not self.history[-1].is_contain_tags([MessageType.Talk.value]): - return "" + return None return self.history[-1].content diff --git a/metagpt/roles/assistant.py b/metagpt/roles/assistant.py index 3924039b5..1e503857a 100644 --- a/metagpt/roles/assistant.py +++ b/metagpt/roles/assistant.py @@ -113,6 +113,8 @@ class Assistant(Role): async def refine_memory(self) -> str: history_text = self.memory.history_text last_talk = self.memory.last_talk + if last_talk is None: # No user feedback, unsure if past conversation is finished. + return None if history_text == "": return last_talk history_summary = await self._llm.get_context_title(history_text, max_words=20)