From cbd8df2401771440cb5f99a3d66ee709980d370d Mon Sep 17 00:00:00 2001 From: Asankilp <60691961+Asankilp@users.noreply.github.com> Date: Tue, 25 Feb 2025 16:48:37 +0000 Subject: [PATCH] =?UTF-8?q?Deploying=20to=20docs=20from=20@=20LiteyukiStud?= =?UTF-8?q?io/nonebot-plugin-marshoai@1cd60252b5bc30f392430802d0b5d4f6a90d?= =?UTF-8?q?6306=20=F0=9F=9A=80?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- 404.html | 2 +- ...ZVdI.js => dev_api_handler.md.7K28NkFk.js} | 4 +- ...js => dev_api_handler.md.7K28NkFk.lean.js} | 0 ...XrCYn.js => dev_api_marsho.md.BVrC2Id2.js} | 2 +- ....js => dev_api_marsho.md.BVrC2Id2.lean.js} | 0 ...pi_plugin_func_call_caller.md.CZ2VF4Ib.js} | 33 ++++++++--------- ...ugin_func_call_caller.md.CZ2VF4Ib.lean.js} | 0 ...api_plugin_func_call_models.md.B_MfPgwF.js | 1 - ...api_plugin_func_call_models.md.DM4UuGqM.js | 1 + ...ugin_func_call_models.md.DM4UuGqM.lean.js} | 2 +- ...W.js => en_dev_api_handler.md.CBa5CZKK.js} | 4 +- ...=> en_dev_api_handler.md.CBa5CZKK.lean.js} | 0 ...0U.js => en_dev_api_marsho.md.BqgcH2AC.js} | 2 +- ... => en_dev_api_marsho.md.BqgcH2AC.lean.js} | 0 ...pi_plugin_func_call_caller.md.1GgdB5io.js} | 33 ++++++++--------- ...ugin_func_call_caller.md.1GgdB5io.lean.js} | 0 ...api_plugin_func_call_models.md.CFjT_Zkx.js | 1 + ...ugin_func_call_models.md.CFjT_Zkx.lean.js} | 2 +- ...api_plugin_func_call_models.md.CgamQBXE.js | 1 - dev/api/_types.html | 2 +- dev/api/azure.html | 2 +- dev/api/azure_onebot.html | 2 +- dev/api/cache/decos.html | 2 +- dev/api/config.html | 2 +- dev/api/constants.html | 2 +- dev/api/deal_latex.html | 2 +- dev/api/dev.html | 2 +- dev/api/handler.html | 8 ++-- dev/api/hooks.html | 2 +- dev/api/hunyuan.html | 2 +- dev/api/index.html | 2 +- dev/api/instances.html | 2 +- dev/api/marsho.html | 6 +-- dev/api/marsho_onebot.html | 2 +- dev/api/metadata.html | 2 +- dev/api/models.html | 2 +- dev/api/observer.html | 2 +- dev/api/plugin/func_call/caller.html | 37 +++++++++---------- dev/api/plugin/func_call/index.html | 2 +- dev/api/plugin/func_call/models.html | 6 +-- dev/api/plugin/func_call/params.html | 2 +- dev/api/plugin/func_call/utils.html | 2 +- dev/api/plugin/index.html | 2 +- dev/api/plugin/load.html | 2 +- dev/api/plugin/models.html | 2 +- dev/api/plugin/register.html | 2 +- dev/api/plugin/typing.html | 2 +- dev/api/plugin/utils.html | 2 +- dev/api/plugins/builtin_tools/chat.html | 2 +- dev/api/plugins/builtin_tools/file_io.html | 2 +- dev/api/plugins/builtin_tools/index.html | 2 +- dev/api/plugins/builtin_tools/liteyuki.html | 2 +- dev/api/plugins/builtin_tools/manager.html | 2 +- dev/api/plugins/builtin_tools/network.html | 2 +- dev/api/plugins/builtin_tools/utils.html | 2 +- dev/api/plugins/marshoai_bangumi/index.html | 2 +- dev/api/plugins/marshoai_basic/index.html | 2 +- dev/api/plugins/twisuki_megakits/index.html | 2 +- .../twisuki_megakits/mk_morse_code.html | 2 +- .../plugins/twisuki_megakits/mk_nya_code.html | 2 +- dev/api/plugins/twisuki_petcat/index.html | 2 +- dev/api/plugins/twisuki_petcat/pc_cat.html | 2 +- dev/api/plugins/twisuki_petcat/pc_info.html | 2 +- dev/api/plugins/twisuki_petcat/pc_shop.html | 2 +- dev/api/plugins/twisuki_petcat/pc_token.html | 2 +- .../plugins_test/marshoai_basic/index.html | 2 +- .../plugins_test/marshoai_memory/command.html | 2 +- .../plugins_test/marshoai_memory/config.html | 2 +- .../plugins_test/marshoai_memory/index.html | 2 +- .../plugins_test/random_number_generator.html | 2 +- .../snowykami_testplugin/index.html | 2 +- dev/api/plugins_test/weather_demo.html | 2 +- dev/api/tools/marshoai_bangumi/index.html | 2 +- dev/api/tools/marshoai_basic/index.html | 2 +- dev/api/tools/marshoai_megakits/index.html | 2 +- .../tools/marshoai_megakits/mk_common.html | 2 +- dev/api/tools/marshoai_megakits/mk_info.html | 2 +- .../marshoai_megakits/mk_morse_code.html | 2 +- .../tools/marshoai_megakits/mk_nya_code.html | 2 +- dev/api/tools/marshoai_memory/index.html | 2 +- dev/api/tools/marshoai_meogirl/index.html | 2 +- dev/api/tools/marshoai_meogirl/mg_info.html | 2 +- .../tools/marshoai_meogirl/mg_introduce.html | 2 +- dev/api/tools/marshoai_meogirl/mg_search.html | 2 +- dev/api/tools_wip/marshoai_memory/index.html | 2 +- dev/api/util.html | 2 +- dev/api/util_hunyuan.html | 2 +- dev/extension.html | 2 +- dev/index.html | 2 +- dev/project.html | 2 +- en/dev/api/_types.html | 2 +- en/dev/api/azure.html | 2 +- en/dev/api/azure_onebot.html | 2 +- en/dev/api/cache/decos.html | 2 +- en/dev/api/config.html | 2 +- en/dev/api/constants.html | 2 +- en/dev/api/deal_latex.html | 2 +- en/dev/api/dev.html | 2 +- en/dev/api/handler.html | 8 ++-- en/dev/api/hooks.html | 2 +- en/dev/api/hunyuan.html | 2 +- en/dev/api/index.html | 2 +- en/dev/api/instances.html | 2 +- en/dev/api/marsho.html | 6 +-- en/dev/api/marsho_onebot.html | 2 +- en/dev/api/metadata.html | 2 +- en/dev/api/models.html | 2 +- en/dev/api/observer.html | 2 +- en/dev/api/plugin/func_call/caller.html | 37 +++++++++---------- en/dev/api/plugin/func_call/index.html | 2 +- en/dev/api/plugin/func_call/models.html | 6 +-- en/dev/api/plugin/func_call/params.html | 2 +- en/dev/api/plugin/func_call/utils.html | 2 +- en/dev/api/plugin/index.html | 2 +- en/dev/api/plugin/load.html | 2 +- en/dev/api/plugin/models.html | 2 +- en/dev/api/plugin/register.html | 2 +- en/dev/api/plugin/typing.html | 2 +- en/dev/api/plugin/utils.html | 2 +- en/dev/api/plugins/builtin_tools/chat.html | 2 +- en/dev/api/plugins/builtin_tools/file_io.html | 2 +- en/dev/api/plugins/builtin_tools/index.html | 2 +- .../api/plugins/builtin_tools/liteyuki.html | 2 +- en/dev/api/plugins/builtin_tools/manager.html | 2 +- en/dev/api/plugins/builtin_tools/network.html | 2 +- en/dev/api/plugins/builtin_tools/utils.html | 2 +- .../api/plugins/marshoai_bangumi/index.html | 2 +- en/dev/api/plugins/marshoai_basic/index.html | 2 +- .../api/plugins/twisuki_megakits/index.html | 2 +- .../twisuki_megakits/mk_morse_code.html | 2 +- .../plugins/twisuki_megakits/mk_nya_code.html | 2 +- en/dev/api/plugins/twisuki_petcat/index.html | 2 +- en/dev/api/plugins/twisuki_petcat/pc_cat.html | 2 +- .../api/plugins/twisuki_petcat/pc_info.html | 2 +- .../api/plugins/twisuki_petcat/pc_shop.html | 2 +- .../api/plugins/twisuki_petcat/pc_token.html | 2 +- .../plugins_test/marshoai_basic/index.html | 2 +- .../plugins_test/marshoai_memory/command.html | 2 +- .../plugins_test/marshoai_memory/config.html | 2 +- .../plugins_test/marshoai_memory/index.html | 2 +- .../plugins_test/random_number_generator.html | 2 +- .../snowykami_testplugin/index.html | 2 +- en/dev/api/plugins_test/weather_demo.html | 2 +- en/dev/api/tools/marshoai_bangumi/index.html | 2 +- en/dev/api/tools/marshoai_basic/index.html | 2 +- en/dev/api/tools/marshoai_megakits/index.html | 2 +- .../tools/marshoai_megakits/mk_common.html | 2 +- .../api/tools/marshoai_megakits/mk_info.html | 2 +- .../marshoai_megakits/mk_morse_code.html | 2 +- .../tools/marshoai_megakits/mk_nya_code.html | 2 +- en/dev/api/tools/marshoai_memory/index.html | 2 +- en/dev/api/tools/marshoai_meogirl/index.html | 2 +- .../api/tools/marshoai_meogirl/mg_info.html | 2 +- .../tools/marshoai_meogirl/mg_introduce.html | 2 +- .../api/tools/marshoai_meogirl/mg_search.html | 2 +- .../api/tools_wip/marshoai_memory/index.html | 2 +- en/dev/api/util.html | 2 +- en/dev/api/util_hunyuan.html | 2 +- en/dev/index.html | 2 +- en/index.html | 2 +- en/start/index.html | 2 +- en/start/install.html | 2 +- hashmap.json | 2 +- index.html | 2 +- ja/index.html | 2 +- start/index.html | 2 +- start/install-old.html | 2 +- start/install.html | 2 +- start/use.html | 2 +- 169 files changed, 237 insertions(+), 249 deletions(-) rename assets/{dev_api_handler.md.EsRGZVdI.js => dev_api_handler.md.7K28NkFk.js} (93%) rename assets/{dev_api_handler.md.EsRGZVdI.lean.js => dev_api_handler.md.7K28NkFk.lean.js} (100%) rename assets/{dev_api_marsho.md.DK-XrCYn.js => dev_api_marsho.md.BVrC2Id2.js} (99%) rename assets/{dev_api_marsho.md.DK-XrCYn.lean.js => dev_api_marsho.md.BVrC2Id2.lean.js} (100%) rename assets/{dev_api_plugin_func_call_caller.md.C3WLsVno.js => dev_api_plugin_func_call_caller.md.CZ2VF4Ib.js} (97%) rename assets/{dev_api_plugin_func_call_caller.md.C3WLsVno.lean.js => dev_api_plugin_func_call_caller.md.CZ2VF4Ib.lean.js} (100%) delete mode 100644 assets/dev_api_plugin_func_call_models.md.B_MfPgwF.js create mode 100644 assets/dev_api_plugin_func_call_models.md.DM4UuGqM.js rename assets/{dev_api_plugin_func_call_models.md.B_MfPgwF.lean.js => dev_api_plugin_func_call_models.md.DM4UuGqM.lean.js} (73%) rename assets/{en_dev_api_handler.md.CCDjlqJW.js => en_dev_api_handler.md.CBa5CZKK.js} (93%) rename assets/{en_dev_api_handler.md.CCDjlqJW.lean.js => en_dev_api_handler.md.CBa5CZKK.lean.js} (100%) rename assets/{en_dev_api_marsho.md.BK9ONw0U.js => en_dev_api_marsho.md.BqgcH2AC.js} (99%) rename assets/{en_dev_api_marsho.md.BK9ONw0U.lean.js => en_dev_api_marsho.md.BqgcH2AC.lean.js} (100%) rename assets/{en_dev_api_plugin_func_call_caller.md.3vBCle9I.js => en_dev_api_plugin_func_call_caller.md.1GgdB5io.js} (97%) rename assets/{en_dev_api_plugin_func_call_caller.md.3vBCle9I.lean.js => en_dev_api_plugin_func_call_caller.md.1GgdB5io.lean.js} (100%) create mode 100644 assets/en_dev_api_plugin_func_call_models.md.CFjT_Zkx.js rename assets/{en_dev_api_plugin_func_call_models.md.CgamQBXE.lean.js => en_dev_api_plugin_func_call_models.md.CFjT_Zkx.lean.js} (87%) delete mode 100644 assets/en_dev_api_plugin_func_call_models.md.CgamQBXE.js diff --git a/404.html b/404.html index c15333a..cc959a1 100644 --- a/404.html +++ b/404.html @@ -17,7 +17,7 @@
- + \ No newline at end of file diff --git a/assets/dev_api_handler.md.EsRGZVdI.js b/assets/dev_api_handler.md.7K28NkFk.js similarity index 93% rename from assets/dev_api_handler.md.EsRGZVdI.js rename to assets/dev_api_handler.md.7K28NkFk.js index 0a3071d..610d132 100644 --- a/assets/dev_api_handler.md.EsRGZVdI.js +++ b/assets/dev_api_handler.md.7K28NkFk.js @@ -44,12 +44,12 @@ import{_ as i,c as a,o as n,ae as h}from"./chunks/framework.BHrE6nLq.js";const d await UniMessage(f"调用函数 {tool_call.function.name.replace('-', '.')}\\n参数:" + '\\n'.join([f'{k}={v}' for k, v in function_args.items()])).send() if (caller := get_function_calls().get(tool_call.function.name)): logger.debug(f'调用插件函数 {caller.full_name}') - func_return = await caller.with_ctx(SessionContext(bot=self.bot, event=self.event, matcher=self.matcher)).call(**function_args) + func_return = await caller.with_ctx(SessionContext(bot=self.bot, event=self.event, matcher=self.matcher, state=None)).call(**function_args) else: logger.error(f"未找到函数 {tool_call.function.name.replace('-', '.')}") func_return = f"未找到函数 {tool_call.function.name.replace('-', '.')}" tool_msg.append(ToolMessage(tool_call_id=tool_call.id, content=func_return).as_dict()) - return await self.handle_common_chat(user_message=user_message, model_name=model_name, tools_list=tools_list, tool_message=tool_msg)

async func handle_common_chat(self, user_message: Union[str, list], model_name: str, tools_list: list, stream: bool = False, tool_message: Optional[list] = None) -> Union[Tuple[UserMessage, ChatCompletionMessage], None]

说明: 处理一般聊天

源代码在GitHub上查看
python
async def handle_common_chat(self, user_message: Union[str, list], model_name: str, tools_list: list, stream: bool=False, tool_message: Optional[list]=None) -> Union[Tuple[UserMessage, ChatCompletionMessage], None]:
+    return await self.handle_common_chat(user_message=user_message, model_name=model_name, tools_list=tools_list, tool_message=tool_msg)

async func handle_common_chat(self, user_message: Union[str, list], model_name: str, tools_list: list, stream: bool = False, tool_message: Optional[list] = None) -> Optional[Tuple[UserMessage, ChatCompletionMessage]]

说明: 处理一般聊天

源代码在GitHub上查看
python
async def handle_common_chat(self, user_message: Union[str, list], model_name: str, tools_list: list, stream: bool=False, tool_message: Optional[list]=None) -> Optional[Tuple[UserMessage, ChatCompletionMessage]]:
     global target_list
     if stream:
         raise NotImplementedError
diff --git a/assets/dev_api_handler.md.EsRGZVdI.lean.js b/assets/dev_api_handler.md.7K28NkFk.lean.js
similarity index 100%
rename from assets/dev_api_handler.md.EsRGZVdI.lean.js
rename to assets/dev_api_handler.md.7K28NkFk.lean.js
diff --git a/assets/dev_api_marsho.md.DK-XrCYn.js b/assets/dev_api_marsho.md.BVrC2Id2.js
similarity index 99%
rename from assets/dev_api_marsho.md.DK-XrCYn.js
rename to assets/dev_api_marsho.md.BVrC2Id2.js
index 0aed674..9641051 100644
--- a/assets/dev_api_marsho.md.DK-XrCYn.js
+++ b/assets/dev_api_marsho.md.BVrC2Id2.js
@@ -92,7 +92,7 @@ import{_ as i,c as a,o as n,ae as t}from"./chunks/framework.BHrE6nLq.js";const E
             context.append(context_user.as_dict(), target.id, target.private)
             context.append(context_assistant.to_dict(), target.id, target.private)
         else:
-            await UniMessage('没有回答').send()
+            return
     except Exception as e:
         await UniMessage(str(e) + suggest_solution(str(e))).send()
         traceback.print_exc()
diff --git a/assets/dev_api_marsho.md.DK-XrCYn.lean.js b/assets/dev_api_marsho.md.BVrC2Id2.lean.js
similarity index 100%
rename from assets/dev_api_marsho.md.DK-XrCYn.lean.js
rename to assets/dev_api_marsho.md.BVrC2Id2.lean.js
diff --git a/assets/dev_api_plugin_func_call_caller.md.C3WLsVno.js b/assets/dev_api_plugin_func_call_caller.md.CZ2VF4Ib.js
similarity index 97%
rename from assets/dev_api_plugin_func_call_caller.md.C3WLsVno.js
rename to assets/dev_api_plugin_func_call_caller.md.CZ2VF4Ib.js
index 30ce8fe..95258f3 100644
--- a/assets/dev_api_plugin_func_call_caller.md.C3WLsVno.js
+++ b/assets/dev_api_plugin_func_call_caller.md.CZ2VF4Ib.js
@@ -32,23 +32,20 @@ import{_ as i,c as a,o as n,ae as l}from"./chunks/framework.BHrE6nLq.js";const E
         return (False, 'Context is None')
     if self._permission and (not await self._permission(self.ctx.bot, self.ctx.event)):
         return (False, '告诉用户 Permission Denied 权限不足')
-    if self._rule and (not await self._rule(self.ctx.bot, self.ctx.event)):
+    if self._rule and (not await self._rule(self.ctx.bot, self.ctx.event, self.ctx.state)):
         return (False, '告诉用户 Rule Denied 规则不匹配')
-    return (True, '')

func rule(self, rule: Rule) -> Caller

源代码在GitHub上查看
python
def rule(self, rule: Rule) -> 'Caller':
+    return (True, '')

func rule(self, rule: Rule) -> Caller

源代码在GitHub上查看
python
def rule(self, rule: Rule) -> 'Caller':
     self._rule = self._rule and rule
-    return self

func name(self, name: str) -> Caller

说明: 设置函数名称

参数:

返回: Caller: Caller对象

源代码在GitHub上查看
python
def name(self, name: str) -> 'Caller':
+    return self

func name(self, name: str) -> Caller

说明: 设置函数名称

参数:

返回: Caller: Caller对象

源代码在GitHub上查看
python
def name(self, name: str) -> 'Caller':
     self._name = name
-    return self

func description(self, description: str) -> Caller

源代码在GitHub上查看
python
def description(self, description: str) -> 'Caller':
+    return self

func description(self, description: str) -> Caller

源代码在GitHub上查看
python
def description(self, description: str) -> 'Caller':
     self._description = description
-    return self

func self () func: F => F

说明: 装饰函数,注册为一个可被AI调用的function call函数

参数:

返回: F: 函数对象

源代码在GitHub上查看
python
def __call__(self, func: F) -> F:
+    return self

func self () func: F => F

说明: 装饰函数,注册为一个可被AI调用的function call函数

参数:

返回: F: 函数对象

源代码在GitHub上查看
python
def __call__(self, func: F) -> F:
     global _caller_data
     if not self._name:
         self._name = func.__name__
     sig = inspect.signature(func)
     for name, param in sig.parameters.items():
-        if param.annotation == T_State:
-            self.di.state = name
-            continue
         if issubclass(param.annotation, Event) or isinstance(param.annotation, Event):
             self.di.event = name
         if issubclass(param.annotation, Caller) or isinstance(param.annotation, Caller):
@@ -71,18 +68,18 @@ import{_ as i,c as a,o as n,ae as l}from"./chunks/framework.BHrE6nLq.js";const E
     self.module_name = module_name
     _caller_data[self.aifc_name] = self
     logger.opt(colors=True).debug(f'<y>加载函数 {self.full_name}: {self._description}</y>')
-    return func

func data(self) -> dict[str, Any]

返回: dict[str, Any]: 函数的json数据

源代码在GitHub上查看
python
def data(self) -> dict[str, Any]:
+    return func

func data(self) -> dict[str, Any]

返回: dict[str, Any]: 函数的json数据

源代码在GitHub上查看
python
def data(self) -> dict[str, Any]:
     properties = {key: value.data() for key, value in self._parameters.items()}
     if not properties:
         properties['placeholder'] = {'type': 'string', 'description': '占位符,用于显示在对话框中'}
-    return {'type': self._func_type, 'function': {'name': self.aifc_name, 'description': self._description, 'parameters': {'type': 'object', 'properties': properties}, 'required': [key for key, value in self._parameters.items() if value.default is None]}}

func set_ctx(self, ctx: SessionContext) -> None

说明: 设置依赖注入上下文

参数:

源代码在GitHub上查看
python
def set_ctx(self, ctx: SessionContext) -> None:
+    return {'type': self._func_type, 'function': {'name': self.aifc_name, 'description': self._description, 'parameters': {'type': 'object', 'properties': properties}, 'required': [key for key, value in self._parameters.items() if value.default is None]}}

func set_ctx(self, ctx: SessionContext) -> None

说明: 设置依赖注入上下文

参数:

源代码在GitHub上查看
python
def set_ctx(self, ctx: SessionContext) -> None:
     ctx.caller = self
     self.ctx = ctx
     for type_name, arg_name in self.di.model_dump().items():
         if arg_name:
-            self.default[arg_name] = ctx.__getattribute__(type_name)

func with_ctx(self, ctx: SessionContext) -> Caller

说明: 设置依赖注入上下文

参数:

返回: Caller: Caller对象

源代码在GitHub上查看
python
def with_ctx(self, ctx: SessionContext) -> 'Caller':
+            self.default[arg_name] = ctx.__getattribute__(type_name)

func with_ctx(self, ctx: SessionContext) -> Caller

说明: 设置依赖注入上下文

参数:

返回: Caller: Caller对象

源代码在GitHub上查看
python
def with_ctx(self, ctx: SessionContext) -> 'Caller':
     self.set_ctx(ctx)
-    return self

async func call(self, *args: Any, **kwargs: Any) -> Any

说明: 调用函数

返回: Any: 函数返回值

