Update Controller_CoderFlow.py
Browse files- Controller_CoderFlow.py +5 -3
Controller_CoderFlow.py
CHANGED
@@ -115,9 +115,11 @@ class Controller_CoderFlow(ChatAtomicFlow):
|
|
115 |
while True:
|
116 |
api_output = super().run(input_data)["api_output"].strip()
|
117 |
try:
|
118 |
-
|
119 |
-
|
120 |
-
|
|
|
|
|
121 |
updated_system_message_content = self._get_message(self.system_message_prompt_template, input_data)
|
122 |
self._state_update_add_chat_message(content=updated_system_message_content,
|
123 |
role=self.flow_config["system_name"])
|
|
|
115 |
while True:
|
116 |
api_output = super().run(input_data)["api_output"].strip()
|
117 |
try:
|
118 |
+
start = api_output.index("{")
|
119 |
+
end = api_output.rindex("}") + 1
|
120 |
+
json_str = api_output[start:end]
|
121 |
+
return json.loads(json_str)
|
122 |
+
except (ValueError, json.decoder.JSONDecodeError, json.JSONDecodeError):
|
123 |
updated_system_message_content = self._get_message(self.system_message_prompt_template, input_data)
|
124 |
self._state_update_add_chat_message(content=updated_system_message_content,
|
125 |
role=self.flow_config["system_name"])
|