mirror of
https://github.com/csunny/DB-GPT.git
synced 2025-08-12 21:46:06 +00:00
close auto load plugin
This commit is contained in:
parent
b2ec087322
commit
d784e7e00a
@ -5,6 +5,7 @@ import os
|
|||||||
import glob
|
import glob
|
||||||
import zipfile
|
import zipfile
|
||||||
import requests
|
import requests
|
||||||
|
import threading
|
||||||
import datetime
|
import datetime
|
||||||
from pathlib import Path
|
from pathlib import Path
|
||||||
from typing import List
|
from typing import List
|
||||||
@ -77,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):
|
||||||
print("load_native_plugins")
|
print("load_native_plugins")
|
||||||
### TODO 默认拉主分支,后续拉发布版本
|
### TODO 默认拉主分支,后续拉发布版本
|
||||||
branch_name = cfg.plugins_git_branch
|
branch_name = cfg.plugins_git_branch
|
||||||
@ -97,9 +99,15 @@ def load_native_plugins(cfg: Config):
|
|||||||
with open(file_name, "wb") as f:
|
with open(file_name, "wb") as f:
|
||||||
f.write(response.content)
|
f.write(response.content)
|
||||||
print("文件已保存到本地")
|
print("文件已保存到本地")
|
||||||
|
cfg.set_plugins(scan_plugins(cfg, cfg.debug_mode))
|
||||||
else:
|
else:
|
||||||
print("获取Release信息失败,状态码为:", response.status_code)
|
print("获取Release信息失败,状态码为:", response.status_code)
|
||||||
|
|
||||||
|
# 创建一个线程
|
||||||
|
t = threading.Thread(target=load_from_git, args=(cfg,))
|
||||||
|
# 启动线程
|
||||||
|
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.
|
||||||
|
@ -90,7 +90,7 @@ class Config(metaclass=Singleton):
|
|||||||
### The associated configuration parameters of the plug-in control the loading and use of the plug-in
|
### The associated configuration parameters of the plug-in control the loading and use of the plug-in
|
||||||
self.plugins: List[AutoGPTPluginTemplate] = []
|
self.plugins: List[AutoGPTPluginTemplate] = []
|
||||||
self.plugins_openai = []
|
self.plugins_openai = []
|
||||||
self.plugins_auto_load = os.getenv("AUTO_LOAD_PLUGIN", "False") == "True"
|
self.plugins_auto_load = os.getenv("AUTO_LOAD_PLUGIN", "True") == "True"
|
||||||
|
|
||||||
self.plugins_git_branch = os.getenv("PLUGINS_GIT_BRANCH", "plugin_dashboard")
|
self.plugins_git_branch = os.getenv("PLUGINS_GIT_BRANCH", "plugin_dashboard")
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user