Skip to content

Commit

Permalink
chat: do not send empty text to assitant
Browse files Browse the repository at this point in the history
  • Loading branch information
rmackay9 committed Dec 21, 2023
1 parent b57b4a9 commit 7b37530
Showing 1 changed file with 4 additions and 1 deletion.
5 changes: 4 additions & 1 deletion MAVProxy/modules/mavproxy_chat/chat_window.py
Original file line number Diff line number Diff line change
Expand Up @@ -135,7 +135,7 @@ def record_button_click_execute(self, event):

# convert audio to text and place in input box
text = self.chat_voice_to_text.convert_audio_to_text(rec_filename)
if text is None:
if text is None or text == "":
self.set_status_text("audio to text conversion failed")
return
wx.CallAfter(self.text_input.SetValue, text)
Expand All @@ -149,6 +149,9 @@ def send_button_click(self, event):

# handle text input
def text_input_change(self, event):
# protect against sending empty text
if self.text_input.GetValue() == "":
return
# send text to assistant in a separate thread
th = Thread(target=self.send_text_to_assistant)
th.start()
Expand Down

0 comments on commit 7b37530

Please sign in to comment.