From 774849dc06cf36425b36c5dd0430e0cdc96f183f Mon Sep 17 00:00:00 2001 From: "pre-commit-ci[bot]" <66853113+pre-commit-ci[bot]@users.noreply.github.com> Date: Tue, 27 Feb 2024 18:07:53 +0000 Subject: [PATCH] [pre-commit.ci] auto fixes from pre-commit.com hooks for more information, see https://pre-commit.ci --- .../jupyter-ai/jupyter_ai/chat_handlers/__init__.py | 2 +- packages/jupyter-ai/jupyter_ai/chat_handlers/export.py | 10 +++++----- packages/jupyter-ai/jupyter_ai/extension.py | 2 +- 3 files changed, 7 insertions(+), 7 deletions(-) diff --git a/packages/jupyter-ai/jupyter_ai/chat_handlers/__init__.py b/packages/jupyter-ai/jupyter_ai/chat_handlers/__init__.py index 17364f198..b9046a6f8 100644 --- a/packages/jupyter-ai/jupyter_ai/chat_handlers/__init__.py +++ b/packages/jupyter-ai/jupyter_ai/chat_handlers/__init__.py @@ -2,7 +2,7 @@ from .base import BaseChatHandler, SlashCommandRoutingType from .clear import ClearChatHandler from .default import DefaultChatHandler +from .export import ExportChatHandler from .generate import GenerateChatHandler from .help import HelpChatHandler from .learn import LearnChatHandler -from .export import ExportChatHandler diff --git a/packages/jupyter-ai/jupyter_ai/chat_handlers/export.py b/packages/jupyter-ai/jupyter_ai/chat_handlers/export.py index 1f5849507..a644ef423 100644 --- a/packages/jupyter-ai/jupyter_ai/chat_handlers/export.py +++ b/packages/jupyter-ai/jupyter_ai/chat_handlers/export.py @@ -1,9 +1,10 @@ from typing import List -from jupyter_ai.models import HumanChatMessage, AgentChatMessage +from jupyter_ai.models import AgentChatMessage, HumanChatMessage from .base import BaseChatHandler, SlashCommandRoutingType + class ExportChatHandler(BaseChatHandler): id = "export" name = "Export chat messages" @@ -23,11 +24,10 @@ def chat_message_to_markdown(self, message): else: return "" - async def process_message(self, _): - markdown_content = "\n\n".join(self.chat_message_to_markdown(msg) for msg in self._chat_history) + markdown_content = "\n\n".join( + self.chat_message_to_markdown(msg) for msg in self._chat_history + ) # Write the markdown content to a file or do whatever you want with it with open("./playground/chat_history.md", "w") as chat_history: chat_history.write(markdown_content) - - diff --git a/packages/jupyter-ai/jupyter_ai/extension.py b/packages/jupyter-ai/jupyter_ai/extension.py index 6920792fa..245a1c957 100644 --- a/packages/jupyter-ai/jupyter_ai/extension.py +++ b/packages/jupyter-ai/jupyter_ai/extension.py @@ -13,10 +13,10 @@ AskChatHandler, ClearChatHandler, DefaultChatHandler, + ExportChatHandler, GenerateChatHandler, HelpChatHandler, LearnChatHandler, - ExportChatHandler, ) from .chat_handlers.help import HelpMessage from .completions.handlers import DefaultInlineCompletionHandler