Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fixed /export for timestamp, agent name #854

Merged
merged 6 commits into from
Jun 21, 2024
Merged
Changes from 1 commit
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
Prev Previous commit
Next Next commit
[pre-commit.ci] auto fixes from pre-commit.com hooks
for more information, see https://pre-commit.ci
  • Loading branch information
pre-commit-ci[bot] committed Jun 21, 2024
commit 98502fdedab36a6bff22183e1e0f8dc18f109880
10 changes: 7 additions & 3 deletions packages/jupyter-ai/jupyter_ai/chat_handlers/export.py
Original file line number Diff line number Diff line change
Expand Up @@ -36,10 36,14 @@ async def process_message(self, message: HumanChatMessage):
self.chat_message_to_markdown(msg) for msg in self._chat_history
)
args = self.parse_args(message)
chat_filename = ( # if no filename, use "chat_history" timestamp
args.path[0] if (args.path and args.path[0] != "") else f"chat_history-{datetime.now():%Y-%m-%d-%H-%M-%S}.md"
chat_filename = ( # if no filename, use "chat_history" timestamp
args.path[0]
if (args.path and args.path[0] != "")
else f"chat_history-{datetime.now():%Y-%m-%d-%H-%M-%S}.md"
) # Handles both empty args and double tap <Enter> key
chat_file = os.path.join(self.root_dir, chat_filename) # Do not use timestamp if filename is entered as argument
chat_file = os.path.join(
self.root_dir, chat_filename
) # Do not use timestamp if filename is entered as argument
with open(chat_file, "w") as chat_history:
chat_history.write(markdown_content)
self.reply(f"File saved to `{chat_file}`")
Loading