Browse Source

Fix:Setting the message_history_window_size to 0 does not take effect (#7842)

### What problem does this PR solve?

Close #7830
The caller method should already have code to handle this.

### Type of change

- [x] Bug Fix (non-breaking change which fixes an issue)
tags/v0.19.1
Stephen Hu 5 months ago
parent
commit
ae171956e8
No account linked to committer's email address
1 changed files with 2 additions and 0 deletions
  1. 2
    0
      agent/canvas.py

+ 2
- 0
agent/canvas.py View File

@@ -304,6 +304,8 @@ class Canvas:

def get_history(self, window_size):
convs = []
if window_size <= 0:
return convs
for role, obj in self.history[window_size * -1:]:
if isinstance(obj, list) and obj and all([isinstance(o, dict) for o in obj]):
convs.append({"role": role, "content": '\n'.join([str(s.get("content", "")) for s in obj])})

Loading…
Cancel
Save