浏览代码

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 7 个月前
父节点
当前提交
64c6cc4cf3
没有帐户链接到提交者的电子邮件
共有 1 个文件被更改,包括 1 次插入1 次删除
  1. 1
    1
      rag/prompts.py

+ 1
- 1
rag/prompts.py 查看文件

@@ -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_

正在加载...
取消
保存