Skip to content

Commit

Permalink
feat: Added on of off option for cintinuously conversations (Upsonic#179
Browse files Browse the repository at this point in the history
)
  • Loading branch information
onuratakan authored Jun 20, 2024
1 parent 767e168 commit 6f83147
Show file tree
Hide file tree
Showing 3 changed files with 52 additions and 1 deletion.
2 changes: 1 addition & 1 deletion gpt_computer_assistant/gpt_computer_assistant.py
Original file line number Diff line number Diff line change
Expand Up @@ -888,7 +888,7 @@ def update_state(self, new_state):
if assistant_stopped:
if llm_settings[load_model_settings()]["transcription"]:
global the_input_box
if the_input_box.toPlainText().endswith("?"):
if the_input_box.toPlainText().endswith("?") and is_continuously_conversations_setting_active():
self.button_handler.toggle_recording(no_screenshot=True, new_record=True)

def pulse_circle(self):
Expand Down
24 changes: 24 additions & 0 deletions gpt_computer_assistant/gui/settings.py
Original file line number Diff line number Diff line change
Expand Up @@ -325,4 +325,28 @@ def activate_auto_stop_recording_():
wake_word_screen_button.clicked.connect(activate_auto_stop_recording_)




continuously_conversations_button = QPushButton("Enable Continuously Conversations")

settings_dialog.layout().addWidget(continuously_conversations_button)

if is_continuously_conversations_setting_active():
continuously_conversations_button.setText("Disable Continuously Conversations")

def deactivate_auto_stop_recording_():
deactivate_continuously_conversations_setting()
the_main_window.update_from_thread("Disabled Continuously Conversations")
settings_dialog.close()

continuously_conversations_button.clicked.connect(deactivate_auto_stop_recording_)
else:

def activate_auto_stop_recording_():
activate_continuously_conversations_setting()
the_main_window.update_from_thread("Enabled Continuously Conversations")
settings_dialog.close()

continuously_conversations_button.clicked.connect(activate_auto_stop_recording_)

settings_dialog.exec_()
27 changes: 27 additions & 0 deletions gpt_computer_assistant/utils/db.py
Original file line number Diff line number Diff line change
Expand Up @@ -399,4 +399,31 @@ def is_wake_word_screen_setting_active():
if not os.path.exists(wake_word_screen_setting):
return True
with open(wake_word_screen_setting, "r") as f:
return f.read() == "1"






continuously_conversations_setting = os.path.join(artifacts_dir, "continuously_conversations_setting.db")


def activate_continuously_conversations_setting():
"""Activate the continuously_conversations setting."""
with open(continuously_conversations_setting, "w") as f:
f.write("1")


def deactivate_continuously_conversations_setting():
"""Deactivate the continuously_conversations setting."""
with open(continuously_conversations_setting, "w") as f:
f.write("0")


def is_continuously_conversations_setting_active():
"""Check if the continuously_conversations setting is active."""
if not os.path.exists(continuously_conversations_setting):
return False
with open(continuously_conversations_setting, "r") as f:
return f.read() == "1"

0 comments on commit 6f83147

Please sign in to comment.