mirror of
https://git.mirrors.martin98.com/https://github.com/infiniflow/ragflow.git
synced 2025-08-13 02:58:59 +08:00
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)
This commit is contained in:
parent
3418984848
commit
64c6cc4cf3
@ -70,7 +70,7 @@ def message_fit_in(msg, max_length=4000):
|
|||||||
if c < max_length:
|
if c < max_length:
|
||||||
return c, msg
|
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:
|
if len(msg) > 1:
|
||||||
msg_.append(msg[-1])
|
msg_.append(msg[-1])
|
||||||
msg = msg_
|
msg = msg_
|
||||||
|
Loading…
x
Reference in New Issue
Block a user