源代码在GitHub上查看
python
async def call(self, *args: Any, **kwargs: Any) -> Any:
+    return self

async func call(self, *args: Any, **kwargs: Any) -> Any

说明: 调用函数

返回: Any: 函数返回值

源代码在GitHub上查看
python
async def call(self, *args: Any, **kwargs: Any) -> Any:
     y, r = await self.pre_check()
     if not y:
         logger.debug(f'Function {self._name} pre_check failed: {r}')
@@ -92,17 +89,17 @@ import{_ as i,c as a,o as n,ae as l}from"./chunks/framework.BHrE6nLq.js";const E
     for name, value in self.default.items():
         if name not in kwargs:
             kwargs[name] = value
-    return await self.func(*args, **kwargs)

@property

func short_name(self) -> str

说明: 函数本名

源代码在GitHub上查看
python
@property
+    return await self.func(*args, **kwargs)

@property

func short_name(self) -> str

说明: 函数本名

源代码在GitHub上查看
python
@property
 def short_name(self) -> str:
-    return self._name.split('.')[-1]

@property

func aifc_name(self) -> str

说明: AI调用名,没有点

源代码在GitHub上查看
python
@property
+    return self._name.split('.')[-1]

@property

func aifc_name(self) -> str

说明: AI调用名,没有点

源代码在GitHub上查看
python
@property
 def aifc_name(self) -> str:
     if self.no_module_name:
         return self._name
-    return self.full_name.replace('.', '-')

@property

func full_name(self) -> str

说明: 完整名

源代码在GitHub上查看
python
@property
+    return self.full_name.replace('.', '-')

@property

func full_name(self) -> str

说明: 完整名

源代码在GitHub上查看
python
@property
 def full_name(self) -> str:
-    return self.module_name + '.' + self._name

@property

func short_info(self) -> str

源代码在GitHub上查看
python
@property
+    return self.module_name + '.' + self._name

@property

func short_info(self) -> str

源代码在GitHub上查看
python
@property
 def short_info(self) -> str:
-    return f'{self.full_name}({self._description})'

func on_function_call(name: str = '', description: str | None = None, func_type: str = 'function', no_module_name: bool = False) -> Caller

参数:

返回: Caller: Caller对象

源代码在GitHub上查看
python
def on_function_call(name: str='', description: str | None=None, func_type: str='function', no_module_name: bool=False) -> Caller:
+    return f'{self.full_name}({self._description})'

func on_function_call(name: str = '', description: str | None = None, func_type: str = 'function', no_module_name: bool = False) -> Caller

参数:

返回: Caller: Caller对象

源代码在GitHub上查看
python
def on_function_call(name: str='', description: str | None=None, func_type: str='function', no_module_name: bool=False) -> Caller:
     caller = Caller(name=name, description=description, func_type=func_type, no_module_name=no_module_name)
-    return caller

func get_function_calls() -> dict[str, Caller]

说明: 获取所有已注册的function call函数

返回: dict[str, Caller]: 所有已注册的function call函数

源代码在GitHub上查看
python
def get_function_calls() -> dict[str, Caller]:
+    return caller

func get_function_calls() -> dict[str, Caller]

说明: 获取所有已注册的function call函数

返回: dict[str, Caller]: 所有已注册的function call函数

源代码在GitHub上查看
python
def get_function_calls() -> dict[str, Caller]:
     return _caller_data
