Skip to content

Commit

Permalink
Backport PR #1155: Fix code output format in IPython (#1162)
Browse files Browse the repository at this point in the history
Co-authored-by: Divyansh Choudhary <[email protected]>
  • Loading branch information
meeseeksmachine and divyansshhh authored Dec 19, 2024
1 parent 135bc8f commit 6c895bf
Showing 1 changed file with 1 addition and 7 deletions.
8 changes: 1 addition & 7 deletions packages/jupyter-ai-magics/jupyter_ai_magics/magics.py
Original file line number Diff line number Diff line change
Expand Up @@ -482,13 +482,7 @@ def display_output(self, output, display_format, md):
lang_indicator = r"^```[a-zA-Z0-9]*\n"
output = re.sub(lang_indicator, "", output)
output = re.sub(r"\n```$", "", output)
new_cell_payload = dict(
source="set_next_input",
text=output,
replace=False,
)
ip = self.shell
ip.payload_manager.write_payload(new_cell_payload)
self.shell.set_next_input(output, replace=False)
return HTML(
"AI generated code inserted below &#11015;&#65039;", metadata=md
)
Expand Down

0 comments on commit 6c895bf

Please sign in to comment.