Fix: duplicated role... (#9622)

### What problem does this PR solve?

#9611
#9603 #9597

### Type of change

- [x] Bug Fix (non-breaking change which fixes an issue)
This commit is contained in:
Kevin Hu
2025-08-21 12:14:43 +08:00
committed by GitHub
parent 30005c0203
commit 929dc97509
7 changed files with 16 additions and 18 deletions

View File

@ -426,7 +426,7 @@ class Canvas:
convs = []
if window_size <= 0:
return convs
for role, obj in self.history[window_size * -1:]:
for role, obj in self.history[window_size * -2:]:
if isinstance(obj, dict):
convs.append({"role": role, "content": obj.get("content", "")})
else: