mirror of
https://github.com/csunny/DB-GPT.git
synced 2025-08-09 12:18:12 +00:00
async auto load plugin
This commit is contained in:
parent
d784e7e00a
commit
8ba409f305
@ -79,8 +79,7 @@ def load_native_plugins(cfg: Config):
|
|||||||
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("load_native_plugins")
|
print("async load_native_plugins")
|
||||||
### TODO 默认拉主分支,后续拉发布版本
|
|
||||||
branch_name = cfg.plugins_git_branch
|
branch_name = cfg.plugins_git_branch
|
||||||
native_plugin_repo = "DB-GPT-Plugins"
|
native_plugin_repo = "DB-GPT-Plugins"
|
||||||
url = "https://github.com/csunny/{repo}/archive/{branch}.zip"
|
url = "https://github.com/csunny/{repo}/archive/{branch}.zip"
|
||||||
@ -98,10 +97,10 @@ def load_native_plugins(cfg: Config):
|
|||||||
print(file_name)
|
print(file_name)
|
||||||
with open(file_name, "wb") as f:
|
with open(file_name, "wb") as f:
|
||||||
f.write(response.content)
|
f.write(response.content)
|
||||||
print("文件已保存到本地")
|
print("save file")
|
||||||
cfg.set_plugins(scan_plugins(cfg, cfg.debug_mode))
|
cfg.set_plugins(scan_plugins(cfg, cfg.debug_mode))
|
||||||
else:
|
else:
|
||||||
print("获取Release信息失败,状态码为:", response.status_code)
|
print("get file faild,response code:", response.status_code)
|
||||||
|
|
||||||
# 创建一个线程
|
# 创建一个线程
|
||||||
t = threading.Thread(target=load_from_git, args=(cfg,))
|
t = threading.Thread(target=load_from_git, args=(cfg,))
|
||||||
|
Binary file not shown.
Loading…
Reference in New Issue
Block a user