Pārlūkot izejas kodu

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 pirms 8 mēnešiem
vecāks
revīzija
64c6cc4cf3
Revīzijas autora e-pasta adrese nav piesaistīta nevienam kontam
1 mainītis faili ar 1 papildinājumiem un 1 dzēšanām
  1. 1
    1
      rag/prompts.py

+ 1
- 1
rag/prompts.py Parādīt failu

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

Notiek ielāde…
Atcelt
Saglabāt