Update CoderFlow.py
Browse files- CoderFlow.py +22 -1
CoderFlow.py
CHANGED
|
@@ -1,4 +1,25 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
from flow_modules.Tachi67.AbstractBossFlowModule import AbstractBossFlow
|
| 2 |
|
| 3 |
class CoderFlow(AbstractBossFlow):
|
| 4 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
from typing import Dict, Any
|
| 2 |
+
from flows.utils import logging
|
| 3 |
+
log = logging.get_logger(__name__)
|
| 4 |
+
|
| 5 |
from flow_modules.Tachi67.AbstractBossFlowModule import AbstractBossFlow
|
| 6 |
|
| 7 |
class CoderFlow(AbstractBossFlow):
|
| 8 |
+
def run(self, input_data: Dict[str, Any]) -> Dict[str, Any]:
|
| 9 |
+
# ~~~ sets the input_data in the flow_state dict ~~~
|
| 10 |
+
self._state_update_dict(update_data=input_data)
|
| 11 |
+
|
| 12 |
+
# ~~~ set the memory file to the flow state ~~~
|
| 13 |
+
self._state_update_dict(update_data={"memory_files": self.memory_files})
|
| 14 |
+
|
| 15 |
+
max_rounds = self.flow_config.get("max_rounds", 1)
|
| 16 |
+
if max_rounds is None:
|
| 17 |
+
log.info(f"Running {self.flow_config['name']} without `max_rounds` until the early exit condition is met.")
|
| 18 |
+
|
| 19 |
+
self._sequential_run(max_rounds=max_rounds)
|
| 20 |
+
|
| 21 |
+
output = self._get_output_from_state()
|
| 22 |
+
|
| 23 |
+
self.reset(full_reset=True, recursive=True, src_flow=self)
|
| 24 |
+
|
| 25 |
+
return output
|