Browse Source

added persistant custom patterns. Anything you add to the .config/fabric/patterns folder will persist

pull/247/head
jad2121 11 months ago
parent
commit
46216ed90a
  1. 1
      helper_files/save.py
  2. 12
      installer/client/cli/utils.py

1
helper_files/save.py

@ -1,4 +1,3 @@
#!/usr/bin/env python3
import argparse
import os
import sys

12
installer/client/cli/utils.py

@ -268,7 +268,6 @@ class Standalone:
else:
print(f"Error: {e}")
print(e)
def fetch_available_models(self):
gptlist = []
@ -351,6 +350,17 @@ class Update:
if os.path.exists(patterns_source_path):
# If the patterns directory already exists, remove it before copying over the new one
if os.path.exists(self.pattern_directory):
old_pattern_contents = os.listdir(self.pattern_directory)
new_pattern_contents = os.listdir(patterns_source_path)
custom_patterns = []
for pattern in old_pattern_contents:
if pattern not in new_pattern_contents:
custom_patterns.append(pattern)
if custom_patterns:
for pattern in custom_patterns:
custom_path = os.path.join(
self.pattern_directory, pattern)
shutil.move(custom_path, patterns_source_path)
shutil.rmtree(self.pattern_directory)
shutil.copytree(patterns_source_path, self.pattern_directory)
print("Patterns updated successfully.")

Loading…
Cancel
Save