mirror of
https://github.com/langbot-app/LangBot.git
synced 2026-09-03 08:07:14 +00:00
feat: add manifest for LLMAPIRequester
This commit is contained in:
@@ -10,26 +10,6 @@ from .types import message as platform_message
|
|||||||
from .types import events as platform_events
|
from .types import events as platform_events
|
||||||
|
|
||||||
|
|
||||||
preregistered_adapters: list[typing.Type[MessagePlatformAdapter]] = []
|
|
||||||
|
|
||||||
def adapter_class(
|
|
||||||
name: str
|
|
||||||
):
|
|
||||||
"""消息平台适配器类装饰器
|
|
||||||
|
|
||||||
Args:
|
|
||||||
name (str): 适配器名称
|
|
||||||
|
|
||||||
Returns:
|
|
||||||
typing.Callable[[typing.Type[MessageSourceAdapter]], typing.Type[MessageSourceAdapter]]: 装饰器
|
|
||||||
"""
|
|
||||||
def decorator(cls: typing.Type[MessagePlatformAdapter]) -> typing.Type[MessagePlatformAdapter]:
|
|
||||||
cls.name = name
|
|
||||||
preregistered_adapters.append(cls)
|
|
||||||
return cls
|
|
||||||
return decorator
|
|
||||||
|
|
||||||
|
|
||||||
class MessagePlatformAdapter(metaclass=abc.ABCMeta):
|
class MessagePlatformAdapter(metaclass=abc.ABCMeta):
|
||||||
"""消息平台适配器基类"""
|
"""消息平台适配器基类"""
|
||||||
|
|
||||||
|
|||||||
@@ -1,7 +1,6 @@
|
|||||||
apiVersion: v1
|
apiVersion: v1
|
||||||
kind: ComponentTemplate
|
kind: ComponentTemplate
|
||||||
metadata:
|
metadata:
|
||||||
icon:
|
|
||||||
name: MessagePlatformAdapter
|
name: MessagePlatformAdapter
|
||||||
label:
|
label:
|
||||||
en_US: Message Platform Adapter
|
en_US: Message Platform Adapter
|
||||||
|
|||||||
@@ -0,0 +1,14 @@
|
|||||||
|
apiVersion: v1
|
||||||
|
kind: ComponentTemplate
|
||||||
|
metadata:
|
||||||
|
name: LLMAPIRequester
|
||||||
|
label:
|
||||||
|
en_US: LLM API Requester
|
||||||
|
zh_CN: LLM API 请求器
|
||||||
|
spec:
|
||||||
|
type:
|
||||||
|
- python
|
||||||
|
execution:
|
||||||
|
python:
|
||||||
|
path: ./requester.py
|
||||||
|
attr: LLMAPIRequester
|
||||||
Reference in New Issue
Block a user