mirror of
https://github.com/langbot-app/LangBot.git
synced 2026-06-09 23:36:02 +00:00
style: introduce ruff as linter and formatter (#1356)
* style: remove necessary imports * style: fix F841 * style: fix F401 * style: fix F811 * style: fix E402 * style: fix E721 * style: fix E722 * style: fix E722 * style: fix F541 * style: ruff format * style: all passed * style: add ruff in deps * style: more ignores in ruff.toml * style: add pre-commit
This commit is contained in:
committed by
GitHub
parent
09e70d70e9
commit
209f16af76
@@ -9,9 +9,10 @@ from . import entities as tools_entities
|
||||
|
||||
preregistered_loaders: list[typing.Type[ToolLoader]] = []
|
||||
|
||||
|
||||
def loader_class(name: str):
|
||||
"""注册一个工具加载器
|
||||
"""
|
||||
"""注册一个工具加载器"""
|
||||
|
||||
def decorator(cls: typing.Type[ToolLoader]) -> typing.Type[ToolLoader]:
|
||||
cls.name = name
|
||||
preregistered_loaders.append(cls)
|
||||
@@ -22,7 +23,7 @@ def loader_class(name: str):
|
||||
|
||||
class ToolLoader(abc.ABC):
|
||||
"""工具加载器"""
|
||||
|
||||
|
||||
name: str = None
|
||||
|
||||
ap: app.Application
|
||||
@@ -34,7 +35,7 @@ class ToolLoader(abc.ABC):
|
||||
pass
|
||||
|
||||
@abc.abstractmethod
|
||||
async def get_tools(self, enabled: bool=True) -> list[tools_entities.LLMFunction]:
|
||||
async def get_tools(self, enabled: bool = True) -> list[tools_entities.LLMFunction]:
|
||||
"""获取所有工具"""
|
||||
pass
|
||||
|
||||
@@ -44,11 +45,13 @@ class ToolLoader(abc.ABC):
|
||||
pass
|
||||
|
||||
@abc.abstractmethod
|
||||
async def invoke_tool(self, query: core_entities.Query, name: str, parameters: dict) -> typing.Any:
|
||||
async def invoke_tool(
|
||||
self, query: core_entities.Query, name: str, parameters: dict
|
||||
) -> typing.Any:
|
||||
"""执行工具调用"""
|
||||
pass
|
||||
|
||||
@abc.abstractmethod
|
||||
async def shutdown(self):
|
||||
"""关闭工具"""
|
||||
pass
|
||||
pass
|
||||
|
||||
Reference in New Issue
Block a user