Skip to content

Commit

Permalink
[pre-commit.ci] auto fixes from pre-commit.com hooks
Browse files Browse the repository at this point in the history
for more information, see https://pre-commit.ci
  • Loading branch information
pre-commit-ci[bot] authored and 3coins committed Jun 20, 2024
1 parent 8063a61 commit d417329
Showing 1 changed file with 9 additions and 4 deletions.
13 changes: 9 additions & 4 deletions packages/jupyter-ai/jupyter_ai/chat_handlers/clear.py
Original file line number Diff line number Diff line change
@@ -1,7 +1,10 @@
from typing import List

from jupyter_ai.chat_handlers.help import build_help_message
from jupyter_ai.models import ChatMessage, ClearMessage

from .base import BaseChatHandler, SlashCommandRoutingType
from jupyter_ai.chat_handlers.help import build_help_message


class ClearChatHandler(BaseChatHandler):
"""Clear the chat panel and show the help menu"""
Expand All @@ -21,16 +24,18 @@ async def process_message(self, _):
if not handler:
continue

# Clear chat
# Clear chat
handler.broadcast_message(ClearMessage())
self._chat_history.clear()

# Build /help message and reinstate it in chat
chat_handlers = handler.chat_handlers
persona = self.config_manager.persona
lm_provider = self.config_manager.lm_provider
unsupported_slash_commands = (lm_provider.unsupported_slash_commands if lm_provider else set())
unsupported_slash_commands = (
lm_provider.unsupported_slash_commands if lm_provider else set()
)
msg = build_help_message(chat_handlers, persona, unsupported_slash_commands)
self.reply(msg.body)

break
break

0 comments on commit d417329

Please sign in to comment.