diff --git a/modules/chat.py b/modules/chat.py index 5380f1ac8e..670567e3d5 100644 --- a/modules/chat.py +++ b/modules/chat.py @@ -169,7 +169,7 @@ def make_prompt(messages): prompt = make_prompt(messages) # Handle truncation - max_length = get_max_prompt_length(state) + max_length = state['truncation_length'] while len(messages) > 0 and get_encoded_length(prompt) > max_length: # Try to save the system message if len(messages) > 1 and messages[0]['role'] == 'system':