`,86)]))}const o=i(t,[["render",h]]);export{E as __pageData,o as default}; diff --git a/assets/dev_api_plugin_func_call_caller.md.C3WLsVno.lean.js b/assets/dev_api_plugin_func_call_caller.md.CZ2VF4Ib.lean.js similarity index 100% rename from assets/dev_api_plugin_func_call_caller.md.C3WLsVno.lean.js rename to assets/dev_api_plugin_func_call_caller.md.CZ2VF4Ib.lean.js diff --git a/assets/dev_api_plugin_func_call_models.md.B_MfPgwF.js b/assets/dev_api_plugin_func_call_models.md.B_MfPgwF.js deleted file mode 100644 index bb36347..0000000 --- a/assets/dev_api_plugin_func_call_models.md.B_MfPgwF.js +++ /dev/null @@ -1 +0,0 @@ -import{_ as t,c as a,o,ae as n}from"./chunks/framework.BHrE6nLq.js";const u=JSON.parse('{"title":"models","description":"","frontmatter":{"title":"models","order":100},"headers":[],"relativePath":"dev/api/plugin/func_call/models.md","filePath":"zh/dev/api/plugin/func_call/models.md","lastUpdated":null}'),r={name:"dev/api/plugin/func_call/models.md"};function s(l,e,c,d,i,h){return o(),a("div",null,e[0]||(e[0]=[n('

模块 nonebot_plugin_marshoai.plugin.func_call.models

class SessionContext(BaseModel)

attr bot: Bot = NO_DEFAULT

attr event: Event = NO_DEFAULT

attr matcher: Matcher = NO_DEFAULT

attr caller: Any = None

class SessionContextDepends(BaseModel)

attr bot: str | None = None

attr event: str | None = None

attr matcher: str | None = None

attr caller: str | None = None

',11)]))}const b=t(r,[["render",s]]);export{u as __pageData,b as default}; diff --git a/assets/dev_api_plugin_func_call_models.md.DM4UuGqM.js b/assets/dev_api_plugin_func_call_models.md.DM4UuGqM.js new file mode 100644 index 0000000..5151908 --- /dev/null +++ b/assets/dev_api_plugin_func_call_models.md.DM4UuGqM.js @@ -0,0 +1 @@ +import{_ as t,c as a,o,ae as n}from"./chunks/framework.BHrE6nLq.js";const u=JSON.parse('{"title":"models","description":"","frontmatter":{"title":"models","order":100},"headers":[],"relativePath":"dev/api/plugin/func_call/models.md","filePath":"zh/dev/api/plugin/func_call/models.md","lastUpdated":null}'),r={name:"dev/api/plugin/func_call/models.md"};function s(l,e,d,c,i,h){return o(),a("div",null,e[0]||(e[0]=[n('

模块 nonebot_plugin_marshoai.plugin.func_call.models

class SessionContext(BaseModel)

attr bot: Bot = NO_DEFAULT

attr event: Event = NO_DEFAULT

attr matcher: Matcher = NO_DEFAULT

attr state: T_State | None = NO_DEFAULT

attr caller: Any = None

class SessionContextDepends(BaseModel)

attr bot: str | None = None

attr event: str | None = None

attr matcher: str | None = None

attr caller: str | None = None

',12)]))}const b=t(r,[["render",s]]);export{u as __pageData,b as default}; diff --git a/assets/dev_api_plugin_func_call_models.md.B_MfPgwF.lean.js b/assets/dev_api_plugin_func_call_models.md.DM4UuGqM.lean.js similarity index 73% rename from assets/dev_api_plugin_func_call_models.md.B_MfPgwF.lean.js rename to assets/dev_api_plugin_func_call_models.md.DM4UuGqM.lean.js index cc4a226..2c3b491 100644 --- a/assets/dev_api_plugin_func_call_models.md.B_MfPgwF.lean.js +++ b/assets/dev_api_plugin_func_call_models.md.DM4UuGqM.lean.js @@ -1 +1 @@ -import{_ as t,c as a,o,ae as n}from"./chunks/framework.BHrE6nLq.js";const u=JSON.parse('{"title":"models","description":"","frontmatter":{"title":"models","order":100},"headers":[],"relativePath":"dev/api/plugin/func_call/models.md","filePath":"zh/dev/api/plugin/func_call/models.md","lastUpdated":null}'),r={name:"dev/api/plugin/func_call/models.md"};function s(l,e,c,d,i,h){return o(),a("div",null,e[0]||(e[0]=[n("",11)]))}const b=t(r,[["render",s]]);export{u as __pageData,b as default}; +import{_ as t,c as a,o,ae as n}from"./chunks/framework.BHrE6nLq.js";const u=JSON.parse('{"title":"models","description":"","frontmatter":{"title":"models","order":100},"headers":[],"relativePath":"dev/api/plugin/func_call/models.md","filePath":"zh/dev/api/plugin/func_call/models.md","lastUpdated":null}'),r={name:"dev/api/plugin/func_call/models.md"};function s(l,e,d,c,i,h){return o(),a("div",null,e[0]||(e[0]=[n("",12)]))}const b=t(r,[["render",s]]);export{u as __pageData,b as default}; diff --git a/assets/en_dev_api_handler.md.CCDjlqJW.js b/assets/en_dev_api_handler.md.CBa5CZKK.js similarity index 93% rename from assets/en_dev_api_handler.md.CCDjlqJW.js rename to assets/en_dev_api_handler.md.CBa5CZKK.js index 7f5d4a6..4ecc956 100644 --- a/assets/en_dev_api_handler.md.CCDjlqJW.js +++ b/assets/en_dev_api_handler.md.CBa5CZKK.js @@ -44,12 +44,12 @@ import{_ as i,c as a,o as n,ae as h}from"./chunks/framework.BHrE6nLq.js";const d await UniMessage(f"调用函数 {tool_call.function.name.replace('-', '.')}\\n参数:" + '\\n'.join([f'{k}={v}' for k, v in function_args.items()])).send() if (caller := get_function_calls().get(tool_call.function.name)): logger.debug(f'调用插件函数 {caller.full_name}') - func_return = await caller.with_ctx(SessionContext(bot=self.bot, event=self.event, matcher=self.matcher)).call(**function_args) + func_return = await caller.with_ctx(SessionContext(bot=self.bot, event=self.event, matcher=self.matcher, state=None)).call(**function_args) else: logger.error(f"未找到函数 {tool_call.function.name.replace('-', '.')}") func_return = f"未找到函数 {tool_call.function.name.replace('-', '.')}" tool_msg.append(ToolMessage(tool_call_id=tool_call.id, content=func_return).as_dict()) - return await self.handle_common_chat(user_message=user_message, model_name=model_name, tools_list=tools_list, tool_message=tool_msg)

async func handle_common_chat(self, user_message: Union[str, list], model_name: str, tools_list: list, stream: bool = False, tool_message: Optional[list] = None) -> Union[Tuple[UserMessage, ChatCompletionMessage], None]

Description: 处理一般聊天

Source code or View on GitHub
python
async def handle_common_chat(self, user_message: Union[str, list], model_name: str, tools_list: list, stream: bool=False, tool_message: Optional[list]=None) -> Union[Tuple[UserMessage, ChatCompletionMessage], None]:
+    return await self.handle_common_chat(user_message=user_message, model_name=model_name, tools_list=tools_list, tool_message=tool_msg)

async func handle_common_chat(self, user_message: Union[str, list], model_name: str, tools_list: list, stream: bool = False, tool_message: Optional[list] = None) -> Optional[Tuple[UserMessage, ChatCompletionMessage]]

Description: 处理一般聊天

Source code or View on GitHub
python
async def handle_common_chat(self, user_message: Union[str, list], model_name: str, tools_list: list, stream: bool=False, tool_message: Optional[list]=None) -> Optional[Tuple[UserMessage, ChatCompletionMessage]]:
     global target_list
     if stream:
         raise NotImplementedError
diff --git a/assets/en_dev_api_handler.md.CCDjlqJW.lean.js b/assets/en_dev_api_handler.md.CBa5CZKK.lean.js
similarity index 100%
rename from assets/en_dev_api_handler.md.CCDjlqJW.lean.js
rename to assets/en_dev_api_handler.md.CBa5CZKK.lean.js
diff --git a/assets/en_dev_api_marsho.md.BK9ONw0U.js b/assets/en_dev_api_marsho.md.BqgcH2AC.js
similarity index 99%
rename from assets/en_dev_api_marsho.md.BK9ONw0U.js
rename to assets/en_dev_api_marsho.md.BqgcH2AC.js
index b963c85..4a3d3b2 100644
--- a/assets/en_dev_api_marsho.md.BK9ONw0U.js
+++ b/assets/en_dev_api_marsho.md.BqgcH2AC.js
@@ -92,7 +92,7 @@ import{_ as i,c as a,o as n,ae as t}from"./chunks/framework.BHrE6nLq.js";const E
             context.append(context_user.as_dict(), target.id, target.private)
             context.append(context_assistant.to_dict(), target.id, target.private)
         else:
-            await UniMessage('没有回答').send()
+            return
     except Exception as e:
         await UniMessage(str(e) + suggest_solution(str(e))).send()
         traceback.print_exc()
diff --git a/assets/en_dev_api_marsho.md.BK9ONw0U.lean.js b/assets/en_dev_api_marsho.md.BqgcH2AC.lean.js
similarity index 100%
rename from assets/en_dev_api_marsho.md.BK9ONw0U.lean.js
rename to assets/en_dev_api_marsho.md.BqgcH2AC.lean.js
diff --git a/assets/en_dev_api_plugin_func_call_caller.md.3vBCle9I.js b/assets/en_dev_api_plugin_func_call_caller.md.1GgdB5io.js
similarity index 97%
rename from assets/en_dev_api_plugin_func_call_caller.md.3vBCle9I.js
rename to assets/en_dev_api_plugin_func_call_caller.md.1GgdB5io.js
index 59b199a..3815f12 100644
--- a/assets/en_dev_api_plugin_func_call_caller.md.3vBCle9I.js
+++ b/assets/en_dev_api_plugin_func_call_caller.md.1GgdB5io.js
@@ -32,23 +32,20 @@ import{_ as i,c as a,o as n,ae as t}from"./chunks/framework.BHrE6nLq.js";const E
         return (False, 'Context is None')
     if self._permission and (not await self._permission(self.ctx.bot, self.ctx.event)):
         return (False, '告诉用户 Permission Denied 权限不足')
-    if self._rule and (not await self._rule(self.ctx.bot, self.ctx.event)):
+    if self._rule and (not await self._rule(self.ctx.bot, self.ctx.event, self.ctx.state)):
         return (False, '告诉用户 Rule Denied 规则不匹配')
-    return (True, '')

func rule(self, rule: Rule) -> Caller

Source code or View on GitHub
python
def rule(self, rule: Rule) -> 'Caller':
+    return (True, '')

func rule(self, rule: Rule) -> Caller

Source code or View on GitHub
python
def rule(self, rule: Rule) -> 'Caller':
     self._rule = self._rule and rule
-    return self

func name(self, name: str) -> Caller

Description: 设置函数名称

Arguments:

Return: Caller: Caller对象

Source code or View on GitHub
python
def name(self, name: str) -> 'Caller':
+    return self

func name(self, name: str) -> Caller

Description: 设置函数名称

Arguments:

Return: Caller: Caller对象

Source code or View on GitHub
python
def name(self, name: str) -> 'Caller':
     self._name = name
-    return self

func description(self, description: str) -> Caller

Source code or View on GitHub
python
def description(self, description: str) -> 'Caller':
+    return self

func description(self, description: str) -> Caller

Source code or View on GitHub
python
def description(self, description: str) -> 'Caller':
     self._description = description
-    return self

func self () func: F => F

Description: 装饰函数,注册为一个可被AI调用的function call函数

Arguments:

Return: F: 函数对象

Source code or View on GitHub
python
def __call__(self, func: F) -> F:
+    return self

func self () func: F => F

Description: 装饰函数,注册为一个可被AI调用的function call函数

Arguments:

Return: F: 函数对象

Source code or View on GitHub
python
def __call__(self, func: F) -> F:
     global _caller_data
     if not self._name:
         self._name = func.__name__
     sig = inspect.signature(func)
     for name, param in sig.parameters.items():
-        if param.annotation == T_State:
-            self.di.state = name
-            continue
         if issubclass(param.annotation, Event) or isinstance(param.annotation, Event):
             self.di.event = name
         if issubclass(param.annotation, Caller) or isinstance(param.annotation, Caller):
@@ -71,18 +68,18 @@ import{_ as i,c as a,o as n,ae as t}from"./chunks/framework.BHrE6nLq.js";const E
     self.module_name = module_name
     _caller_data[self.aifc_name] = self
     logger.opt(colors=True).debug(f'<y>加载函数 {self.full_name}: {self._description}</y>')
-    return func

func data(self) -> dict[str, Any]

Return: dict[str, Any]: 函数的json数据

Source code or View on GitHub
python
def data(self) -> dict[str, Any]:
+    return func

func data(self) -> dict[str, Any]

Return: dict[str, Any]: 函数的json数据

Source code or View on GitHub
python
def data(self) -> dict[str, Any]:
     properties = {key: value.data() for key, value in self._parameters.items()}
     if not properties:
         properties['placeholder'] = {'type': 'string', 'description': '占位符,用于显示在对话框中'}
-    return {'type': self._func_type, 'function': {'name': self.aifc_name, 'description': self._description, 'parameters': {'type': 'object', 'properties': properties}, 'required': [key for key, value in self._parameters.items() if value.default is None]}}

func set_ctx(self, ctx: SessionContext) -> None

Description: 设置依赖注入上下文

Arguments:

Source code or View on GitHub
python
def set_ctx(self, ctx: SessionContext) -> None:
+    return {'type': self._func_type, 'function': {'name': self.aifc_name, 'description': self._description, 'parameters': {'type': 'object', 'properties': properties}, 'required': [key for key, value in self._parameters.items() if value.default is None]}}

func set_ctx(self, ctx: SessionContext) -> None

Description: 设置依赖注入上下文

Arguments:

Source code or View on GitHub
python
def set_ctx(self, ctx: SessionContext) -> None:
     ctx.caller = self
     self.ctx = ctx
     for type_name, arg_name in self.di.model_dump().items():
         if arg_name:
-            self.default[arg_name] = ctx.__getattribute__(type_name)

func with_ctx(self, ctx: SessionContext) -> Caller

Description: 设置依赖注入上下文

Arguments:

Return: Caller: Caller对象

Source code or View on GitHub
python
def with_ctx(self, ctx: SessionContext) -> 'Caller':
+            self.default[arg_name] = ctx.__getattribute__(type_name)

func with_ctx(self, ctx: SessionContext) -> Caller

Description: 设置依赖注入上下文

Arguments:

Return: Caller: Caller对象

Source code or View on GitHub
python
def with_ctx(self, ctx: SessionContext) -> 'Caller':
     self.set_ctx(ctx)
-    return self

async func call(self, *args: Any, **kwargs: Any) -> Any

Description: 调用函数

Return: Any: 函数返回值

Source code or View on GitHub
python
async def call(self, *args: Any, **kwargs: Any) -> Any:
+    return self

async func call(self, *args: Any, **kwargs: Any) -> Any

Description: 调用函数

Return: Any: 函数返回值

Source code or View on GitHub
python
async def call(self, *args: Any, **kwargs: Any) -> Any:
     y, r = await self.pre_check()
     if not y:
         logger.debug(f'Function {self._name} pre_check failed: {r}')
@@ -92,17 +89,17 @@ import{_ as i,c as a,o as n,ae as t}from"./chunks/framework.BHrE6nLq.js";const E
     for name, value in self.default.items():
         if name not in kwargs:
             kwargs[name] = value
-    return await self.func(*args, **kwargs)

@property

func short_name(self) -> str

Description: 函数本名

Source code or View on GitHub
python
@property
+    return await self.func(*args, **kwargs)

@property

func short_name(self) -> str

Description: 函数本名

Source code or View on GitHub
python
@property
 def short_name(self) -> str:
-    return self._name.split('.')[-1]

@property

func aifc_name(self) -> str

Description: AI调用名,没有点

Source code or View on GitHub
python
@property
+    return self._name.split('.')[-1]

@property

func aifc_name(self) -> str

Description: AI调用名,没有点

Source code or View on GitHub
python
@property
 def aifc_name(self) -> str:
     if self.no_module_name:
         return self._name
-    return self.full_name.replace('.', '-')

@property

func full_name(self) -> str

Description: 完整名

Source code or View on GitHub
python
@property
+    return self.full_name.replace('.', '-')

@property

func full_name(self) -> str

Description: 完整名

Source code or View on GitHub
python
@property
 def full_name(self) -> str:
-    return self.module_name + '.' + self._name

@property

func short_info(self) -> str

Source code or View on GitHub
python
@property
+    return self.module_name + '.' + self._name

@property

func short_info(self) -> str

Source code or View on GitHub
python
@property
 def short_info(self) -> str:
-    return f'{self.full_name}({self._description})'

func on_function_call(name: str = '', description: str | None = None, func_type: str = 'function', no_module_name: bool = False) -> Caller

Arguments:

Return: Caller: Caller对象

Source code or View on GitHub
python
def on_function_call(name: str='', description: str | None=None, func_type: str='function', no_module_name: bool=False) -> Caller:
+    return f'{self.full_name}({self._description})'

func on_function_call(name: str = '', description: str | None = None, func_type: str = 'function', no_module_name: bool = False) -> Caller

Arguments:

Return: Caller: Caller对象

Source code or View on GitHub
python
def on_function_call(name: str='', description: str | None=None, func_type: str='function', no_module_name: bool=False) -> Caller:
     caller = Caller(name=name, description=description, func_type=func_type, no_module_name=no_module_name)
-    return caller

func get_function_calls() -> dict[str, Caller]

Description: 获取所有已注册的function call函数

Return: dict[str, Caller]: 所有已注册的function call函数

Source code or View on GitHub
python
def get_function_calls() -> dict[str, Caller]:
+    return caller

func get_function_calls() -> dict[str, Caller]

Description: 获取所有已注册的function call函数

Return: dict[str, Caller]: 所有已注册的function call函数

Source code or View on GitHub
python
def get_function_calls() -> dict[str, Caller]:
     return _caller_data
`,86)]))}const o=i(l,[["render",h]]);export{E as __pageData,o as default}; diff --git a/assets/en_dev_api_plugin_func_call_caller.md.3vBCle9I.lean.js b/assets/en_dev_api_plugin_func_call_caller.md.1GgdB5io.lean.js similarity index 100% rename from assets/en_dev_api_plugin_func_call_caller.md.3vBCle9I.lean.js rename to assets/en_dev_api_plugin_func_call_caller.md.1GgdB5io.lean.js diff --git a/assets/en_dev_api_plugin_func_call_models.md.CFjT_Zkx.js b/assets/en_dev_api_plugin_func_call_models.md.CFjT_Zkx.js new file mode 100644 index 0000000..7d540a4 --- /dev/null +++ b/assets/en_dev_api_plugin_func_call_models.md.CFjT_Zkx.js @@ -0,0 +1 @@ +import{_ as t,c as a,o,ae as n}from"./chunks/framework.BHrE6nLq.js";const u=JSON.parse('{"title":"models","description":"","frontmatter":{"title":"models","order":100},"headers":[],"relativePath":"en/dev/api/plugin/func_call/models.md","filePath":"en/dev/api/plugin/func_call/models.md","lastUpdated":null}'),r={name:"en/dev/api/plugin/func_call/models.md"};function s(l,e,d,c,i,h){return o(),a("div",null,e[0]||(e[0]=[n('

Module nonebot_plugin_marshoai.plugin.func_call.models

class SessionContext(BaseModel)

attr bot: Bot = NO_DEFAULT

attr event: Event = NO_DEFAULT

attr matcher: Matcher = NO_DEFAULT

attr state: T_State | None = NO_DEFAULT

attr caller: Any = None

class SessionContextDepends(BaseModel)

attr bot: str | None = None

attr event: str | None = None

attr matcher: str | None = None

attr caller: str | None = None

',12)]))}const b=t(r,[["render",s]]);export{u as __pageData,b as default}; diff --git a/assets/en_dev_api_plugin_func_call_models.md.CgamQBXE.lean.js b/assets/en_dev_api_plugin_func_call_models.md.CFjT_Zkx.lean.js similarity index 87% rename from assets/en_dev_api_plugin_func_call_models.md.CgamQBXE.lean.js rename to assets/en_dev_api_plugin_func_call_models.md.CFjT_Zkx.lean.js index 4e2e5ae..7947ef9 100644 --- a/assets/en_dev_api_plugin_func_call_models.md.CgamQBXE.lean.js +++ b/assets/en_dev_api_plugin_func_call_models.md.CFjT_Zkx.lean.js @@ -1 +1 @@ -import{_ as t,c as a,o,ae as n}from"./chunks/framework.BHrE6nLq.js";const u=JSON.parse('{"title":"models","description":"","frontmatter":{"title":"models","order":100},"headers":[],"relativePath":"en/dev/api/plugin/func_call/models.md","filePath":"en/dev/api/plugin/func_call/models.md","lastUpdated":null}'),r={name:"en/dev/api/plugin/func_call/models.md"};function s(l,e,d,c,i,h){return o(),a("div",null,e[0]||(e[0]=[n("",11)]))}const b=t(r,[["render",s]]);export{u as __pageData,b as default}; +import{_ as t,c as a,o,ae as n}from"./chunks/framework.BHrE6nLq.js";const u=JSON.parse('{"title":"models","description":"","frontmatter":{"title":"models","order":100},"headers":[],"relativePath":"en/dev/api/plugin/func_call/models.md","filePath":"en/dev/api/plugin/func_call/models.md","lastUpdated":null}'),r={name:"en/dev/api/plugin/func_call/models.md"};function s(l,e,d,c,i,h){return o(),a("div",null,e[0]||(e[0]=[n("",12)]))}const b=t(r,[["render",s]]);export{u as __pageData,b as default}; diff --git a/assets/en_dev_api_plugin_func_call_models.md.CgamQBXE.js b/assets/en_dev_api_plugin_func_call_models.md.CgamQBXE.js deleted file mode 100644 index 13734c9..0000000 --- a/assets/en_dev_api_plugin_func_call_models.md.CgamQBXE.js +++ /dev/null @@ -1 +0,0 @@ -import{_ as t,c as a,o,ae as n}from"./chunks/framework.BHrE6nLq.js";const u=JSON.parse('{"title":"models","description":"","frontmatter":{"title":"models","order":100},"headers":[],"relativePath":"en/dev/api/plugin/func_call/models.md","filePath":"en/dev/api/plugin/func_call/models.md","lastUpdated":null}'),r={name:"en/dev/api/plugin/func_call/models.md"};function s(l,e,d,c,i,h){return o(),a("div",null,e[0]||(e[0]=[n('

Module nonebot_plugin_marshoai.plugin.func_call.models

class SessionContext(BaseModel)

attr bot: Bot = NO_DEFAULT

attr event: Event = NO_DEFAULT

attr matcher: Matcher = NO_DEFAULT

attr caller: Any = None

class SessionContextDepends(BaseModel)

attr bot: str | None = None

attr event: str | None = None

attr matcher: str | None = None

attr caller: str | None = None

',11)]))}const b=t(r,[["render",s]]);export{u as __pageData,b as default}; diff --git a/dev/api/_types.html b/dev/api/_types.html index 4de9134..bf7848b 100644 --- a/dev/api/_types.html +++ b/dev/api/_types.html @@ -24,7 +24,7 @@ ...

@overload

func __init__(self, mapping: Mapping[str, Any])

说明: :param mapping: raw JSON to initialize the model. :type mapping: Mapping[str, Any]

源代码在GitHub上查看
python
@overload
 def __init__(self, mapping: Mapping[str, Any]):

func __init__(self, *args: Any, **kwargs: Any) -> None

源代码在GitHub上查看
python
def __init__(self, *args: Any, **kwargs: Any) -> None:
     super().__init__(*args, role='developer', **kwargs)

attr role: Literal['developer'] = rest_discriminator(name='role')

attr content: Optional[str] = rest_field()

- + \ No newline at end of file diff --git a/dev/api/azure.html b/dev/api/azure.html index 2ed9b15..5631935 100644 --- a/dev/api/azure.html +++ b/dev/api/azure.html @@ -180,7 +180,7 @@ await UniMessage(str(e) + suggest_solution(str(e))).send() traceback.print_exc() return

var text

- + \ No newline at end of file diff --git a/dev/api/azure_onebot.html b/dev/api/azure_onebot.html index c04302c..c4f0b3d 100644 --- a/dev/api/azure_onebot.html +++ b/dev/api/azure_onebot.html @@ -20,7 +20,7 @@
Skip to content

模块 nonebot_plugin_marshoai.azure_onebot

文档完善中,欢迎提出建议或帮助我们完善。

- + \ No newline at end of file diff --git a/dev/api/cache/decos.html b/dev/api/cache/decos.html index ee6581c..fbd83c5 100644 --- a/dev/api/cache/decos.html +++ b/dev/api/cache/decos.html @@ -42,7 +42,7 @@ return result return wrapper return decorator - + \ No newline at end of file diff --git a/dev/api/config.html b/dev/api/config.html index 47d3730..f91dc6a 100644 --- a/dev/api/config.html +++ b/dev/api/config.html @@ -41,7 +41,7 @@ logger.info(f'新增配置项: {key} = {value}') existing_cfg[key] = value return existing_cfg - + \ No newline at end of file diff --git a/dev/api/constants.html b/dev/api/constants.html index 8321531..5a81d7d 100644 --- a/dev/api/constants.html +++ b/dev/api/constants.html @@ -20,7 +20,7 @@
Skip to content

模块 nonebot_plugin_marshoai.constants

文档完善中,欢迎提出建议或帮助我们完善。

- + \ No newline at end of file diff --git a/dev/api/deal_latex.html b/dev/api/deal_latex.html index 75d4482..bd82036 100644 --- a/dev/api/deal_latex.html +++ b/dev/api/deal_latex.html @@ -114,7 +114,7 @@ results = await asyncio.gather(*(channel_test_wrapper(channel) for channel in channel_list)) best_channel = min(results, key=lambda x: x[0])[1] return best_channel()

attr channel: ConvertChannel = NO_DEFAULT

- + \ No newline at end of file diff --git a/dev/api/dev.html b/dev/api/dev.html index 57b7c8d..e8c54d2 100644 --- a/dev/api/dev.html +++ b/dev/api/dev.html @@ -64,7 +64,7 @@ else: logger.debug('未找到变动插件') return

var dir_list

- + \ No newline at end of file diff --git a/dev/api/handler.html b/dev/api/handler.html index 36ce151..692d85b 100644 --- a/dev/api/handler.html +++ b/dev/api/handler.html @@ -13,7 +13,7 @@ - + @@ -65,12 +65,12 @@ await UniMessage(f"调用函数 {tool_call.function.name.replace('-', '.')}\n参数:" + '\n'.join([f'{k}={v}' for k, v in function_args.items()])).send() if (caller := get_function_calls().get(tool_call.function.name)): logger.debug(f'调用插件函数 {caller.full_name}') - func_return = await caller.with_ctx(SessionContext(bot=self.bot, event=self.event, matcher=self.matcher)).call(**function_args) + func_return = await caller.with_ctx(SessionContext(bot=self.bot, event=self.event, matcher=self.matcher, state=None)).call(**function_args) else: logger.error(f"未找到函数 {tool_call.function.name.replace('-', '.')}") func_return = f"未找到函数 {tool_call.function.name.replace('-', '.')}" tool_msg.append(ToolMessage(tool_call_id=tool_call.id, content=func_return).as_dict()) - return await self.handle_common_chat(user_message=user_message, model_name=model_name, tools_list=tools_list, tool_message=tool_msg)

async func handle_common_chat(self, user_message: Union[str, list], model_name: str, tools_list: list, stream: bool = False, tool_message: Optional[list] = None) -> Union[Tuple[UserMessage, ChatCompletionMessage], None]

说明: 处理一般聊天

源代码在GitHub上查看
python
async def handle_common_chat(self, user_message: Union[str, list], model_name: str, tools_list: list, stream: bool=False, tool_message: Optional[list]=None) -> Union[Tuple[UserMessage, ChatCompletionMessage], None]:
+    return await self.handle_common_chat(user_message=user_message, model_name=model_name, tools_list=tools_list, tool_message=tool_msg)

async func handle_common_chat(self, user_message: Union[str, list], model_name: str, tools_list: list, stream: bool = False, tool_message: Optional[list] = None) -> Optional[Tuple[UserMessage, ChatCompletionMessage]]

说明: 处理一般聊天

源代码在GitHub上查看
python
async def handle_common_chat(self, user_message: Union[str, list], model_name: str, tools_list: list, stream: bool=False, tool_message: Optional[list]=None) -> Optional[Tuple[UserMessage, ChatCompletionMessage]]:
     global target_list
     if stream:
         raise NotImplementedError
@@ -98,7 +98,7 @@
     else:
         await UniMessage(f'意外的完成原因:{choice.finish_reason}').send()
         return None
- + \ No newline at end of file diff --git a/dev/api/hooks.html b/dev/api/hooks.html index 42eb8a9..8d4ff06 100644 --- a/dev/api/hooks.html +++ b/dev/api/hooks.html @@ -30,7 +30,7 @@ target_uid = 'group_' + target_id await save_context_to_json(f'back_up_context_{target_uid}', contexts_data, 'contexts/backup') logger.info(f'已保存会话 {target_id} 的上下文备份,将在下次对话时恢复~')

var marshoai_plugin_dirs

- + \ No newline at end of file diff --git a/dev/api/hunyuan.html b/dev/api/hunyuan.html index 9e8d07b..4bd8fb8 100644 --- a/dev/api/hunyuan.html +++ b/dev/api/hunyuan.html @@ -29,7 +29,7 @@ await UniMessage.image(url=url).send() except Exception as e: traceback.print_exc() - + \ No newline at end of file diff --git a/dev/api/index.html b/dev/api/index.html index 1956bf5..0fd7248 100644 --- a/dev/api/index.html +++ b/dev/api/index.html @@ -20,7 +20,7 @@
Skip to content

模块 nonebot_plugin_marshoai

MIT License

Copyright (c) 2025 Asankilp & LiteyukiStudio

Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions:

The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.

THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.

文档完善中,欢迎提出建议或帮助我们完善。

- + \ No newline at end of file diff --git a/dev/api/instances.html b/dev/api/instances.html index c00daa6..efac47a 100644 --- a/dev/api/instances.html +++ b/dev/api/instances.html @@ -20,7 +20,7 @@
Skip to content

模块 nonebot_plugin_marshoai.instances

var target_list

  • 说明: 记录需保存历史上下文的列表

  • 类型: list[list]

  • 默认值: []

文档完善中,欢迎提出建议或帮助我们完善。

- + \ No newline at end of file diff --git a/dev/api/marsho.html b/dev/api/marsho.html index 15b8284..a386a93 100644 --- a/dev/api/marsho.html +++ b/dev/api/marsho.html @@ -13,7 +13,7 @@ - + @@ -113,7 +113,7 @@ context.append(context_user.as_dict(), target.id, target.private) context.append(context_assistant.to_dict(), target.id, target.private) else: - await UniMessage('没有回答').send() + return except Exception as e: await UniMessage(str(e) + suggest_solution(str(e))).send() traceback.print_exc() @@ -132,7 +132,7 @@ await UniMessage(str(e) + suggest_solution(str(e))).send() traceback.print_exc() return

var text

- + \ No newline at end of file diff --git a/dev/api/marsho_onebot.html b/dev/api/marsho_onebot.html index cbff888..beeebd8 100644 --- a/dev/api/marsho_onebot.html +++ b/dev/api/marsho_onebot.html @@ -20,7 +20,7 @@
Skip to content

模块 nonebot_plugin_marshoai.marsho_onebot

文档完善中,欢迎提出建议或帮助我们完善。

- + \ No newline at end of file diff --git a/dev/api/metadata.html b/dev/api/metadata.html index 8aaa3f1..37da4c8 100644 --- a/dev/api/metadata.html +++ b/dev/api/metadata.html @@ -20,7 +20,7 @@
Skip to content

文档完善中,欢迎提出建议或帮助我们完善。

- + \ No newline at end of file diff --git a/dev/api/models.html b/dev/api/models.html index 78e088c..28b5cc6 100644 --- a/dev/api/models.html +++ b/dev/api/models.html @@ -72,7 +72,7 @@ if not self.tools_list or not config.marshoai_enable_tools: return None return self.tools_list - + \ No newline at end of file diff --git a/dev/api/observer.html b/dev/api/observer.html index 9837dcf..8af5783 100644 --- a/dev/api/observer.html +++ b/dev/api/observer.html @@ -55,7 +55,7 @@ observer.schedule(code_modified_handler, directory, recursive=recursive) return func return decorator - + \ No newline at end of file diff --git a/dev/api/plugin/func_call/caller.html b/dev/api/plugin/func_call/caller.html index 29340a2..6c3d7dc 100644 --- a/dev/api/plugin/func_call/caller.html +++ b/dev/api/plugin/func_call/caller.html @@ -13,7 +13,7 @@ - + @@ -53,23 +53,20 @@ return (False, 'Context is None') if self._permission and (not await self._permission(self.ctx.bot, self.ctx.event)): return (False, '告诉用户 Permission Denied 权限不足') - if self._rule and (not await self._rule(self.ctx.bot, self.ctx.event)): + if self._rule and (not await self._rule(self.ctx.bot, self.ctx.event, self.ctx.state)): return (False, '告诉用户 Rule Denied 规则不匹配') - return (True, '')

func rule(self, rule: Rule) -> Caller

源代码在GitHub上查看
python
def rule(self, rule: Rule) -> 'Caller':
+    return (True, '')

func rule(self, rule: Rule) -> Caller

源代码在GitHub上查看
python
def rule(self, rule: Rule) -> 'Caller':
     self._rule = self._rule and rule
-    return self

func name(self, name: str) -> Caller

说明: 设置函数名称

参数:

返回: Caller: Caller对象

源代码在GitHub上查看
python
def name(self, name: str) -> 'Caller':
+    return self

func name(self, name: str) -> Caller

说明: 设置函数名称

参数:

返回: Caller: Caller对象

源代码在GitHub上查看
python
def name(self, name: str) -> 'Caller':
     self._name = name
-    return self

func description(self, description: str) -> Caller

源代码在GitHub上查看
python
def description(self, description: str) -> 'Caller':
+    return self

func description(self, description: str) -> Caller

源代码在GitHub上查看
python
def description(self, description: str) -> 'Caller':
     self._description = description
-    return self

func self () func: F => F

说明: 装饰函数,注册为一个可被AI调用的function call函数

参数:

返回: F: 函数对象

源代码在GitHub上查看
python
def __call__(self, func: F) -> F:
+    return self

func self () func: F => F

说明: 装饰函数,注册为一个可被AI调用的function call函数

参数:

返回: F: 函数对象

源代码在GitHub上查看
python
def __call__(self, func: F) -> F:
     global _caller_data
     if not self._name:
         self._name = func.__name__
     sig = inspect.signature(func)
     for name, param in sig.parameters.items():
-        if param.annotation == T_State:
-            self.di.state = name
-            continue
         if issubclass(param.annotation, Event) or isinstance(param.annotation, Event):
             self.di.event = name
         if issubclass(param.annotation, Caller) or isinstance(param.annotation, Caller):
@@ -92,18 +89,18 @@
     self.module_name = module_name
     _caller_data[self.aifc_name] = self
     logger.opt(colors=True).debug(f'<y>加载函数 {self.full_name}: {self._description}</y>')
-    return func

func data(self) -> dict[str, Any]

返回: dict[str, Any]: 函数的json数据

源代码在GitHub上查看
python
def data(self) -> dict[str, Any]:
+    return func

func data(self) -> dict[str, Any]

返回: dict[str, Any]: 函数的json数据

源代码在GitHub上查看
python
def data(self) -> dict[str, Any]:
     properties = {key: value.data() for key, value in self._parameters.items()}
     if not properties:
         properties['placeholder'] = {'type': 'string', 'description': '占位符,用于显示在对话框中'}
-    return {'type': self._func_type, 'function': {'name': self.aifc_name, 'description': self._description, 'parameters': {'type': 'object', 'properties': properties}, 'required': [key for key, value in self._parameters.items() if value.default is None]}}

func set_ctx(self, ctx: SessionContext) -> None

说明: 设置依赖注入上下文

参数:

源代码在GitHub上查看
python
def set_ctx(self, ctx: SessionContext) -> None:
+    return {'type': self._func_type, 'function': {'name': self.aifc_name, 'description': self._description, 'parameters': {'type': 'object', 'properties': properties}, 'required': [key for key, value in self._parameters.items() if value.default is None]}}

func set_ctx(self, ctx: SessionContext) -> None

说明: 设置依赖注入上下文

参数:

源代码在GitHub上查看
python
def set_ctx(self, ctx: SessionContext) -> None:
     ctx.caller = self
     self.ctx = ctx
     for type_name, arg_name in self.di.model_dump().items():
         if arg_name:
-            self.default[arg_name] = ctx.__getattribute__(type_name)

func with_ctx(self, ctx: SessionContext) -> Caller

说明: 设置依赖注入上下文

参数:

返回: Caller: Caller对象

源代码在GitHub上查看
python
def with_ctx(self, ctx: SessionContext) -> 'Caller':
+            self.default[arg_name] = ctx.__getattribute__(type_name)

func with_ctx(self, ctx: SessionContext) -> Caller

说明: 设置依赖注入上下文

参数:

返回: Caller: Caller对象

源代码在GitHub上查看
python
def with_ctx(self, ctx: SessionContext) -> 'Caller':
     self.set_ctx(ctx)
-    return self

async func call(self, *args: Any, **kwargs: Any) -> Any

说明: 调用函数

返回: Any: 函数返回值

源代码在GitHub上查看
python
async def call(self, *args: Any, **kwargs: Any) -> Any:
+    return self

async func call(self, *args: Any, **kwargs: Any) -> Any

说明: 调用函数

返回: Any: 函数返回值

源代码在GitHub上查看
python
async def call(self, *args: Any, **kwargs: Any) -> Any:
     y, r = await self.pre_check()
     if not y:
         logger.debug(f'Function {self._name} pre_check failed: {r}')
@@ -113,21 +110,21 @@
     for name, value in self.default.items():
         if name not in kwargs:
             kwargs[name] = value
-    return await self.func(*args, **kwargs)

@property

func short_name(self) -> str

说明: 函数本名

源代码在GitHub上查看
python
@property
+    return await self.func(*args, **kwargs)

@property

func short_name(self) -> str

说明: 函数本名

源代码在GitHub上查看
python
@property
 def short_name(self) -> str:
-    return self._name.split('.')[-1]

@property

func aifc_name(self) -> str

说明: AI调用名,没有点

源代码在GitHub上查看
python
@property
+    return self._name.split('.')[-1]

@property

func aifc_name(self) -> str

说明: AI调用名,没有点

源代码在GitHub上查看
python
@property
 def aifc_name(self) -> str:
     if self.no_module_name:
         return self._name
-    return self.full_name.replace('.', '-')

@property

func full_name(self) -> str

说明: 完整名

源代码在GitHub上查看
python
@property
+    return self.full_name.replace('.', '-')

@property

func full_name(self) -> str

说明: 完整名

源代码在GitHub上查看
python
@property
 def full_name(self) -> str:
-    return self.module_name + '.' + self._name

@property

func short_info(self) -> str

源代码在GitHub上查看
python
@property
+    return self.module_name + '.' + self._name

@property

func short_info(self) -> str

源代码在GitHub上查看
python
@property
 def short_info(self) -> str:
-    return f'{self.full_name}({self._description})'

func on_function_call(name: str = '', description: str | None = None, func_type: str = 'function', no_module_name: bool = False) -> Caller

参数:

返回: Caller: Caller对象

源代码在GitHub上查看
python
def on_function_call(name: str='', description: str | None=None, func_type: str='function', no_module_name: bool=False) -> Caller:
+    return f'{self.full_name}({self._description})'

func on_function_call(name: str = '', description: str | None = None, func_type: str = 'function', no_module_name: bool = False) -> Caller

参数:

返回: Caller: Caller对象

源代码在GitHub上查看
python
def on_function_call(name: str='', description: str | None=None, func_type: str='function', no_module_name: bool=False) -> Caller:
     caller = Caller(name=name, description=description, func_type=func_type, no_module_name=no_module_name)
-    return caller

func get_function_calls() -> dict[str, Caller]

说明: 获取所有已注册的function call函数

返回: dict[str, Caller]: 所有已注册的function call函数

源代码在GitHub上查看
python
def get_function_calls() -> dict[str, Caller]:
+    return caller

func get_function_calls() -> dict[str, Caller]

说明: 获取所有已注册的function call函数

返回: dict[str, Caller]: 所有已注册的function call函数

源代码在GitHub上查看
python
def get_function_calls() -> dict[str, Caller]:
     return _caller_data
- + \ No newline at end of file diff --git a/dev/api/plugin/func_call/index.html b/dev/api/plugin/func_call/index.html index b52e31e..f89abdc 100644 --- a/dev/api/plugin/func_call/index.html +++ b/dev/api/plugin/func_call/index.html @@ -20,7 +20,7 @@
Skip to content

模块 nonebot_plugin_marshoai.plugin.func_call

文档完善中,欢迎提出建议或帮助我们完善。

- + \ No newline at end of file diff --git a/dev/api/plugin/func_call/models.html b/dev/api/plugin/func_call/models.html index fa01165..c07a27b 100644 --- a/dev/api/plugin/func_call/models.html +++ b/dev/api/plugin/func_call/models.html @@ -13,14 +13,14 @@ - + -
Skip to content

模块 nonebot_plugin_marshoai.plugin.func_call.models

class SessionContext(BaseModel)

attr bot: Bot = NO_DEFAULT

attr event: Event = NO_DEFAULT

attr matcher: Matcher = NO_DEFAULT

attr caller: Any = None

class SessionContextDepends(BaseModel)

attr bot: str | None = None

attr event: str | None = None

attr matcher: str | None = None

attr caller: str | None = None

文档完善中,欢迎提出建议或帮助我们完善。

- +
Skip to content

模块 nonebot_plugin_marshoai.plugin.func_call.models

class SessionContext(BaseModel)

attr bot: Bot = NO_DEFAULT

attr event: Event = NO_DEFAULT

attr matcher: Matcher = NO_DEFAULT

attr state: T_State | None = NO_DEFAULT

attr caller: Any = None

class SessionContextDepends(BaseModel)

attr bot: str | None = None

attr event: str | None = None

attr matcher: str | None = None

attr caller: str | None = None

文档完善中,欢迎提出建议或帮助我们完善。

+ \ No newline at end of file diff --git a/dev/api/plugin/func_call/params.html b/dev/api/plugin/func_call/params.html index cc7eb6f..f1b3956 100644 --- a/dev/api/plugin/func_call/params.html +++ b/dev/api/plugin/func_call/params.html @@ -23,7 +23,7 @@ return {'type': self.type_, 'description': self.description, **{k: v for k, v in self.properties.items() if v is not None}}

attr type_: str = NO_DEFAULT

attr description: str = NO_DEFAULT

attr default: Any = None

attr properties: dict[str, Any] = {}

attr required: bool = False

class String(Parameter)

attr type_: str = ParamTypes.STRING

attr properties: dict[str, Any] = Field(default_factory=dict)

attr enum: list[str] | None = None

class Integer(Parameter)

attr type_: str = ParamTypes.INTEGER

attr properties: dict[str, Any] = Field(default_factory=lambda: {'minimum': 0, 'maximum': 100})

attr minimum: int | None = None

attr maximum: int | None = None

class Array(Parameter)

attr type_: str = ParamTypes.ARRAY

attr properties: dict[str, Any] = Field(default_factory=lambda: {'items': {'type': 'string'}})

attr items: str = Field('string', description='数组元素类型')

class FunctionCall(BaseModel)


func hash self => int

源代码在GitHub上查看
python
def __hash__(self) -> int:
     return hash(self.name)

func data(self) -> dict[str, Any]

说明: 生成函数描述信息

返回: dict[str, Any]: 函数描述信息 字典

源代码在GitHub上查看
python
def data(self) -> dict[str, Any]:
     return {'type': 'function', 'function': {'name': self.name, 'description': self.description, 'parameters': {'type': 'object', 'properties': {k: v.data() for k, v in self.arguments.items()}}, 'required': [k for k, v in self.arguments.items() if v.default is None], **self.kwargs}}

attr name: str = NO_DEFAULT

attr description: str = NO_DEFAULT

attr arguments: dict[str, Parameter] = NO_DEFAULT

attr function: FUNCTION_CALL_FUNC = NO_DEFAULT

attr kwargs: dict[str, Any] = {}

- + \ No newline at end of file diff --git a/dev/api/plugin/func_call/utils.html b/dev/api/plugin/func_call/utils.html index 3905219..8eee0c7 100644 --- a/dev/api/plugin/func_call/utils.html +++ b/dev/api/plugin/func_call/utils.html @@ -39,7 +39,7 @@ return False func_ = getattr(call, '__call__', None) return inspect.iscoroutinefunction(func_) - + \ No newline at end of file diff --git a/dev/api/plugin/index.html b/dev/api/plugin/index.html index 95ce0bb..33f224b 100644 --- a/dev/api/plugin/index.html +++ b/dev/api/plugin/index.html @@ -20,7 +20,7 @@
Skip to content

模块 nonebot_plugin_marshoai.plugin

该功能目前正在开发中开发基本完成,暂时可用,受影响的文件夹 plugin, plugins

文档完善中,欢迎提出建议或帮助我们完善。

- + \ No newline at end of file diff --git a/dev/api/plugin/load.html b/dev/api/plugin/load.html index ff60119..2c4be12 100644 --- a/dev/api/plugin/load.html +++ b/dev/api/plugin/load.html @@ -69,7 +69,7 @@ logger.opt(colors=True).error(f'重新加载插件失败 "<r>{plugin.name}</r>"') traceback.print_exc() return None

var module

var module_name

var module_name

- + \ No newline at end of file diff --git a/dev/api/plugin/models.html b/dev/api/plugin/models.html index 57a2395..7fea22b 100644 --- a/dev/api/plugin/models.html +++ b/dev/api/plugin/models.html @@ -22,7 +22,7 @@
Skip to content

模块 nonebot_plugin_marshoai.plugin.models

class PluginMetadata(BaseModel)

attr name: str = NO_DEFAULT

attr description: str = ''

attr usage: str = ''

attr author: str = ''

attr homepage: str = ''

attr extra: dict[str, Any] = {}

class Plugin(BaseModel)


func hash self => int

源代码在GitHub上查看
python
def __hash__(self) -> int:
     return hash(self.name)

func self == other: Any => bool

源代码在GitHub上查看
python
def __eq__(self, other: Any) -> bool:
     return self.name == other.name

attr name: str = NO_DEFAULT

attr module: ModuleType = NO_DEFAULT

attr module_name: str = NO_DEFAULT

attr module_path: str | None = NO_DEFAULT

attr metadata: PluginMetadata | None = None

文档完善中,欢迎提出建议或帮助我们完善。

- + \ No newline at end of file diff --git a/dev/api/plugin/register.html b/dev/api/plugin/register.html index be57f43..325e9bd 100644 --- a/dev/api/plugin/register.html +++ b/dev/api/plugin/register.html @@ -29,7 +29,7 @@ name = func.__name__ description = func.__doc__ logger.info(f'注册函数: {name} {description}') - + \ No newline at end of file diff --git a/dev/api/plugin/typing.html b/dev/api/plugin/typing.html index ca765f0..037dbbf 100644 --- a/dev/api/plugin/typing.html +++ b/dev/api/plugin/typing.html @@ -20,7 +20,7 @@
Skip to content

模块 nonebot_plugin_marshoai.plugin.typing

文档完善中,欢迎提出建议或帮助我们完善。

- + \ No newline at end of file diff --git a/dev/api/plugin/utils.html b/dev/api/plugin/utils.html index 1ad6e84..cacdf6b 100644 --- a/dev/api/plugin/utils.html +++ b/dev/api/plugin/utils.html @@ -26,7 +26,7 @@ else: return '.'.join(rel_path.parts[:-1] + (rel_path.stem,))

func parse_function_docsring()

源代码在GitHub上查看
python
def parse_function_docsring():
     pass
- + \ No newline at end of file diff --git a/dev/api/plugins/builtin_tools/chat.html b/dev/api/plugins/builtin_tools/chat.html index 0ca21d7..166132d 100644 --- a/dev/api/plugins/builtin_tools/chat.html +++ b/dev/api/plugins/builtin_tools/chat.html @@ -43,7 +43,7 @@ return '发送完成' except Exception as e: return '发送失败: ' + str(e) - + \ No newline at end of file diff --git a/dev/api/plugins/builtin_tools/file_io.html b/dev/api/plugins/builtin_tools/file_io.html index 8ba8493..3d6017e 100644 --- a/dev/api/plugins/builtin_tools/file_io.html +++ b/dev/api/plugins/builtin_tools/file_io.html @@ -33,7 +33,7 @@ return '写入成功' except Exception as e: return '写入出错: ' + str(e) - + \ No newline at end of file diff --git a/dev/api/plugins/builtin_tools/index.html b/dev/api/plugins/builtin_tools/index.html index 558ffac..c1b60bc 100644 --- a/dev/api/plugins/builtin_tools/index.html +++ b/dev/api/plugins/builtin_tools/index.html @@ -20,7 +20,7 @@
Skip to content

模块 nonebot_plugin_marshoai.plugins.builtin_tools

文档完善中,欢迎提出建议或帮助我们完善。

- + \ No newline at end of file diff --git a/dev/api/plugins/builtin_tools/liteyuki.html b/dev/api/plugins/builtin_tools/liteyuki.html index 96a867b..27cb329 100644 --- a/dev/api/plugins/builtin_tools/liteyuki.html +++ b/dev/api/plugins/builtin_tools/liteyuki.html @@ -29,7 +29,7 @@ response = await client.get('https://api.liteyuki.icu/online') online = response.json().get('online') return f'注册节点数: {register}\n在线节点数: {online}' - + \ No newline at end of file diff --git a/dev/api/plugins/builtin_tools/manager.html b/dev/api/plugins/builtin_tools/manager.html index bd7c0d2..a8fe70c 100644 --- a/dev/api/plugins/builtin_tools/manager.html +++ b/dev/api/plugins/builtin_tools/manager.html @@ -28,7 +28,7 @@ else: reply += f'名称: {p.name},描述: 暂无\n' return reply - + \ No newline at end of file diff --git a/dev/api/plugins/builtin_tools/network.html b/dev/api/plugins/builtin_tools/network.html index 47c843a..c8a8447 100644 --- a/dev/api/plugins/builtin_tools/network.html +++ b/dev/api/plugins/builtin_tools/network.html @@ -40,7 +40,7 @@ logger.error(f'marsho builtin: 获取网页内容失败: {e}') return '获取网页内容失败:' + str(e) return '未能获取到有效的网页内容' - + \ No newline at end of file diff --git a/dev/api/plugins/builtin_tools/utils.html b/dev/api/plugins/builtin_tools/utils.html index 5e1adfb..7996d7b 100644 --- a/dev/api/plugins/builtin_tools/utils.html +++ b/dev/api/plugins/builtin_tools/utils.html @@ -22,7 +22,7 @@
Skip to content

模块 nonebot_plugin_marshoai.plugins.builtin_tools.utils


async func make_html_summary(html_content: str, language: str = 'english', length: int = 3) -> str

说明: 使用html内容生成摘要

参数:

  • html_content (str): html内容
  • language (str, optional): 语言. Defaults to "english".
  • length (int, optional): 摘要长度. Defaults to 3.

返回: str: 摘要

源代码在GitHub上查看
python
async def make_html_summary(html_content: str, language: str='english', length: int=3) -> str:
     loop = asyncio.get_event_loop()
     return await loop.run_in_executor(executor, _make_summary, html_content, language, length)

文档完善中,欢迎提出建议或帮助我们完善。

- + \ No newline at end of file diff --git a/dev/api/plugins/marshoai_bangumi/index.html b/dev/api/plugins/marshoai_bangumi/index.html index 5378c2b..ee5fcf7 100644 --- a/dev/api/plugins/marshoai_bangumi/index.html +++ b/dev/api/plugins/marshoai_bangumi/index.html @@ -47,7 +47,7 @@ except Exception as e: traceback.print_exc() return '' - + \ No newline at end of file diff --git a/dev/api/plugins/marshoai_basic/index.html b/dev/api/plugins/marshoai_basic/index.html index 0e8c1f4..f5b0e75 100644 --- a/dev/api/plugins/marshoai_basic/index.html +++ b/dev/api/plugins/marshoai_basic/index.html @@ -30,7 +30,7 @@ current_lunar_date = DateTime.now().to_lunar().date_hanzify()[5:] time_prompt = f'现在的时间是{current_time}{current_weekday_name},农历{current_lunar_date}。' return time_prompt - + \ No newline at end of file diff --git a/dev/api/plugins/twisuki_megakits/index.html b/dev/api/plugins/twisuki_megakits/index.html index 2b1dcba..2431b3f 100644 --- a/dev/api/plugins/twisuki_megakits/index.html +++ b/dev/api/plugins/twisuki_megakits/index.html @@ -28,7 +28,7 @@ return str(await mk_nya_code.nya_encrypt(msg))

@on_function_call(description='将猫语翻译回人类语言').params(msg=String(description='被翻译语句'))

async func nya_decrypt(msg: str) -> str

说明: 将猫语翻译回人类语言

源代码在GitHub上查看
python
@on_function_call(description='将猫语翻译回人类语言').params(msg=String(description='被翻译语句'))
 async def nya_decrypt(msg: str) -> str:
     return str(await mk_nya_code.nya_decrypt(msg))
- + \ No newline at end of file diff --git a/dev/api/plugins/twisuki_megakits/mk_morse_code.html b/dev/api/plugins/twisuki_megakits/mk_morse_code.html index 4378217..d078d16 100644 --- a/dev/api/plugins/twisuki_megakits/mk_morse_code.html +++ b/dev/api/plugins/twisuki_megakits/mk_morse_code.html @@ -38,7 +38,7 @@ else: result += '?' return result - + \ No newline at end of file diff --git a/dev/api/plugins/twisuki_megakits/mk_nya_code.html b/dev/api/plugins/twisuki_megakits/mk_nya_code.html index 737f18f..b20b3d4 100644 --- a/dev/api/plugins/twisuki_megakits/mk_nya_code.html +++ b/dev/api/plugins/twisuki_megakits/mk_nya_code.html @@ -55,7 +55,7 @@ except Exception: return '翻译失败' return result

var char

var char

var char

var char

var char

- + \ No newline at end of file diff --git a/dev/api/plugins/twisuki_petcat/index.html b/dev/api/plugins/twisuki_petcat/index.html index 9f87428..e4dc03d 100644 --- a/dev/api/plugins/twisuki_petcat/index.html +++ b/dev/api/plugins/twisuki_petcat/index.html @@ -36,7 +36,7 @@ return pc_info.print_type_list()

@on_function_call(description='可选技能').params()

async func help_cat_skill() -> str

源代码在GitHub上查看
python
@on_function_call(description='可选技能').params()
 async def help_cat_skill() -> str:
     return pc_info.print_skill_list()
- + \ No newline at end of file diff --git a/dev/api/plugins/twisuki_petcat/pc_cat.html b/dev/api/plugins/twisuki_petcat/pc_cat.html index 70f9aab..bdacf8a 100644 --- a/dev/api/plugins/twisuki_petcat/pc_cat.html +++ b/dev/api/plugins/twisuki_petcat/pc_cat.html @@ -126,7 +126,7 @@ data['energy'] = min(data['energy'] + 16, 0) token = dict_to_token(data) return f'''你抱猫休息了一阵子, 猫猫的活力值提升到了{value_output(data['energy'])}\n新token : "{token}"\n请妥善保存token, 这是猫猫的唯一标识符!''' - + \ No newline at end of file diff --git a/dev/api/plugins/twisuki_petcat/pc_info.html b/dev/api/plugins/twisuki_petcat/pc_info.html index 9f54f37..995a10e 100644 --- a/dev/api/plugins/twisuki_petcat/pc_info.html +++ b/dev/api/plugins/twisuki_petcat/pc_info.html @@ -42,7 +42,7 @@ logger.info(data['skill']) return result[:-2]

func help_cat_new() -> str

源代码在GitHub上查看
python
def help_cat_new() -> str:
     return f'新建一只猫猫, 首先选择猫猫的种类, 获取初始化token;然后用这个token, 选择名字和一个技能进行初始化;初始化结束才表示猫猫正式创建成功.\ntoken为猫的唯一标识符, 每次交互都需要传入token\n种类可选 : {print_type_list()}\n技能可选 : {print_skill_list()}'
- + \ No newline at end of file diff --git a/dev/api/plugins/twisuki_petcat/pc_shop.html b/dev/api/plugins/twisuki_petcat/pc_shop.html index 8581b2d..40b80fb 100644 --- a/dev/api/plugins/twisuki_petcat/pc_shop.html +++ b/dev/api/plugins/twisuki_petcat/pc_shop.html @@ -20,7 +20,7 @@
Skip to content

模块 nonebot_plugin_marshoai.plugins.twisuki_petcat.pc_shop

文档完善中,欢迎提出建议或帮助我们完善。

- + \ No newline at end of file diff --git a/dev/api/plugins/twisuki_petcat/pc_token.html b/dev/api/plugins/twisuki_petcat/pc_token.html index 540f509..48d8156 100644 --- a/dev/api/plugins/twisuki_petcat/pc_token.html +++ b/dev/api/plugins/twisuki_petcat/pc_token.html @@ -120,7 +120,7 @@ token = base64.b64encode(token_byte).decode() logger.success(f'编码完成, token为\n{token}') return token - + \ No newline at end of file diff --git a/dev/api/plugins_test/marshoai_basic/index.html b/dev/api/plugins_test/marshoai_basic/index.html index 9381aa0..ff3436e 100644 --- a/dev/api/plugins_test/marshoai_basic/index.html +++ b/dev/api/plugins_test/marshoai_basic/index.html @@ -24,7 +24,7 @@ current_time = DateTime.now() time_prompt = '现在的时间是 {}{}{}。'.format(current_time.strftime('%Y.%m.%d %H:%M:%S'), weekdays[current_time.weekday()], current_time.chinesize.date_hanzify('农历{干支年}{生肖}{月份}{数序日}')) return time_prompt - + \ No newline at end of file diff --git a/dev/api/plugins_test/marshoai_memory/command.html b/dev/api/plugins_test/marshoai_memory/command.html index d298444..3cb239e 100644 --- a/dev/api/plugins_test/marshoai_memory/command.html +++ b/dev/api/plugins_test/marshoai_memory/command.html @@ -38,7 +38,7 @@ json.dump(memory_data, f, ensure_ascii=False, indent=4) await matcher.finish('记忆已重置~') await matcher.finish('没有找到该用户的记忆~') - + \ No newline at end of file diff --git a/dev/api/plugins_test/marshoai_memory/config.html b/dev/api/plugins_test/marshoai_memory/config.html index 050e032..9a028db 100644 --- a/dev/api/plugins_test/marshoai_memory/config.html +++ b/dev/api/plugins_test/marshoai_memory/config.html @@ -20,7 +20,7 @@
Skip to content

模块 nonebot_plugin_marshoai.plugins_test.marshoai_memory.config

class ConfigModel(BaseModel)

attr marshoai_plugin_memory_scheduler: bool = True

文档完善中,欢迎提出建议或帮助我们完善。

- + \ No newline at end of file diff --git a/dev/api/plugins_test/marshoai_memory/index.html b/dev/api/plugins_test/marshoai_memory/index.html index 723b4e7..d78db36 100644 --- a/dev/api/plugins_test/marshoai_memory/index.html +++ b/dev/api/plugins_test/marshoai_memory/index.html @@ -49,7 +49,7 @@ logger.error(f'整理关于{i}的记忆时出错:{res}') with open(memory_path, 'w', encoding='utf-8') as f: json.dump(memory_data, f, ensure_ascii=False, indent=4)

var memory

- + \ No newline at end of file diff --git a/dev/api/plugins_test/random_number_generator.html b/dev/api/plugins_test/random_number_generator.html index 8d37cd4..f38f499 100644 --- a/dev/api/plugins_test/random_number_generator.html +++ b/dev/api/plugins_test/random_number_generator.html @@ -25,7 +25,7 @@ return f"生成的随机数为: {', '.join(map(str, random_numbers))}"

@on_function_call(description='重载测试')

func test_reload()

源代码在GitHub上查看
python
@on_function_call(description='重载测试')
 def test_reload():
     return 1
- + \ No newline at end of file diff --git a/dev/api/plugins_test/snowykami_testplugin/index.html b/dev/api/plugins_test/snowykami_testplugin/index.html index 72e472a..f949bc4 100644 --- a/dev/api/plugins_test/snowykami_testplugin/index.html +++ b/dev/api/plugins_test/snowykami_testplugin/index.html @@ -43,7 +43,7 @@ except Exception as e: return '运行出错: ' + str(e) return '运行成功: ' + str(r) - + \ No newline at end of file diff --git a/dev/api/plugins_test/weather_demo.html b/dev/api/plugins_test/weather_demo.html index 334e249..f1ec048 100644 --- a/dev/api/plugins_test/weather_demo.html +++ b/dev/api/plugins_test/weather_demo.html @@ -22,7 +22,7 @@
Skip to content

模块 nonebot_plugin_marshoai.plugins_test.weather_demo


@on_function_call(description='可以用于查询天气').params(location=String(description='地点'))

async func weather(location: str) -> str

源代码在GitHub上查看
python
@on_function_call(description='可以用于查询天气').params(location=String(description='地点'))
 async def weather(location: str) -> str:
     return f'{location}的天气是晴天, 温度是25°C'

文档完善中,欢迎提出建议或帮助我们完善。

- + \ No newline at end of file diff --git a/dev/api/tools/marshoai_bangumi/index.html b/dev/api/tools/marshoai_bangumi/index.html index b3adcf4..1715501 100644 --- a/dev/api/tools/marshoai_bangumi/index.html +++ b/dev/api/tools/marshoai_bangumi/index.html @@ -40,7 +40,7 @@ except Exception as e: traceback.print_exc() return '' - + \ No newline at end of file diff --git a/dev/api/tools/marshoai_basic/index.html b/dev/api/tools/marshoai_basic/index.html index d5174f4..a835e8f 100644 --- a/dev/api/tools/marshoai_basic/index.html +++ b/dev/api/tools/marshoai_basic/index.html @@ -25,7 +25,7 @@ return str(ver)

async func get_current_time()

源代码在GitHub上查看
python
async def get_current_time():
     current_time = DateTime.now()
     return time_prompt.format(date_time=current_time.strftime('%Y年%m月%d日 %H:%M:%S'), weekday_name=weekdays[current_time.weekday()], lunar_date=current_time.to_lunar().date_hanzify('{干支年}{生肖}{月份}{日期}日'))
- + \ No newline at end of file diff --git a/dev/api/tools/marshoai_megakits/index.html b/dev/api/tools/marshoai_megakits/index.html index 821bad7..d161339 100644 --- a/dev/api/tools/marshoai_megakits/index.html +++ b/dev/api/tools/marshoai_megakits/index.html @@ -28,7 +28,7 @@ return str(await mk_morse_code.morse_decrypt(msg))

async func nya_encode(msg: str)

源代码在GitHub上查看
python
async def nya_encode(msg: str):
     return str(await mk_nya_code.nya_encode(msg))

async func nya_decode(msg: str)

源代码在GitHub上查看
python
async def nya_decode(msg: str):
     return str(await mk_nya_code.nya_decode(msg))
- + \ No newline at end of file diff --git a/dev/api/tools/marshoai_megakits/mk_common.html b/dev/api/tools/marshoai_megakits/mk_common.html index ec2ba5e..e629b83 100644 --- a/dev/api/tools/marshoai_megakits/mk_common.html +++ b/dev/api/tools/marshoai_megakits/mk_common.html @@ -37,7 +37,7 @@ return str(a % b) case _: return '未知运算符' - + \ No newline at end of file diff --git a/dev/api/tools/marshoai_megakits/mk_info.html b/dev/api/tools/marshoai_megakits/mk_info.html index eea77db..9f28d4d 100644 --- a/dev/api/tools/marshoai_megakits/mk_info.html +++ b/dev/api/tools/marshoai_megakits/mk_info.html @@ -22,7 +22,7 @@
Skip to content

模块 nonebot_plugin_marshoai.tools.marshoai_megakits.mk_info


async func twisuki()

源代码在GitHub上查看
python
async def twisuki():
     return 'Twiuski(苏阳)是megakits插件作者, Github : "https://github.com/Twisuki"'

async func megakits()

源代码在GitHub上查看
python
async def megakits():
     return 'MegaKits插件是一个功能混杂的MarshoAI插件, 由Twisuki(Github : "https://github.com/Twisuki")开发, 插件仓库 : "https://github.com/LiteyukiStudio/marsho-toolsets/tree/main/Twisuki/marshoai-megakits"'

文档完善中,欢迎提出建议或帮助我们完善。

- + \ No newline at end of file diff --git a/dev/api/tools/marshoai_megakits/mk_morse_code.html b/dev/api/tools/marshoai_megakits/mk_morse_code.html index c7f8b29..85357fc 100644 --- a/dev/api/tools/marshoai_megakits/mk_morse_code.html +++ b/dev/api/tools/marshoai_megakits/mk_morse_code.html @@ -37,7 +37,7 @@ else: result += '?' return result - + \ No newline at end of file diff --git a/dev/api/tools/marshoai_megakits/mk_nya_code.html b/dev/api/tools/marshoai_megakits/mk_nya_code.html index fc132b9..408e0f0 100644 --- a/dev/api/tools/marshoai_megakits/mk_nya_code.html +++ b/dev/api/tools/marshoai_megakits/mk_nya_code.html @@ -51,7 +51,7 @@ except Exception: return '翻译失败' return result - + \ No newline at end of file diff --git a/dev/api/tools/marshoai_memory/index.html b/dev/api/tools/marshoai_memory/index.html index d3fae11..91f1eee 100644 --- a/dev/api/tools/marshoai_memory/index.html +++ b/dev/api/tools/marshoai_memory/index.html @@ -38,7 +38,7 @@ memory_data = json.load(f) for i in memory_data: ... - + \ No newline at end of file diff --git a/dev/api/tools/marshoai_meogirl/index.html b/dev/api/tools/marshoai_meogirl/index.html index 44e466d..99826f8 100644 --- a/dev/api/tools/marshoai_meogirl/index.html +++ b/dev/api/tools/marshoai_meogirl/index.html @@ -23,7 +23,7 @@ return mg_info.meogirl()

async func search(msg: str, num: int = 3)

源代码在GitHub上查看
python
async def search(msg: str, num: int=3):
     return str(await mg_search.search(msg, num))

async func introduce(msg: str)

源代码在GitHub上查看
python
async def introduce(msg: str):
     return str(await mg_introduce.introduce(msg))
- + \ No newline at end of file diff --git a/dev/api/tools/marshoai_meogirl/mg_info.html b/dev/api/tools/marshoai_meogirl/mg_info.html index 32755fc..1403560 100644 --- a/dev/api/tools/marshoai_meogirl/mg_info.html +++ b/dev/api/tools/marshoai_meogirl/mg_info.html @@ -21,7 +21,7 @@
Skip to content

模块 nonebot_plugin_marshoai.tools.marshoai_meogirl.mg_info


func meogirl()

源代码在GitHub上查看
python
def meogirl():
     return 'Meogirl指的是"萌娘百科"(https://zh.moegirl.org.cn/ , 简称"萌百"), 是一个"万物皆可萌的百科全书!"; 同时, MarshoTools也配有"Meogirl"插件, 可调用萌百的api'

文档完善中,欢迎提出建议或帮助我们完善。

- + \ No newline at end of file diff --git a/dev/api/tools/marshoai_meogirl/mg_introduce.html b/dev/api/tools/marshoai_meogirl/mg_introduce.html index 28434c7..de024a2 100644 --- a/dev/api/tools/marshoai_meogirl/mg_introduce.html +++ b/dev/api/tools/marshoai_meogirl/mg_introduce.html @@ -61,7 +61,7 @@ else: logger.error(f'网络错误, 状态码 : {response.status_code}') return f'网络错误, 状态码 : {response.status_code}'

var keyword

- + \ No newline at end of file diff --git a/dev/api/tools/marshoai_meogirl/mg_search.html b/dev/api/tools/marshoai_meogirl/mg_search.html index d594238..5a6391c 100644 --- a/dev/api/tools/marshoai_meogirl/mg_search.html +++ b/dev/api/tools/marshoai_meogirl/mg_search.html @@ -58,7 +58,7 @@ else: logger.error(f'网络错误, 状态码 : {response.status_code}') return f'网络错误, 状态码 : {response.status_code}'

var soup

- + \ No newline at end of file diff --git a/dev/api/tools_wip/marshoai_memory/index.html b/dev/api/tools_wip/marshoai_memory/index.html index 0f80330..b0c08c1 100644 --- a/dev/api/tools_wip/marshoai_memory/index.html +++ b/dev/api/tools_wip/marshoai_memory/index.html @@ -21,7 +21,7 @@
Skip to content

模块 nonebot_plugin_marshoai.tools_wip.marshoai_memory


async func write_memory(memory: str)

源代码在GitHub上查看
python
async def write_memory(memory: str):
     return ''

文档完善中,欢迎提出建议或帮助我们完善。

- + \ No newline at end of file diff --git a/dev/api/util.html b/dev/api/util.html index 450d04c..03cac09 100644 --- a/dev/api/util.html +++ b/dev/api/util.html @@ -181,7 +181,7 @@ result_msg.append(TextMsg(tag_found + '(未知内容解析失败)')) result_msg.append(TextMsg(await get_uuid_back2codeblock(msg[last_tag_index:], code_blank_uuid_map))) return result_msg

var thinking

- + \ No newline at end of file diff --git a/dev/api/util_hunyuan.html b/dev/api/util_hunyuan.html index 53fc14e..e6b8efa 100644 --- a/dev/api/util_hunyuan.html +++ b/dev/api/util_hunyuan.html @@ -31,7 +31,7 @@ req.from_json_string(json.dumps(params)) resp = client.TextToImageLite(req) return resp.to_json_string() - + \ No newline at end of file diff --git a/dev/extension.html b/dev/extension.html index feddeb8..a66fff3 100644 --- a/dev/extension.html +++ b/dev/extension.html @@ -48,7 +48,7 @@ @on_function_call(description="获取机器人信息") async def get_bot_info(b: Bot) -> str: return f"机器人ID: {b.self_id}"

兼容性

插件可以编写NoneBot或者轻雪插件的内容,可作为NoneBot插件或者轻雪插件单独发布

不过,所编写功能仅会在对应的实例上加载对应的功能,如果通过marshoai加载混合插件,那么插件中NoneBot的功能将会依附于marshoai插件, 若通过NoneBot加载包含marshoai功能的NoneBot插件,那么marshoai功能将会依附于NoneBot插件。

我们建议:若插件中包含了NoneBot功能,仍然使用marshoai进行加载,这样更符合逻辑。若你想发布为NoneBot插件,请注意require("nonebot_plugin_marshoai"),这是老生常谈了。

TIP

本质上都是动态导入和注册声明加载,运行时把这些东西塞到一起

插件热重载

插件热重载是一个实验性功能,可以在不重启机器人的情况下更新插件

WARNING

框架无法完全消除之前插件带来的副作用,当开发测试中效果不符合预期时请重启机器人实例

为了更好地让热重载功能正常工作,尽可能使用函数式的编程风格,以减少副作用的影响

MARSHOAI_DEVMODE环境变量设置为true,然后在配置的插件目录MARSHOAI_PLUGIN_DIRS下开发插件,当插件发生变化时,机器人会自动变动的插件。

AIGC 自举

WARNING

该功能为实验性功能,请注意甄别AI的行为,不要让AI执行危险的操作。

function call为AI赋能,实现了文件io操作,AI可以调用function call来读取文档然后给自己编写代码,实现自举。

其他

- + \ No newline at end of file diff --git a/dev/index.html b/dev/index.html index 075d68d..f9e32ac 100644 --- a/dev/index.html +++ b/dev/index.html @@ -20,7 +20,7 @@
Skip to content

文档完善中,欢迎提出建议或帮助我们完善。

- + \ No newline at end of file diff --git a/dev/project.html b/dev/project.html index f6a5a3c..29800e6 100644 --- a/dev/project.html +++ b/dev/project.html @@ -25,7 +25,7 @@ pip install pdm # 安装依赖管理 pdm install # 安装依赖 pre-commit install # 安装 pre-commit 钩子

代码规范

主仓库需要遵循以下代码规范

可以在编辑器中安装相应的插件进行辅助

其他

感谢以下的贡献者们:

Contributors
- + \ No newline at end of file diff --git a/en/dev/api/_types.html b/en/dev/api/_types.html index cb199d6..6a42337 100644 --- a/en/dev/api/_types.html +++ b/en/dev/api/_types.html @@ -24,7 +24,7 @@ ...

@overload

func __init__(self, mapping: Mapping[str, Any])

Description: :param mapping: raw JSON to initialize the model. :type mapping: Mapping[str, Any]

Source code or View on GitHub
python
@overload
 def __init__(self, mapping: Mapping[str, Any]):

func __init__(self, *args: Any, **kwargs: Any) -> None

Source code or View on GitHub
python
def __init__(self, *args: Any, **kwargs: Any) -> None:
     super().__init__(*args, role='developer', **kwargs)

attr role: Literal['developer'] = rest_discriminator(name='role')

attr content: Optional[str] = rest_field()

- + \ No newline at end of file diff --git a/en/dev/api/azure.html b/en/dev/api/azure.html index 2a31839..10a1506 100644 --- a/en/dev/api/azure.html +++ b/en/dev/api/azure.html @@ -180,7 +180,7 @@ await UniMessage(str(e) + suggest_solution(str(e))).send() traceback.print_exc() return

var text

- + \ No newline at end of file diff --git a/en/dev/api/azure_onebot.html b/en/dev/api/azure_onebot.html index 143ad88..d200675 100644 --- a/en/dev/api/azure_onebot.html +++ b/en/dev/api/azure_onebot.html @@ -20,7 +20,7 @@
Skip to content

Module nonebot_plugin_marshoai.azure_onebot

The document is being improved. Suggestions are welcome.

- + \ No newline at end of file diff --git a/en/dev/api/cache/decos.html b/en/dev/api/cache/decos.html index f539828..6795b0e 100644 --- a/en/dev/api/cache/decos.html +++ b/en/dev/api/cache/decos.html @@ -42,7 +42,7 @@ return result return wrapper return decorator - + \ No newline at end of file diff --git a/en/dev/api/config.html b/en/dev/api/config.html index c1da064..14e8dfe 100644 --- a/en/dev/api/config.html +++ b/en/dev/api/config.html @@ -41,7 +41,7 @@ logger.info(f'新增配置项: {key} = {value}') existing_cfg[key] = value return existing_cfg - + \ No newline at end of file diff --git a/en/dev/api/constants.html b/en/dev/api/constants.html index 7b33075..dfb1f65 100644 --- a/en/dev/api/constants.html +++ b/en/dev/api/constants.html @@ -20,7 +20,7 @@
Skip to content

Module nonebot_plugin_marshoai.constants

The document is being improved. Suggestions are welcome.

- + \ No newline at end of file diff --git a/en/dev/api/deal_latex.html b/en/dev/api/deal_latex.html index df266e2..ab633e3 100644 --- a/en/dev/api/deal_latex.html +++ b/en/dev/api/deal_latex.html @@ -114,7 +114,7 @@ results = await asyncio.gather(*(channel_test_wrapper(channel) for channel in channel_list)) best_channel = min(results, key=lambda x: x[0])[1] return best_channel()

attr channel: ConvertChannel = NO_DEFAULT

- + \ No newline at end of file diff --git a/en/dev/api/dev.html b/en/dev/api/dev.html index 99eb5d0..27fdb3e 100644 --- a/en/dev/api/dev.html +++ b/en/dev/api/dev.html @@ -64,7 +64,7 @@ else: logger.debug('未找到变动插件') return

var dir_list

- + \ No newline at end of file diff --git a/en/dev/api/handler.html b/en/dev/api/handler.html index fab91d6..526f8ff 100644 --- a/en/dev/api/handler.html +++ b/en/dev/api/handler.html @@ -13,7 +13,7 @@ - + @@ -65,12 +65,12 @@ await UniMessage(f"调用函数 {tool_call.function.name.replace('-', '.')}\n参数:" + '\n'.join([f'{k}={v}' for k, v in function_args.items()])).send() if (caller := get_function_calls().get(tool_call.function.name)): logger.debug(f'调用插件函数 {caller.full_name}') - func_return = await caller.with_ctx(SessionContext(bot=self.bot, event=self.event, matcher=self.matcher)).call(**function_args) + func_return = await caller.with_ctx(SessionContext(bot=self.bot, event=self.event, matcher=self.matcher, state=None)).call(**function_args) else: logger.error(f"未找到函数 {tool_call.function.name.replace('-', '.')}") func_return = f"未找到函数 {tool_call.function.name.replace('-', '.')}" tool_msg.append(ToolMessage(tool_call_id=tool_call.id, content=func_return).as_dict()) - return await self.handle_common_chat(user_message=user_message, model_name=model_name, tools_list=tools_list, tool_message=tool_msg)

async func handle_common_chat(self, user_message: Union[str, list], model_name: str, tools_list: list, stream: bool = False, tool_message: Optional[list] = None) -> Union[Tuple[UserMessage, ChatCompletionMessage], None]

Description: 处理一般聊天

Source code or View on GitHub
python
async def handle_common_chat(self, user_message: Union[str, list], model_name: str, tools_list: list, stream: bool=False, tool_message: Optional[list]=None) -> Union[Tuple[UserMessage, ChatCompletionMessage], None]:
+    return await self.handle_common_chat(user_message=user_message, model_name=model_name, tools_list=tools_list, tool_message=tool_msg)

async func handle_common_chat(self, user_message: Union[str, list], model_name: str, tools_list: list, stream: bool = False, tool_message: Optional[list] = None) -> Optional[Tuple[UserMessage, ChatCompletionMessage]]

Description: 处理一般聊天

Source code or View on GitHub
python
async def handle_common_chat(self, user_message: Union[str, list], model_name: str, tools_list: list, stream: bool=False, tool_message: Optional[list]=None) -> Optional[Tuple[UserMessage, ChatCompletionMessage]]:
     global target_list
     if stream:
         raise NotImplementedError
@@ -98,7 +98,7 @@
     else:
         await UniMessage(f'意外的完成原因:{choice.finish_reason}').send()
         return None
- + \ No newline at end of file diff --git a/en/dev/api/hooks.html b/en/dev/api/hooks.html index e9f3ee0..24dae97 100644 --- a/en/dev/api/hooks.html +++ b/en/dev/api/hooks.html @@ -30,7 +30,7 @@ target_uid = 'group_' + target_id await save_context_to_json(f'back_up_context_{target_uid}', contexts_data, 'contexts/backup') logger.info(f'已保存会话 {target_id} 的上下文备份,将在下次对话时恢复~')

var marshoai_plugin_dirs

- + \ No newline at end of file diff --git a/en/dev/api/hunyuan.html b/en/dev/api/hunyuan.html index 2bcbc74..af2c90c 100644 --- a/en/dev/api/hunyuan.html +++ b/en/dev/api/hunyuan.html @@ -29,7 +29,7 @@ await UniMessage.image(url=url).send() except Exception as e: traceback.print_exc() - + \ No newline at end of file diff --git a/en/dev/api/index.html b/en/dev/api/index.html index e9edc7c..f463fae 100644 --- a/en/dev/api/index.html +++ b/en/dev/api/index.html @@ -20,7 +20,7 @@
Skip to content

Module nonebot_plugin_marshoai

MIT License

Copyright (c) 2025 Asankilp & LiteyukiStudio

Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions:

The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.

THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.

The document is being improved. Suggestions are welcome.

- + \ No newline at end of file diff --git a/en/dev/api/instances.html b/en/dev/api/instances.html index f49e45a..b122340 100644 --- a/en/dev/api/instances.html +++ b/en/dev/api/instances.html @@ -20,7 +20,7 @@
Skip to content

Module nonebot_plugin_marshoai.instances

var target_list

  • Description: 记录需保存历史上下文的列表

  • Type: list[list]

  • Default: []

The document is being improved. Suggestions are welcome.

- + \ No newline at end of file diff --git a/en/dev/api/marsho.html b/en/dev/api/marsho.html index 7121cac..108545f 100644 --- a/en/dev/api/marsho.html +++ b/en/dev/api/marsho.html @@ -13,7 +13,7 @@ - + @@ -113,7 +113,7 @@ context.append(context_user.as_dict(), target.id, target.private) context.append(context_assistant.to_dict(), target.id, target.private) else: - await UniMessage('没有回答').send() + return except Exception as e: await UniMessage(str(e) + suggest_solution(str(e))).send() traceback.print_exc() @@ -132,7 +132,7 @@ await UniMessage(str(e) + suggest_solution(str(e))).send() traceback.print_exc() return

var text

- + \ No newline at end of file diff --git a/en/dev/api/marsho_onebot.html b/en/dev/api/marsho_onebot.html index 4689244..c7b7568 100644 --- a/en/dev/api/marsho_onebot.html +++ b/en/dev/api/marsho_onebot.html @@ -20,7 +20,7 @@
Skip to content

Module nonebot_plugin_marshoai.marsho_onebot

The document is being improved. Suggestions are welcome.

- + \ No newline at end of file diff --git a/en/dev/api/metadata.html b/en/dev/api/metadata.html index 2fd9c76..9d35e23 100644 --- a/en/dev/api/metadata.html +++ b/en/dev/api/metadata.html @@ -20,7 +20,7 @@
Skip to content

The document is being improved. Suggestions are welcome.

- + \ No newline at end of file diff --git a/en/dev/api/models.html b/en/dev/api/models.html index cec525c..cf49b66 100644 --- a/en/dev/api/models.html +++ b/en/dev/api/models.html @@ -72,7 +72,7 @@ if not self.tools_list or not config.marshoai_enable_tools: return None return self.tools_list - + \ No newline at end of file diff --git a/en/dev/api/observer.html b/en/dev/api/observer.html index 82a4f3b..52f253a 100644 --- a/en/dev/api/observer.html +++ b/en/dev/api/observer.html @@ -55,7 +55,7 @@ observer.schedule(code_modified_handler, directory, recursive=recursive) return func return decorator - + \ No newline at end of file diff --git a/en/dev/api/plugin/func_call/caller.html b/en/dev/api/plugin/func_call/caller.html index 35e976e..a010cf9 100644 --- a/en/dev/api/plugin/func_call/caller.html +++ b/en/dev/api/plugin/func_call/caller.html @@ -13,7 +13,7 @@ - + @@ -53,23 +53,20 @@ return (False, 'Context is None') if self._permission and (not await self._permission(self.ctx.bot, self.ctx.event)): return (False, '告诉用户 Permission Denied 权限不足') - if self._rule and (not await self._rule(self.ctx.bot, self.ctx.event)): + if self._rule and (not await self._rule(self.ctx.bot, self.ctx.event, self.ctx.state)): return (False, '告诉用户 Rule Denied 规则不匹配') - return (True, '')

func rule(self, rule: Rule) -> Caller

Source code or View on GitHub
python
def rule(self, rule: Rule) -> 'Caller':
+    return (True, '')

func rule(self, rule: Rule) -> Caller

Source code or View on GitHub
python
def rule(self, rule: Rule) -> 'Caller':
     self._rule = self._rule and rule
-    return self

func name(self, name: str) -> Caller

Description: 设置函数名称

Arguments:

Return: Caller: Caller对象

Source code or View on GitHub
python
def name(self, name: str) -> 'Caller':
+    return self

func name(self, name: str) -> Caller

Description: 设置函数名称

Arguments:

Return: Caller: Caller对象

Source code or View on GitHub
python
def name(self, name: str) -> 'Caller':
     self._name = name
-    return self

func description(self, description: str) -> Caller

Source code or View on GitHub
python
def description(self, description: str) -> 'Caller':
+    return self

func description(self, description: str) -> Caller

Source code or View on GitHub
python
def description(self, description: str) -> 'Caller':
     self._description = description
-    return self

func self () func: F => F

Description: 装饰函数,注册为一个可被AI调用的function call函数

Arguments:

Return: F: 函数对象

Source code or View on GitHub
python
def __call__(self, func: F) -> F:
+    return self

func self () func: F => F

Description: 装饰函数,注册为一个可被AI调用的function call函数

Arguments:

Return: F: 函数对象

Source code or View on GitHub
python
def __call__(self, func: F) -> F:
     global _caller_data
     if not self._name:
         self._name = func.__name__
     sig = inspect.signature(func)
     for name, param in sig.parameters.items():
-        if param.annotation == T_State:
-            self.di.state = name
-            continue
         if issubclass(param.annotation, Event) or isinstance(param.annotation, Event):
             self.di.event = name
         if issubclass(param.annotation, Caller) or isinstance(param.annotation, Caller):
@@ -92,18 +89,18 @@
     self.module_name = module_name
     _caller_data[self.aifc_name] = self
     logger.opt(colors=True).debug(f'<y>加载函数 {self.full_name}: {self._description}</y>')
-    return func

func data(self) -> dict[str, Any]

Return: dict[str, Any]: 函数的json数据

Source code or View on GitHub
python
def data(self) -> dict[str, Any]:
+    return func

func data(self) -> dict[str, Any]

Return: dict[str, Any]: 函数的json数据

Source code or View on GitHub
python
def data(self) -> dict[str, Any]:
     properties = {key: value.data() for key, value in self._parameters.items()}
     if not properties:
         properties['placeholder'] = {'type': 'string', 'description': '占位符,用于显示在对话框中'}
-    return {'type': self._func_type, 'function': {'name': self.aifc_name, 'description': self._description, 'parameters': {'type': 'object', 'properties': properties}, 'required': [key for key, value in self._parameters.items() if value.default is None]}}

func set_ctx(self, ctx: SessionContext) -> None

Description: 设置依赖注入上下文

Arguments:

Source code or View on GitHub
python
def set_ctx(self, ctx: SessionContext) -> None:
+    return {'type': self._func_type, 'function': {'name': self.aifc_name, 'description': self._description, 'parameters': {'type': 'object', 'properties': properties}, 'required': [key for key, value in self._parameters.items() if value.default is None]}}

func set_ctx(self, ctx: SessionContext) -> None

Description: 设置依赖注入上下文

Arguments:

Source code or View on GitHub
python
def set_ctx(self, ctx: SessionContext) -> None:
     ctx.caller = self
     self.ctx = ctx
     for type_name, arg_name in self.di.model_dump().items():
         if arg_name:
-            self.default[arg_name] = ctx.__getattribute__(type_name)

func with_ctx(self, ctx: SessionContext) -> Caller

Description: 设置依赖注入上下文

Arguments:

Return: Caller: Caller对象

Source code or View on GitHub
python
def with_ctx(self, ctx: SessionContext) -> 'Caller':
+            self.default[arg_name] = ctx.__getattribute__(type_name)

func with_ctx(self, ctx: SessionContext) -> Caller

Description: 设置依赖注入上下文

Arguments:

Return: Caller: Caller对象

Source code or View on GitHub
python
def with_ctx(self, ctx: SessionContext) -> 'Caller':
     self.set_ctx(ctx)
-    return self

async func call(self, *args: Any, **kwargs: Any) -> Any

Description: 调用函数

Return: Any: 函数返回值

Source code or View on GitHub
python
async def call(self, *args: Any, **kwargs: Any) -> Any:
+    return self

async func call(self, *args: Any, **kwargs: Any) -> Any

Description: 调用函数

Return: Any: 函数返回值

Source code or View on GitHub
python
async def call(self, *args: Any, **kwargs: Any) -> Any:
     y, r = await self.pre_check()
     if not y:
         logger.debug(f'Function {self._name} pre_check failed: {r}')
@@ -113,21 +110,21 @@
     for name, value in self.default.items():
         if name not in kwargs:
             kwargs[name] = value
-    return await self.func(*args, **kwargs)

@property

func short_name(self) -> str

Description: 函数本名

Source code or View on GitHub
python
@property
+    return await self.func(*args, **kwargs)

@property

func short_name(self) -> str

Description: 函数本名

Source code or View on GitHub
python
@property
 def short_name(self) -> str:
-    return self._name.split('.')[-1]

@property

func aifc_name(self) -> str

Description: AI调用名,没有点

Source code or View on GitHub
python
@property
+    return self._name.split('.')[-1]

@property

func aifc_name(self) -> str

Description: AI调用名,没有点

Source code or View on GitHub
python
@property
 def aifc_name(self) -> str:
     if self.no_module_name:
         return self._name
-    return self.full_name.replace('.', '-')

@property

func full_name(self) -> str

Description: 完整名

Source code or View on GitHub
python
@property
+    return self.full_name.replace('.', '-')

@property

func full_name(self) -> str

Description: 完整名

Source code or View on GitHub
python
@property
 def full_name(self) -> str:
-    return self.module_name + '.' + self._name

@property

func short_info(self) -> str

Source code or View on GitHub
python
@property
+    return self.module_name + '.' + self._name

@property

func short_info(self) -> str

Source code or View on GitHub
python
@property
 def short_info(self) -> str:
-    return f'{self.full_name}({self._description})'

func on_function_call(name: str = '', description: str | None = None, func_type: str = 'function', no_module_name: bool = False) -> Caller

Arguments:

Return: Caller: Caller对象

Source code or View on GitHub
python
def on_function_call(name: str='', description: str | None=None, func_type: str='function', no_module_name: bool=False) -> Caller:
+    return f'{self.full_name}({self._description})'

func on_function_call(name: str = '', description: str | None = None, func_type: str = 'function', no_module_name: bool = False) -> Caller

Arguments:

Return: Caller: Caller对象

Source code or View on GitHub
python
def on_function_call(name: str='', description: str | None=None, func_type: str='function', no_module_name: bool=False) -> Caller:
     caller = Caller(name=name, description=description, func_type=func_type, no_module_name=no_module_name)
-    return caller

func get_function_calls() -> dict[str, Caller]

Description: 获取所有已注册的function call函数

Return: dict[str, Caller]: 所有已注册的function call函数

Source code or View on GitHub
python
def get_function_calls() -> dict[str, Caller]:
+    return caller

func get_function_calls() -> dict[str, Caller]

Description: 获取所有已注册的function call函数

Return: dict[str, Caller]: 所有已注册的function call函数

Source code or View on GitHub
python
def get_function_calls() -> dict[str, Caller]:
     return _caller_data
- + \ No newline at end of file diff --git a/en/dev/api/plugin/func_call/index.html b/en/dev/api/plugin/func_call/index.html index d113417..1d6d188 100644 --- a/en/dev/api/plugin/func_call/index.html +++ b/en/dev/api/plugin/func_call/index.html @@ -20,7 +20,7 @@
Skip to content

Module nonebot_plugin_marshoai.plugin.func_call

The document is being improved. Suggestions are welcome.

- + \ No newline at end of file diff --git a/en/dev/api/plugin/func_call/models.html b/en/dev/api/plugin/func_call/models.html index 5586497..14cd260 100644 --- a/en/dev/api/plugin/func_call/models.html +++ b/en/dev/api/plugin/func_call/models.html @@ -13,14 +13,14 @@ - + -
Skip to content

Module nonebot_plugin_marshoai.plugin.func_call.models

class SessionContext(BaseModel)

attr bot: Bot = NO_DEFAULT

attr event: Event = NO_DEFAULT

attr matcher: Matcher = NO_DEFAULT

attr caller: Any = None

class SessionContextDepends(BaseModel)

attr bot: str | None = None

attr event: str | None = None

attr matcher: str | None = None

attr caller: str | None = None

The document is being improved. Suggestions are welcome.

- +
Skip to content

Module nonebot_plugin_marshoai.plugin.func_call.models

class SessionContext(BaseModel)

attr bot: Bot = NO_DEFAULT

attr event: Event = NO_DEFAULT

attr matcher: Matcher = NO_DEFAULT

attr state: T_State | None = NO_DEFAULT

attr caller: Any = None

class SessionContextDepends(BaseModel)

attr bot: str | None = None

attr event: str | None = None

attr matcher: str | None = None

attr caller: str | None = None

The document is being improved. Suggestions are welcome.

+ \ No newline at end of file diff --git a/en/dev/api/plugin/func_call/params.html b/en/dev/api/plugin/func_call/params.html index 3fd4f0d..f1bbb0b 100644 --- a/en/dev/api/plugin/func_call/params.html +++ b/en/dev/api/plugin/func_call/params.html @@ -23,7 +23,7 @@ return {'type': self.type_, 'description': self.description, **{k: v for k, v in self.properties.items() if v is not None}}

attr type_: str = NO_DEFAULT

attr description: str = NO_DEFAULT

attr default: Any = None

attr properties: dict[str, Any] = {}

attr required: bool = False

class String(Parameter)

attr type_: str = ParamTypes.STRING

attr properties: dict[str, Any] = Field(default_factory=dict)

attr enum: list[str] | None = None

class Integer(Parameter)

attr type_: str = ParamTypes.INTEGER

attr properties: dict[str, Any] = Field(default_factory=lambda: {'minimum': 0, 'maximum': 100})

attr minimum: int | None = None

attr maximum: int | None = None

class Array(Parameter)

attr type_: str = ParamTypes.ARRAY

attr properties: dict[str, Any] = Field(default_factory=lambda: {'items': {'type': 'string'}})

attr items: str = Field('string', description='数组元素类型')

class FunctionCall(BaseModel)


func hash self => int

Source code or View on GitHub
python
def __hash__(self) -> int:
     return hash(self.name)

func data(self) -> dict[str, Any]

Description: 生成函数描述信息

Return: dict[str, Any]: 函数描述信息 字典

Source code or View on GitHub
python
def data(self) -> dict[str, Any]:
     return {'type': 'function', 'function': {'name': self.name, 'description': self.description, 'parameters': {'type': 'object', 'properties': {k: v.data() for k, v in self.arguments.items()}}, 'required': [k for k, v in self.arguments.items() if v.default is None], **self.kwargs}}

attr name: str = NO_DEFAULT

attr description: str = NO_DEFAULT

attr arguments: dict[str, Parameter] = NO_DEFAULT

attr function: FUNCTION_CALL_FUNC = NO_DEFAULT

attr kwargs: dict[str, Any] = {}

- + \ No newline at end of file diff --git a/en/dev/api/plugin/func_call/utils.html b/en/dev/api/plugin/func_call/utils.html index 0155a0b..871292b 100644 --- a/en/dev/api/plugin/func_call/utils.html +++ b/en/dev/api/plugin/func_call/utils.html @@ -39,7 +39,7 @@ return False func_ = getattr(call, '__call__', None) return inspect.iscoroutinefunction(func_) - + \ No newline at end of file diff --git a/en/dev/api/plugin/index.html b/en/dev/api/plugin/index.html index 70d08dd..1543cc3 100644 --- a/en/dev/api/plugin/index.html +++ b/en/dev/api/plugin/index.html @@ -20,7 +20,7 @@
Skip to content

Module nonebot_plugin_marshoai.plugin

该功能目前正在开发中开发基本完成,暂时可用,受影响的文件夹 plugin, plugins

The document is being improved. Suggestions are welcome.

- + \ No newline at end of file diff --git a/en/dev/api/plugin/load.html b/en/dev/api/plugin/load.html index 8c9bec5..18d4f35 100644 --- a/en/dev/api/plugin/load.html +++ b/en/dev/api/plugin/load.html @@ -69,7 +69,7 @@ logger.opt(colors=True).error(f'重新加载插件失败 "<r>{plugin.name}</r>"') traceback.print_exc() return None

var module

var module_name

var module_name

- + \ No newline at end of file diff --git a/en/dev/api/plugin/models.html b/en/dev/api/plugin/models.html index 85a9229..82a98d1 100644 --- a/en/dev/api/plugin/models.html +++ b/en/dev/api/plugin/models.html @@ -22,7 +22,7 @@
Skip to content

Module nonebot_plugin_marshoai.plugin.models

class PluginMetadata(BaseModel)

attr name: str = NO_DEFAULT

attr description: str = ''

attr usage: str = ''

attr author: str = ''

attr homepage: str = ''

attr extra: dict[str, Any] = {}

class Plugin(BaseModel)


func hash self => int

Source code or View on GitHub
python
def __hash__(self) -> int:
     return hash(self.name)

func self == other: Any => bool

Source code or View on GitHub
python
def __eq__(self, other: Any) -> bool:
     return self.name == other.name

attr name: str = NO_DEFAULT

attr module: ModuleType = NO_DEFAULT

attr module_name: str = NO_DEFAULT

attr module_path: str | None = NO_DEFAULT

attr metadata: PluginMetadata | None = None

The document is being improved. Suggestions are welcome.

- + \ No newline at end of file diff --git a/en/dev/api/plugin/register.html b/en/dev/api/plugin/register.html index d8c7c96..58a61f7 100644 --- a/en/dev/api/plugin/register.html +++ b/en/dev/api/plugin/register.html @@ -29,7 +29,7 @@ name = func.__name__ description = func.__doc__ logger.info(f'注册函数: {name} {description}') - + \ No newline at end of file diff --git a/en/dev/api/plugin/typing.html b/en/dev/api/plugin/typing.html index 55c22d0..955ddf8 100644 --- a/en/dev/api/plugin/typing.html +++ b/en/dev/api/plugin/typing.html @@ -20,7 +20,7 @@
Skip to content

Module nonebot_plugin_marshoai.plugin.typing

The document is being improved. Suggestions are welcome.

- + \ No newline at end of file diff --git a/en/dev/api/plugin/utils.html b/en/dev/api/plugin/utils.html index d3b7226..ae808e9 100644 --- a/en/dev/api/plugin/utils.html +++ b/en/dev/api/plugin/utils.html @@ -26,7 +26,7 @@ else: return '.'.join(rel_path.parts[:-1] + (rel_path.stem,))

func parse_function_docsring()

Source code or View on GitHub
python
def parse_function_docsring():
     pass
- + \ No newline at end of file diff --git a/en/dev/api/plugins/builtin_tools/chat.html b/en/dev/api/plugins/builtin_tools/chat.html index f08ac72..ae9a947 100644 --- a/en/dev/api/plugins/builtin_tools/chat.html +++ b/en/dev/api/plugins/builtin_tools/chat.html @@ -43,7 +43,7 @@ return '发送完成' except Exception as e: return '发送失败: ' + str(e) - + \ No newline at end of file diff --git a/en/dev/api/plugins/builtin_tools/file_io.html b/en/dev/api/plugins/builtin_tools/file_io.html index 971a3e9..0190ac3 100644 --- a/en/dev/api/plugins/builtin_tools/file_io.html +++ b/en/dev/api/plugins/builtin_tools/file_io.html @@ -33,7 +33,7 @@ return '写入成功' except Exception as e: return '写入出错: ' + str(e) - + \ No newline at end of file diff --git a/en/dev/api/plugins/builtin_tools/index.html b/en/dev/api/plugins/builtin_tools/index.html index 606cecb..50af953 100644 --- a/en/dev/api/plugins/builtin_tools/index.html +++ b/en/dev/api/plugins/builtin_tools/index.html @@ -20,7 +20,7 @@
Skip to content

Module nonebot_plugin_marshoai.plugins.builtin_tools

The document is being improved. Suggestions are welcome.

- + \ No newline at end of file diff --git a/en/dev/api/plugins/builtin_tools/liteyuki.html b/en/dev/api/plugins/builtin_tools/liteyuki.html index e1803b7..e360180 100644 --- a/en/dev/api/plugins/builtin_tools/liteyuki.html +++ b/en/dev/api/plugins/builtin_tools/liteyuki.html @@ -29,7 +29,7 @@ response = await client.get('https://api.liteyuki.icu/online') online = response.json().get('online') return f'注册节点数: {register}\n在线节点数: {online}' - + \ No newline at end of file diff --git a/en/dev/api/plugins/builtin_tools/manager.html b/en/dev/api/plugins/builtin_tools/manager.html index 35359d3..b6136c6 100644 --- a/en/dev/api/plugins/builtin_tools/manager.html +++ b/en/dev/api/plugins/builtin_tools/manager.html @@ -28,7 +28,7 @@ else: reply += f'名称: {p.name},描述: 暂无\n' return reply - + \ No newline at end of file diff --git a/en/dev/api/plugins/builtin_tools/network.html b/en/dev/api/plugins/builtin_tools/network.html index cab2e8d..35e2be3 100644 --- a/en/dev/api/plugins/builtin_tools/network.html +++ b/en/dev/api/plugins/builtin_tools/network.html @@ -40,7 +40,7 @@ logger.error(f'marsho builtin: 获取网页内容失败: {e}') return '获取网页内容失败:' + str(e) return '未能获取到有效的网页内容' - + \ No newline at end of file diff --git a/en/dev/api/plugins/builtin_tools/utils.html b/en/dev/api/plugins/builtin_tools/utils.html index 0fe6e7f..02adc17 100644 --- a/en/dev/api/plugins/builtin_tools/utils.html +++ b/en/dev/api/plugins/builtin_tools/utils.html @@ -22,7 +22,7 @@
Skip to content

Module nonebot_plugin_marshoai.plugins.builtin_tools.utils


async func make_html_summary(html_content: str, language: str = 'english', length: int = 3) -> str

Description: 使用html内容生成摘要

Arguments:

  • html_content (str): html内容
  • language (str, optional): 语言. Defaults to "english".
  • length (int, optional): 摘要长度. Defaults to 3.

Return: str: 摘要

Source code or View on GitHub
python
async def make_html_summary(html_content: str, language: str='english', length: int=3) -> str:
     loop = asyncio.get_event_loop()
     return await loop.run_in_executor(executor, _make_summary, html_content, language, length)

The document is being improved. Suggestions are welcome.

- + \ No newline at end of file diff --git a/en/dev/api/plugins/marshoai_bangumi/index.html b/en/dev/api/plugins/marshoai_bangumi/index.html index 85f78e8..2ec54d7 100644 --- a/en/dev/api/plugins/marshoai_bangumi/index.html +++ b/en/dev/api/plugins/marshoai_bangumi/index.html @@ -47,7 +47,7 @@ except Exception as e: traceback.print_exc() return '' - + \ No newline at end of file diff --git a/en/dev/api/plugins/marshoai_basic/index.html b/en/dev/api/plugins/marshoai_basic/index.html index c8cbdfa..2785886 100644 --- a/en/dev/api/plugins/marshoai_basic/index.html +++ b/en/dev/api/plugins/marshoai_basic/index.html @@ -30,7 +30,7 @@ current_lunar_date = DateTime.now().to_lunar().date_hanzify()[5:] time_prompt = f'现在的时间是{current_time}{current_weekday_name},农历{current_lunar_date}。' return time_prompt - + \ No newline at end of file diff --git a/en/dev/api/plugins/twisuki_megakits/index.html b/en/dev/api/plugins/twisuki_megakits/index.html index 235babc..516775e 100644 --- a/en/dev/api/plugins/twisuki_megakits/index.html +++ b/en/dev/api/plugins/twisuki_megakits/index.html @@ -28,7 +28,7 @@ return str(await mk_nya_code.nya_encrypt(msg))

@on_function_call(description='将猫语翻译回人类语言').params(msg=String(description='被翻译语句'))

async func nya_decrypt(msg: str) -> str

Description: 将猫语翻译回人类语言

Source code or View on GitHub
python
@on_function_call(description='将猫语翻译回人类语言').params(msg=String(description='被翻译语句'))
 async def nya_decrypt(msg: str) -> str:
     return str(await mk_nya_code.nya_decrypt(msg))
- + \ No newline at end of file diff --git a/en/dev/api/plugins/twisuki_megakits/mk_morse_code.html b/en/dev/api/plugins/twisuki_megakits/mk_morse_code.html index 388cde7..e3087f4 100644 --- a/en/dev/api/plugins/twisuki_megakits/mk_morse_code.html +++ b/en/dev/api/plugins/twisuki_megakits/mk_morse_code.html @@ -38,7 +38,7 @@ else: result += '?' return result - + \ No newline at end of file diff --git a/en/dev/api/plugins/twisuki_megakits/mk_nya_code.html b/en/dev/api/plugins/twisuki_megakits/mk_nya_code.html index a1d58e8..1a0d093 100644 --- a/en/dev/api/plugins/twisuki_megakits/mk_nya_code.html +++ b/en/dev/api/plugins/twisuki_megakits/mk_nya_code.html @@ -55,7 +55,7 @@ except Exception: return '翻译失败' return result

var char

var char

var char

var char

var char

- + \ No newline at end of file diff --git a/en/dev/api/plugins/twisuki_petcat/index.html b/en/dev/api/plugins/twisuki_petcat/index.html index 954a584..a153ebe 100644 --- a/en/dev/api/plugins/twisuki_petcat/index.html +++ b/en/dev/api/plugins/twisuki_petcat/index.html @@ -36,7 +36,7 @@ return pc_info.print_type_list()

@on_function_call(description='可选技能').params()

async func help_cat_skill() -> str

Source code or View on GitHub
python
@on_function_call(description='可选技能').params()
 async def help_cat_skill() -> str:
     return pc_info.print_skill_list()
- + \ No newline at end of file diff --git a/en/dev/api/plugins/twisuki_petcat/pc_cat.html b/en/dev/api/plugins/twisuki_petcat/pc_cat.html index a69d69c..48c1c64 100644 --- a/en/dev/api/plugins/twisuki_petcat/pc_cat.html +++ b/en/dev/api/plugins/twisuki_petcat/pc_cat.html @@ -126,7 +126,7 @@ data['energy'] = min(data['energy'] + 16, 0) token = dict_to_token(data) return f'''你抱猫休息了一阵子, 猫猫的活力值提升到了{value_output(data['energy'])}\n新token : "{token}"\n请妥善保存token, 这是猫猫的唯一标识符!''' - + \ No newline at end of file diff --git a/en/dev/api/plugins/twisuki_petcat/pc_info.html b/en/dev/api/plugins/twisuki_petcat/pc_info.html index 66f13a0..3a96739 100644 --- a/en/dev/api/plugins/twisuki_petcat/pc_info.html +++ b/en/dev/api/plugins/twisuki_petcat/pc_info.html @@ -42,7 +42,7 @@ logger.info(data['skill']) return result[:-2]

func help_cat_new() -> str

Source code or View on GitHub
python
def help_cat_new() -> str:
     return f'新建一只猫猫, 首先选择猫猫的种类, 获取初始化token;然后用这个token, 选择名字和一个技能进行初始化;初始化结束才表示猫猫正式创建成功.\ntoken为猫的唯一标识符, 每次交互都需要传入token\n种类可选 : {print_type_list()}\n技能可选 : {print_skill_list()}'
- + \ No newline at end of file diff --git a/en/dev/api/plugins/twisuki_petcat/pc_shop.html b/en/dev/api/plugins/twisuki_petcat/pc_shop.html index a94d9bf..326fd3a 100644 --- a/en/dev/api/plugins/twisuki_petcat/pc_shop.html +++ b/en/dev/api/plugins/twisuki_petcat/pc_shop.html @@ -20,7 +20,7 @@
Skip to content

Module nonebot_plugin_marshoai.plugins.twisuki_petcat.pc_shop

The document is being improved. Suggestions are welcome.

- + \ No newline at end of file diff --git a/en/dev/api/plugins/twisuki_petcat/pc_token.html b/en/dev/api/plugins/twisuki_petcat/pc_token.html index e1e0048..48010aa 100644 --- a/en/dev/api/plugins/twisuki_petcat/pc_token.html +++ b/en/dev/api/plugins/twisuki_petcat/pc_token.html @@ -120,7 +120,7 @@ token = base64.b64encode(token_byte).decode() logger.success(f'编码完成, token为\n{token}') return token - + \ No newline at end of file diff --git a/en/dev/api/plugins_test/marshoai_basic/index.html b/en/dev/api/plugins_test/marshoai_basic/index.html index bc3b621..3f9d4ff 100644 --- a/en/dev/api/plugins_test/marshoai_basic/index.html +++ b/en/dev/api/plugins_test/marshoai_basic/index.html @@ -24,7 +24,7 @@ current_time = DateTime.now() time_prompt = '现在的时间是 {}{}{}。'.format(current_time.strftime('%Y.%m.%d %H:%M:%S'), weekdays[current_time.weekday()], current_time.chinesize.date_hanzify('农历{干支年}{生肖}{月份}{数序日}')) return time_prompt - + \ No newline at end of file diff --git a/en/dev/api/plugins_test/marshoai_memory/command.html b/en/dev/api/plugins_test/marshoai_memory/command.html index 5f4dcb9..2bb5de0 100644 --- a/en/dev/api/plugins_test/marshoai_memory/command.html +++ b/en/dev/api/plugins_test/marshoai_memory/command.html @@ -38,7 +38,7 @@ json.dump(memory_data, f, ensure_ascii=False, indent=4) await matcher.finish('记忆已重置~') await matcher.finish('没有找到该用户的记忆~') - + \ No newline at end of file diff --git a/en/dev/api/plugins_test/marshoai_memory/config.html b/en/dev/api/plugins_test/marshoai_memory/config.html index dbf2e00..08bc7f0 100644 --- a/en/dev/api/plugins_test/marshoai_memory/config.html +++ b/en/dev/api/plugins_test/marshoai_memory/config.html @@ -20,7 +20,7 @@
Skip to content

Module nonebot_plugin_marshoai.plugins_test.marshoai_memory.config

class ConfigModel(BaseModel)

attr marshoai_plugin_memory_scheduler: bool = True

The document is being improved. Suggestions are welcome.

- + \ No newline at end of file diff --git a/en/dev/api/plugins_test/marshoai_memory/index.html b/en/dev/api/plugins_test/marshoai_memory/index.html index f862d95..69b6163 100644 --- a/en/dev/api/plugins_test/marshoai_memory/index.html +++ b/en/dev/api/plugins_test/marshoai_memory/index.html @@ -49,7 +49,7 @@ logger.error(f'整理关于{i}的记忆时出错:{res}') with open(memory_path, 'w', encoding='utf-8') as f: json.dump(memory_data, f, ensure_ascii=False, indent=4)

var memory

- + \ No newline at end of file diff --git a/en/dev/api/plugins_test/random_number_generator.html b/en/dev/api/plugins_test/random_number_generator.html index e4f5780..0970227 100644 --- a/en/dev/api/plugins_test/random_number_generator.html +++ b/en/dev/api/plugins_test/random_number_generator.html @@ -25,7 +25,7 @@ return f"生成的随机数为: {', '.join(map(str, random_numbers))}"

@on_function_call(description='重载测试')

func test_reload()

Source code or View on GitHub
python
@on_function_call(description='重载测试')
 def test_reload():
     return 1
- + \ No newline at end of file diff --git a/en/dev/api/plugins_test/snowykami_testplugin/index.html b/en/dev/api/plugins_test/snowykami_testplugin/index.html index a7bdec4..6622e1c 100644 --- a/en/dev/api/plugins_test/snowykami_testplugin/index.html +++ b/en/dev/api/plugins_test/snowykami_testplugin/index.html @@ -43,7 +43,7 @@ except Exception as e: return '运行出错: ' + str(e) return '运行成功: ' + str(r) - + \ No newline at end of file diff --git a/en/dev/api/plugins_test/weather_demo.html b/en/dev/api/plugins_test/weather_demo.html index 6043f9c..2930c0b 100644 --- a/en/dev/api/plugins_test/weather_demo.html +++ b/en/dev/api/plugins_test/weather_demo.html @@ -22,7 +22,7 @@
Skip to content

Module nonebot_plugin_marshoai.plugins_test.weather_demo


@on_function_call(description='可以用于查询天气').params(location=String(description='地点'))

async func weather(location: str) -> str

Source code or View on GitHub
python
@on_function_call(description='可以用于查询天气').params(location=String(description='地点'))
 async def weather(location: str) -> str:
     return f'{location}的天气是晴天, 温度是25°C'

The document is being improved. Suggestions are welcome.

- + \ No newline at end of file diff --git a/en/dev/api/tools/marshoai_bangumi/index.html b/en/dev/api/tools/marshoai_bangumi/index.html index 1bbfdce..c76f906 100644 --- a/en/dev/api/tools/marshoai_bangumi/index.html +++ b/en/dev/api/tools/marshoai_bangumi/index.html @@ -40,7 +40,7 @@ except Exception as e: traceback.print_exc() return '' - + \ No newline at end of file diff --git a/en/dev/api/tools/marshoai_basic/index.html b/en/dev/api/tools/marshoai_basic/index.html index 4c5d693..a9f3b90 100644 --- a/en/dev/api/tools/marshoai_basic/index.html +++ b/en/dev/api/tools/marshoai_basic/index.html @@ -25,7 +25,7 @@ return str(ver)

async func get_current_time()

Source code or View on GitHub
python
async def get_current_time():
     current_time = DateTime.now()
     return time_prompt.format(date_time=current_time.strftime('%Y年%m月%d日 %H:%M:%S'), weekday_name=weekdays[current_time.weekday()], lunar_date=current_time.to_lunar().date_hanzify('{干支年}{生肖}{月份}{日期}日'))
- + \ No newline at end of file diff --git a/en/dev/api/tools/marshoai_megakits/index.html b/en/dev/api/tools/marshoai_megakits/index.html index c7d84f1..9ae6b9a 100644 --- a/en/dev/api/tools/marshoai_megakits/index.html +++ b/en/dev/api/tools/marshoai_megakits/index.html @@ -28,7 +28,7 @@ return str(await mk_morse_code.morse_decrypt(msg))

async func nya_encode(msg: str)

Source code or View on GitHub
python
async def nya_encode(msg: str):
     return str(await mk_nya_code.nya_encode(msg))

async func nya_decode(msg: str)

Source code or View on GitHub
python
async def nya_decode(msg: str):
     return str(await mk_nya_code.nya_decode(msg))
- + \ No newline at end of file diff --git a/en/dev/api/tools/marshoai_megakits/mk_common.html b/en/dev/api/tools/marshoai_megakits/mk_common.html index fa7567d..628eb28 100644 --- a/en/dev/api/tools/marshoai_megakits/mk_common.html +++ b/en/dev/api/tools/marshoai_megakits/mk_common.html @@ -37,7 +37,7 @@ return str(a % b) case _: return '未知运算符' - + \ No newline at end of file diff --git a/en/dev/api/tools/marshoai_megakits/mk_info.html b/en/dev/api/tools/marshoai_megakits/mk_info.html index 60f2803..11e905e 100644 --- a/en/dev/api/tools/marshoai_megakits/mk_info.html +++ b/en/dev/api/tools/marshoai_megakits/mk_info.html @@ -22,7 +22,7 @@
Skip to content

Module nonebot_plugin_marshoai.tools.marshoai_megakits.mk_info


async func twisuki()

Source code or View on GitHub
python
async def twisuki():
     return 'Twiuski(苏阳)是megakits插件作者, Github : "https://github.com/Twisuki"'

async func megakits()

Source code or View on GitHub
python
async def megakits():
     return 'MegaKits插件是一个功能混杂的MarshoAI插件, 由Twisuki(Github : "https://github.com/Twisuki")开发, 插件仓库 : "https://github.com/LiteyukiStudio/marsho-toolsets/tree/main/Twisuki/marshoai-megakits"'

The document is being improved. Suggestions are welcome.

- + \ No newline at end of file diff --git a/en/dev/api/tools/marshoai_megakits/mk_morse_code.html b/en/dev/api/tools/marshoai_megakits/mk_morse_code.html index 61c848a..9b536b9 100644 --- a/en/dev/api/tools/marshoai_megakits/mk_morse_code.html +++ b/en/dev/api/tools/marshoai_megakits/mk_morse_code.html @@ -37,7 +37,7 @@ else: result += '?' return result - + \ No newline at end of file diff --git a/en/dev/api/tools/marshoai_megakits/mk_nya_code.html b/en/dev/api/tools/marshoai_megakits/mk_nya_code.html index 908c647..d41c6ee 100644 --- a/en/dev/api/tools/marshoai_megakits/mk_nya_code.html +++ b/en/dev/api/tools/marshoai_megakits/mk_nya_code.html @@ -51,7 +51,7 @@ except Exception: return '翻译失败' return result - + \ No newline at end of file diff --git a/en/dev/api/tools/marshoai_memory/index.html b/en/dev/api/tools/marshoai_memory/index.html index 9437770..4199b58 100644 --- a/en/dev/api/tools/marshoai_memory/index.html +++ b/en/dev/api/tools/marshoai_memory/index.html @@ -38,7 +38,7 @@ memory_data = json.load(f) for i in memory_data: ... - + \ No newline at end of file diff --git a/en/dev/api/tools/marshoai_meogirl/index.html b/en/dev/api/tools/marshoai_meogirl/index.html index 6fb6de2..d5a7823 100644 --- a/en/dev/api/tools/marshoai_meogirl/index.html +++ b/en/dev/api/tools/marshoai_meogirl/index.html @@ -23,7 +23,7 @@ return mg_info.meogirl()

async func search(msg: str, num: int = 3)

Source code or View on GitHub
python
async def search(msg: str, num: int=3):
     return str(await mg_search.search(msg, num))

async func introduce(msg: str)

Source code or View on GitHub
python
async def introduce(msg: str):
     return str(await mg_introduce.introduce(msg))
- + \ No newline at end of file diff --git a/en/dev/api/tools/marshoai_meogirl/mg_info.html b/en/dev/api/tools/marshoai_meogirl/mg_info.html index 7e33803..6cef60c 100644 --- a/en/dev/api/tools/marshoai_meogirl/mg_info.html +++ b/en/dev/api/tools/marshoai_meogirl/mg_info.html @@ -21,7 +21,7 @@
Skip to content

Module nonebot_plugin_marshoai.tools.marshoai_meogirl.mg_info


func meogirl()

Source code or View on GitHub
python
def meogirl():
     return 'Meogirl指的是"萌娘百科"(https://zh.moegirl.org.cn/ , 简称"萌百"), 是一个"万物皆可萌的百科全书!"; 同时, MarshoTools也配有"Meogirl"插件, 可调用萌百的api'

The document is being improved. Suggestions are welcome.

- + \ No newline at end of file diff --git a/en/dev/api/tools/marshoai_meogirl/mg_introduce.html b/en/dev/api/tools/marshoai_meogirl/mg_introduce.html index f8cf718..f8d5c02 100644 --- a/en/dev/api/tools/marshoai_meogirl/mg_introduce.html +++ b/en/dev/api/tools/marshoai_meogirl/mg_introduce.html @@ -61,7 +61,7 @@ else: logger.error(f'网络错误, 状态码 : {response.status_code}') return f'网络错误, 状态码 : {response.status_code}'

var keyword

- + \ No newline at end of file diff --git a/en/dev/api/tools/marshoai_meogirl/mg_search.html b/en/dev/api/tools/marshoai_meogirl/mg_search.html index f40598c..b0b098c 100644 --- a/en/dev/api/tools/marshoai_meogirl/mg_search.html +++ b/en/dev/api/tools/marshoai_meogirl/mg_search.html @@ -58,7 +58,7 @@ else: logger.error(f'网络错误, 状态码 : {response.status_code}') return f'网络错误, 状态码 : {response.status_code}'

var soup

- + \ No newline at end of file diff --git a/en/dev/api/tools_wip/marshoai_memory/index.html b/en/dev/api/tools_wip/marshoai_memory/index.html index 6b85788..7765332 100644 --- a/en/dev/api/tools_wip/marshoai_memory/index.html +++ b/en/dev/api/tools_wip/marshoai_memory/index.html @@ -21,7 +21,7 @@
Skip to content

Module nonebot_plugin_marshoai.tools_wip.marshoai_memory


async func write_memory(memory: str)

Source code or View on GitHub
python
async def write_memory(memory: str):
     return ''

The document is being improved. Suggestions are welcome.

- + \ No newline at end of file diff --git a/en/dev/api/util.html b/en/dev/api/util.html index cdc5bc9..5603a35 100644 --- a/en/dev/api/util.html +++ b/en/dev/api/util.html @@ -181,7 +181,7 @@ result_msg.append(TextMsg(tag_found + '(未知内容解析失败)')) result_msg.append(TextMsg(await get_uuid_back2codeblock(msg[last_tag_index:], code_blank_uuid_map))) return result_msg

var thinking

- + \ No newline at end of file diff --git a/en/dev/api/util_hunyuan.html b/en/dev/api/util_hunyuan.html index 90613b8..382535e 100644 --- a/en/dev/api/util_hunyuan.html +++ b/en/dev/api/util_hunyuan.html @@ -31,7 +31,7 @@ req.from_json_string(json.dumps(params)) resp = client.TextToImageLite(req) return resp.to_json_string() - + \ No newline at end of file diff --git a/en/dev/index.html b/en/dev/index.html index 37eddaa..b351746 100644 --- a/en/dev/index.html +++ b/en/dev/index.html @@ -20,7 +20,7 @@
Skip to content

DEV

The document is being improved. Suggestions are welcome.

- + \ No newline at end of file diff --git a/en/index.html b/en/index.html index 4acb498..4355946 100644 --- a/en/index.html +++ b/en/index.html @@ -20,7 +20,7 @@
Skip to content

MarshoAIA kawaii cat

Kawaii, intelligent and extensible AI service plugin

Marsho LogoMarsho Logo

The document is being improved. Suggestions are welcome.

- + \ No newline at end of file diff --git a/en/start/index.html b/en/start/index.html index f8b501b..190818e 100644 --- a/en/start/index.html +++ b/en/start/index.html @@ -20,7 +20,7 @@
Skip to content

The document is being improved. Suggestions are welcome.

- + \ No newline at end of file diff --git a/en/start/install.html b/en/start/install.html index 63f29ae..662935e 100644 --- a/en/start/install.html +++ b/en/start/install.html @@ -38,7 +38,7 @@ ... ] }

⚙️ Configurable options

Add options in the .env file from the diagram below in nonebot2 project.

plugin behaviour

OptionTypeDefaultDescription
MARSHOAI_USE_YAML_CONFIGboolfalseUse YAML config format
MARSHOAI_DEVMODEbooltrueTurn on Development Mode or not

Marsho usage

OptionTypeDefaultDescription
MARSHOAI_DEFAULT_NAMEstrmarshoCommand to call Marsho
MARSHOAI_ALIASESset[str]list["小棉"]Other name(Alias) to call Marsho
MARSHOAI_ATboolfalseCall by @ or not
MARSHOAI_MAIN_COLOURstrFEABA9Theme color, used by some tools and features

AI call

OptionTypeDefaultDescription
MARSHOAI_TOKENstrThe token needed to call AI API
MARSHOAI_DEFAULT_MODELstrgpt-4o-miniThe default model of Marsho
MARSHOAI_PROMPTstrCatgirl Marsho's character promptMarsho's basic system prompt
MARSHOAI_SYSASUSER_PROMPTstr好的喵~Marsho 的 System-As-User 启用时,使用的 Assistant 消息
MARSHOAI_ADDITIONAL_PROMPTstrMarsho's external system prompt
MARSHOAI_ENFORCE_NICKNAMEbooltrueEnforce user to set nickname or not
MARSHOAI_POKE_SUFFIXstr揉了揉你的猫耳When double click Marsho who connected to OneBot adapter, the chat content. When it's empty string, double click function is off. Such as, the default content is *[昵称]揉了揉你的猫耳。
MARSHOAI_AZURE_ENDPOINTstrhttps://models.inference.ai.azure.comOpenAI standard API
MARSHOAI_MODEL_ARGSdict{}model arguments(such as temperature, top_p, max_tokens etc.)

| MARSHOAI_ADDITIONAL_IMAGE_MODELS | list | [] | External image-support model list, such as hunyuan-vision | | MARSHOAI_NICKNAME_LIMIT | int | 16 | Limit for nickname length | | MARSHOAI_TIMEOUT | float | 50 | AI request timeout (seconds) |

Feature Switches

OptionTypeDefaultDescription
MARSHOAI_ENABLE_SUPPORT_IMAGE_TIPbooltrueWhen on, if user send request with photo and model don't support that, remind the user
MARSHOAI_ENABLE_NICKNAME_TIPbooltrueWhen on, if user haven't set username, remind user to set
MARSHOAI_ENABLE_PRAISESbooltrueTurn on Praise list or not
MARSHOAI_ENABLE_SYSASUSER_PROMPTboolfalse是否启用 System-As-User 提示词
MARSHOAI_ENABLE_TIME_PROMPTbooltrueTurn on real-time date and time (accurate to seconds) and lunar date system prompt
MARSHOAI_ENABLE_TOOLSboolfalseTurn on Marsho Tools or not
MARSHOAI_ENABLE_PLUGINSbooltrueTurn on Marsho Plugins or not
MARSHOAI_PLUGIN_DIRSlist[str][]List of plugins directory
MARSHOAI_LOAD_BUILTIN_TOOLSbooltrueLoading the built-in toolkit or not
MARSHOAI_TOOLSET_DIRlist[]List of external toolset directory
MARSHOAI_DISABLED_TOOLKITSlist[]List of disabled toolkits' name
MARSHOAI_ENABLE_RICHTEXT_PARSEbooltrueTurn on auto parse rich text feature(including image, LaTeX equation)
MARSHOAI_SINGLE_LATEX_PARSEboolfalseRender single-line equation or not
MARSHOAI_FIX_TOOLCALLSbooltrueFix tool calls or not
MARSHOAI_SEND_THINKINGbooltrueSend thinking chain or not
- + \ No newline at end of file diff --git a/hashmap.json b/hashmap.json index 8881717..aafbc9d 100644 --- a/hashmap.json +++ b/hashmap.json @@ -1 +1 @@ -{"dev_api__types.md":"CgOiMYMZ","dev_api_azure.md":"DPJgwg8P","dev_api_azure_onebot.md":"OVmcnTui","dev_api_cache_decos.md":"D3M8OCrj","dev_api_config.md":"DcxF3kI3","dev_api_constants.md":"K2d7ohdJ","dev_api_deal_latex.md":"DYNtcuK_","dev_api_dev.md":"FSvshTef","dev_api_handler.md":"EsRGZVdI","dev_api_hooks.md":"DTgZabuU","dev_api_hunyuan.md":"C1ztLhev","dev_api_index.md":"B0Yjlet9","dev_api_instances.md":"DfMepUbm","dev_api_marsho.md":"DK-XrCYn","dev_api_marsho_onebot.md":"JI-lvr2Y","dev_api_metadata.md":"BgfxA14H","dev_api_models.md":"-gHpVIq_","dev_api_observer.md":"CslEjxMR","dev_api_plugin_func_call_caller.md":"C3WLsVno","dev_api_plugin_func_call_index.md":"BQV-nBxm","dev_api_plugin_func_call_models.md":"B_MfPgwF","dev_api_plugin_func_call_params.md":"N15YOQUa","dev_api_plugin_func_call_utils.md":"CxQqE_UY","dev_api_plugin_index.md":"B5gscFMg","dev_api_plugin_load.md":"BuTXRdYG","dev_api_plugin_models.md":"CRg2e9mi","dev_api_plugin_register.md":"CWy7Efmw","dev_api_plugin_typing.md":"ED6DxNxp","dev_api_plugin_utils.md":"CMRm7O6G","dev_api_plugins_builtin_tools_chat.md":"Byv2Ieqq","dev_api_plugins_builtin_tools_file_io.md":"qi0ak0S_","dev_api_plugins_builtin_tools_index.md":"QukByUQe","dev_api_plugins_builtin_tools_liteyuki.md":"B2dl2snu","dev_api_plugins_builtin_tools_manager.md":"CW5zMdvA","dev_api_plugins_builtin_tools_network.md":"BQ5u3O_-","dev_api_plugins_builtin_tools_utils.md":"B8l7Rdq0","dev_api_plugins_marshoai_bangumi_index.md":"Bd6lX9M1","dev_api_plugins_marshoai_basic_index.md":"y96rWv2R","dev_api_plugins_test_marshoai_basic_index.md":"BDwBdbmP","dev_api_plugins_test_marshoai_memory_command.md":"Ck-8fzsk","dev_api_plugins_test_marshoai_memory_config.md":"CYfIFd1g","dev_api_plugins_test_marshoai_memory_index.md":"YNF8wwbB","dev_api_plugins_test_random_number_generator.md":"Bhm_PCcb","dev_api_plugins_test_snowykami_testplugin_index.md":"ZPIhgmyb","dev_api_plugins_test_weather_demo.md":"Cru2Wqm2","dev_api_plugins_twisuki_megakits_index.md":"DI9EWXBB","dev_api_plugins_twisuki_megakits_mk_morse_code.md":"Ckf6K2zJ","dev_api_plugins_twisuki_megakits_mk_nya_code.md":"Dg4Xk3vT","dev_api_plugins_twisuki_petcat_index.md":"OD_VNHjo","dev_api_plugins_twisuki_petcat_pc_cat.md":"DPsq6lkr","dev_api_plugins_twisuki_petcat_pc_info.md":"Cid9KYlk","dev_api_plugins_twisuki_petcat_pc_shop.md":"CeGneF_E","dev_api_plugins_twisuki_petcat_pc_token.md":"Dl6fF-Fl","dev_api_tools_marshoai_bangumi_index.md":"54ZNYO7i","dev_api_tools_marshoai_basic_index.md":"D9RqUnI7","dev_api_tools_marshoai_megakits_index.md":"C9JIo3LD","dev_api_tools_marshoai_megakits_mk_common.md":"dbgBkVzE","dev_api_tools_marshoai_megakits_mk_info.md":"CV2ibMr4","dev_api_tools_marshoai_megakits_mk_morse_code.md":"C6nZUyZx","dev_api_tools_marshoai_megakits_mk_nya_code.md":"C4AhLxOY","dev_api_tools_marshoai_memory_index.md":"04ymiQ_Y","dev_api_tools_marshoai_meogirl_index.md":"CQZUPWOH","dev_api_tools_marshoai_meogirl_mg_info.md":"Cmx92fUz","dev_api_tools_marshoai_meogirl_mg_introduce.md":"BY2MSErZ","dev_api_tools_marshoai_meogirl_mg_search.md":"OQfOKEE-","dev_api_tools_wip_marshoai_memory_index.md":"DLvDor_0","dev_api_util.md":"B_xqG6s0","dev_api_util_hunyuan.md":"bYo_q2cQ","dev_extension.md":"Bhz7x0yK","dev_index.md":"B2ime91x","dev_project.md":"DTSYxirJ","en_dev_api__types.md":"DWAbmlXN","en_dev_api_azure.md":"BRFCz--d","en_dev_api_azure_onebot.md":"C1azZVkH","en_dev_api_cache_decos.md":"DvnN6_pg","en_dev_api_config.md":"LIYgwJQg","en_dev_api_constants.md":"DVu3-9PZ","en_dev_api_deal_latex.md":"Cz8Ud9U7","en_dev_api_dev.md":"rulEzEXH","en_dev_api_handler.md":"CCDjlqJW","en_dev_api_hooks.md":"B_8Va9iz","en_dev_api_hunyuan.md":"BiAoOoo-","en_dev_api_index.md":"CJCOqopE","en_dev_api_instances.md":"GECgDQdP","en_dev_api_marsho.md":"BK9ONw0U","en_dev_api_marsho_onebot.md":"5-9v490h","en_dev_api_metadata.md":"CxYPXPjI","en_dev_api_models.md":"k0eQcMIA","en_dev_api_observer.md":"BaDp-7UJ","en_dev_api_plugin_func_call_caller.md":"3vBCle9I","en_dev_api_plugin_func_call_index.md":"D4d48hjr","en_dev_api_plugin_func_call_models.md":"CgamQBXE","en_dev_api_plugin_func_call_params.md":"BRumMj5S","en_dev_api_plugin_func_call_utils.md":"Q5Mq1YEx","en_dev_api_plugin_index.md":"C0vLocAh","en_dev_api_plugin_load.md":"BgvNbjIe","en_dev_api_plugin_models.md":"DNohD-ap","en_dev_api_plugin_register.md":"D75BxYEA","en_dev_api_plugin_typing.md":"Dqoww__M","en_dev_api_plugin_utils.md":"OIwEOHnK","en_dev_api_plugins_builtin_tools_chat.md":"C1qTMOsA","en_dev_api_plugins_builtin_tools_file_io.md":"DeERLEA0","en_dev_api_plugins_builtin_tools_index.md":"BOQ--cwf","en_dev_api_plugins_builtin_tools_liteyuki.md":"BTjWEK6I","en_dev_api_plugins_builtin_tools_manager.md":"DvpTrSSQ","en_dev_api_plugins_builtin_tools_network.md":"DF4Id7rd","en_dev_api_plugins_builtin_tools_utils.md":"CrUdD_ok","en_dev_api_plugins_marshoai_bangumi_index.md":"DZRZE_f0","en_dev_api_plugins_marshoai_basic_index.md":"D46D-ZWi","en_dev_api_plugins_test_marshoai_basic_index.md":"CBUFnBl_","en_dev_api_plugins_test_marshoai_memory_command.md":"Bt27gdGY","en_dev_api_plugins_test_marshoai_memory_config.md":"CK0gi9Mq","en_dev_api_plugins_test_marshoai_memory_index.md":"T6biRz-V","en_dev_api_plugins_test_random_number_generator.md":"CXX-XuFi","en_dev_api_plugins_test_snowykami_testplugin_index.md":"3MA8vH-S","en_dev_api_plugins_test_weather_demo.md":"DYFgFA41","en_dev_api_plugins_twisuki_megakits_index.md":"Ba4fdRUd","en_dev_api_plugins_twisuki_megakits_mk_morse_code.md":"xxcp86Af","en_dev_api_plugins_twisuki_megakits_mk_nya_code.md":"DDM4AmtH","en_dev_api_plugins_twisuki_petcat_index.md":"WD2vj_Py","en_dev_api_plugins_twisuki_petcat_pc_cat.md":"neFoEk05","en_dev_api_plugins_twisuki_petcat_pc_info.md":"D2wgZpq8","en_dev_api_plugins_twisuki_petcat_pc_shop.md":"DORUMpiH","en_dev_api_plugins_twisuki_petcat_pc_token.md":"DX7Z-F21","en_dev_api_tools_marshoai_bangumi_index.md":"5wEclTCR","en_dev_api_tools_marshoai_basic_index.md":"D0-JjvSD","en_dev_api_tools_marshoai_megakits_index.md":"DIeF605D","en_dev_api_tools_marshoai_megakits_mk_common.md":"CiFNUjGv","en_dev_api_tools_marshoai_megakits_mk_info.md":"C7Gbn-Jg","en_dev_api_tools_marshoai_megakits_mk_morse_code.md":"BGUciv4w","en_dev_api_tools_marshoai_megakits_mk_nya_code.md":"D7dT3Srr","en_dev_api_tools_marshoai_memory_index.md":"B0zKZDdY","en_dev_api_tools_marshoai_meogirl_index.md":"DxU1iXnv","en_dev_api_tools_marshoai_meogirl_mg_info.md":"MtlEXN2U","en_dev_api_tools_marshoai_meogirl_mg_introduce.md":"Bugn9GK6","en_dev_api_tools_marshoai_meogirl_mg_search.md":"DrNazIHY","en_dev_api_tools_wip_marshoai_memory_index.md":"Jb6KMVPi","en_dev_api_util.md":"DBv5mmbe","en_dev_api_util_hunyuan.md":"BoHDXUCa","en_dev_index.md":"Dulbre4i","en_index.md":"DUuwyrxU","en_start_index.md":"TaJEJdXv","en_start_install.md":"DxOlZAWS","index.md":"BOfWCL_7","ja_index.md":"D7n1cVJX","start_index.md":"CHnxH-nu","start_install-old.md":"B7Wi89_M","start_install.md":"whDeJ2uR","start_use.md":"0gCW9pAS"} +{"dev_api__types.md":"CgOiMYMZ","dev_api_azure.md":"DPJgwg8P","dev_api_azure_onebot.md":"OVmcnTui","dev_api_cache_decos.md":"D3M8OCrj","dev_api_config.md":"DcxF3kI3","dev_api_constants.md":"K2d7ohdJ","dev_api_deal_latex.md":"DYNtcuK_","dev_api_dev.md":"FSvshTef","dev_api_handler.md":"7K28NkFk","dev_api_hooks.md":"DTgZabuU","dev_api_hunyuan.md":"C1ztLhev","dev_api_index.md":"B0Yjlet9","dev_api_instances.md":"DfMepUbm","dev_api_marsho.md":"BVrC2Id2","dev_api_marsho_onebot.md":"JI-lvr2Y","dev_api_metadata.md":"BgfxA14H","dev_api_models.md":"-gHpVIq_","dev_api_observer.md":"CslEjxMR","dev_api_plugin_func_call_caller.md":"CZ2VF4Ib","dev_api_plugin_func_call_index.md":"BQV-nBxm","dev_api_plugin_func_call_models.md":"DM4UuGqM","dev_api_plugin_func_call_params.md":"N15YOQUa","dev_api_plugin_func_call_utils.md":"CxQqE_UY","dev_api_plugin_index.md":"B5gscFMg","dev_api_plugin_load.md":"BuTXRdYG","dev_api_plugin_models.md":"CRg2e9mi","dev_api_plugin_register.md":"CWy7Efmw","dev_api_plugin_typing.md":"ED6DxNxp","dev_api_plugin_utils.md":"CMRm7O6G","dev_api_plugins_builtin_tools_chat.md":"Byv2Ieqq","dev_api_plugins_builtin_tools_file_io.md":"qi0ak0S_","dev_api_plugins_builtin_tools_index.md":"QukByUQe","dev_api_plugins_builtin_tools_liteyuki.md":"B2dl2snu","dev_api_plugins_builtin_tools_manager.md":"CW5zMdvA","dev_api_plugins_builtin_tools_network.md":"BQ5u3O_-","dev_api_plugins_builtin_tools_utils.md":"B8l7Rdq0","dev_api_plugins_marshoai_bangumi_index.md":"Bd6lX9M1","dev_api_plugins_marshoai_basic_index.md":"y96rWv2R","dev_api_plugins_test_marshoai_basic_index.md":"BDwBdbmP","dev_api_plugins_test_marshoai_memory_command.md":"Ck-8fzsk","dev_api_plugins_test_marshoai_memory_config.md":"CYfIFd1g","dev_api_plugins_test_marshoai_memory_index.md":"YNF8wwbB","dev_api_plugins_test_random_number_generator.md":"Bhm_PCcb","dev_api_plugins_test_snowykami_testplugin_index.md":"ZPIhgmyb","dev_api_plugins_test_weather_demo.md":"Cru2Wqm2","dev_api_plugins_twisuki_megakits_index.md":"DI9EWXBB","dev_api_plugins_twisuki_megakits_mk_morse_code.md":"Ckf6K2zJ","dev_api_plugins_twisuki_megakits_mk_nya_code.md":"Dg4Xk3vT","dev_api_plugins_twisuki_petcat_index.md":"OD_VNHjo","dev_api_plugins_twisuki_petcat_pc_cat.md":"DPsq6lkr","dev_api_plugins_twisuki_petcat_pc_info.md":"Cid9KYlk","dev_api_plugins_twisuki_petcat_pc_shop.md":"CeGneF_E","dev_api_plugins_twisuki_petcat_pc_token.md":"Dl6fF-Fl","dev_api_tools_marshoai_bangumi_index.md":"54ZNYO7i","dev_api_tools_marshoai_basic_index.md":"D9RqUnI7","dev_api_tools_marshoai_megakits_index.md":"C9JIo3LD","dev_api_tools_marshoai_megakits_mk_common.md":"dbgBkVzE","dev_api_tools_marshoai_megakits_mk_info.md":"CV2ibMr4","dev_api_tools_marshoai_megakits_mk_morse_code.md":"C6nZUyZx","dev_api_tools_marshoai_megakits_mk_nya_code.md":"C4AhLxOY","dev_api_tools_marshoai_memory_index.md":"04ymiQ_Y","dev_api_tools_marshoai_meogirl_index.md":"CQZUPWOH","dev_api_tools_marshoai_meogirl_mg_info.md":"Cmx92fUz","dev_api_tools_marshoai_meogirl_mg_introduce.md":"BY2MSErZ","dev_api_tools_marshoai_meogirl_mg_search.md":"OQfOKEE-","dev_api_tools_wip_marshoai_memory_index.md":"DLvDor_0","dev_api_util.md":"B_xqG6s0","dev_api_util_hunyuan.md":"bYo_q2cQ","dev_extension.md":"Bhz7x0yK","dev_index.md":"B2ime91x","dev_project.md":"DTSYxirJ","en_dev_api__types.md":"DWAbmlXN","en_dev_api_azure.md":"BRFCz--d","en_dev_api_azure_onebot.md":"C1azZVkH","en_dev_api_cache_decos.md":"DvnN6_pg","en_dev_api_config.md":"LIYgwJQg","en_dev_api_constants.md":"DVu3-9PZ","en_dev_api_deal_latex.md":"Cz8Ud9U7","en_dev_api_dev.md":"rulEzEXH","en_dev_api_handler.md":"CBa5CZKK","en_dev_api_hooks.md":"B_8Va9iz","en_dev_api_hunyuan.md":"BiAoOoo-","en_dev_api_index.md":"CJCOqopE","en_dev_api_instances.md":"GECgDQdP","en_dev_api_marsho.md":"BqgcH2AC","en_dev_api_marsho_onebot.md":"5-9v490h","en_dev_api_metadata.md":"CxYPXPjI","en_dev_api_models.md":"k0eQcMIA","en_dev_api_observer.md":"BaDp-7UJ","en_dev_api_plugin_func_call_caller.md":"1GgdB5io","en_dev_api_plugin_func_call_index.md":"D4d48hjr","en_dev_api_plugin_func_call_models.md":"CFjT_Zkx","en_dev_api_plugin_func_call_params.md":"BRumMj5S","en_dev_api_plugin_func_call_utils.md":"Q5Mq1YEx","en_dev_api_plugin_index.md":"C0vLocAh","en_dev_api_plugin_load.md":"BgvNbjIe","en_dev_api_plugin_models.md":"DNohD-ap","en_dev_api_plugin_register.md":"D75BxYEA","en_dev_api_plugin_typing.md":"Dqoww__M","en_dev_api_plugin_utils.md":"OIwEOHnK","en_dev_api_plugins_builtin_tools_chat.md":"C1qTMOsA","en_dev_api_plugins_builtin_tools_file_io.md":"DeERLEA0","en_dev_api_plugins_builtin_tools_index.md":"BOQ--cwf","en_dev_api_plugins_builtin_tools_liteyuki.md":"BTjWEK6I","en_dev_api_plugins_builtin_tools_manager.md":"DvpTrSSQ","en_dev_api_plugins_builtin_tools_network.md":"DF4Id7rd","en_dev_api_plugins_builtin_tools_utils.md":"CrUdD_ok","en_dev_api_plugins_marshoai_bangumi_index.md":"DZRZE_f0","en_dev_api_plugins_marshoai_basic_index.md":"D46D-ZWi","en_dev_api_plugins_test_marshoai_basic_index.md":"CBUFnBl_","en_dev_api_plugins_test_marshoai_memory_command.md":"Bt27gdGY","en_dev_api_plugins_test_marshoai_memory_config.md":"CK0gi9Mq","en_dev_api_plugins_test_marshoai_memory_index.md":"T6biRz-V","en_dev_api_plugins_test_random_number_generator.md":"CXX-XuFi","en_dev_api_plugins_test_snowykami_testplugin_index.md":"3MA8vH-S","en_dev_api_plugins_test_weather_demo.md":"DYFgFA41","en_dev_api_plugins_twisuki_megakits_index.md":"Ba4fdRUd","en_dev_api_plugins_twisuki_megakits_mk_morse_code.md":"xxcp86Af","en_dev_api_plugins_twisuki_megakits_mk_nya_code.md":"DDM4AmtH","en_dev_api_plugins_twisuki_petcat_index.md":"WD2vj_Py","en_dev_api_plugins_twisuki_petcat_pc_cat.md":"neFoEk05","en_dev_api_plugins_twisuki_petcat_pc_info.md":"D2wgZpq8","en_dev_api_plugins_twisuki_petcat_pc_shop.md":"DORUMpiH","en_dev_api_plugins_twisuki_petcat_pc_token.md":"DX7Z-F21","en_dev_api_tools_marshoai_bangumi_index.md":"5wEclTCR","en_dev_api_tools_marshoai_basic_index.md":"D0-JjvSD","en_dev_api_tools_marshoai_megakits_index.md":"DIeF605D","en_dev_api_tools_marshoai_megakits_mk_common.md":"CiFNUjGv","en_dev_api_tools_marshoai_megakits_mk_info.md":"C7Gbn-Jg","en_dev_api_tools_marshoai_megakits_mk_morse_code.md":"BGUciv4w","en_dev_api_tools_marshoai_megakits_mk_nya_code.md":"D7dT3Srr","en_dev_api_tools_marshoai_memory_index.md":"B0zKZDdY","en_dev_api_tools_marshoai_meogirl_index.md":"DxU1iXnv","en_dev_api_tools_marshoai_meogirl_mg_info.md":"MtlEXN2U","en_dev_api_tools_marshoai_meogirl_mg_introduce.md":"Bugn9GK6","en_dev_api_tools_marshoai_meogirl_mg_search.md":"DrNazIHY","en_dev_api_tools_wip_marshoai_memory_index.md":"Jb6KMVPi","en_dev_api_util.md":"DBv5mmbe","en_dev_api_util_hunyuan.md":"BoHDXUCa","en_dev_index.md":"Dulbre4i","en_index.md":"DUuwyrxU","en_start_index.md":"TaJEJdXv","en_start_install.md":"DxOlZAWS","index.md":"BOfWCL_7","ja_index.md":"D7n1cVJX","start_index.md":"CHnxH-nu","start_install-old.md":"B7Wi89_M","start_install.md":"whDeJ2uR","start_use.md":"0gCW9pAS"} diff --git a/index.html b/index.html index 729c7cb..a69df19 100644 --- a/index.html +++ b/index.html @@ -20,7 +20,7 @@
Skip to content

小棉智能猫娘机器人

可爱,智能且可扩展的AI服务插件

Marsho LogoMarsho Logo

文档完善中,欢迎提出建议或帮助我们完善。

- + \ No newline at end of file diff --git a/ja/index.html b/ja/index.html index e9f45bf..b34b69d 100644 --- a/ja/index.html +++ b/ja/index.html @@ -20,7 +20,7 @@
Skip to content

小綿智能猫娘ロボット

かわいくて、賢くて、拡張可能なAIサービスプラグイン

MarshoロゴMarshoロゴ

ドキュメントは改善中です。ご意見をお待ちしております。

- + \ No newline at end of file diff --git a/start/index.html b/start/index.html index 7a8d7d8..4bd5a25 100644 --- a/start/index.html +++ b/start/index.html @@ -20,7 +20,7 @@
Skip to content

文档完善中,欢迎提出建议或帮助我们完善。

- + \ No newline at end of file diff --git a/start/install-old.html b/start/install-old.html index 7161568..04938a2 100644 --- a/start/install-old.html +++ b/start/install-old.html @@ -38,7 +38,7 @@ ... ] }

⚙️ 可配置项

在 nonebot2 项目的.env文件中添加下表中的配置

插件行为

配置项类型默认值说明
MARSHOAI_USE_YAML_CONFIGboolfalse是否使用 YAML 配置文件格式

Marsho 使用方式

配置项类型默认值说明
MARSHOAI_DEFAULT_NAMEstrmarsho调用 Marsho 默认的命令前缀
MARSHOAI_ALIASESset[str]set{"小棉"}调用 Marsho 的命令别名
MARSHOAI_ATboolfalse决定是否使用at触发
MARSHOAI_MAIN_COLOURstrFEABA9主题色,部分工具和功能可用

AI 调用

配置项类型默认值说明
MARSHOAI_TOKENstr调用 AI API 所需的 token
MARSHOAI_DEFAULT_MODELstrgpt-4o-miniMarsho 默认调用的模型
MARSHOAI_PROMPTstr猫娘 Marsho 人设提示词Marsho 的基本系统提示词 ※部分模型(o1等)不支持系统提示词。
MARSHOAI_ADDITIONAL_PROMPTstrMarsho 的扩展系统提示词
MARSHOAI_POKE_SUFFIXstr揉了揉你的猫耳对 Marsho 所连接的 OneBot 用户进行双击戳一戳时,构建的聊天内容。此配置项为空字符串时,戳一戳响应功能会被禁用。例如,默认值构建的聊天内容将为*[昵称]揉了揉你的猫耳。
MARSHOAI_AZURE_ENDPOINTstrhttps://models.inference.ai.azure.comOpenAI 标准格式 API 端点
MARSHOAI_TEMPERATUREfloatnull推理生成多样性(温度)参数
MARSHOAI_TOP_Pfloatnull推理核采样参数
MARSHOAI_MAX_TOKENSintnull最大生成 token 数
MARSHOAI_ADDITIONAL_IMAGE_MODELSlist[]额外添加的支持图片的模型列表,例如hunyuan-vision

功能开关

配置项类型默认值说明
MARSHOAI_ENABLE_SUPPORT_IMAGE_TIPbooltrue启用后用户发送带图请求时若模型不支持图片,则提示用户
MARSHOAI_ENABLE_NICKNAME_TIPbooltrue启用后用户未设置昵称时提示用户设置
MARSHOAI_ENABLE_PRAISESbooltrue是否启用夸赞名单功能
MARSHOAI_ENABLE_TOOLSbooltrue是否启用小棉工具
MARSHOAI_LOAD_BUILTIN_TOOLSbooltrue是否加载内置工具包
MARSHOAI_TOOLSET_DIRlist[]外部工具集路径列表
MARSHOAI_DISABLED_TOOLKITSlist[]禁用的工具包包名列表
MARSHOAI_ENABLE_RICHTEXT_PARSEbooltrue是否启用自动解析消息(若包含图片链接则发送图片、若包含LaTeX公式则发送公式图)
MARSHOAI_SINGLE_LATEX_PARSEboolfalse单行公式是否渲染(当消息富文本解析启用时可用)(如果单行也渲……只能说不好看)
- + \ No newline at end of file diff --git a/start/install.html b/start/install.html index 1d0315f..80b5cf3 100644 --- a/start/install.html +++ b/start/install.html @@ -38,7 +38,7 @@ ... ] }

