Expand the tail to ensure head ends with assistant msg

This commit is contained in:
Paul Gauthier 2023-07-25 06:58:41 -03:00
parent 4b41eb7525
commit f0ec6cb36a

View file

@ -49,8 +49,8 @@ class ChatSummary:
break
# Ensure the head ends with an assistant message
while messages[split_index - 1]["role"] != "assistant" and split_index < len(messages):
split_index += 1
while messages[split_index - 1]["role"] != "assistant" and split_index > 1:
split_index -= 1
head = messages[:split_index]
tail = messages[split_index:]