Update arcade chat Help Menu (#170)
# PR Description * Fixes available commands display bug * Add `/history` command. Displays the conversation history. ``` Available Commands: /show Show all available tools /history Show the chat history /clear Clear the chat history /exit Exit the chat /?, /help Help for a command Surround in """ for multi-line messages ```
This commit is contained in:
parent
02eee63884
commit
d8c8b060af
1 changed files with 13 additions and 7 deletions
|
|
@ -39,8 +39,10 @@ class OrderCommands(TyperGroup):
|
||||||
|
|
||||||
|
|
||||||
class ChatCommand(str, Enum):
|
class ChatCommand(str, Enum):
|
||||||
HELP = "/?"
|
HELP = "/help"
|
||||||
|
HELP_ALT = "/?"
|
||||||
CLEAR = "/clear"
|
CLEAR = "/clear"
|
||||||
|
HISTORY = "/history"
|
||||||
SHOW = "/show"
|
SHOW = "/show"
|
||||||
EXIT = "/exit"
|
EXIT = "/exit"
|
||||||
|
|
||||||
|
|
@ -628,12 +630,13 @@ def display_chat_help() -> None:
|
||||||
help_message = dedent(f"""\
|
help_message = dedent(f"""\
|
||||||
[default]
|
[default]
|
||||||
Available Commands:
|
Available Commands:
|
||||||
{ChatCommand.SHOW:<10} Show all available tools
|
{ChatCommand.SHOW.value:<13} Show all available tools
|
||||||
{ChatCommand.CLEAR:<10} Clear the chat history
|
{ChatCommand.HISTORY.value:<13} Show the chat history
|
||||||
{ChatCommand.HELP:<10} Help for a command
|
{ChatCommand.CLEAR.value:<13} Clear the chat history
|
||||||
{ChatCommand.EXIT:<10} Exit the chat
|
{ChatCommand.EXIT.value:<13} Exit the chat
|
||||||
|
{ChatCommand.HELP_ALT.value}, {ChatCommand.HELP.value:<9} Help for a command
|
||||||
|
|
||||||
Use \"\"\" to begin & end a multi-line message[/default]
|
Surround in \"\"\" for multi-line messages[/default]
|
||||||
""")
|
""")
|
||||||
console.print(help_message)
|
console.print(help_message)
|
||||||
|
|
||||||
|
|
@ -650,11 +653,14 @@ def handle_user_command(
|
||||||
"""
|
"""
|
||||||
Handle user commands during `arcade chat` and return True if a command was processed, otherwise False.
|
Handle user commands during `arcade chat` and return True if a command was processed, otherwise False.
|
||||||
"""
|
"""
|
||||||
if user_input == ChatCommand.HELP:
|
if user_input in [ChatCommand.HELP, ChatCommand.HELP_ALT]:
|
||||||
display_chat_help()
|
display_chat_help()
|
||||||
return True
|
return True
|
||||||
elif user_input == ChatCommand.EXIT:
|
elif user_input == ChatCommand.EXIT:
|
||||||
raise KeyboardInterrupt
|
raise KeyboardInterrupt
|
||||||
|
elif user_input == ChatCommand.HISTORY:
|
||||||
|
console.print(history)
|
||||||
|
return True
|
||||||
elif user_input == ChatCommand.CLEAR:
|
elif user_input == ChatCommand.CLEAR:
|
||||||
console.print("Chat history cleared.", style="bold green")
|
console.print("Chat history cleared.", style="bold green")
|
||||||
history.clear()
|
history.clear()
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue