diff --git a/testzeus_hercules/__main__.py b/testzeus_hercules/__main__.py index b851244..ffe0801 100644 --- a/testzeus_hercules/__main__.py +++ b/testzeus_hercules/__main__.py @@ -74,7 +74,9 @@ def sequential_process() -> None: asyncio.run(runner.start()) runner_result = {} - cost_metrics = runner.result.cost or {} + cost_metrics = {} + if runner.result and runner.result.cost: + cost_metrics = runner.result.cost execution_time = runner.execution_time if runner.result and runner.result.chat_history: s_rr = runner.result.chat_history[-1]["content"] diff --git a/testzeus_hercules/core/runner.py b/testzeus_hercules/core/runner.py index 3a8e3c4..d3145f2 100644 --- a/testzeus_hercules/core/runner.py +++ b/testzeus_hercules/core/runner.py @@ -102,9 +102,10 @@ async def process_command(self, command: str) -> tuple[Any, float]: await self.browser_manager.update_processing_state("done") # type: ignore end_time = time.time() elapsed_time = round(end_time - start_time, 2) - logger.info(f'Command "{command}" took: {elapsed_time} seconds. and total cost metric is {result.cost}') # type: ignore + await self.save_planner_chat_messages() if result is not None: + logger.info(f'Command "{command}" took: {elapsed_time} seconds. and total cost metric is {result.cost}') # type: ignore chat_history = result.chat_history # type: ignore last_message = chat_history[-1] if chat_history else None # type: ignore if (