mirror of
https://github.com/ParisNeo/lollms.git
synced 2025-04-11 04:39:53 +00:00
added some good tools to clone repositories
This commit is contained in:
parent
6f120647a5
commit
3b5e185942
@ -122,7 +122,6 @@ class LLMBinding:
|
||||
model_path=self.searchModelFolder(model_name)
|
||||
mp:Path = None
|
||||
for f in model_path.iterdir():
|
||||
print(f)
|
||||
a = model_name.lower()
|
||||
b = f.name.lower()
|
||||
if a in b :
|
||||
|
@ -16,6 +16,7 @@ import json
|
||||
import re
|
||||
import subprocess
|
||||
import gc
|
||||
import shutil
|
||||
|
||||
from typing import List
|
||||
|
||||
@ -33,6 +34,7 @@ import io
|
||||
import urllib
|
||||
import os
|
||||
import sys
|
||||
import git
|
||||
|
||||
def discussion_path_2_url(path:str|Path):
|
||||
path = str(path)
|
||||
@ -519,8 +521,25 @@ class NumpyEncoderDecoder(json.JSONEncoder):
|
||||
if '__numpy_array__' in dct:
|
||||
return np.array(dct['data'])
|
||||
return dct
|
||||
|
||||
|
||||
def clone_repository(repository_url, local_folder:Path|str, exist_ok=False):
|
||||
if Path(local_folder).exists():
|
||||
if exist_ok:
|
||||
shutil.rmtree(str(local_folder))
|
||||
else:
|
||||
ASCIIColors.success("Repository already exists!")
|
||||
return False
|
||||
|
||||
try:
|
||||
# Create a new repository object
|
||||
repo = git.Repo.clone_from(repository_url, str(local_folder))
|
||||
ASCIIColors.success("Repository was cloned successfully")
|
||||
return True
|
||||
except:
|
||||
ASCIIColors.error("Repository cloning failed")
|
||||
return False
|
||||
|
||||
def git_pull(folder_path):
|
||||
try:
|
||||
# Change the current working directory to the desired folder
|
||||
|
Loading…
x
Reference in New Issue
Block a user