This commit is contained in:
rohans30 2024-11-14 10:31:02 +01:00 committed by GitHub
commit 079f1f0119
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194

View File

@ -159,7 +159,7 @@ class PrivateGptUi:
)
# max 20 messages to try to avoid context overflow
return history_messages[:20]
return history_messages[-20:]
new_message = ChatMessage(content=message, role=MessageRole.USER)
all_messages = [*build_history(), new_message]