Fixed history_messages in ui.py

This commit is contained in:
rohans30 2024-08-20 00:10:30 -07:00
parent 89477ea9d3
commit f12c57b472

View File

@ -155,7 +155,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]