Spaces:
Sleeping
Sleeping
reduce element in conversation history
Browse files- chatbot_simulator.py +2 -0
chatbot_simulator.py
CHANGED
@@ -181,7 +181,9 @@ Example Output Format:
|
|
181 |
system_prompt = self._generate_system_prompt()
|
182 |
|
183 |
# GPT generates the page instructions
|
|
|
184 |
self.conversation.append({"role": "system", "content": system_prompt})
|
|
|
185 |
gpt_instruction = self._get_openai_response(self.conversation)
|
186 |
self.conversation.append({"role": "assistant", "content": gpt_instruction})
|
187 |
return gpt_instruction
|
|
|
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 |
+
|
187 |
gpt_instruction = self._get_openai_response(self.conversation)
|
188 |
self.conversation.append({"role": "assistant", "content": gpt_instruction})
|
189 |
return gpt_instruction
|