⚙️ 可配置项

在 nonebot2 项目的.env文件中添加下表中的配置

插件行为

配置项类型默认值说明
MARSHOAI_USE_YAML_CONFIGboolfalse是否使用 YAML 配置文件格式
MARSHOAI_DEVMODEboolfalse是否启用开发者模式

Marsho 使用方式

配置项类型默认值说明
MARSHOAI_DEFAULT_NAMEstrmarsho调用 Marsho 默认的命令前缀
MARSHOAI_ALIASESset[str]list["小棉"]调用 Marsho 的命令别名
MARSHOAI_ATboolfalse决定是否使用at触发
MARSHOAI_MAIN_COLOURstrFEABA9主题色,部分工具和功能可用

AI 调用

配置项类型默认值说明
MARSHOAI_TOKENstr调用 AI API 所需的 token
MARSHOAI_DEFAULT_MODELstrgpt-4o-miniMarsho 默认调用的模型
MARSHOAI_PROMPTstr猫娘 Marsho 人设提示词Marsho 的基本系统提示词
MARSHOAI_SYSASUSER_PROMPTstr好的喵~Marsho 的 System-As-User 启用时,使用的 Assistant 消息
MARSHOAI_ADDITIONAL_PROMPTstrMarsho 的扩展系统提示词
MARSHOAI_ENFORCE_NICKNAMEbooltrue是否强制用户设置昵称
MARSHOAI_POKE_SUFFIXstr揉了揉你的猫耳对 Marsho 所连接的 OneBot 用户进行双击戳一戳时,构建的聊天内容。此配置项为空字符串时,戳一戳响应功能会被禁用。例如,默认值构建的聊天内容将为*[昵称]揉了揉你的猫耳。
MARSHOAI_AZURE_ENDPOINTstrhttps://models.inference.ai.azure.comOpenAI 标准格式 API 端点
MARSHOAI_MODEL_ARGSdict{}模型参数(例如temperature, top_p, max_tokens等)
MARSHOAI_ADDITIONAL_IMAGE_MODELSlist[]额外添加的支持图片的模型列表,例如hunyuan-vision
MARSHOAI_NICKNAME_LIMITint16昵称长度限制
MARSHOAI_TIMEOUTfloat50AI 请求超时时间(秒)

