mirror of
https://github.com/ParisNeo/lollms-webui.git
synced 2024-12-18 20:17:50 +00:00
Update update_script.py
This commit is contained in:
parent
a3569a81e9
commit
ee2ac53a52
@ -80,12 +80,33 @@ def run_git_pull():
|
||||
ASCIIColors.error(error_message)
|
||||
show_error_dialog(error_message)
|
||||
return False
|
||||
|
||||
def get_valid_input():
|
||||
while True:
|
||||
update_prompt = "New code is updated. Do you want to update the requirements? (y/n): "
|
||||
user_response = input(update_prompt).strip().lower()
|
||||
|
||||
if user_response in ['y', 'yes']:
|
||||
return 'yes'
|
||||
elif user_response in ['n', 'no']:
|
||||
return 'no'
|
||||
else:
|
||||
print("Invalid input. Please respond with 'y' or 'n'.")
|
||||
|
||||
def install_requirements():
|
||||
try:
|
||||
subprocess.check_call([sys.executable, "-m", "pip", "install", "--upgrade", "-r", "requirements.txt"])
|
||||
subprocess.check_call([sys.executable, "-m", "pip", "install", "--upgrade", "-e", "lollms_core"])
|
||||
ASCIIColors.success("Successfully installed requirements")
|
||||
# Get valid input from the user
|
||||
user_choice = get_valid_input()
|
||||
|
||||
# Enhance the text based on the user's response
|
||||
if user_choice == 'yes':
|
||||
enhanced_text = "Great choice! Updating requirements ensures your project stays up-to-date with the latest changes."
|
||||
print(enhanced_text)
|
||||
subprocess.check_call([sys.executable, "-m", "pip", "install", "--upgrade", "-r", "requirements.txt"])
|
||||
subprocess.check_call([sys.executable, "-m", "pip", "install", "--upgrade", "-e", "lollms_core"])
|
||||
ASCIIColors.success("Successfully installed requirements")
|
||||
else: # user_choice == 'no'
|
||||
enhanced_text = "Understood. Skipping the requirements update. Make sure to update them later if needed."
|
||||
print(enhanced_text)
|
||||
except subprocess.CalledProcessError as e:
|
||||
error_message = f"Error during pip install: {str(e)}"
|
||||
ASCIIColors.error(error_message)
|
||||
|
Loading…
Reference in New Issue
Block a user