Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion interpreter/core/core.py
Original file line number Diff line number Diff line change
Expand Up @@ -347,7 +347,7 @@ def is_ephemeral(chunk):
yield {**last_flag_base, "end": True}
last_flag_base = None

if self.auto_run == False:
if self.auto_run == False or callable(self.auto_run):
yield chunk

# We want to append this now, so even if content is never filled, we know that the execution didn't produce output.
Expand Down
8 changes: 7 additions & 1 deletion interpreter/terminal_interface/terminal_interface.py
Original file line number Diff line number Diff line change
Expand Up @@ -185,7 +185,13 @@ def terminal_interface(interpreter, message):

# Execution notice
if chunk["type"] == "confirmation":
if not interpreter.auto_run:
_code_content = chunk["content"]["content"]
_should_auto_run = (
interpreter.auto_run(_code_content)
if callable(interpreter.auto_run)
else interpreter.auto_run
)
if not _should_auto_run:
# OI is about to execute code. The user wants to approve this

# End the active code block so you can run input() below it
Expand Down