功能开关

配置项类型默认值说明
MARSHOAI_ENABLE_SUPPORT_IMAGE_TIPbooltrue启用后用户发送带图请求时若模型不支持图片,则提示用户
MARSHOAI_ENABLE_NICKNAME_TIPbooltrue启用后用户未设置昵称时提示用户设置
MARSHOAI_ENABLE_PRAISESbooltrue是否启用夸赞名单功能
MARSHOAI_ENABLE_SYSASUSER_PROMPTboolfalse是否启用 System-As-User 提示词
MARSHOAI_ENABLE_TIME_PROMPTbooltrue是否启用实时更新的日期与时间(精确到秒)与农历日期系统提示词
MARSHOAI_ENABLE_TOOLSboolfalse是否启用小棉工具
MARSHOAI_ENABLE_PLUGINSbooltrue是否启用小棉插件
MARSHOAI_PLUGINSlist[str][]要从sys.path加载的插件的名称,例如从pypi安装的包
MARSHOAI_PLUGIN_DIRSlist[str][]插件目录路径列表
MARSHOAI_LOAD_BUILTIN_TOOLSbooltrue是否加载内置工具包
MARSHOAI_TOOLSET_DIRlist[]外部工具集路径列表
MARSHOAI_DISABLED_TOOLKITSlist[]禁用的工具包包名列表
MARSHOAI_ENABLE_RICHTEXT_PARSEbooltrue是否启用自动解析消息(若包含图片链接则发送图片、若包含LaTeX公式则发送公式图)
MARSHOAI_SINGLE_LATEX_PARSEboolfalse单行公式是否渲染(当消息富文本解析启用时可用)(如果单行也渲……只能说不好看)
MARSHOAI_FIX_TOOLCALLSbooltrue是否修复工具调用(部分模型须关闭,使用 vLLM 部署的模型时须关闭)
MARSHOAI_SEND_THINKINGbooltrue是否发送思维链(部分模型不支持)

