Skip to content

Commit

Permalink
Make webapp default. Minor UI changes.
Browse files Browse the repository at this point in the history
  • Loading branch information
paulovcmedeiros committed Mar 3, 2024
1 parent 15ca7dc commit 16aa69b
Show file tree
Hide file tree
Showing 4 changed files with 20 additions and 17 deletions.
5 changes: 3 additions & 2 deletions pyrobbot/app/app_page_templates.py
Original file line number Diff line number Diff line change
Expand Up @@ -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,
Expand Down
6 changes: 4 additions & 2 deletions pyrobbot/app/multipage.py
Original file line number Diff line number Diff line change
Expand Up @@ -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,
)

Expand Down
24 changes: 12 additions & 12 deletions pyrobbot/argparse_wrapper.py
Original file line number Diff line number Diff line change
Expand Up @@ -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:
Expand Down Expand Up @@ -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(
Expand All @@ -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",
Expand Down
2 changes: 1 addition & 1 deletion tests/smoke/test_commands.py
Original file line number Diff line number Diff line change
Expand Up @@ -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")
Expand Down

0 comments on commit 16aa69b

Please sign in to comment.