Spaces:
Sleeping
Sleeping
add a little comments
Browse files- chatbot_simulator.py +2 -1
chatbot_simulator.py
CHANGED
@@ -150,7 +150,7 @@ Example Output Format:
|
|
150 |
|
151 |
self.conversation.append({"role": "assistant", "content": update_prompt})
|
152 |
updated_state = self._get_openai_response(self.conversation)
|
153 |
-
self.conversation.pop(-1)
|
154 |
|
155 |
# Parse and update the user state
|
156 |
updated_state = json_repair.loads(updated_state)
|
@@ -181,6 +181,7 @@ Example Output Format:
|
|
181 |
system_prompt = self._generate_system_prompt()
|
182 |
|
183 |
# GPT generates the page instructions
|
|
|
184 |
self.conversation = [entry for entry in self.conversation if entry["role"] != "system"]
|
185 |
self.conversation.append({"role": "system", "content": system_prompt})
|
186 |
|
|
|
150 |
|
151 |
self.conversation.append({"role": "assistant", "content": update_prompt})
|
152 |
updated_state = self._get_openai_response(self.conversation)
|
153 |
+
self.conversation.pop(-1) ## update prompt don't have to stay in conversation history
|
154 |
|
155 |
# Parse and update the user state
|
156 |
updated_state = json_repair.loads(updated_state)
|
|
|
181 |
system_prompt = self._generate_system_prompt()
|
182 |
|
183 |
# GPT generates the page instructions
|
184 |
+
## no need to store old system prompt while we get a new one
|
185 |
self.conversation = [entry for entry in self.conversation if entry["role"] != "system"]
|
186 |
self.conversation.append({"role": "system", "content": system_prompt})
|
187 |
|