mirror of
https://github.com/LiteyukiStudio/nonebot-plugin-marshoai.git
synced 2025-02-07 15:26:11 +08:00
✨ 优化函数列表显示,添加短信息属性以改善函数调用的描述
This commit is contained in:
parent
7893f28259
commit
87b18c424b
@ -42,7 +42,7 @@ function_call = on_alconna(
|
||||
async def list_functions():
|
||||
reply = "共有如下可调用函数:\n"
|
||||
for function in get_function_calls().values():
|
||||
reply += f"- {function.name}({function.description}))\n"
|
||||
reply += f"- {function.short_info}\n"
|
||||
await UniMessage(reply).send()
|
||||
|
||||
|
||||
|
@ -240,6 +240,10 @@ class Caller:
|
||||
"""完整名"""
|
||||
return self.module_name + self._name
|
||||
|
||||
@property
|
||||
def short_info(self) -> str:
|
||||
return f"{self.full_name}({self._description})"
|
||||
|
||||
|
||||
def on_function_call(name: str = "", description: str | None = None) -> Caller:
|
||||
"""返回一个Caller类,可用于装饰一个函数,使其注册为一个可被AI调用的function call函数
|
||||
|
Loading…
x
Reference in New Issue
Block a user