mirror of
https://github.com/langbot-app/LangBot.git
synced 2026-08-21 17:57:14 +00:00
feat: 新的引入路径
This commit is contained in:
+1
-2
@@ -85,8 +85,7 @@ class Application:
|
|||||||
tasks = []
|
tasks = []
|
||||||
|
|
||||||
try:
|
try:
|
||||||
|
|
||||||
|
|
||||||
tasks = [
|
tasks = [
|
||||||
asyncio.create_task(self.im_mgr.run()),
|
asyncio.create_task(self.im_mgr.run()),
|
||||||
asyncio.create_task(self.ctrl.run())
|
asyncio.create_task(self.ctrl.run())
|
||||||
|
|||||||
@@ -9,6 +9,26 @@ from ..provider.tools import entities as tools_entities
|
|||||||
from ..core import app
|
from ..core import app
|
||||||
|
|
||||||
|
|
||||||
|
def register(
|
||||||
|
name: str,
|
||||||
|
description: str,
|
||||||
|
version: str,
|
||||||
|
author
|
||||||
|
) -> typing.Callable[[typing.Type[BasePlugin]], typing.Type[BasePlugin]]:
|
||||||
|
pass
|
||||||
|
|
||||||
|
def handler(
|
||||||
|
event: typing.Type[events.BaseEventModel]
|
||||||
|
) -> typing.Callable[[typing.Callable], typing.Callable]:
|
||||||
|
pass
|
||||||
|
|
||||||
|
|
||||||
|
def llm_func(
|
||||||
|
name: str=None,
|
||||||
|
) -> typing.Callable:
|
||||||
|
pass
|
||||||
|
|
||||||
|
|
||||||
class BasePlugin(metaclass=abc.ABCMeta):
|
class BasePlugin(metaclass=abc.ABCMeta):
|
||||||
"""插件基类"""
|
"""插件基类"""
|
||||||
|
|
||||||
|
|||||||
@@ -1,3 +1,7 @@
|
|||||||
|
# 此模块已过时
|
||||||
|
# 请从 pkg.plugin.context 引入 BasePlugin, EventContext 和 APIHost
|
||||||
|
# 最早将于 v3.4 移除此模块
|
||||||
|
|
||||||
from . events import *
|
from . events import *
|
||||||
from . context import EventContext, APIHost as PluginHost
|
from . context import EventContext, APIHost as PluginHost
|
||||||
|
|
||||||
|
|||||||
@@ -28,8 +28,9 @@ class PluginLoader(loader.PluginLoader):
|
|||||||
setattr(models, 'on', self.on)
|
setattr(models, 'on', self.on)
|
||||||
setattr(models, 'func', self.func)
|
setattr(models, 'func', self.func)
|
||||||
|
|
||||||
setattr(models, 'handler', self.handler)
|
setattr(context, 'register', self.register)
|
||||||
setattr(models, 'llm_func', self.llm_func)
|
setattr(context, 'handler', self.handler)
|
||||||
|
setattr(context, 'llm_func', self.llm_func)
|
||||||
|
|
||||||
def register(
|
def register(
|
||||||
self,
|
self,
|
||||||
|
|||||||
+4
-12
@@ -1,3 +1,7 @@
|
|||||||
|
# 此模块已过时,请引入 pkg.plugin.context 中的 register, handler 和 llm_func 来注册插件、事件处理函数和内容函数
|
||||||
|
# 各个事件模型请从 pkg.plugin.events 引入
|
||||||
|
# 最早将于 v3.4 移除此模块
|
||||||
|
|
||||||
from __future__ import annotations
|
from __future__ import annotations
|
||||||
|
|
||||||
import typing
|
import typing
|
||||||
@@ -24,15 +28,3 @@ def func(
|
|||||||
name: str=None,
|
name: str=None,
|
||||||
) -> typing.Callable:
|
) -> typing.Callable:
|
||||||
pass
|
pass
|
||||||
|
|
||||||
|
|
||||||
def handler(
|
|
||||||
event: typing.Type[BaseEventModel]
|
|
||||||
) -> typing.Callable[[typing.Callable], typing.Callable]:
|
|
||||||
pass
|
|
||||||
|
|
||||||
|
|
||||||
def llm_func(
|
|
||||||
name: str=None,
|
|
||||||
) -> typing.Callable:
|
|
||||||
pass
|
|
||||||
Reference in New Issue
Block a user