Skip to content

Commit 810fad0

Browse files
committed
fix(history_saver): save history for interupted scenarios
1 parent 2b1c4a1 commit 810fad0

File tree

3 files changed

+7
-5
lines changed

3 files changed

+7
-5
lines changed

examples/agri_example.py

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -153,7 +153,6 @@ def main():
153153
llm_type=llm_type,
154154
)
155155
scenario_runner.run()
156-
scenario_runner.save_to_html()
157156

158157

159158
if __name__ == "__main__":

examples/husarion_poc_example.py

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -46,7 +46,7 @@ def main():
4646
"The voice message should contain a very short information about what is going on and what is the next step. "
4747
),
4848
HumanMessage(
49-
content="The robot is moving. Use vision to understand the surroundings, and add waypoints based on observations. camera is accesible at topic /camera/camera/color/image_raw ."
49+
content="The robot is moving. Use vision to understand the surroundings, and add waypoints based on observations. camera is accesible at topic /camera_image_color ."
5050
),
5151
AgentLoop(stop_action=FinishTool().__class__.__name__, stop_iters=50),
5252
]
@@ -61,7 +61,6 @@ def main():
6161
log_usage=log_usage,
6262
)
6363
runner.run()
64-
runner.save_to_html()
6564

6665

6766
if __name__ == "__main__":

src/rai/scenario_engine/scenario_engine.py

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -125,9 +125,13 @@ def __init__(
125125

126126
def run(self):
127127
self.logger.info(f"Starting conversation.")
128-
self._run(self.scenario)
129128

130-
self.logger.info(f"Conversation completed.")
129+
try:
130+
self._run(self.scenario)
131+
132+
self.logger.info(f"Conversation completed.")
133+
finally:
134+
self.save_to_html()
131135
return self.history
132136

133137
def _run(self, scenario: ScenarioType):

0 commit comments

Comments
 (0)