mirror of
https://github.com/langbot-app/LangBot.git
synced 2026-07-25 13:56:08 +00:00
chore: 统一docstring格式
This commit is contained in:
@@ -1,2 +1 @@
|
|||||||
"""OpenAI 接口处理及会话管理相关
|
"""OpenAI 接口处理及会话管理相关"""
|
||||||
"""
|
|
||||||
|
|||||||
@@ -11,8 +11,7 @@ class KeysManager:
|
|||||||
"""所有api-key"""
|
"""所有api-key"""
|
||||||
|
|
||||||
using_key = ""
|
using_key = ""
|
||||||
"""当前使用的api-key
|
"""当前使用的api-key"""
|
||||||
"""
|
|
||||||
|
|
||||||
alerted = []
|
alerted = []
|
||||||
"""已提示过超额的key
|
"""已提示过超额的key
|
||||||
@@ -79,8 +78,7 @@ class KeysManager:
|
|||||||
self.api_key[key_name] = key
|
self.api_key[key_name] = key
|
||||||
|
|
||||||
def set_current_exceeded(self):
|
def set_current_exceeded(self):
|
||||||
"""设置当前使用的api-key使用量超限
|
"""设置当前使用的api-key使用量超限"""
|
||||||
"""
|
|
||||||
self.exceeded.append(self.using_key)
|
self.exceeded.append(self.using_key)
|
||||||
|
|
||||||
def get_key_name(self, api_key):
|
def get_key_name(self, api_key):
|
||||||
|
|||||||
+4
-5
@@ -15,8 +15,7 @@ import pkg.plugin.settings as settings
|
|||||||
from mirai import Mirai
|
from mirai import Mirai
|
||||||
|
|
||||||
__plugins__ = {}
|
__plugins__ = {}
|
||||||
"""
|
"""插件列表
|
||||||
插件列表
|
|
||||||
|
|
||||||
示例:
|
示例:
|
||||||
{
|
{
|
||||||
@@ -35,7 +34,8 @@ __plugins__ = {}
|
|||||||
},
|
},
|
||||||
"instance": None
|
"instance": None
|
||||||
}
|
}
|
||||||
}"""
|
}
|
||||||
|
"""
|
||||||
|
|
||||||
__plugins_order__ = []
|
__plugins_order__ = []
|
||||||
"""插件顺序"""
|
"""插件顺序"""
|
||||||
@@ -117,8 +117,7 @@ def initialize_plugins():
|
|||||||
|
|
||||||
|
|
||||||
def unload_plugins():
|
def unload_plugins():
|
||||||
""" 卸载插件
|
"""卸载插件"""
|
||||||
"""
|
|
||||||
# 不再显式卸载插件,因为当程序结束时,插件的析构函数会被系统执行
|
# 不再显式卸载插件,因为当程序结束时,插件的析构函数会被系统执行
|
||||||
# for plugin in __plugins__.values():
|
# for plugin in __plugins__.values():
|
||||||
# if plugin['enabled'] and plugin['instance'] is not None:
|
# if plugin['enabled'] and plugin['instance'] is not None:
|
||||||
|
|||||||
@@ -4,9 +4,7 @@ from concurrent.futures import ThreadPoolExecutor
|
|||||||
|
|
||||||
|
|
||||||
class Pool:
|
class Pool:
|
||||||
'''
|
"""线程池结构"""
|
||||||
线程池结构
|
|
||||||
'''
|
|
||||||
pool_num:int = None
|
pool_num:int = None
|
||||||
ctl:ThreadPoolExecutor = None
|
ctl:ThreadPoolExecutor = None
|
||||||
task_list:list = None
|
task_list:list = None
|
||||||
@@ -33,12 +31,11 @@ class Pool:
|
|||||||
|
|
||||||
class ThreadCtl:
|
class ThreadCtl:
|
||||||
def __init__(self, sys_pool_num, admin_pool_num, user_pool_num):
|
def __init__(self, sys_pool_num, admin_pool_num, user_pool_num):
|
||||||
'''
|
"""线程池控制类
|
||||||
线程池控制类
|
|
||||||
sys_pool_num:分配系统使用的线程池数量(>=8)
|
sys_pool_num:分配系统使用的线程池数量(>=8)
|
||||||
admin_pool_num:用于处理管理员消息的线程池数量(>=1)
|
admin_pool_num:用于处理管理员消息的线程池数量(>=1)
|
||||||
user_pool_num:分配用于处理用户消息的线程池的数量(>=1)
|
user_pool_num:分配用于处理用户消息的线程池的数量(>=1)
|
||||||
'''
|
"""
|
||||||
if sys_pool_num < 5:
|
if sys_pool_num < 5:
|
||||||
raise Exception("Too few system threads(sys_pool_num needs >= 8, but received {})".format(sys_pool_num))
|
raise Exception("Too few system threads(sys_pool_num needs >= 8, but received {})".format(sys_pool_num))
|
||||||
if admin_pool_num < 1:
|
if admin_pool_num < 1:
|
||||||
|
|||||||
Reference in New Issue
Block a user