mirror of
https://github.com/FoundationAgents/MetaGPT.git
synced 2026-05-06 06:12:39 +02:00
fixbug: exceed length
This commit is contained in:
parent
8c943dd8e9
commit
f7ebd2a374
1 changed files with 10 additions and 1 deletions
|
|
@ -45,7 +45,16 @@ class BrainMemory(pydantic.BaseModel):
|
|||
def history_text(self):
|
||||
if len(self.history) == 0:
|
||||
return ""
|
||||
texts = [Message(**m).content for m in self.history[:-1]]
|
||||
texts = []
|
||||
for m in self.history[:-1]:
|
||||
if isinstance(m, Dict):
|
||||
t = Message(**m).content
|
||||
elif isinstance(m, Message):
|
||||
t = m.content
|
||||
else:
|
||||
continue
|
||||
texts.append(t)
|
||||
|
||||
return "\n".join(texts)
|
||||
|
||||
def move_to_solution(self, history_summary):
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue