QChatGPT/pkg/utils/context.py
2023-01-02 00:35:36 +08:00

32 lines
745 B
Python

context = {
'inst': {
'database.manager.DatabaseManager': None,
'openai.manager.OpenAIInteract': None,
'qqbot.manager.QQBotManager': None,
},
'logger_handler': None,
}
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']