Spaces:
Sleeping
Sleeping
trim more
Browse files- chatbot_simulator.py +2 -1
chatbot_simulator.py
CHANGED
@@ -84,7 +84,7 @@ Rules:
|
|
84 |
|
85 |
def _trim_conversation(self):
|
86 |
"""Trim the conversation to keep it within the token limit."""
|
87 |
-
while self._calculate_token_count(self.conversation) > self.max_tokens -
|
88 |
self.conversation.pop(0) #
|
89 |
|
90 |
def one_conversation_round(self, user_input):
|
@@ -155,6 +155,7 @@ Rules:
|
|
155 |
|
156 |
self.user_state = updated_state
|
157 |
|
|
|
158 |
system_prompt = self._generate_system_prompt()
|
159 |
|
160 |
# GPT generates the page instructions
|
|
|
84 |
|
85 |
def _trim_conversation(self):
|
86 |
"""Trim the conversation to keep it within the token limit."""
|
87 |
+
while self._calculate_token_count(self.conversation) > self.max_tokens - self.buffer_tokens:
|
88 |
self.conversation.pop(0) #
|
89 |
|
90 |
def one_conversation_round(self, user_input):
|
|
|
155 |
|
156 |
self.user_state = updated_state
|
157 |
|
158 |
+
self.conversation.clear()
|
159 |
system_prompt = self._generate_system_prompt()
|
160 |
|
161 |
# GPT generates the page instructions
|