mirror of
https://github.com/langbot-app/LangBot.git
synced 2026-06-05 05:16:03 +00:00
feat: 实现配置文件管理器并适配main.py中的引用
This commit is contained in:
@@ -6,6 +6,7 @@ from . import threadctl
|
||||
from ..database import manager as db_mgr
|
||||
from ..openai import manager as openai_mgr
|
||||
from ..qqbot import manager as qqbot_mgr
|
||||
from ..config import manager as config_mgr
|
||||
from ..plugin import host as plugin_host
|
||||
|
||||
|
||||
@@ -14,6 +15,7 @@ context = {
|
||||
'database.manager.DatabaseManager': None,
|
||||
'openai.manager.OpenAIInteract': None,
|
||||
'qqbot.manager.QQBotManager': None,
|
||||
'config.manager.ConfigManager': None,
|
||||
},
|
||||
'pool_ctl': None,
|
||||
'logger_handler': None,
|
||||
@@ -75,6 +77,19 @@ def get_qqbot_manager() -> qqbot_mgr.QQBotManager:
|
||||
return t
|
||||
|
||||
|
||||
def set_config_manager(inst: config_mgr.ConfigManager):
|
||||
context_lock.acquire()
|
||||
context['inst']['config.manager.ConfigManager'] = inst
|
||||
context_lock.release()
|
||||
|
||||
|
||||
def get_config_manager() -> config_mgr.ConfigManager:
|
||||
context_lock.acquire()
|
||||
t = context['inst']['config.manager.ConfigManager']
|
||||
context_lock.release()
|
||||
return t
|
||||
|
||||
|
||||
def set_plugin_host(inst: plugin_host.PluginHost):
|
||||
context_lock.acquire()
|
||||
context['plugin_host'] = inst
|
||||
|
||||
Reference in New Issue
Block a user