Skip to content

Commit

Permalink
[apps/browser] print code being executed
Browse files Browse the repository at this point in the history
  • Loading branch information
javierluraschi committed Sep 11, 2024
1 parent c20f8a9 commit b0bdfa7
Showing 1 changed file with 4 additions and 1 deletion.
5 changes: 4 additions & 1 deletion apps/browser/app.py
Original file line number Diff line number Diff line change
Expand Up @@ -40,12 +40,15 @@ async def main():
code = site_use(prompt, page.url)
wrapped_code = wrap_in_async_function(code)
local_vars = {}

print(f"```\n{wrapped_code}\n```")
exec(wrapped_code, {}, local_vars)

await local_vars['dynamic_async_func'](page)

await take_screenshot(page, i)
except Exception as e:
print(f"Failed to use browser, details follow.\n```\n{code}\n```\n\n```\n{e}\n```\n")
print(f"Failed to use browser:\n```\n{e}\n```\n")
print(f"Available Memory: {(psutil.virtual_memory().available/ (1024 ** 2)):.2f} MB")

prompt = h9.input(f"Taking screenshot for step {i}/5, what next?")
Expand Down

0 comments on commit b0bdfa7

Please sign in to comment.