Update Controller_CoderFlow.py
Browse files- Controller_CoderFlow.py +10 -10
Controller_CoderFlow.py
CHANGED
|
@@ -112,14 +112,14 @@ class Controller_CoderFlow(ChatAtomicFlow):
|
|
| 112 |
self._state_update_add_chat_message(content=updated_system_message_content,
|
| 113 |
role=self.flow_config["system_name"])
|
| 114 |
|
| 115 |
-
|
| 116 |
-
|
| 117 |
-
|
| 118 |
-
|
| 119 |
-
|
| 120 |
-
|
| 121 |
-
|
| 122 |
-
|
| 123 |
-
|
| 124 |
-
|
| 125 |
|
|
|
|
| 112 |
self._state_update_add_chat_message(content=updated_system_message_content,
|
| 113 |
role=self.flow_config["system_name"])
|
| 114 |
|
| 115 |
+
while True:
|
| 116 |
+
api_output = super().run(input_data)["api_output"].strip()
|
| 117 |
+
try:
|
| 118 |
+
response = json.loads(api_output)
|
| 119 |
+
return response
|
| 120 |
+
except (json.decoder.JSONDecodeError, json.JSONDecodeError):
|
| 121 |
+
new_goal = "The previous respond cannot be parsed with json.loads. Make sure your next response is in JSON format."
|
| 122 |
+
new_input_data = input_data.copy()
|
| 123 |
+
new_input_data['result'] = new_goal
|
| 124 |
+
input_data = new_input_data
|
| 125 |
|