Update ControllerFlow_ExtLib.py
Browse files- ControllerFlow_ExtLib.py +4 -2
ControllerFlow_ExtLib.py
CHANGED
|
@@ -113,8 +113,10 @@ class ControllerFlow_ExtLib(ChatAtomicFlow):
|
|
| 113 |
while True:
|
| 114 |
api_output = super().run(input_data)["api_output"].strip()
|
| 115 |
try:
|
| 116 |
-
|
| 117 |
-
|
|
|
|
|
|
|
| 118 |
except (json.decoder.JSONDecodeError, json.JSONDecodeError):
|
| 119 |
updated_system_message_content = self._get_message(self.system_message_prompt_template, input_data)
|
| 120 |
self._state_update_add_chat_message(content=updated_system_message_content,
|
|
|
|
| 113 |
while True:
|
| 114 |
api_output = super().run(input_data)["api_output"].strip()
|
| 115 |
try:
|
| 116 |
+
start = api_output.index("{")
|
| 117 |
+
end = api_output.rindex("}") + 1
|
| 118 |
+
json_str = api_output[start:end]
|
| 119 |
+
return json.loads(json_str)
|
| 120 |
except (json.decoder.JSONDecodeError, json.JSONDecodeError):
|
| 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,
|