fixbug: No user feedback, unsure if past conversation is finished.

This commit is contained in:
莘权 马 2023-08-27 13:22:34 +08:00
parent 5a03ff20ce
commit 4fddfbab58
2 changed files with 3 additions and 1 deletions

View file

@ -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

View file

@ -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)