Skip to content

Commit

Permalink
Refactor export code reprise
Browse files Browse the repository at this point in the history
Updated some variable names
  • Loading branch information
srdas committed May 8, 2024
1 parent 0baa834 commit c7dda33
Showing 1 changed file with 4 additions and 5 deletions.
9 changes: 4 additions & 5 deletions packages/jupyter-ai/jupyter_ai/chat_handlers/export.py
Original file line number Diff line number Diff line change
Expand Up @@ -36,9 +36,8 @@ async def process_message(self, message: HumanChatMessage):
)
args = self.parse_args(message)
chat_filename = args.path[0] if args.path else "chat_history"
outfile = f"{chat_filename}-{datetime.now():%Y-%m-%d-%H-%M}.md"
chat_filename = os.path.join(self.root_dir, outfile)
with open(chat_filename, "w") as chat_history:
chat_filename = f"{chat_filename}-{datetime.now():%Y-%m-%d-%H-%M}.md"
chat_file = os.path.join(self.root_dir, chat_filename)
with open(chat_file, "w") as chat_history:
chat_history.write(markdown_content)

self.reply(f"File saved to `{chat_filename}`")
self.reply(f"File saved to `{chat_file}`")

0 comments on commit c7dda33

Please sign in to comment.