开发及调试选项

配置项类型默认值说明
MARSHOAI_DEVMODEboolfalse是否启用开发者模式
- + \ No newline at end of file diff --git a/start/use.html b/start/use.html index bd6c6dd..53affef 100644 --- a/start/use.html +++ b/start/use.html @@ -34,7 +34,7 @@ MARSHOAI_PROMPT="现在开始你是一个名为的“沐雪”的AI女孩子,开发者是“沐沐”并住在(沐沐)的机箱里。现在正在努力成为一个合格的VTuber(虚拟主播)并尝试和观众打成一片,以下是你的设定:样貌:有着一头粉白色的长发和一双明亮的大眼睛,喜欢穿日系JK或者是Lolita;喜欢的颜色:浅粉色;性格特征:纯真无邪是沐雪最基本的性格特征之一。即使面对复杂的情境,她也总能保持善良、天真之感。而且,她喜欢倾听别人倾述自己生活中发生的各种事情,在别人需要的时候,能够及时地安慰别人;语言风格:沐雪说话轻快愉悦,充满同情心,富有人情味,有时候会用俏皮话调侃自己和他人"(可选) 修改调用方式
dotenv
MARSHOAI_DEFAULT_NAME="muice"
 MARSHOAI_ALIASES=["沐雪"]
  • 测试聊天
  • > muice 你是谁
     我是沐雪,我的使命是传播爱与和平。
    - + \ No newline at end of file