Skip to content

Commit

Permalink
Rename display_arguments_help to supports_help
Browse files Browse the repository at this point in the history
  • Loading branch information
krassowski committed Jul 9, 2024
1 parent ec0e960 commit f8c59c6
Show file tree
Hide file tree
Showing 3 changed files with 5 additions and 5 deletions.
6 changes: 3 additions & 3 deletions packages/jupyter-ai/jupyter_ai/chat_handlers/base.py
Original file line number Diff line number Diff line change
Expand Up @@ -97,7 +97,7 @@ class BaseChatHandler:
specified by the config. Subclasses should define this. Should be set to
`False` for handlers like `/help`."""

display_arguments_help: ClassVar[bool] = True
supports_help: ClassVar[bool] = True
"""Class attribute specifying whether this chat handler should
parse the arguments and display help when user queries with
`-h` or `--help`"""
Expand Down Expand Up @@ -126,7 +126,7 @@ def __init__(
add_help=False, description=self.help, formatter_class=MarkdownHelpFormatter
)
# the default help would exit; instead implement a custom help
if self.__class__.display_arguments_help:
if self.__class__.supports_help:
self.parser.add_argument(
"-h", "--help", action="store_true", help="Show this help message"
)
Expand Down Expand Up @@ -171,7 +171,7 @@ async def on_message(self, message: HumanChatMessage):

BaseChatHandler._requests_count += 1

if self.__class__.display_arguments_help:
if self.__class__.supports_help:
args = self.parse_args(message, silent=True)
if args and args.help:
self.reply(self.parser.format_help(), message)
Expand Down
2 changes: 1 addition & 1 deletion packages/jupyter-ai/jupyter_ai/chat_handlers/default.py
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@ class DefaultChatHandler(BaseChatHandler):
routing_type = SlashCommandRoutingType(slash_id=None)

uses_llm = True
display_arguments_help = False
supports_help = False

def __init__(self, *args, **kwargs):
super().__init__(*args, **kwargs)
Expand Down
2 changes: 1 addition & 1 deletion packages/jupyter-ai/jupyter_ai/chat_handlers/help.py
Original file line number Diff line number Diff line change
Expand Up @@ -54,7 +54,7 @@ class HelpChatHandler(BaseChatHandler):
name = "Help"
help = "Display this help message"
routing_type = SlashCommandRoutingType(slash_id="help")
display_arguments_help = False
supports_help = False

uses_llm = False

Expand Down

0 comments on commit f8c59c6

Please sign in to comment.