Browse Source

fixed stuff

pull/174/head
jad2121 12 months ago
parent
commit
cd93dfe278
  1. 16
      installer/client/cli/utils.py

16
installer/client/cli/utils.py

@ -425,8 +425,8 @@ class Setup:
try:
openaiapikey = os.environ["OPENAI_API_KEY"]
self.openaiapi_key = openaiapikey
except KeyError:
self.openaiapi_key = ""
except:
pass
try:
self.fetch_available_models()
except:
@ -603,6 +603,7 @@ class Setup:
modified_line = self.clear_alias(
modified_line)
f.write(modified_line)
self.remove_duplicates(env_file)
else:
print("No shell configuration file found.")
@ -650,6 +651,17 @@ class Setup:
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.

Loading…
Cancel
Save