in src/nova_act/impl/run_info_compiler.py [0:0]
def compile(self, act: Act) -> str:
run_info = ""
for i, step in enumerate(act.steps):
run_info += format_run_info(
i + 1,
step.model_input.active_url,
str(step.observed_time),
step.model_input.image,
step.model_output.awl_raw_program,
)
# Compile Workflow View
html_content = HTML_TEMPLATE.format(
run_info=run_info,
act_id=act.id,
prompt=act.prompt,
)
# Add prompt to the name
prompt_filename_snippet = self._safe_filename(act.prompt, 30)
file_name_prefix = f"act_{act.id}_{prompt_filename_snippet}"
output_file_path = os.path.join(self._session_logs_directory, file_name_prefix + ".html")
try:
with open(output_file_path, "w", encoding="utf-8") as f:
f.write(html_content)
# Compile request and response JSON
request_response_file_name = f"{file_name_prefix}_calls.json"
json_file_path = os.path.join(self._session_logs_directory, request_response_file_name)
step_info = []
for step in act.steps:
step_info.append(
{"request": step.rawMessage.get("input", {}), "response": step.rawMessage.get("output")}
)
with open(json_file_path, "w", encoding="utf-8") as f:
json.dump(step_info, f)
except OSError as e:
_LOGGER.warning(f"Failed to write to file: {e}")
return output_file_path