mirror of
https://github.com/langbot-app/LangBot.git
synced 2026-07-19 19:06:07 +00:00
style: restrict line-length
This commit is contained in:
@@ -19,9 +19,7 @@ class PluginManifestLoader(loader.PluginLoader):
|
||||
def __init__(self, ap: app.Application):
|
||||
super().__init__(ap)
|
||||
|
||||
def handler(
|
||||
self, event: typing.Type[events.BaseEventModel]
|
||||
) -> typing.Callable[[typing.Callable], typing.Callable]:
|
||||
def handler(self, event: typing.Type[events.BaseEventModel]) -> typing.Callable[[typing.Callable], typing.Callable]:
|
||||
"""注册事件处理器"""
|
||||
self.ap.logger.debug(f'注册事件处理器 {event.__name__}')
|
||||
|
||||
@@ -41,11 +39,7 @@ class PluginManifestLoader(loader.PluginLoader):
|
||||
|
||||
def wrapper(func: typing.Callable) -> typing.Callable:
|
||||
function_schema = funcschema.get_func_schema(func)
|
||||
function_name = (
|
||||
self._current_container.plugin_name
|
||||
+ '-'
|
||||
+ (func.__name__ if name is None else name)
|
||||
)
|
||||
function_name = self._current_container.plugin_name + '-' + (func.__name__ if name is None else name)
|
||||
|
||||
llm_function = tools_entities.LLMFunction(
|
||||
name=function_name,
|
||||
@@ -70,11 +64,7 @@ class PluginManifestLoader(loader.PluginLoader):
|
||||
|
||||
for plugin_manifest in plugin_manifests:
|
||||
try:
|
||||
config_schema = (
|
||||
plugin_manifest.spec['config']
|
||||
if 'config' in plugin_manifest.spec
|
||||
else []
|
||||
)
|
||||
config_schema = plugin_manifest.spec['config'] if 'config' in plugin_manifest.spec else []
|
||||
|
||||
current_plugin_container = context.RuntimeContainer(
|
||||
plugin_name=plugin_manifest.metadata.name,
|
||||
@@ -83,9 +73,7 @@ class PluginManifestLoader(loader.PluginLoader):
|
||||
plugin_version=plugin_manifest.metadata.version,
|
||||
plugin_author=plugin_manifest.metadata.author,
|
||||
plugin_repository=plugin_manifest.metadata.repository,
|
||||
main_file=os.path.join(
|
||||
plugin_manifest.rel_dir, plugin_manifest.execution.python.path
|
||||
),
|
||||
main_file=os.path.join(plugin_manifest.rel_dir, plugin_manifest.execution.python.path),
|
||||
pkg_path=plugin_manifest.rel_dir,
|
||||
config_schema=config_schema,
|
||||
event_handlers={},
|
||||
@@ -104,7 +92,5 @@ class PluginManifestLoader(loader.PluginLoader):
|
||||
|
||||
self.plugins.append(current_plugin_container)
|
||||
except Exception:
|
||||
self.ap.logger.error(
|
||||
f'加载插件 {plugin_manifest.metadata.name} 时发生错误'
|
||||
)
|
||||
self.ap.logger.error(f'加载插件 {plugin_manifest.metadata.name} 时发生错误')
|
||||
traceback.print_exc()
|
||||
|
||||
Reference in New Issue
Block a user