瀏覽代碼

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 查看文件

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…
取消
儲存