Skip to content

Commit

Permalink
refactor: remove unused imports (#39)
Browse files Browse the repository at this point in the history
Signed-off-by: gitworkflows <118260833+gitworkflows@users.noreply.github.com>
  • Loading branch information
gitworkflows authored Jun 26, 2024
1 parent dac6036 commit fb822ea
Show file tree
Hide file tree
Showing 4 changed files with 20 additions and 22 deletions.
4 changes: 2 additions & 2 deletions gpt_computer_agent/agent/process.py
Original file line number Diff line number Diff line change
Expand Up @@ -44,8 +44,8 @@ def tts_if_you_can(text:str, not_threaded=False, status_edit=False):
signal_handler.agent_response_ready.emit()

def play_audio():
mixer.init()
for each_r in response_path:
mixer.init()
mixer.music.load(each_r)
mixer.music.play()
while mixer.music.get_busy():
Expand Down Expand Up @@ -268,7 +268,7 @@ def play_text():
print("Error in process_screenshot", e)
traceback.print_exc()
from ..gpt_computer_agent import the_input_box, the_main_window
the_main_window.update_from_thread(f"EXCEPTION: {e}")
the_main_window.update_from_thread("EXCEPTION: " + str(e))
tts_if_you_can("Exception occurred. Please check the logs.")
signal_handler.agent_response_stopped.emit()

Expand Down
7 changes: 5 additions & 2 deletions gpt_computer_agent/gpt_computer_agent.py
Original file line number Diff line number Diff line change
@@ -1,6 +1,9 @@
try:
from .agent.chat_history import *
# Removed duplicate import
from .agent.agent import *
from .llm import *
from .llm_settings import llm_settings
from .agent.agent import *
from .agent.background import *

from .gui.signal import *
Expand Down Expand Up @@ -176,7 +179,7 @@ def paintEvent(self, event):



if llm_settings[load_model_settings()]["vision"] == True:
if llm_settings[load_model_settings()]["vision"] is True:
self.main_.screen_available = True
else:
self.main_.screen_available = False
Expand Down
19 changes: 6 additions & 13 deletions gpt_computer_agent/gui/settings.py
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
from PyQt5.QtWidgets import QDialog, QVBoxLayout, QLabel, QLineEdit, QPushButton
from PyQt5.QtCore import Qt
from ..utils.db import specific_function1, specific_function2 # Replace with actual functions used
from ..utils.db import *
from ..agent.chat_history import clear_chat_history

def settings_popup(self):
Expand Down Expand Up @@ -142,12 +142,10 @@ def activate_dark_mode_():
Returns:
- None
"""
if activate_dark_mode():
the_main_window.update_from_thread("Enabled Dark Mode")
the_main_window.dark_mode()
settings_dialog.close()
else:
handle_activation_failure() # Implement this function to handle failures
activate_dark_mode()
the_main_window.update_from_thread("Enabled Dark Mode")
the_main_window.dark_mode()
settings_dialog.close()

dark_mode_button.clicked.connect(activate_dark_mode_)

Expand All @@ -161,12 +159,7 @@ def activate_dark_mode_():
try:
import crewai
if is_predefined_agents_setting_active():
def update_predefined_agents_button_text(is_active):
if is_active:
predefined_agents_button.setText("Disable Predefined Agents (Bad Results, Short Response Time)")
else:
predefined_agents_button.setText("Enable Predefined Agents (Good Results, Long Response Time)")
update_predefined_agents_button_text(is_predefined_agents_setting_active())
predefined_agents_button.setText("Disable Predefined Agents (Bad Results, Short Response Time)")

def deactivate_predefined_agents_():
deactivate_predefined_agents_setting()
Expand Down
12 changes: 7 additions & 5 deletions gpt_computer_agent/teams.py
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,12 @@
from .utils.db import load_api_key
from .llm import get_model
from .top_bar_wrapper import wrapper
from .agent.agent_tools get_tools
from .agent.agent_tools import get_tools
except ImportError:
from utils.db import load_api_key
from llm import get_model
from top_bar_wrapper import wrapper
from agent.agent_tools import get_tools



Expand All @@ -23,8 +28,6 @@ def search_on_internet_and_report_team_(the_subject:str, copy_to_clipboard: bool



# Place this at the top of the file
# Place this at the top of the file
from crewai import Task, Crew, Agent


Expand Down Expand Up @@ -161,8 +164,7 @@ def required_old_code(aim):
return the_string

except:
except Exception as e:
return f"An exception occurred: {str(e)}"
return "An exception occurred"



Expand Down

0 comments on commit fb822ea

Please sign in to comment.