From 55a92960bdcb28dc5ce4e17b1e9930a1f977997d Mon Sep 17 00:00:00 2001 From: Saifeddine ALOUI Date: Wed, 29 Nov 2023 16:28:08 +0100 Subject: [PATCH] Update app.py --- app.py | 21 +++++++++++++++++++-- 1 file changed, 19 insertions(+), 2 deletions(-) diff --git a/app.py b/app.py index 9028b501..f6e0be17 100644 --- a/app.py +++ b/app.py @@ -100,10 +100,9 @@ try: except: ASCIIColors.yellow("Couldn't set mimetype") - def check_update_(branch_name="main"): + def check_module_update_(repo_path, branch_name="main"): try: # Open the repository - repo_path = str(Path(__file__).parent) ASCIIColors.yellow(f"Checking for updates from {repo_path}") repo = git.Repo(repo_path) @@ -121,6 +120,24 @@ try: # Return True if the local branch is behind the remote branch return is_behind + except Exception as e: + # Handle any errors that may occur during the fetch process + # trace_exception(e) + return False + + def check_update_(branch_name="main"): + try: + # Open the repository + repo_path = str(Path(__file__).parent) + if check_module_update_(repo_path, branch_name): + return True + repo_path = str(Path(__file__).parent/"lollms_core") + if check_module_update_(repo_path, branch_name): + return True + repo_path = str(Path(__file__).parent/"utilities/safe_store") + if check_module_update_(repo_path, branch_name): + return True + return False except Exception as e: # Handle any errors that may occur during the fetch process # trace_exception(e)