2023-01-03 17:50:13 +08:00
|
|
|
import pkg.database.manager
|
|
|
|
import pkg.openai.manager
|
|
|
|
import pkg.qqbot.manager
|
|
|
|
|
2023-01-01 23:18:32 +08:00
|
|
|
context = {
|
|
|
|
'inst': {
|
|
|
|
'database.manager.DatabaseManager': None,
|
|
|
|
'openai.manager.OpenAIInteract': None,
|
|
|
|
'qqbot.manager.QQBotManager': None,
|
2023-01-02 00:35:36 +08:00
|
|
|
},
|
|
|
|
'logger_handler': None,
|
2023-01-04 17:09:57 +08:00
|
|
|
'config': None,
|
2023-01-01 23:18:32 +08:00
|
|
|
}
|
|
|
|
|
|
|
|
|
2023-01-04 17:09:57 +08:00
|
|
|
def set_config(inst):
|
|
|
|
context['config'] = inst
|
|
|
|
|
|
|
|
|
|
|
|
def get_config():
|
|
|
|
return context['config']
|
|
|
|
|
|
|
|
|
2023-01-01 23:18:32 +08:00
|
|
|
def set_database_manager(inst):
|
|
|
|
context['inst']['database.manager.DatabaseManager'] = inst
|
|
|
|
|
|
|
|
|
|
|
|
def get_database_manager():
|
|
|
|
return context['inst']['database.manager.DatabaseManager']
|
|
|
|
|
|
|
|
|
|
|
|
def set_openai_manager(inst):
|
|
|
|
context['inst']['openai.manager.OpenAIInteract'] = inst
|
|
|
|
|
|
|
|
|
|
|
|
def get_openai_manager():
|
|
|
|
return context['inst']['openai.manager.OpenAIInteract']
|
|
|
|
|
|
|
|
|
|
|
|
def set_qqbot_manager(inst):
|
|
|
|
context['inst']['qqbot.manager.QQBotManager'] = inst
|
|
|
|
|
|
|
|
|
|
|
|
def get_qqbot_manager():
|
|
|
|
return context['inst']['qqbot.manager.QQBotManager']
|