mirror of
https://github.com/csunny/DB-GPT.git
synced 2025-08-21 01:34:24 +00:00
fix:format
This commit is contained in:
parent
51d5517cb5
commit
d07d103db9
@ -78,6 +78,7 @@ def load_native_plugins(cfg: Config):
|
|||||||
if not cfg.plugins_auto_load:
|
if not cfg.plugins_auto_load:
|
||||||
print("not auto load_native_plugins")
|
print("not auto load_native_plugins")
|
||||||
return
|
return
|
||||||
|
|
||||||
def load_from_git(cfg: Config):
|
def load_from_git(cfg: Config):
|
||||||
print("async load_native_plugins")
|
print("async load_native_plugins")
|
||||||
branch_name = cfg.plugins_git_branch
|
branch_name = cfg.plugins_git_branch
|
||||||
@ -85,16 +86,20 @@ def load_native_plugins(cfg: Config):
|
|||||||
url = "https://github.com/csunny/{repo}/archive/{branch}.zip"
|
url = "https://github.com/csunny/{repo}/archive/{branch}.zip"
|
||||||
try:
|
try:
|
||||||
session = requests.Session()
|
session = requests.Session()
|
||||||
response = session.get(url.format(repo=native_plugin_repo, branch=branch_name),
|
response = session.get(
|
||||||
headers={'Authorization': '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'})
|
url.format(repo=native_plugin_repo, branch=branch_name),
|
||||||
|
headers={"Authorization": "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"},
|
||||||
|
)
|
||||||
|
|
||||||
if response.status_code == 200:
|
if response.status_code == 200:
|
||||||
plugins_path_path = Path(PLUGINS_DIR)
|
plugins_path_path = Path(PLUGINS_DIR)
|
||||||
files = glob.glob(os.path.join(plugins_path_path, f'{native_plugin_repo}*'))
|
files = glob.glob(
|
||||||
|
os.path.join(plugins_path_path, f"{native_plugin_repo}*")
|
||||||
|
)
|
||||||
for file in files:
|
for file in files:
|
||||||
os.remove(file)
|
os.remove(file)
|
||||||
now = datetime.datetime.now()
|
now = datetime.datetime.now()
|
||||||
time_str = now.strftime('%Y%m%d%H%M%S')
|
time_str = now.strftime("%Y%m%d%H%M%S")
|
||||||
file_name = f"{plugins_path_path}/{native_plugin_repo}-{branch_name}-{time_str}.zip"
|
file_name = f"{plugins_path_path}/{native_plugin_repo}-{branch_name}-{time_str}.zip"
|
||||||
print(file_name)
|
print(file_name)
|
||||||
with open(file_name, "wb") as f:
|
with open(file_name, "wb") as f:
|
||||||
@ -110,7 +115,6 @@ def load_native_plugins(cfg: Config):
|
|||||||
t.start()
|
t.start()
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
def scan_plugins(cfg: Config, debug: bool = False) -> List[AutoGPTPluginTemplate]:
|
def scan_plugins(cfg: Config, debug: bool = False) -> List[AutoGPTPluginTemplate]:
|
||||||
"""Scan the plugins directory for plugins and loads them.
|
"""Scan the plugins directory for plugins and loads them.
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user