feat(contentPlugin): 完成基本的内容函数调用功能

This commit is contained in:
RockChinQ
2023-07-28 19:03:02 +08:00
parent caa72fa40c
commit ae6994e241
11 changed files with 700 additions and 166 deletions

View File

@@ -45,7 +45,10 @@ __plugins_order__ = []
"""插件顺序"""
__callable_functions__ = []
"""供GPT调用的函数"""
"""供GPT调用的函数结构"""
__function_inst_map__: dict[str, callable] = {}
"""函数名:实例 映射"""
def generate_plugin_order():
@@ -107,6 +110,10 @@ def load_plugins():
# 加载插件顺序
settings.load_settings()
# 输出已注册的内容函数列表
logging.debug("registered content functions: {}".format(__callable_functions__))
logging.debug("function instance map: {}".format(__function_inst_map__))
def initialize_plugins():
"""初始化插件"""

View File

@@ -189,6 +189,11 @@ class Plugin:
def wrapper(func):
function_schema = get_func_schema(func)
function_schema['name'] = __current_registering_plugin__ + '-' + func.__name__
host.__function_inst_map__[function_schema['name']] = function_schema['function']
del function_schema['function']
# logging.debug("registering content function: p='{}', f='{}', s={}".format(__current_registering_plugin__, func, function_schema))