Skip to content

Commit

Permalink
fixed stuff
Browse files Browse the repository at this point in the history
  • Loading branch information
xssdoctor committed Mar 8, 2024
1 parent caca2b7 commit cd93dfe
Showing 1 changed file with 14 additions and 2 deletions.
16 changes: 14 additions & 2 deletions installer/client/cli/utils.py
Original file line number Diff line number Diff line change
Expand Up @@ -425,8 +425,8 @@ def __init__(self):
try:
openaiapikey = os.environ["OPENAI_API_KEY"]
self.openaiapi_key = openaiapikey
except KeyError:
self.openaiapi_key = ""
except:
pass
try:
self.fetch_available_models()
except:
Expand Down Expand Up @@ -603,6 +603,7 @@ def clean_env(self):
modified_line = self.clear_alias(
modified_line)
f.write(modified_line)
self.remove_duplicates(env_file)
else:
print("No shell configuration file found.")

Expand Down Expand Up @@ -650,6 +651,17 @@ def default_model(self, model):
else:
print("No shell configuration file found.")

def remove_duplicates(filename):
unique_lines = set()
with open(filename, 'r') as file:
lines = file.readlines()

with open(filename, 'w') as file:
for line in lines:
if line not in unique_lines:
file.write(line)
unique_lines.add(line)

def patterns(self):
""" Method to update patterns and exit the system.
Expand Down

0 comments on commit cd93dfe

Please sign in to comment.