From 16aa69b5dc22542f89754b53dbcdc84f86239fc3 Mon Sep 17 00:00:00 2001 From: Paulo V C Medeiros Date: Sun, 3 Mar 2024 01:30:42 +0100 Subject: [PATCH] Make webapp default. Minor UI changes. --- pyrobbot/app/app_page_templates.py | 5 +++-- pyrobbot/app/multipage.py | 6 ++++-- pyrobbot/argparse_wrapper.py | 24 ++++++++++++------------ tests/smoke/test_commands.py | 2 +- 4 files changed, 20 insertions(+), 17 deletions(-) diff --git a/pyrobbot/app/app_page_templates.py b/pyrobbot/app/app_page_templates.py index 32ac451..109f820 100644 --- a/pyrobbot/app/app_page_templates.py +++ b/pyrobbot/app/app_page_templates.py @@ -110,12 +110,13 @@ def continuous_mic_recorder(self): def manual_switch_mic_recorder(self): """Record audio from the microphone.""" - studio_microphone = "\U0001F399" red_square = "\U0001F7E5" + microphone = "\U0001F3A4" + play_button = "\U000025B6" recording = mic_recorder( key=f"audiorecorder_widget_{self.page_id}", - start_prompt=studio_microphone, + start_prompt=play_button + microphone, stop_prompt=red_square, just_once=True, use_container_width=True, diff --git a/pyrobbot/app/multipage.py b/pyrobbot/app/multipage.py index 18d361f..30622c5 100644 --- a/pyrobbot/app/multipage.py +++ b/pyrobbot/app/multipage.py @@ -646,15 +646,17 @@ def render(self, **kwargs): st.toggle( key="toggle_voice_output", label=speaking_head_in_silhouette, - help="Toggle voice output", + help="Allow the assistant to speak", value=True, ) with right: # Add button to toggle continuous voice input + _infinity_emoji = "\U0000221E" st.toggle( key="toggle_continuous_voice_input", label=":microphone:", - help="Toggle continuous voice input", + help="Speak to the assistant in a continuous manner, without " + "clicking the microphone button to start/stop recording", value=False, ) diff --git a/pyrobbot/argparse_wrapper.py b/pyrobbot/argparse_wrapper.py index d72517a..956661d 100644 --- a/pyrobbot/argparse_wrapper.py +++ b/pyrobbot/argparse_wrapper.py @@ -55,7 +55,7 @@ def _populate_parser_from_pydantic_model(parser, model: BaseModel): return parser -def get_parsed_args(argv=None, default_command="voice"): +def get_parsed_args(argv=None, default_command="ui"): """Get parsed command line arguments. Args: @@ -107,6 +107,15 @@ def get_parsed_args(argv=None, default_command="voice"): help="Report estimated costs when done with the chat.", ) + # Web app chat + parser_ui = subparsers.add_parser( + "ui", + aliases=["app", "webapp", "browser"], + parents=[chat_options_parser], + help="Run the chat UI on the browser.", + ) + parser_ui.set_defaults(run_command=browser_chat) + # Voice chat voice_options_parser = _populate_parser_from_pydantic_model( parser=argparse.ArgumentParser( @@ -116,21 +125,12 @@ def get_parsed_args(argv=None, default_command="voice"): ) parser_voice_chat = subparsers.add_parser( "voice", - aliases=["v"], + aliases=["v", "speech", "talk"], parents=[voice_options_parser], - help="Run the chat over voice.", + help="Run the chat over voice only.", ) parser_voice_chat.set_defaults(run_command=voice_chat) - # Web app chat - parser_ui = subparsers.add_parser( - "ui", - aliases=["app"], - parents=[chat_options_parser], - help="Run the chat UI on the browser.", - ) - parser_ui.set_defaults(run_command=browser_chat) - # Terminal chat parser_terminal = subparsers.add_parser( "terminal", diff --git a/tests/smoke/test_commands.py b/tests/smoke/test_commands.py index 99f5ced..ecbbc80 100644 --- a/tests/smoke/test_commands.py +++ b/tests/smoke/test_commands.py @@ -10,7 +10,7 @@ def test_default_command(): args = get_parsed_args(argv=[]) - assert args.command == "voice" + assert args.command == "ui" @pytest.mark.usefixtures("_input_builtin_mocker")