Skip to content

Commit

Permalink
Merge pull request #532 from aws-samples/hubin-daily
Browse files Browse the repository at this point in the history
fix: Update the eviction policy for chat history
  • Loading branch information
530051970 authored Feb 13, 2025
2 parents 1480183 + b4f5ad9 commit cecb2ae
Showing 1 changed file with 2 additions and 1 deletion.
Original file line number Diff line number Diff line change
Expand Up @@ -677,7 +677,8 @@ def common_entry(event_body):
query = event_body["query"]
use_history = chatbot_config["use_history"]
max_rounds_in_memory = event_body["chatbot_config"]["max_rounds_in_memory"]
chat_history = event_body["chat_history"][:max_rounds_in_memory] if use_history else []
# if(len(event_body["chat_history"])<=2*max_rounds_in_memory)
chat_history = event_body["chat_history"][-2*max_rounds_in_memory:] if use_history else []
stream = event_body["stream"]
message_id = event_body["custom_message_id"]
ws_connection_id = event_body["ws_connection_id"]
Expand Down

0 comments on commit cecb2ae

Please sign in to comment.