Kaynağa Gözat
Fix: truncate message issue. (#5765)
### What problem does this PR solve?
Close #5761
### Type of change
- [x] Bug Fix (non-breaking change which fixes an issue)
tags/v0.17.1
Kevin Hu
8 ay önce
ebeveyn
işleme
64c6cc4cf3
No account linked to committer's email address
|
|
|
@@ -70,7 +70,7 @@ def message_fit_in(msg, max_length=4000): |
|
|
|
if c < max_length: |
|
|
|
return c, msg |
|
|
|
|
|
|
|
msg_ = [m for m in msg[:-1] if m["role"] == "system"] |
|
|
|
msg_ = [m for m in msg if m["role"] == "system"] |
|
|
|
if len(msg) > 1: |
|
|
|
msg_.append(msg[-1]) |
|
|
|
msg = msg_ |