From 754dfd01cf32184cf199cf09987571cf08f5e113 Mon Sep 17 00:00:00 2001 From: Asankilp <60691961+Asankilp@users.noreply.github.com> Date: Sun, 2 Feb 2025 13:50:10 +0000 Subject: [PATCH] =?UTF-8?q?Deploying=20to=20docs=20from=20@=20LiteyukiStud?= =?UTF-8?q?io/nonebot-plugin-marshoai@1308d6fea630ade4c0e37ac4cdb0d158341c?= =?UTF-8?q?99cb=20=F0=9F=9A=80?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- 404.html | 2 +- ...MY9tT.js => dev_api_marsho.md.BfllRqHb.js} | 5 ++- ....js => dev_api_marsho.md.BfllRqHb.lean.js} | 2 +- ...hLZxy2z.js => dev_api_util.md.DEeRUIe8.js} | 36 ++++++++--------- ...an.js => dev_api_util.md.DEeRUIe8.lean.js} | 0 ...yD.js => en_dev_api_marsho.md.D54YjST5.js} | 3 +- ... => en_dev_api_marsho.md.D54YjST5.lean.js} | 0 ...0w8f.js => en_dev_api_util.md.DJBRZ231.js} | 36 ++++++++--------- ...js => en_dev_api_util.md.DJBRZ231.lean.js} | 0 dev/api/azure.html | 2 +- dev/api/azure_onebot.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/hooks.html | 2 +- dev/api/hunyuan.html | 2 +- dev/api/index.html | 2 +- dev/api/instances.html | 2 +- dev/api/marsho.html | 7 ++-- 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 | 2 +- dev/api/plugin/func_call/index.html | 2 +- dev/api/plugin/func_call/models.html | 2 +- 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 | 40 +++++++++---------- dev/api/util_hunyuan.html | 2 +- dev/extension.html | 2 +- dev/index.html | 2 +- dev/project.html | 2 +- en/dev/api/azure.html | 2 +- en/dev/api/azure_onebot.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/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 | 7 ++-- 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 | 2 +- en/dev/api/plugin/func_call/index.html | 2 +- en/dev/api/plugin/func_call/models.html | 2 +- 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 | 40 +++++++++---------- 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 +- 153 files changed, 231 insertions(+), 227 deletions(-) rename assets/{dev_api_marsho.md.CbYMY9tT.js => dev_api_marsho.md.BfllRqHb.js} (99%) rename assets/{dev_api_marsho.md.CbYMY9tT.lean.js => dev_api_marsho.md.BfllRqHb.lean.js} (85%) rename assets/{dev_api_util.md.ChLZxy2z.js => dev_api_util.md.DEeRUIe8.js} (98%) rename assets/{dev_api_util.md.ChLZxy2z.lean.js => dev_api_util.md.DEeRUIe8.lean.js} (100%) rename assets/{en_dev_api_marsho.md.DsXdR6yD.js => en_dev_api_marsho.md.D54YjST5.js} (99%) rename assets/{en_dev_api_marsho.md.DsXdR6yD.lean.js => en_dev_api_marsho.md.D54YjST5.lean.js} (100%) rename assets/{en_dev_api_util.md.C3Ix0w8f.js => en_dev_api_util.md.DJBRZ231.js} (98%) rename assets/{en_dev_api_util.md.C3Ix0w8f.lean.js => en_dev_api_util.md.DJBRZ231.lean.js} (100%) diff --git a/404.html b/404.html index adcf4c2a..e083c58a 100644 --- a/404.html +++ b/404.html @@ -17,7 +17,7 @@
- + \ No newline at end of file diff --git a/assets/dev_api_marsho.md.CbYMY9tT.js b/assets/dev_api_marsho.md.BfllRqHb.js similarity index 99% rename from assets/dev_api_marsho.md.CbYMY9tT.js rename to assets/dev_api_marsho.md.BfllRqHb.js index d753d4ae..121d4e73 100644 --- a/assets/dev_api_marsho.md.CbYMY9tT.js +++ b/assets/dev_api_marsho.md.BfllRqHb.js @@ -1,4 +1,4 @@ -import{_ as i,c as a,o as n,ae as h}from"./chunks/framework.AELpvxz7.js";const d=JSON.parse('{"title":"marsho","description":"","frontmatter":{"title":"marsho","order":100},"headers":[],"relativePath":"dev/api/marsho.md","filePath":"zh/dev/api/marsho.md","lastUpdated":null}'),t={name:"dev/api/marsho.md"};function k(l,s,e,p,E,r){return n(),a("div",null,s[0]||(s[0]=[h(`

模块 nonebot_plugin_marshoai.marsho


async func at_enable()

源代码在GitHub上查看
python
async def at_enable():
+import{_ as i,c as a,o as n,ae as h}from"./chunks/framework.AELpvxz7.js";const d=JSON.parse('{"title":"marsho","description":"","frontmatter":{"title":"marsho","order":100},"headers":[],"relativePath":"dev/api/marsho.md","filePath":"zh/dev/api/marsho.md","lastUpdated":null}'),t={name:"dev/api/marsho.md"};function k(l,s,p,e,E,r){return n(),a("div",null,s[0]||(s[0]=[h(`

模块 nonebot_plugin_marshoai.marsho


async func at_enable()

源代码在GitHub上查看
python
async def at_enable():
     return config.marshoai_at

@add_usermsg_cmd.handle()

async func add_usermsg(target: MsgTarget, arg: Message = CommandArg())

源代码在GitHub上查看
python
@add_usermsg_cmd.handle()
 async def add_usermsg(target: MsgTarget, arg: Message=CommandArg()):
     if (msg := arg.extract_plain_text()):
@@ -95,6 +95,7 @@ import{_ as i,c as a,o as n,ae as h}from"./chunks/framework.AELpvxz7.js";const d
             elif i.type == 'image':
                 if is_support_image_model:
                     usermsg.append(ImageContentItem(image_url=ImageUrl(url=str(await get_image_b64(i.data['url'])))).as_dict())
+                    logger.info(f"输入图片 {i.data['url']}")
                 elif config.marshoai_enable_support_image_tip:
                     await UniMessage('*此模型不支持图片处理或管理员未启用此模型的图片支持。图片将被忽略。').send()
         backup_context = await get_backup_context(target.id, target.private)
@@ -177,7 +178,7 @@ import{_ as i,c as a,o as n,ae as h}from"./chunks/framework.AELpvxz7.js";const d
     except Exception as e:
         await UniMessage(str(e) + suggest_solution(str(e))).send()
         traceback.print_exc()
-        return

@poke_notify.handle()

async func poke(event: Event)

源代码在GitHub上查看
python
@poke_notify.handle()
+        return

@poke_notify.handle()

async func poke(event: Event)

源代码在GitHub上查看
python
@poke_notify.handle()
 async def poke(event: Event):
     user_id = event.get_user_id()
     nicknames = await get_nicknames()
diff --git a/assets/dev_api_marsho.md.CbYMY9tT.lean.js b/assets/dev_api_marsho.md.BfllRqHb.lean.js
similarity index 85%
rename from assets/dev_api_marsho.md.CbYMY9tT.lean.js
rename to assets/dev_api_marsho.md.BfllRqHb.lean.js
index 500efe8e..42472b29 100644
--- a/assets/dev_api_marsho.md.CbYMY9tT.lean.js
+++ b/assets/dev_api_marsho.md.BfllRqHb.lean.js
@@ -1 +1 @@
-import{_ as i,c as a,o as n,ae as h}from"./chunks/framework.AELpvxz7.js";const d=JSON.parse('{"title":"marsho","description":"","frontmatter":{"title":"marsho","order":100},"headers":[],"relativePath":"dev/api/marsho.md","filePath":"zh/dev/api/marsho.md","lastUpdated":null}'),t={name:"dev/api/marsho.md"};function k(l,s,e,p,E,r){return n(),a("div",null,s[0]||(s[0]=[h("",64)]))}const y=i(t,[["render",k]]);export{d as __pageData,y as default};
+import{_ as i,c as a,o as n,ae as h}from"./chunks/framework.AELpvxz7.js";const d=JSON.parse('{"title":"marsho","description":"","frontmatter":{"title":"marsho","order":100},"headers":[],"relativePath":"dev/api/marsho.md","filePath":"zh/dev/api/marsho.md","lastUpdated":null}'),t={name:"dev/api/marsho.md"};function k(l,s,p,e,E,r){return n(),a("div",null,s[0]||(s[0]=[h("",64)]))}const y=i(t,[["render",k]]);export{d as __pageData,y as default};
diff --git a/assets/dev_api_util.md.ChLZxy2z.js b/assets/dev_api_util.md.DEeRUIe8.js
similarity index 98%
rename from assets/dev_api_util.md.ChLZxy2z.js
rename to assets/dev_api_util.md.DEeRUIe8.js
index 94a15c8c..b74224c8 100644
--- a/assets/dev_api_util.md.ChLZxy2z.js
+++ b/assets/dev_api_util.md.DEeRUIe8.js
@@ -8,14 +8,14 @@ import{_ as i,c as a,o as n,ae as t}from"./chunks/framework.AELpvxz7.js";const g
             return (response.content, str(content_type))
         else:
             return None

async func get_image_b64(url: str, timeout: int = 10) -> Optional[str]

说明: 获取图片的base64编码

参数:

  • url: 图片链接
  • timeout: 超时时间 秒
源代码在GitHub上查看
python
async def get_image_b64(url: str, timeout: int=10) -> Optional[str]:
-    if (data_type := (await get_image_raw_and_type(url, timeout))):
+    if (data_type := (await get_image_raw_and_type(url.replace('https://', 'http://'), timeout))):
         base64_image = base64.b64encode(data_type[0]).decode('utf-8')
         data_url = 'data:{};base64,{}'.format(data_type[1], base64_image)
         return data_url
     else:
-        return None

async func make_chat(client: ChatCompletionsClient, msg: list, model_name: str, tools: Optional[list] = None)

说明: 调用ai获取回复

参数:

  • client: 用于与AI模型进行通信
  • msg: 消息内容
  • model_name: 指定AI模型名
  • tools: 工具列表
源代码在GitHub上查看
python
async def make_chat(client: ChatCompletionsClient, msg: list, model_name: str, tools: Optional[list]=None):
-    return await client.complete(messages=msg, model=model_name, tools=tools, temperature=config.marshoai_temperature, max_tokens=config.marshoai_max_tokens, top_p=config.marshoai_top_p)

async func make_chat_openai(client: AsyncOpenAI, msg: list, model_name: str, tools: Optional[list] = None)

说明: 使用 Openai SDK 调用ai获取回复

参数:

  • client: 用于与AI模型进行通信
  • msg: 消息内容
  • model_name: 指定AI模型名
  • tools: 工具列表
源代码在GitHub上查看
python
async def make_chat_openai(client: AsyncOpenAI, msg: list, model_name: str, tools: Optional[list]=None):
-    return await client.chat.completions.create(messages=msg, model=model_name, tools=tools or NOT_GIVEN, temperature=config.marshoai_temperature or NOT_GIVEN, max_tokens=config.marshoai_max_tokens or NOT_GIVEN, top_p=config.marshoai_top_p or NOT_GIVEN, timeout=config.marshoai_timeout)

func get_praises()

源代码在GitHub上查看
python
def get_praises():
+        return None

async func make_chat(client: ChatCompletionsClient, msg: list, model_name: str, tools: Optional[list] = None)

说明: 调用ai获取回复

参数:

  • client: 用于与AI模型进行通信
  • msg: 消息内容
  • model_name: 指定AI模型名
  • tools: 工具列表
源代码在GitHub上查看
python
async def make_chat(client: ChatCompletionsClient, msg: list, model_name: str, tools: Optional[list]=None):
+    return await client.complete(messages=msg, model=model_name, tools=tools, temperature=config.marshoai_temperature, max_tokens=config.marshoai_max_tokens, top_p=config.marshoai_top_p)

async func make_chat_openai(client: AsyncOpenAI, msg: list, model_name: str, tools: Optional[list] = None)

说明: 使用 Openai SDK 调用ai获取回复

参数:

  • client: 用于与AI模型进行通信
  • msg: 消息内容
  • model_name: 指定AI模型名
  • tools: 工具列表
源代码在GitHub上查看
python
async def make_chat_openai(client: AsyncOpenAI, msg: list, model_name: str, tools: Optional[list]=None):
+    return await client.chat.completions.create(messages=msg, model=model_name, tools=tools or NOT_GIVEN, temperature=config.marshoai_temperature or NOT_GIVEN, max_tokens=config.marshoai_max_tokens or NOT_GIVEN, top_p=config.marshoai_top_p or NOT_GIVEN, timeout=config.marshoai_timeout)

func get_praises()

源代码在GitHub上查看
python
def get_praises():
     global praises_json
     if praises_json is None:
         praises_file = store.get_plugin_data_file('praises.json')
@@ -25,7 +25,7 @@ import{_ as i,c as a,o as n,ae as t}from"./chunks/framework.AELpvxz7.js";const g
         with open(praises_file, 'r', encoding='utf-8') as f:
             data = json.load(f)
         praises_json = data
-    return praises_json

async func refresh_praises_json()

源代码在GitHub上查看
python
async def refresh_praises_json():
+    return praises_json

async func refresh_praises_json()

源代码在GitHub上查看
python
async def refresh_praises_json():
     global praises_json
     praises_file = store.get_plugin_data_file('praises.json')
     if not praises_file.exists():
@@ -33,21 +33,21 @@ import{_ as i,c as a,o as n,ae as t}from"./chunks/framework.AELpvxz7.js";const g
             json.dump(_praises_init_data, f, ensure_ascii=False, indent=4)
     async with aiofiles.open(praises_file, 'r', encoding='utf-8') as f:
         data = json.loads(await f.read())
-    praises_json = data

func build_praises() -> str

源代码在GitHub上查看
python
def build_praises() -> str:
+    praises_json = data

func build_praises() -> str

源代码在GitHub上查看
python
def build_praises() -> str:
     praises = get_praises()
     result = ['你喜欢以下几个人物,他们有各自的优点:']
     for item in praises['like']:
         result.append(f"名字:{item['name']},优点:{item['advantages']}")
-    return '\\n'.join(result)

async func save_context_to_json(name: str, context: Any, path: str)

源代码在GitHub上查看
python
async def save_context_to_json(name: str, context: Any, path: str):
+    return '\\n'.join(result)

async func save_context_to_json(name: str, context: Any, path: str)

源代码在GitHub上查看
python
async def save_context_to_json(name: str, context: Any, path: str):
     (context_dir := (store.get_plugin_data_dir() / path)).mkdir(parents=True, exist_ok=True)
     with open(context_dir / f'{name}.json', 'w', encoding='utf-8') as json_file:
-        json.dump(context, json_file, ensure_ascii=False, indent=4)

async func load_context_from_json(name: str, path: str) -> list

说明: 从指定路径加载历史记录

源代码在GitHub上查看
python
async def load_context_from_json(name: str, path: str) -> list:
+        json.dump(context, json_file, ensure_ascii=False, indent=4)

async func load_context_from_json(name: str, path: str) -> list

说明: 从指定路径加载历史记录

源代码在GitHub上查看
python
async def load_context_from_json(name: str, path: str) -> list:
     (context_dir := (store.get_plugin_data_dir() / path)).mkdir(parents=True, exist_ok=True)
     if (file_path := (context_dir / f'{name}.json')).exists():
         async with aiofiles.open(file_path, 'r', encoding='utf-8') as json_file:
             return json.loads(await json_file.read())
     else:
-        return []

async func get_nicknames()

说明: 获取nickname_json, 优先来源于全局变量

源代码在GitHub上查看
python
async def get_nicknames():
+        return []

async func get_nicknames()

说明: 获取nickname_json, 优先来源于全局变量

源代码在GitHub上查看
python
async def get_nicknames():
     global nickname_json
     if nickname_json is None:
         filename = store.get_plugin_data_file('nickname.json')
@@ -56,7 +56,7 @@ import{_ as i,c as a,o as n,ae as t}from"./chunks/framework.AELpvxz7.js";const g
                 nickname_json = json.loads(await f.read())
         except Exception:
             nickname_json = {}
-    return nickname_json

async func set_nickname(user_id: str, name: str)

源代码在GitHub上查看
python
async def set_nickname(user_id: str, name: str):
+    return nickname_json

async func set_nickname(user_id: str, name: str)

源代码在GitHub上查看
python
async def set_nickname(user_id: str, name: str):
     global nickname_json
     filename = store.get_plugin_data_file('nickname.json')
     if not filename.exists():
@@ -69,13 +69,13 @@ import{_ as i,c as a,o as n,ae as t}from"./chunks/framework.AELpvxz7.js";const g
         del data[user_id]
     with open(filename, 'w', encoding='utf-8') as f:
         json.dump(data, f, ensure_ascii=False, indent=4)
-    nickname_json = data

async func refresh_nickname_json()

说明: 强制刷新nickname_json, 刷新全局变量

源代码在GitHub上查看
python
async def refresh_nickname_json():
+    nickname_json = data

async func refresh_nickname_json()

说明: 强制刷新nickname_json, 刷新全局变量

源代码在GitHub上查看
python
async def refresh_nickname_json():
     global nickname_json
     try:
         async with aiofiles.open(store.get_plugin_data_file('nickname.json'), 'r', encoding='utf-8') as f:
             nickname_json = json.loads(await f.read())
     except Exception:
-        logger.error('刷新 nickname_json 表错误:无法载入 nickname.json 文件')

func get_prompt()

说明: 获取系统提示词

源代码在GitHub上查看
python
def get_prompt():
+        logger.error('刷新 nickname_json 表错误:无法载入 nickname.json 文件')

func get_prompt()

说明: 获取系统提示词

源代码在GitHub上查看
python
def get_prompt():
     prompts = config.marshoai_additional_prompt
     if config.marshoai_enable_praises:
         praises_prompt = build_praises()
@@ -84,12 +84,12 @@ import{_ as i,c as a,o as n,ae as t}from"./chunks/framework.AELpvxz7.js";const g
         prompts += _time_prompt.format(date_time=(current_time := DateTime.now()).strftime('%Y年%m月%d日 %H:%M:%S'), weekday_name=_weekdays[current_time.weekday()], lunar_date=current_time.chinesize.date_hanzify('农历{干支年}{生肖}{月份}{数序日}'))
     marsho_prompt = config.marshoai_prompt
     spell = SystemMessage(content=marsho_prompt + prompts).as_dict()
-    return spell

func suggest_solution(errinfo: str) -> str

源代码在GitHub上查看
python
def suggest_solution(errinfo: str) -> str:
+    return spell

func suggest_solution(errinfo: str) -> str

源代码在GitHub上查看
python
def suggest_solution(errinfo: str) -> str:
     suggestions = {'content_filter': '消息已被内容过滤器过滤。请调整聊天内容后重试。', 'RateLimitReached': '模型达到调用速率限制。请稍等一段时间或联系Bot管理员。', 'tokens_limit_reached': '请求token达到上限。请重置上下文。', 'content_length_limit': '请求体过大。请重置上下文。', 'unauthorized': '访问token无效。请联系Bot管理员。', 'invalid type: parameter messages.content is of type array but should be of type string.': '聊天请求体包含此模型不支持的数据类型。请重置上下文。', 'At most 1 image(s) may be provided in one request.': '此模型只能在上下文中包含1张图片。如果此前的聊天已经发送过图片,请重置上下文。'}
     for key, suggestion in suggestions.items():
         if key in errinfo:
             return f'\\n{suggestion}'
-    return ''

async func get_backup_context(target_id: str, target_private: bool) -> list

说明: 获取历史上下文

源代码在GitHub上查看
python
async def get_backup_context(target_id: str, target_private: bool) -> list:
+    return ''

async func get_backup_context(target_id: str, target_private: bool) -> list

说明: 获取历史上下文

源代码在GitHub上查看
python
async def get_backup_context(target_id: str, target_private: bool) -> list:
     global loaded_target_list
     if target_private:
         target_uid = f'private_{target_id}'
@@ -98,7 +98,7 @@ import{_ as i,c as a,o as n,ae as t}from"./chunks/framework.AELpvxz7.js";const g
     if target_uid not in loaded_target_list:
         loaded_target_list.append(target_uid)
         return await load_context_from_json(f'back_up_context_{target_uid}', 'contexts/backup')
-    return []

func extract_content_and_think(message: ChatCompletionMessage) -> tuple[str, str | None, ChatCompletionMessage]

说明: 处理 API 返回的消息对象,提取其中的内容和思维链,并返回处理后的消息,思维链,消息对象。

参数:

  • message (ChatCompletionMessage): API 返回的消息对象。
源代码在GitHub上查看
python
def extract_content_and_think(message: ChatCompletionMessage) -> tuple[str, str | None, ChatCompletionMessage]:
+    return []

func extract_content_and_think(message: ChatCompletionMessage) -> tuple[str, str | None, ChatCompletionMessage]

说明: 处理 API 返回的消息对象,提取其中的内容和思维链,并返回处理后的消息,思维链,消息对象。

参数:

  • message (ChatCompletionMessage): API 返回的消息对象。
源代码在GitHub上查看
python
def extract_content_and_think(message: ChatCompletionMessage) -> tuple[str, str | None, ChatCompletionMessage]:
     try:
         thinking = message.reasoning_content
     except AttributeError:
@@ -110,12 +110,12 @@ import{_ as i,c as a,o as n,ae as t}from"./chunks/framework.AELpvxz7.js";const g
         thinking = '\\n'.join([block.strip() for block in think_blocks if block.strip()])
     content = re.sub('<think>.*?</think>', '', message.content or '', flags=re.DOTALL).strip()
     message.content = content
-    return (content, thinking, message)

var latex_convert

  • 说明: 开启一个转换实例

  • 默认值: ConvertLatex()


@get_driver().on_bot_connect

async func load_latex_convert()

源代码在GitHub上查看
python
@get_driver().on_bot_connect
+    return (content, thinking, message)

var latex_convert

  • 说明: 开启一个转换实例

  • 默认值: ConvertLatex()


@get_driver().on_bot_connect

async func load_latex_convert()

源代码在GitHub上查看
python
@get_driver().on_bot_connect
 async def load_latex_convert():
-    await latex_convert.load_channel(None)

async func get_uuid_back2codeblock(msg: str, code_blank_uuid_map: list[tuple[str, str]])

源代码在GitHub上查看
python
async def get_uuid_back2codeblock(msg: str, code_blank_uuid_map: list[tuple[str, str]]):
+    await latex_convert.load_channel(None)

async func get_uuid_back2codeblock(msg: str, code_blank_uuid_map: list[tuple[str, str]])

源代码在GitHub上查看
python
async def get_uuid_back2codeblock(msg: str, code_blank_uuid_map: list[tuple[str, str]]):
     for torep, rep in code_blank_uuid_map:
         msg = msg.replace(torep, rep)
-    return msg

async func parse_richtext(msg: str) -> UniMessage

说明: 人工智能给出的回答一般不会包含 HTML 嵌入其中,但是包含图片或者 LaTeX 公式、代码块,都很正常。 这个函数会把这些都以图片形式嵌入消息体。

源代码在GitHub上查看
python
async def parse_richtext(msg: str) -> UniMessage:
+    return msg

async func parse_richtext(msg: str) -> UniMessage

说明: 人工智能给出的回答一般不会包含 HTML 嵌入其中,但是包含图片或者 LaTeX 公式、代码块,都很正常。 这个函数会把这些都以图片形式嵌入消息体。

源代码在GitHub上查看
python
async def parse_richtext(msg: str) -> UniMessage:
     if not IMG_LATEX_PATTERN.search(msg):
         return UniMessage(msg)
     result_msg = UniMessage()
diff --git a/assets/dev_api_util.md.ChLZxy2z.lean.js b/assets/dev_api_util.md.DEeRUIe8.lean.js
similarity index 100%
rename from assets/dev_api_util.md.ChLZxy2z.lean.js
rename to assets/dev_api_util.md.DEeRUIe8.lean.js
diff --git a/assets/en_dev_api_marsho.md.DsXdR6yD.js b/assets/en_dev_api_marsho.md.D54YjST5.js
similarity index 99%
rename from assets/en_dev_api_marsho.md.DsXdR6yD.js
rename to assets/en_dev_api_marsho.md.D54YjST5.js
index 8f50c26d..d1284fd3 100644
--- a/assets/en_dev_api_marsho.md.DsXdR6yD.js
+++ b/assets/en_dev_api_marsho.md.D54YjST5.js
@@ -95,6 +95,7 @@ import{_ as i,c as a,o as n,ae as h}from"./chunks/framework.AELpvxz7.js";const g
             elif i.type == 'image':
                 if is_support_image_model:
                     usermsg.append(ImageContentItem(image_url=ImageUrl(url=str(await get_image_b64(i.data['url'])))).as_dict())
+                    logger.info(f"输入图片 {i.data['url']}")
                 elif config.marshoai_enable_support_image_tip:
                     await UniMessage('*此模型不支持图片处理或管理员未启用此模型的图片支持。图片将被忽略。').send()
         backup_context = await get_backup_context(target.id, target.private)
@@ -177,7 +178,7 @@ import{_ as i,c as a,o as n,ae as h}from"./chunks/framework.AELpvxz7.js";const g
     except Exception as e:
         await UniMessage(str(e) + suggest_solution(str(e))).send()
         traceback.print_exc()
-        return

@poke_notify.handle()

async func poke(event: Event)

Source code or View on GitHub
python
@poke_notify.handle()
+        return

@poke_notify.handle()

async func poke(event: Event)

Source code or View on GitHub
python
@poke_notify.handle()
 async def poke(event: Event):
     user_id = event.get_user_id()
     nicknames = await get_nicknames()
diff --git a/assets/en_dev_api_marsho.md.DsXdR6yD.lean.js b/assets/en_dev_api_marsho.md.D54YjST5.lean.js
similarity index 100%
rename from assets/en_dev_api_marsho.md.DsXdR6yD.lean.js
rename to assets/en_dev_api_marsho.md.D54YjST5.lean.js
diff --git a/assets/en_dev_api_util.md.C3Ix0w8f.js b/assets/en_dev_api_util.md.DJBRZ231.js
similarity index 98%
rename from assets/en_dev_api_util.md.C3Ix0w8f.js
rename to assets/en_dev_api_util.md.DJBRZ231.js
index 539e57d4..8858292e 100644
--- a/assets/en_dev_api_util.md.C3Ix0w8f.js
+++ b/assets/en_dev_api_util.md.DJBRZ231.js
@@ -8,14 +8,14 @@ import{_ as i,c as a,o as n,ae as t}from"./chunks/framework.AELpvxz7.js";const g
             return (response.content, str(content_type))
         else:
             return None

async func get_image_b64(url: str, timeout: int = 10) -> Optional[str]

Description: 获取图片的base64编码

Arguments:

  • url: 图片链接
  • timeout: 超时时间 秒
Source code or View on GitHub
python
async def get_image_b64(url: str, timeout: int=10) -> Optional[str]:
-    if (data_type := (await get_image_raw_and_type(url, timeout))):
+    if (data_type := (await get_image_raw_and_type(url.replace('https://', 'http://'), timeout))):
         base64_image = base64.b64encode(data_type[0]).decode('utf-8')
         data_url = 'data:{};base64,{}'.format(data_type[1], base64_image)
         return data_url
     else:
-        return None

async func make_chat(client: ChatCompletionsClient, msg: list, model_name: str, tools: Optional[list] = None)

Description: 调用ai获取回复

Arguments:

  • client: 用于与AI模型进行通信
  • msg: 消息内容
  • model_name: 指定AI模型名
  • tools: 工具列表
Source code or View on GitHub
python
async def make_chat(client: ChatCompletionsClient, msg: list, model_name: str, tools: Optional[list]=None):
-    return await client.complete(messages=msg, model=model_name, tools=tools, temperature=config.marshoai_temperature, max_tokens=config.marshoai_max_tokens, top_p=config.marshoai_top_p)

async func make_chat_openai(client: AsyncOpenAI, msg: list, model_name: str, tools: Optional[list] = None)

Description: 使用 Openai SDK 调用ai获取回复

Arguments:

  • client: 用于与AI模型进行通信
  • msg: 消息内容
  • model_name: 指定AI模型名
  • tools: 工具列表
Source code or View on GitHub
python
async def make_chat_openai(client: AsyncOpenAI, msg: list, model_name: str, tools: Optional[list]=None):
-    return await client.chat.completions.create(messages=msg, model=model_name, tools=tools or NOT_GIVEN, temperature=config.marshoai_temperature or NOT_GIVEN, max_tokens=config.marshoai_max_tokens or NOT_GIVEN, top_p=config.marshoai_top_p or NOT_GIVEN, timeout=config.marshoai_timeout)

func get_praises()

Source code or View on GitHub
python
def get_praises():
+        return None

async func make_chat(client: ChatCompletionsClient, msg: list, model_name: str, tools: Optional[list] = None)

Description: 调用ai获取回复

Arguments:

  • client: 用于与AI模型进行通信
  • msg: 消息内容
  • model_name: 指定AI模型名
  • tools: 工具列表
Source code or View on GitHub
python
async def make_chat(client: ChatCompletionsClient, msg: list, model_name: str, tools: Optional[list]=None):
+    return await client.complete(messages=msg, model=model_name, tools=tools, temperature=config.marshoai_temperature, max_tokens=config.marshoai_max_tokens, top_p=config.marshoai_top_p)

async func make_chat_openai(client: AsyncOpenAI, msg: list, model_name: str, tools: Optional[list] = None)

Description: 使用 Openai SDK 调用ai获取回复

Arguments:

  • client: 用于与AI模型进行通信
  • msg: 消息内容
  • model_name: 指定AI模型名
  • tools: 工具列表
Source code or View on GitHub
python
async def make_chat_openai(client: AsyncOpenAI, msg: list, model_name: str, tools: Optional[list]=None):
+    return await client.chat.completions.create(messages=msg, model=model_name, tools=tools or NOT_GIVEN, temperature=config.marshoai_temperature or NOT_GIVEN, max_tokens=config.marshoai_max_tokens or NOT_GIVEN, top_p=config.marshoai_top_p or NOT_GIVEN, timeout=config.marshoai_timeout)

func get_praises()

Source code or View on GitHub
python
def get_praises():
     global praises_json
     if praises_json is None:
         praises_file = store.get_plugin_data_file('praises.json')
@@ -25,7 +25,7 @@ import{_ as i,c as a,o as n,ae as t}from"./chunks/framework.AELpvxz7.js";const g
         with open(praises_file, 'r', encoding='utf-8') as f:
             data = json.load(f)
         praises_json = data
-    return praises_json

async func refresh_praises_json()

Source code or View on GitHub
python
async def refresh_praises_json():
+    return praises_json

async func refresh_praises_json()

Source code or View on GitHub
python
async def refresh_praises_json():
     global praises_json
     praises_file = store.get_plugin_data_file('praises.json')
     if not praises_file.exists():
@@ -33,21 +33,21 @@ import{_ as i,c as a,o as n,ae as t}from"./chunks/framework.AELpvxz7.js";const g
             json.dump(_praises_init_data, f, ensure_ascii=False, indent=4)
     async with aiofiles.open(praises_file, 'r', encoding='utf-8') as f:
         data = json.loads(await f.read())
-    praises_json = data

func build_praises() -> str

Source code or View on GitHub
python
def build_praises() -> str:
+    praises_json = data

func build_praises() -> str

Source code or View on GitHub
python
def build_praises() -> str:
     praises = get_praises()
     result = ['你喜欢以下几个人物,他们有各自的优点:']
     for item in praises['like']:
         result.append(f"名字:{item['name']},优点:{item['advantages']}")
-    return '\\n'.join(result)

async func save_context_to_json(name: str, context: Any, path: str)

Source code or View on GitHub
python
async def save_context_to_json(name: str, context: Any, path: str):
+    return '\\n'.join(result)

async func save_context_to_json(name: str, context: Any, path: str)

Source code or View on GitHub
python
async def save_context_to_json(name: str, context: Any, path: str):
     (context_dir := (store.get_plugin_data_dir() / path)).mkdir(parents=True, exist_ok=True)
     with open(context_dir / f'{name}.json', 'w', encoding='utf-8') as json_file:
-        json.dump(context, json_file, ensure_ascii=False, indent=4)

async func load_context_from_json(name: str, path: str) -> list

Description: 从指定路径加载历史记录

Source code or View on GitHub
python
async def load_context_from_json(name: str, path: str) -> list:
+        json.dump(context, json_file, ensure_ascii=False, indent=4)

async func load_context_from_json(name: str, path: str) -> list

Description: 从指定路径加载历史记录

Source code or View on GitHub
python
async def load_context_from_json(name: str, path: str) -> list:
     (context_dir := (store.get_plugin_data_dir() / path)).mkdir(parents=True, exist_ok=True)
     if (file_path := (context_dir / f'{name}.json')).exists():
         async with aiofiles.open(file_path, 'r', encoding='utf-8') as json_file:
             return json.loads(await json_file.read())
     else:
-        return []

async func get_nicknames()

Description: 获取nickname_json, 优先来源于全局变量

Source code or View on GitHub
python
async def get_nicknames():
+        return []

async func get_nicknames()

Description: 获取nickname_json, 优先来源于全局变量

Source code or View on GitHub
python
async def get_nicknames():
     global nickname_json
     if nickname_json is None:
         filename = store.get_plugin_data_file('nickname.json')
@@ -56,7 +56,7 @@ import{_ as i,c as a,o as n,ae as t}from"./chunks/framework.AELpvxz7.js";const g
                 nickname_json = json.loads(await f.read())
         except Exception:
             nickname_json = {}
-    return nickname_json

async func set_nickname(user_id: str, name: str)

Source code or View on GitHub
python
async def set_nickname(user_id: str, name: str):
+    return nickname_json

async func set_nickname(user_id: str, name: str)

Source code or View on GitHub
python
async def set_nickname(user_id: str, name: str):
     global nickname_json
     filename = store.get_plugin_data_file('nickname.json')
     if not filename.exists():
@@ -69,13 +69,13 @@ import{_ as i,c as a,o as n,ae as t}from"./chunks/framework.AELpvxz7.js";const g
         del data[user_id]
     with open(filename, 'w', encoding='utf-8') as f:
         json.dump(data, f, ensure_ascii=False, indent=4)
-    nickname_json = data

async func refresh_nickname_json()

Description: 强制刷新nickname_json, 刷新全局变量

Source code or View on GitHub
python
async def refresh_nickname_json():
+    nickname_json = data

async func refresh_nickname_json()

Description: 强制刷新nickname_json, 刷新全局变量

Source code or View on GitHub
python
async def refresh_nickname_json():
     global nickname_json
     try:
         async with aiofiles.open(store.get_plugin_data_file('nickname.json'), 'r', encoding='utf-8') as f:
             nickname_json = json.loads(await f.read())
     except Exception:
-        logger.error('刷新 nickname_json 表错误:无法载入 nickname.json 文件')

func get_prompt()

Description: 获取系统提示词

Source code or View on GitHub
python
def get_prompt():
+        logger.error('刷新 nickname_json 表错误:无法载入 nickname.json 文件')

func get_prompt()

Description: 获取系统提示词

Source code or View on GitHub
python
def get_prompt():
     prompts = config.marshoai_additional_prompt
     if config.marshoai_enable_praises:
         praises_prompt = build_praises()
@@ -84,12 +84,12 @@ import{_ as i,c as a,o as n,ae as t}from"./chunks/framework.AELpvxz7.js";const g
         prompts += _time_prompt.format(date_time=(current_time := DateTime.now()).strftime('%Y年%m月%d日 %H:%M:%S'), weekday_name=_weekdays[current_time.weekday()], lunar_date=current_time.chinesize.date_hanzify('农历{干支年}{生肖}{月份}{数序日}'))
     marsho_prompt = config.marshoai_prompt
     spell = SystemMessage(content=marsho_prompt + prompts).as_dict()
-    return spell

func suggest_solution(errinfo: str) -> str

Source code or View on GitHub
python
def suggest_solution(errinfo: str) -> str:
+    return spell

func suggest_solution(errinfo: str) -> str

Source code or View on GitHub
python
def suggest_solution(errinfo: str) -> str:
     suggestions = {'content_filter': '消息已被内容过滤器过滤。请调整聊天内容后重试。', 'RateLimitReached': '模型达到调用速率限制。请稍等一段时间或联系Bot管理员。', 'tokens_limit_reached': '请求token达到上限。请重置上下文。', 'content_length_limit': '请求体过大。请重置上下文。', 'unauthorized': '访问token无效。请联系Bot管理员。', 'invalid type: parameter messages.content is of type array but should be of type string.': '聊天请求体包含此模型不支持的数据类型。请重置上下文。', 'At most 1 image(s) may be provided in one request.': '此模型只能在上下文中包含1张图片。如果此前的聊天已经发送过图片,请重置上下文。'}
     for key, suggestion in suggestions.items():
         if key in errinfo:
             return f'\\n{suggestion}'
-    return ''

async func get_backup_context(target_id: str, target_private: bool) -> list

Description: 获取历史上下文

Source code or View on GitHub
python
async def get_backup_context(target_id: str, target_private: bool) -> list:
+    return ''

async func get_backup_context(target_id: str, target_private: bool) -> list

Description: 获取历史上下文

Source code or View on GitHub
python
async def get_backup_context(target_id: str, target_private: bool) -> list:
     global loaded_target_list
     if target_private:
         target_uid = f'private_{target_id}'
@@ -98,7 +98,7 @@ import{_ as i,c as a,o as n,ae as t}from"./chunks/framework.AELpvxz7.js";const g
     if target_uid not in loaded_target_list:
         loaded_target_list.append(target_uid)
         return await load_context_from_json(f'back_up_context_{target_uid}', 'contexts/backup')
-    return []

func extract_content_and_think(message: ChatCompletionMessage) -> tuple[str, str | None, ChatCompletionMessage]

Description: 处理 API 返回的消息对象,提取其中的内容和思维链,并返回处理后的消息,思维链,消息对象。

Arguments:

  • message (ChatCompletionMessage): API 返回的消息对象。
Source code or View on GitHub
python
def extract_content_and_think(message: ChatCompletionMessage) -> tuple[str, str | None, ChatCompletionMessage]:
+    return []

func extract_content_and_think(message: ChatCompletionMessage) -> tuple[str, str | None, ChatCompletionMessage]

Description: 处理 API 返回的消息对象,提取其中的内容和思维链,并返回处理后的消息,思维链,消息对象。

Arguments:

  • message (ChatCompletionMessage): API 返回的消息对象。
Source code or View on GitHub
python
def extract_content_and_think(message: ChatCompletionMessage) -> tuple[str, str | None, ChatCompletionMessage]:
     try:
         thinking = message.reasoning_content
     except AttributeError:
@@ -110,12 +110,12 @@ import{_ as i,c as a,o as n,ae as t}from"./chunks/framework.AELpvxz7.js";const g
         thinking = '\\n'.join([block.strip() for block in think_blocks if block.strip()])
     content = re.sub('<think>.*?</think>', '', message.content or '', flags=re.DOTALL).strip()
     message.content = content
-    return (content, thinking, message)

var latex_convert

  • Description: 开启一个转换实例

  • Default: ConvertLatex()


@get_driver().on_bot_connect

async func load_latex_convert()

Source code or View on GitHub
python
@get_driver().on_bot_connect
+    return (content, thinking, message)

var latex_convert

  • Description: 开启一个转换实例

  • Default: ConvertLatex()


@get_driver().on_bot_connect

async func load_latex_convert()

Source code or View on GitHub
python
@get_driver().on_bot_connect
 async def load_latex_convert():
-    await latex_convert.load_channel(None)

async func get_uuid_back2codeblock(msg: str, code_blank_uuid_map: list[tuple[str, str]])

Source code or View on GitHub
python
async def get_uuid_back2codeblock(msg: str, code_blank_uuid_map: list[tuple[str, str]]):
+    await latex_convert.load_channel(None)

async func get_uuid_back2codeblock(msg: str, code_blank_uuid_map: list[tuple[str, str]])

Source code or View on GitHub
python
async def get_uuid_back2codeblock(msg: str, code_blank_uuid_map: list[tuple[str, str]]):
     for torep, rep in code_blank_uuid_map:
         msg = msg.replace(torep, rep)
-    return msg

async func parse_richtext(msg: str) -> UniMessage

Description: 人工智能给出的回答一般不会包含 HTML 嵌入其中,但是包含图片或者 LaTeX 公式、代码块,都很正常。 这个函数会把这些都以图片形式嵌入消息体。

Source code or View on GitHub
python
async def parse_richtext(msg: str) -> UniMessage:
+    return msg

async func parse_richtext(msg: str) -> UniMessage

Description: 人工智能给出的回答一般不会包含 HTML 嵌入其中,但是包含图片或者 LaTeX 公式、代码块,都很正常。 这个函数会把这些都以图片形式嵌入消息体。

Source code or View on GitHub
python
async def parse_richtext(msg: str) -> UniMessage:
     if not IMG_LATEX_PATTERN.search(msg):
         return UniMessage(msg)
     result_msg = UniMessage()
diff --git a/assets/en_dev_api_util.md.C3Ix0w8f.lean.js b/assets/en_dev_api_util.md.DJBRZ231.lean.js
similarity index 100%
rename from assets/en_dev_api_util.md.C3Ix0w8f.lean.js
rename to assets/en_dev_api_util.md.DJBRZ231.lean.js
diff --git a/dev/api/azure.html b/dev/api/azure.html
index e6237f3c..710825af 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

  • 说明: type: ignore

  • 默认值: event.get_message()

- + \ No newline at end of file diff --git a/dev/api/azure_onebot.html b/dev/api/azure_onebot.html index c99a9136..fbf40b9c 100644 --- a/dev/api/azure_onebot.html +++ b/dev/api/azure_onebot.html @@ -20,7 +20,7 @@ - + \ No newline at end of file diff --git a/dev/api/config.html b/dev/api/config.html index bc79f57c..ae5ed031 100644 --- a/dev/api/config.html +++ b/dev/api/config.html @@ -38,7 +38,7 @@ logger.info(f'新增配置项: {key} = {value}') old_config[key] = value return old_config
- + \ No newline at end of file diff --git a/dev/api/constants.html b/dev/api/constants.html index 6b86eda0..240b6de6 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 c9b1726c..f9e06108 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 ade2afd2..b23cbc3f 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/hooks.html b/dev/api/hooks.html index a185141a..23398491 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 9cb645d3..b1a4f585 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 b809102b..8f82c7b8 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 cb1e3e2d..ea5742df 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 e5be9541..0249ea8b 100644 --- a/dev/api/marsho.html +++ b/dev/api/marsho.html @@ -13,7 +13,7 @@ - + @@ -116,6 +116,7 @@ elif i.type == 'image': if is_support_image_model: usermsg.append(ImageContentItem(image_url=ImageUrl(url=str(await get_image_b64(i.data['url'])))).as_dict()) + logger.info(f"输入图片 {i.data['url']}") elif config.marshoai_enable_support_image_tip: await UniMessage('*此模型不支持图片处理或管理员未启用此模型的图片支持。图片将被忽略。').send() backup_context = await get_backup_context(target.id, target.private) @@ -198,7 +199,7 @@ except Exception as e: await UniMessage(str(e) + suggest_solution(str(e))).send() traceback.print_exc() - return

@poke_notify.handle()

async func poke(event: Event)

源代码在GitHub上查看
python
@poke_notify.handle()
+        return

@poke_notify.handle()

async func poke(event: Event)

源代码在GitHub上查看
python
@poke_notify.handle()
 async def poke(event: Event):
     user_id = event.get_user_id()
     nicknames = await get_nicknames()
@@ -215,7 +216,7 @@
         await UniMessage(str(e) + suggest_solution(str(e))).send()
         traceback.print_exc()
         return

var text

var request_msg

- + \ No newline at end of file diff --git a/dev/api/marsho_onebot.html b/dev/api/marsho_onebot.html index d8016790..ba944bc9 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 6900bd95..007bab34 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 0f2f284b..d37f5709 100644 --- a/dev/api/models.html +++ b/dev/api/models.html @@ -65,7 +65,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 0a424597..ebca6ec6 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 c0b3120d..fab5ad4f 100644 --- a/dev/api/plugin/func_call/caller.html +++ b/dev/api/plugin/func_call/caller.html @@ -128,7 +128,7 @@ 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_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 2bb10989..4c894e1f 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 d667f83f..8e42bff9 100644 --- a/dev/api/plugin/func_call/models.html +++ b/dev/api/plugin/func_call/models.html @@ -20,7 +20,7 @@
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 = 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 state: 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 edd8b6d5..c0d30e7d 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 03989091..12bf4b13 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 b34022f8..ac1fb70d 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 4543edd3..acca0e70 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 bd6605e6..67c0b0fb 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 e208f9cc..67620f4d 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 b86d5123..f29a22e0 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 8c41e0d6..b2bb0de8 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 907a8ff4..565f563c 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 bd750fe3..a7d69ab0 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 8e94f747..6bcc9461 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 65031781..033ab7ab 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 cecee1e8..72421a5a 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 21e39a41..e885f7d1 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 3f70882b..de62d3a5 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 045727b4..a9e2b372 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 b6ab0fd0..57a1ccf0 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 c14ffd51..53ac09da 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 3a8d75ac..d6a741d6 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 9a2a7c88..ef67ffda 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 3fc8bd40..fa900acc 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 7e8a8735..e090381b 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 5f478979..431a3b68 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 053981d7..f0cd0578 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 2aa064b9..46f2a3b1 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 5c48059d..f72cc6ba 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 d2b10b31..0f45c28e 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 88c0b9b6..9c1df8cc 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 5eac9495..6f999aca 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 96791b55..394f33de 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 d6c77b08..ae0f86a8 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 5f930c12..b8ac7f51 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 704c87bf..72bb2fad 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 d7ee1e53..1c68028c 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 4cc46652..3c1b4cb9 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 1200211d..a56f0205 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 811cb98f..dbca279e 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 18e28f22..2b8f971f 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 ab4f86b1..170dda7f 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 0e992fde..72a7ab9e 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 146f1b25..be778487 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 64bd4716..5debf423 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 67456ea5..1ed407bc 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 39d1495a..b3adf98a 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 09dfa156..1d36d51e 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 a98fa9b8..48adbf43 100644 --- a/dev/api/util.html +++ b/dev/api/util.html @@ -13,7 +13,7 @@ - + @@ -29,14 +29,14 @@ return (response.content, str(content_type)) else: return None

async func get_image_b64(url: str, timeout: int = 10) -> Optional[str]

说明: 获取图片的base64编码

参数:

源代码在GitHub上查看
python
async def get_image_b64(url: str, timeout: int=10) -> Optional[str]:
-    if (data_type := (await get_image_raw_and_type(url, timeout))):
+    if (data_type := (await get_image_raw_and_type(url.replace('https://', 'http://'), timeout))):
         base64_image = base64.b64encode(data_type[0]).decode('utf-8')
         data_url = 'data:{};base64,{}'.format(data_type[1], base64_image)
         return data_url
     else:
-        return None

async func make_chat(client: ChatCompletionsClient, msg: list, model_name: str, tools: Optional[list] = None)

说明: 调用ai获取回复

参数:

源代码在GitHub上查看
python
async def make_chat(client: ChatCompletionsClient, msg: list, model_name: str, tools: Optional[list]=None):
-    return await client.complete(messages=msg, model=model_name, tools=tools, temperature=config.marshoai_temperature, max_tokens=config.marshoai_max_tokens, top_p=config.marshoai_top_p)

async func make_chat_openai(client: AsyncOpenAI, msg: list, model_name: str, tools: Optional[list] = None)

说明: 使用 Openai SDK 调用ai获取回复

参数:

源代码在GitHub上查看
python
async def make_chat_openai(client: AsyncOpenAI, msg: list, model_name: str, tools: Optional[list]=None):
-    return await client.chat.completions.create(messages=msg, model=model_name, tools=tools or NOT_GIVEN, temperature=config.marshoai_temperature or NOT_GIVEN, max_tokens=config.marshoai_max_tokens or NOT_GIVEN, top_p=config.marshoai_top_p or NOT_GIVEN, timeout=config.marshoai_timeout)

func get_praises()

源代码在GitHub上查看
python
def get_praises():
+        return None

async func make_chat(client: ChatCompletionsClient, msg: list, model_name: str, tools: Optional[list] = None)

说明: 调用ai获取回复

参数:

源代码在GitHub上查看
python
async def make_chat(client: ChatCompletionsClient, msg: list, model_name: str, tools: Optional[list]=None):
+    return await client.complete(messages=msg, model=model_name, tools=tools, temperature=config.marshoai_temperature, max_tokens=config.marshoai_max_tokens, top_p=config.marshoai_top_p)

async func make_chat_openai(client: AsyncOpenAI, msg: list, model_name: str, tools: Optional[list] = None)

说明: 使用 Openai SDK 调用ai获取回复

参数:

源代码在GitHub上查看
python
async def make_chat_openai(client: AsyncOpenAI, msg: list, model_name: str, tools: Optional[list]=None):
+    return await client.chat.completions.create(messages=msg, model=model_name, tools=tools or NOT_GIVEN, temperature=config.marshoai_temperature or NOT_GIVEN, max_tokens=config.marshoai_max_tokens or NOT_GIVEN, top_p=config.marshoai_top_p or NOT_GIVEN, timeout=config.marshoai_timeout)

func get_praises()

源代码在GitHub上查看
python
def get_praises():
     global praises_json
     if praises_json is None:
         praises_file = store.get_plugin_data_file('praises.json')
@@ -46,7 +46,7 @@
         with open(praises_file, 'r', encoding='utf-8') as f:
             data = json.load(f)
         praises_json = data
-    return praises_json

async func refresh_praises_json()

源代码在GitHub上查看
python
async def refresh_praises_json():
+    return praises_json

async func refresh_praises_json()

源代码在GitHub上查看
python
async def refresh_praises_json():
     global praises_json
     praises_file = store.get_plugin_data_file('praises.json')
     if not praises_file.exists():
@@ -54,21 +54,21 @@
             json.dump(_praises_init_data, f, ensure_ascii=False, indent=4)
     async with aiofiles.open(praises_file, 'r', encoding='utf-8') as f:
         data = json.loads(await f.read())
-    praises_json = data

func build_praises() -> str

源代码在GitHub上查看
python
def build_praises() -> str:
+    praises_json = data

func build_praises() -> str

源代码在GitHub上查看
python
def build_praises() -> str:
     praises = get_praises()
     result = ['你喜欢以下几个人物,他们有各自的优点:']
     for item in praises['like']:
         result.append(f"名字:{item['name']},优点:{item['advantages']}")
-    return '\n'.join(result)

async func save_context_to_json(name: str, context: Any, path: str)

源代码在GitHub上查看
python
async def save_context_to_json(name: str, context: Any, path: str):
+    return '\n'.join(result)

async func save_context_to_json(name: str, context: Any, path: str)

源代码在GitHub上查看
python
async def save_context_to_json(name: str, context: Any, path: str):
     (context_dir := (store.get_plugin_data_dir() / path)).mkdir(parents=True, exist_ok=True)
     with open(context_dir / f'{name}.json', 'w', encoding='utf-8') as json_file:
-        json.dump(context, json_file, ensure_ascii=False, indent=4)

async func load_context_from_json(name: str, path: str) -> list

说明: 从指定路径加载历史记录

源代码在GitHub上查看
python
async def load_context_from_json(name: str, path: str) -> list:
+        json.dump(context, json_file, ensure_ascii=False, indent=4)

async func load_context_from_json(name: str, path: str) -> list

说明: 从指定路径加载历史记录

源代码在GitHub上查看
python
async def load_context_from_json(name: str, path: str) -> list:
     (context_dir := (store.get_plugin_data_dir() / path)).mkdir(parents=True, exist_ok=True)
     if (file_path := (context_dir / f'{name}.json')).exists():
         async with aiofiles.open(file_path, 'r', encoding='utf-8') as json_file:
             return json.loads(await json_file.read())
     else:
-        return []

async func get_nicknames()

说明: 获取nickname_json, 优先来源于全局变量

源代码在GitHub上查看
python
async def get_nicknames():
+        return []

async func get_nicknames()

说明: 获取nickname_json, 优先来源于全局变量

源代码在GitHub上查看
python
async def get_nicknames():
     global nickname_json
     if nickname_json is None:
         filename = store.get_plugin_data_file('nickname.json')
@@ -77,7 +77,7 @@
                 nickname_json = json.loads(await f.read())
         except Exception:
             nickname_json = {}
-    return nickname_json

async func set_nickname(user_id: str, name: str)

源代码在GitHub上查看
python
async def set_nickname(user_id: str, name: str):
+    return nickname_json

async func set_nickname(user_id: str, name: str)

源代码在GitHub上查看
python
async def set_nickname(user_id: str, name: str):
     global nickname_json
     filename = store.get_plugin_data_file('nickname.json')
     if not filename.exists():
@@ -90,13 +90,13 @@
         del data[user_id]
     with open(filename, 'w', encoding='utf-8') as f:
         json.dump(data, f, ensure_ascii=False, indent=4)
-    nickname_json = data

async func refresh_nickname_json()

说明: 强制刷新nickname_json, 刷新全局变量

源代码在GitHub上查看
python
async def refresh_nickname_json():
+    nickname_json = data

async func refresh_nickname_json()

说明: 强制刷新nickname_json, 刷新全局变量

源代码在GitHub上查看
python
async def refresh_nickname_json():
     global nickname_json
     try:
         async with aiofiles.open(store.get_plugin_data_file('nickname.json'), 'r', encoding='utf-8') as f:
             nickname_json = json.loads(await f.read())
     except Exception:
-        logger.error('刷新 nickname_json 表错误:无法载入 nickname.json 文件')

func get_prompt()

说明: 获取系统提示词

源代码在GitHub上查看
python
def get_prompt():
+        logger.error('刷新 nickname_json 表错误:无法载入 nickname.json 文件')

func get_prompt()

说明: 获取系统提示词

源代码在GitHub上查看
python
def get_prompt():
     prompts = config.marshoai_additional_prompt
     if config.marshoai_enable_praises:
         praises_prompt = build_praises()
@@ -105,12 +105,12 @@
         prompts += _time_prompt.format(date_time=(current_time := DateTime.now()).strftime('%Y年%m月%d日 %H:%M:%S'), weekday_name=_weekdays[current_time.weekday()], lunar_date=current_time.chinesize.date_hanzify('农历{干支年}{生肖}{月份}{数序日}'))
     marsho_prompt = config.marshoai_prompt
     spell = SystemMessage(content=marsho_prompt + prompts).as_dict()
-    return spell

func suggest_solution(errinfo: str) -> str

源代码在GitHub上查看
python
def suggest_solution(errinfo: str) -> str:
+    return spell

func suggest_solution(errinfo: str) -> str

源代码在GitHub上查看
python
def suggest_solution(errinfo: str) -> str:
     suggestions = {'content_filter': '消息已被内容过滤器过滤。请调整聊天内容后重试。', 'RateLimitReached': '模型达到调用速率限制。请稍等一段时间或联系Bot管理员。', 'tokens_limit_reached': '请求token达到上限。请重置上下文。', 'content_length_limit': '请求体过大。请重置上下文。', 'unauthorized': '访问token无效。请联系Bot管理员。', 'invalid type: parameter messages.content is of type array but should be of type string.': '聊天请求体包含此模型不支持的数据类型。请重置上下文。', 'At most 1 image(s) may be provided in one request.': '此模型只能在上下文中包含1张图片。如果此前的聊天已经发送过图片,请重置上下文。'}
     for key, suggestion in suggestions.items():
         if key in errinfo:
             return f'\n{suggestion}'
-    return ''

async func get_backup_context(target_id: str, target_private: bool) -> list

说明: 获取历史上下文

源代码在GitHub上查看
python
async def get_backup_context(target_id: str, target_private: bool) -> list:
+    return ''

async func get_backup_context(target_id: str, target_private: bool) -> list

说明: 获取历史上下文

源代码在GitHub上查看
python
async def get_backup_context(target_id: str, target_private: bool) -> list:
     global loaded_target_list
     if target_private:
         target_uid = f'private_{target_id}'
@@ -119,7 +119,7 @@
     if target_uid not in loaded_target_list:
         loaded_target_list.append(target_uid)
         return await load_context_from_json(f'back_up_context_{target_uid}', 'contexts/backup')
-    return []

func extract_content_and_think(message: ChatCompletionMessage) -> tuple[str, str | None, ChatCompletionMessage]

说明: 处理 API 返回的消息对象,提取其中的内容和思维链,并返回处理后的消息,思维链,消息对象。

参数:

源代码在GitHub上查看
python
def extract_content_and_think(message: ChatCompletionMessage) -> tuple[str, str | None, ChatCompletionMessage]:
+    return []

func extract_content_and_think(message: ChatCompletionMessage) -> tuple[str, str | None, ChatCompletionMessage]

说明: 处理 API 返回的消息对象,提取其中的内容和思维链,并返回处理后的消息,思维链,消息对象。

参数:

源代码在GitHub上查看
python
def extract_content_and_think(message: ChatCompletionMessage) -> tuple[str, str | None, ChatCompletionMessage]:
     try:
         thinking = message.reasoning_content
     except AttributeError:
@@ -131,12 +131,12 @@
         thinking = '\n'.join([block.strip() for block in think_blocks if block.strip()])
     content = re.sub('<think>.*?</think>', '', message.content or '', flags=re.DOTALL).strip()
     message.content = content
-    return (content, thinking, message)

var latex_convert


@get_driver().on_bot_connect

async func load_latex_convert()

源代码在GitHub上查看
python
@get_driver().on_bot_connect
+    return (content, thinking, message)

var latex_convert


@get_driver().on_bot_connect

async func load_latex_convert()

源代码在GitHub上查看
python
@get_driver().on_bot_connect
 async def load_latex_convert():
-    await latex_convert.load_channel(None)

async func get_uuid_back2codeblock(msg: str, code_blank_uuid_map: list[tuple[str, str]])

源代码在GitHub上查看
python
async def get_uuid_back2codeblock(msg: str, code_blank_uuid_map: list[tuple[str, str]]):
+    await latex_convert.load_channel(None)

async func get_uuid_back2codeblock(msg: str, code_blank_uuid_map: list[tuple[str, str]])

源代码在GitHub上查看
python
async def get_uuid_back2codeblock(msg: str, code_blank_uuid_map: list[tuple[str, str]]):
     for torep, rep in code_blank_uuid_map:
         msg = msg.replace(torep, rep)
-    return msg

async func parse_richtext(msg: str) -> UniMessage

说明: 人工智能给出的回答一般不会包含 HTML 嵌入其中,但是包含图片或者 LaTeX 公式、代码块,都很正常。 这个函数会把这些都以图片形式嵌入消息体。

源代码在GitHub上查看
python
async def parse_richtext(msg: str) -> UniMessage:
+    return msg

async func parse_richtext(msg: str) -> UniMessage

说明: 人工智能给出的回答一般不会包含 HTML 嵌入其中,但是包含图片或者 LaTeX 公式、代码块,都很正常。 这个函数会把这些都以图片形式嵌入消息体。

源代码在GitHub上查看
python
async def parse_richtext(msg: str) -> UniMessage:
     if not IMG_LATEX_PATTERN.search(msg):
         return UniMessage(msg)
     result_msg = UniMessage()
@@ -171,7 +171,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 44424ee6..c23b0791 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 0342cced..56e774ee 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 57033aa0..7480b65c 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 93ec6a1c..2aca4aaa 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/azure.html b/en/dev/api/azure.html index 93aace9c..d25bac82 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 4f62b197..458397bc 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/config.html b/en/dev/api/config.html index 6683a797..8474e5e2 100644 --- a/en/dev/api/config.html +++ b/en/dev/api/config.html @@ -38,7 +38,7 @@ logger.info(f'新增配置项: {key} = {value}') old_config[key] = value return old_config - + \ No newline at end of file diff --git a/en/dev/api/constants.html b/en/dev/api/constants.html index 848ac8c3..e6b8eec4 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 a94423d2..d3ab6c31 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 a843f7cd..4cbcc5c4 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/hooks.html b/en/dev/api/hooks.html index 47d0635c..f7953257 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 e56c982b..ce4479d0 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 b3942e12..41ad4ab3 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 770a2f01..445425c5 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 6ceffd57..0bcbf0de 100644 --- a/en/dev/api/marsho.html +++ b/en/dev/api/marsho.html @@ -13,7 +13,7 @@ - + @@ -116,6 +116,7 @@ elif i.type == 'image': if is_support_image_model: usermsg.append(ImageContentItem(image_url=ImageUrl(url=str(await get_image_b64(i.data['url'])))).as_dict()) + logger.info(f"输入图片 {i.data['url']}") elif config.marshoai_enable_support_image_tip: await UniMessage('*此模型不支持图片处理或管理员未启用此模型的图片支持。图片将被忽略。').send() backup_context = await get_backup_context(target.id, target.private) @@ -198,7 +199,7 @@ except Exception as e: await UniMessage(str(e) + suggest_solution(str(e))).send() traceback.print_exc() - return

@poke_notify.handle()

async func poke(event: Event)

Source code or View on GitHub
python
@poke_notify.handle()
+        return

@poke_notify.handle()

async func poke(event: Event)

Source code or View on GitHub
python
@poke_notify.handle()
 async def poke(event: Event):
     user_id = event.get_user_id()
     nicknames = await get_nicknames()
@@ -215,7 +216,7 @@
         await UniMessage(str(e) + suggest_solution(str(e))).send()
         traceback.print_exc()
         return

var text

var request_msg

- + \ No newline at end of file diff --git a/en/dev/api/marsho_onebot.html b/en/dev/api/marsho_onebot.html index f8b0e451..c073ffd9 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 c3e5893f..39e2dc27 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 6656edea..705eeb14 100644 --- a/en/dev/api/models.html +++ b/en/dev/api/models.html @@ -65,7 +65,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 dd144c90..c43ee403 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 cab72cc4..4044a640 100644 --- a/en/dev/api/plugin/func_call/caller.html +++ b/en/dev/api/plugin/func_call/caller.html @@ -128,7 +128,7 @@ 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_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 d00c62cd..9a2b1937 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 ff6430a5..281f8c79 100644 --- a/en/dev/api/plugin/func_call/models.html +++ b/en/dev/api/plugin/func_call/models.html @@ -20,7 +20,7 @@
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 = 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 state: 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 7d874630..4c3745f6 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 a78ba83e..0088bdc6 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 d9d51f3d..da6e009c 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 2685859e..5a816be9 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 f102ffe6..bf8684d6 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 5dc65820..f08fd0fd 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 6a5b1b5c..41ed5026 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 059e866e..3fda5d5c 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 48d4c7dd..c0338595 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 02a3c226..dd309215 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 16b44408..24684c49 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 877412cf..294c0289 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 3d5272ad..9455a004 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 6b6d4417..d22ce4df 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 1a5335ec..0bc177cd 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 ed91c5f1..c7a694cc 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 efcc970d..9e360bcb 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 c36afb8d..e2dc032c 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 937086c5..62759191 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 94268686..9949eb0b 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 dbbd4b4f..72d5fa0e 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 3aa8e882..77aa7e68 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 2eb6c5eb..b060241d 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 60f3ef6a..e05d1f02 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 4a67d0a2..0b7135f3 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 d4f2e6eb..d6bcb266 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 ee55f715..88492557 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 ac28b29d..bc252071 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 92becbf4..40cdd353 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 ba707ee2..bf0fc251 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 033ed3e1..6b58eaf5 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 cfa26f6d..a140b0cb 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 dc93deef..49ab194a 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 73b971b6..33627467 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 ceb76add..1f7fc4bb 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 38949744..db083134 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 3f578331..6d05ab04 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 32b7458c..597fd08c 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 f73a6769..99de1d8f 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 2a196523..eec1a8e6 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 cb2bb350..b440a51f 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 d1472b9e..0dffc3ac 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 f985afca..c7018896 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 fb46d6e5..9ffe2fe2 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 33ba03ad..ace73957 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 d2cae1bf..be2001ea 100644 --- a/en/dev/api/util.html +++ b/en/dev/api/util.html @@ -13,7 +13,7 @@ - + @@ -29,14 +29,14 @@ return (response.content, str(content_type)) else: return None

async func get_image_b64(url: str, timeout: int = 10) -> Optional[str]

Description: 获取图片的base64编码

Arguments:

Source code or View on GitHub
python
async def get_image_b64(url: str, timeout: int=10) -> Optional[str]:
-    if (data_type := (await get_image_raw_and_type(url, timeout))):
+    if (data_type := (await get_image_raw_and_type(url.replace('https://', 'http://'), timeout))):
         base64_image = base64.b64encode(data_type[0]).decode('utf-8')
         data_url = 'data:{};base64,{}'.format(data_type[1], base64_image)
         return data_url
     else:
-        return None

async func make_chat(client: ChatCompletionsClient, msg: list, model_name: str, tools: Optional[list] = None)

Description: 调用ai获取回复

Arguments:

Source code or View on GitHub
python
async def make_chat(client: ChatCompletionsClient, msg: list, model_name: str, tools: Optional[list]=None):
-    return await client.complete(messages=msg, model=model_name, tools=tools, temperature=config.marshoai_temperature, max_tokens=config.marshoai_max_tokens, top_p=config.marshoai_top_p)

async func make_chat_openai(client: AsyncOpenAI, msg: list, model_name: str, tools: Optional[list] = None)

Description: 使用 Openai SDK 调用ai获取回复

Arguments:

Source code or View on GitHub
python
async def make_chat_openai(client: AsyncOpenAI, msg: list, model_name: str, tools: Optional[list]=None):
-    return await client.chat.completions.create(messages=msg, model=model_name, tools=tools or NOT_GIVEN, temperature=config.marshoai_temperature or NOT_GIVEN, max_tokens=config.marshoai_max_tokens or NOT_GIVEN, top_p=config.marshoai_top_p or NOT_GIVEN, timeout=config.marshoai_timeout)

func get_praises()

Source code or View on GitHub
python
def get_praises():
+        return None

async func make_chat(client: ChatCompletionsClient, msg: list, model_name: str, tools: Optional[list] = None)

Description: 调用ai获取回复

Arguments:

Source code or View on GitHub
python
async def make_chat(client: ChatCompletionsClient, msg: list, model_name: str, tools: Optional[list]=None):
+    return await client.complete(messages=msg, model=model_name, tools=tools, temperature=config.marshoai_temperature, max_tokens=config.marshoai_max_tokens, top_p=config.marshoai_top_p)

async func make_chat_openai(client: AsyncOpenAI, msg: list, model_name: str, tools: Optional[list] = None)

Description: 使用 Openai SDK 调用ai获取回复

Arguments:

Source code or View on GitHub
python
async def make_chat_openai(client: AsyncOpenAI, msg: list, model_name: str, tools: Optional[list]=None):
+    return await client.chat.completions.create(messages=msg, model=model_name, tools=tools or NOT_GIVEN, temperature=config.marshoai_temperature or NOT_GIVEN, max_tokens=config.marshoai_max_tokens or NOT_GIVEN, top_p=config.marshoai_top_p or NOT_GIVEN, timeout=config.marshoai_timeout)

func get_praises()

Source code or View on GitHub
python
def get_praises():
     global praises_json
     if praises_json is None:
         praises_file = store.get_plugin_data_file('praises.json')
@@ -46,7 +46,7 @@
         with open(praises_file, 'r', encoding='utf-8') as f:
             data = json.load(f)
         praises_json = data
-    return praises_json

async func refresh_praises_json()

Source code or View on GitHub
python
async def refresh_praises_json():
+    return praises_json

async func refresh_praises_json()

Source code or View on GitHub
python
async def refresh_praises_json():
     global praises_json
     praises_file = store.get_plugin_data_file('praises.json')
     if not praises_file.exists():
@@ -54,21 +54,21 @@
             json.dump(_praises_init_data, f, ensure_ascii=False, indent=4)
     async with aiofiles.open(praises_file, 'r', encoding='utf-8') as f:
         data = json.loads(await f.read())
-    praises_json = data

func build_praises() -> str

Source code or View on GitHub
python
def build_praises() -> str:
+    praises_json = data

func build_praises() -> str

Source code or View on GitHub
python
def build_praises() -> str:
     praises = get_praises()
     result = ['你喜欢以下几个人物,他们有各自的优点:']
     for item in praises['like']:
         result.append(f"名字:{item['name']},优点:{item['advantages']}")
-    return '\n'.join(result)

async func save_context_to_json(name: str, context: Any, path: str)

Source code or View on GitHub
python
async def save_context_to_json(name: str, context: Any, path: str):
+    return '\n'.join(result)

async func save_context_to_json(name: str, context: Any, path: str)

Source code or View on GitHub
python
async def save_context_to_json(name: str, context: Any, path: str):
     (context_dir := (store.get_plugin_data_dir() / path)).mkdir(parents=True, exist_ok=True)
     with open(context_dir / f'{name}.json', 'w', encoding='utf-8') as json_file:
-        json.dump(context, json_file, ensure_ascii=False, indent=4)

async func load_context_from_json(name: str, path: str) -> list

Description: 从指定路径加载历史记录

Source code or View on GitHub
python
async def load_context_from_json(name: str, path: str) -> list:
+        json.dump(context, json_file, ensure_ascii=False, indent=4)

async func load_context_from_json(name: str, path: str) -> list

Description: 从指定路径加载历史记录

Source code or View on GitHub
python
async def load_context_from_json(name: str, path: str) -> list:
     (context_dir := (store.get_plugin_data_dir() / path)).mkdir(parents=True, exist_ok=True)
     if (file_path := (context_dir / f'{name}.json')).exists():
         async with aiofiles.open(file_path, 'r', encoding='utf-8') as json_file:
             return json.loads(await json_file.read())
     else:
-        return []

async func get_nicknames()

Description: 获取nickname_json, 优先来源于全局变量

Source code or View on GitHub
python
async def get_nicknames():
+        return []

async func get_nicknames()

Description: 获取nickname_json, 优先来源于全局变量

Source code or View on GitHub
python
async def get_nicknames():
     global nickname_json
     if nickname_json is None:
         filename = store.get_plugin_data_file('nickname.json')
@@ -77,7 +77,7 @@
                 nickname_json = json.loads(await f.read())
         except Exception:
             nickname_json = {}
-    return nickname_json

async func set_nickname(user_id: str, name: str)

Source code or View on GitHub
python
async def set_nickname(user_id: str, name: str):
+    return nickname_json

async func set_nickname(user_id: str, name: str)

Source code or View on GitHub
python
async def set_nickname(user_id: str, name: str):
     global nickname_json
     filename = store.get_plugin_data_file('nickname.json')
     if not filename.exists():
@@ -90,13 +90,13 @@
         del data[user_id]
     with open(filename, 'w', encoding='utf-8') as f:
         json.dump(data, f, ensure_ascii=False, indent=4)
-    nickname_json = data

async func refresh_nickname_json()

Description: 强制刷新nickname_json, 刷新全局变量

Source code or View on GitHub
python
async def refresh_nickname_json():
+    nickname_json = data

async func refresh_nickname_json()

Description: 强制刷新nickname_json, 刷新全局变量

Source code or View on GitHub
python
async def refresh_nickname_json():
     global nickname_json
     try:
         async with aiofiles.open(store.get_plugin_data_file('nickname.json'), 'r', encoding='utf-8') as f:
             nickname_json = json.loads(await f.read())
     except Exception:
-        logger.error('刷新 nickname_json 表错误:无法载入 nickname.json 文件')

func get_prompt()

Description: 获取系统提示词

Source code or View on GitHub
python
def get_prompt():
+        logger.error('刷新 nickname_json 表错误:无法载入 nickname.json 文件')

func get_prompt()

Description: 获取系统提示词

Source code or View on GitHub
python
def get_prompt():
     prompts = config.marshoai_additional_prompt
     if config.marshoai_enable_praises:
         praises_prompt = build_praises()
@@ -105,12 +105,12 @@
         prompts += _time_prompt.format(date_time=(current_time := DateTime.now()).strftime('%Y年%m月%d日 %H:%M:%S'), weekday_name=_weekdays[current_time.weekday()], lunar_date=current_time.chinesize.date_hanzify('农历{干支年}{生肖}{月份}{数序日}'))
     marsho_prompt = config.marshoai_prompt
     spell = SystemMessage(content=marsho_prompt + prompts).as_dict()
-    return spell

func suggest_solution(errinfo: str) -> str

Source code or View on GitHub
python
def suggest_solution(errinfo: str) -> str:
+    return spell

func suggest_solution(errinfo: str) -> str

Source code or View on GitHub
python
def suggest_solution(errinfo: str) -> str:
     suggestions = {'content_filter': '消息已被内容过滤器过滤。请调整聊天内容后重试。', 'RateLimitReached': '模型达到调用速率限制。请稍等一段时间或联系Bot管理员。', 'tokens_limit_reached': '请求token达到上限。请重置上下文。', 'content_length_limit': '请求体过大。请重置上下文。', 'unauthorized': '访问token无效。请联系Bot管理员。', 'invalid type: parameter messages.content is of type array but should be of type string.': '聊天请求体包含此模型不支持的数据类型。请重置上下文。', 'At most 1 image(s) may be provided in one request.': '此模型只能在上下文中包含1张图片。如果此前的聊天已经发送过图片,请重置上下文。'}
     for key, suggestion in suggestions.items():
         if key in errinfo:
             return f'\n{suggestion}'
-    return ''

async func get_backup_context(target_id: str, target_private: bool) -> list

Description: 获取历史上下文

Source code or View on GitHub
python
async def get_backup_context(target_id: str, target_private: bool) -> list:
+    return ''

async func get_backup_context(target_id: str, target_private: bool) -> list

Description: 获取历史上下文

Source code or View on GitHub
python
async def get_backup_context(target_id: str, target_private: bool) -> list:
     global loaded_target_list
     if target_private:
         target_uid = f'private_{target_id}'
@@ -119,7 +119,7 @@
     if target_uid not in loaded_target_list:
         loaded_target_list.append(target_uid)
         return await load_context_from_json(f'back_up_context_{target_uid}', 'contexts/backup')
-    return []

func extract_content_and_think(message: ChatCompletionMessage) -> tuple[str, str | None, ChatCompletionMessage]

Description: 处理 API 返回的消息对象,提取其中的内容和思维链,并返回处理后的消息,思维链,消息对象。

Arguments:

Source code or View on GitHub
python
def extract_content_and_think(message: ChatCompletionMessage) -> tuple[str, str | None, ChatCompletionMessage]:
+    return []

func extract_content_and_think(message: ChatCompletionMessage) -> tuple[str, str | None, ChatCompletionMessage]

Description: 处理 API 返回的消息对象,提取其中的内容和思维链,并返回处理后的消息,思维链,消息对象。

Arguments:

Source code or View on GitHub
python
def extract_content_and_think(message: ChatCompletionMessage) -> tuple[str, str | None, ChatCompletionMessage]:
     try:
         thinking = message.reasoning_content
     except AttributeError:
@@ -131,12 +131,12 @@
         thinking = '\n'.join([block.strip() for block in think_blocks if block.strip()])
     content = re.sub('<think>.*?</think>', '', message.content or '', flags=re.DOTALL).strip()
     message.content = content
-    return (content, thinking, message)

var latex_convert


@get_driver().on_bot_connect

async func load_latex_convert()

Source code or View on GitHub
python
@get_driver().on_bot_connect
+    return (content, thinking, message)

var latex_convert


@get_driver().on_bot_connect

async func load_latex_convert()

Source code or View on GitHub
python
@get_driver().on_bot_connect
 async def load_latex_convert():
-    await latex_convert.load_channel(None)

async func get_uuid_back2codeblock(msg: str, code_blank_uuid_map: list[tuple[str, str]])

Source code or View on GitHub
python
async def get_uuid_back2codeblock(msg: str, code_blank_uuid_map: list[tuple[str, str]]):
+    await latex_convert.load_channel(None)

async func get_uuid_back2codeblock(msg: str, code_blank_uuid_map: list[tuple[str, str]])

Source code or View on GitHub
python
async def get_uuid_back2codeblock(msg: str, code_blank_uuid_map: list[tuple[str, str]]):
     for torep, rep in code_blank_uuid_map:
         msg = msg.replace(torep, rep)
-    return msg

async func parse_richtext(msg: str) -> UniMessage

Description: 人工智能给出的回答一般不会包含 HTML 嵌入其中,但是包含图片或者 LaTeX 公式、代码块,都很正常。 这个函数会把这些都以图片形式嵌入消息体。

Source code or View on GitHub
python
async def parse_richtext(msg: str) -> UniMessage:
+    return msg

async func parse_richtext(msg: str) -> UniMessage

Description: 人工智能给出的回答一般不会包含 HTML 嵌入其中,但是包含图片或者 LaTeX 公式、代码块,都很正常。 这个函数会把这些都以图片形式嵌入消息体。

Source code or View on GitHub
python
async def parse_richtext(msg: str) -> UniMessage:
     if not IMG_LATEX_PATTERN.search(msg):
         return UniMessage(msg)
     result_msg = UniMessage()
@@ -171,7 +171,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 7cf60240..7045c0aa 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 f7df353e..373665a0 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 04375fc5..57468fda 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 3c781bad..3f36aea2 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 4cdd5c63..5bd96677 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 ※Some models(o1 and so on) don't support it
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_TEMPERATUREfloatnulltemperature parameter
MARSHOAI_TOP_PfloatnullNucleus Sampling parameter
MARSHOAI_MAX_TOKENSintnullMax token number
MARSHOAI_ADDITIONAL_IMAGE_MODELSlist[]External image-support model list, such as hunyuan-vision
MARSHOAI_NICKNAME_LIMITint16Limit for nickname length
MARSHOAI_TIMEOUTfloat50AI 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_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 4166da18..d6f725a1 100644 --- a/hashmap.json +++ b/hashmap.json @@ -1 +1 @@ -{"dev_api_azure.md":"BWxHkwhT","dev_api_azure_onebot.md":"BsJhgztq","dev_api_config.md":"BZQygKZM","dev_api_constants.md":"BQXkHkcu","dev_api_deal_latex.md":"CcbPszxu","dev_api_dev.md":"D3bR8yUw","dev_api_hooks.md":"Dx3JiNYl","dev_api_hunyuan.md":"84ZOS2dB","dev_api_index.md":"CKz7r0xO","dev_api_instances.md":"D0EGVkFU","dev_api_marsho.md":"CbYMY9tT","dev_api_marsho_onebot.md":"DVPrHwsF","dev_api_metadata.md":"DcWsjAzN","dev_api_models.md":"-PFe3xV6","dev_api_observer.md":"BxJvd7GM","dev_api_plugin_func_call_caller.md":"B-Afofa_","dev_api_plugin_func_call_index.md":"DJqaEalq","dev_api_plugin_func_call_models.md":"BzVX8der","dev_api_plugin_func_call_params.md":"GsAhbAnt","dev_api_plugin_func_call_utils.md":"Cv6vsuiA","dev_api_plugin_index.md":"C9mfk9HL","dev_api_plugin_load.md":"BaKQuUHB","dev_api_plugin_models.md":"Tm7t-ikW","dev_api_plugin_register.md":"DSL2EGTF","dev_api_plugin_typing.md":"CBPWUMVA","dev_api_plugin_utils.md":"BTfSKGuq","dev_api_plugins_builtin_tools_chat.md":"aFal8Gow","dev_api_plugins_builtin_tools_file_io.md":"BKz6hg1O","dev_api_plugins_builtin_tools_index.md":"-VV3V62O","dev_api_plugins_builtin_tools_liteyuki.md":"DzKH_VlV","dev_api_plugins_builtin_tools_manager.md":"BuenSvBP","dev_api_plugins_builtin_tools_network.md":"dF5tbLpw","dev_api_plugins_builtin_tools_utils.md":"CAzqH2x9","dev_api_plugins_marshoai_bangumi_index.md":"17VF_fLc","dev_api_plugins_marshoai_basic_index.md":"TTNgR0hC","dev_api_plugins_test_marshoai_basic_index.md":"BRO5viiM","dev_api_plugins_test_marshoai_memory_command.md":"Bweavysv","dev_api_plugins_test_marshoai_memory_config.md":"1MjwossB","dev_api_plugins_test_marshoai_memory_index.md":"DT78YGqo","dev_api_plugins_test_random_number_generator.md":"CMxdtMHP","dev_api_plugins_test_snowykami_testplugin_index.md":"CXbiHEYp","dev_api_plugins_test_weather_demo.md":"DqU_unWp","dev_api_plugins_twisuki_megakits_index.md":"-woi3Nla","dev_api_plugins_twisuki_megakits_mk_morse_code.md":"DcFUIHkA","dev_api_plugins_twisuki_megakits_mk_nya_code.md":"C3bf8sjb","dev_api_plugins_twisuki_petcat_index.md":"DrBGExmf","dev_api_plugins_twisuki_petcat_pc_cat.md":"CHiYX-sA","dev_api_plugins_twisuki_petcat_pc_info.md":"Bf0kh5d7","dev_api_plugins_twisuki_petcat_pc_shop.md":"DjOux-Bu","dev_api_plugins_twisuki_petcat_pc_token.md":"CUonlZEg","dev_api_tools_marshoai_bangumi_index.md":"AgX3pxXS","dev_api_tools_marshoai_basic_index.md":"Ch_Siirr","dev_api_tools_marshoai_megakits_index.md":"C7Wrewvp","dev_api_tools_marshoai_megakits_mk_common.md":"BM5eSRuV","dev_api_tools_marshoai_megakits_mk_info.md":"C1kleNHU","dev_api_tools_marshoai_megakits_mk_morse_code.md":"Ck4fcY80","dev_api_tools_marshoai_megakits_mk_nya_code.md":"BD-geeZX","dev_api_tools_marshoai_memory_index.md":"D12ATfZV","dev_api_tools_marshoai_meogirl_index.md":"D329UtlF","dev_api_tools_marshoai_meogirl_mg_info.md":"BGx2xHo4","dev_api_tools_marshoai_meogirl_mg_introduce.md":"DFmMY7uc","dev_api_tools_marshoai_meogirl_mg_search.md":"DQcDOb49","dev_api_tools_wip_marshoai_memory_index.md":"CVH4XmiE","dev_api_util.md":"ChLZxy2z","dev_api_util_hunyuan.md":"BKSF1JNE","dev_extension.md":"MeX5SXJC","dev_index.md":"ZMOYQWTr","dev_project.md":"CT7Wi5Sp","en_dev_api_azure.md":"D2NkLSs5","en_dev_api_azure_onebot.md":"CkpsHNA3","en_dev_api_config.md":"DeZ7DeZC","en_dev_api_constants.md":"9cK-2Rnd","en_dev_api_deal_latex.md":"CDNhgyqb","en_dev_api_dev.md":"DwQwAQ2O","en_dev_api_hooks.md":"B8fuQmIt","en_dev_api_hunyuan.md":"BREw4BH2","en_dev_api_index.md":"D6wqE3Go","en_dev_api_instances.md":"C-rZEpVa","en_dev_api_marsho.md":"DsXdR6yD","en_dev_api_marsho_onebot.md":"DnSZOfp1","en_dev_api_metadata.md":"D7OEYakw","en_dev_api_models.md":"ud2_nMfy","en_dev_api_observer.md":"Buavwltn","en_dev_api_plugin_func_call_caller.md":"CmmMyc7F","en_dev_api_plugin_func_call_index.md":"DHzPv4Ru","en_dev_api_plugin_func_call_models.md":"DEU3e-ya","en_dev_api_plugin_func_call_params.md":"DRLswz-P","en_dev_api_plugin_func_call_utils.md":"DsqMXz_K","en_dev_api_plugin_index.md":"BkRnWH4_","en_dev_api_plugin_load.md":"BqI5wsjI","en_dev_api_plugin_models.md":"oxy5gRRp","en_dev_api_plugin_register.md":"DX9dpKIB","en_dev_api_plugin_typing.md":"BkmgBa4M","en_dev_api_plugin_utils.md":"DU4V8pmV","en_dev_api_plugins_builtin_tools_chat.md":"NZM89geB","en_dev_api_plugins_builtin_tools_file_io.md":"tW4VmItn","en_dev_api_plugins_builtin_tools_index.md":"C-XkxGtY","en_dev_api_plugins_builtin_tools_liteyuki.md":"RQry7oYv","en_dev_api_plugins_builtin_tools_manager.md":"0b459wxY","en_dev_api_plugins_builtin_tools_network.md":"-ABGsH5V","en_dev_api_plugins_builtin_tools_utils.md":"YU2iLw8W","en_dev_api_plugins_marshoai_bangumi_index.md":"BybXEg8m","en_dev_api_plugins_marshoai_basic_index.md":"DeeLIVrI","en_dev_api_plugins_test_marshoai_basic_index.md":"wMr4Ve9L","en_dev_api_plugins_test_marshoai_memory_command.md":"C6E66iFg","en_dev_api_plugins_test_marshoai_memory_config.md":"INuymK3L","en_dev_api_plugins_test_marshoai_memory_index.md":"D6RlqtVH","en_dev_api_plugins_test_random_number_generator.md":"BX4GQvB8","en_dev_api_plugins_test_snowykami_testplugin_index.md":"BayHCb8s","en_dev_api_plugins_test_weather_demo.md":"CSDh9TgV","en_dev_api_plugins_twisuki_megakits_index.md":"ONfKcuRP","en_dev_api_plugins_twisuki_megakits_mk_morse_code.md":"YkyuSz4X","en_dev_api_plugins_twisuki_megakits_mk_nya_code.md":"C5O4Xv8O","en_dev_api_plugins_twisuki_petcat_index.md":"C7CHQqy2","en_dev_api_plugins_twisuki_petcat_pc_cat.md":"CRx4SeFR","en_dev_api_plugins_twisuki_petcat_pc_info.md":"DmAZ17n9","en_dev_api_plugins_twisuki_petcat_pc_shop.md":"tvO7JKea","en_dev_api_plugins_twisuki_petcat_pc_token.md":"Bs6TDv2w","en_dev_api_tools_marshoai_bangumi_index.md":"CQOz1f3Y","en_dev_api_tools_marshoai_basic_index.md":"DdtXVLj-","en_dev_api_tools_marshoai_megakits_index.md":"BD0eqLf4","en_dev_api_tools_marshoai_megakits_mk_common.md":"B2t_B3CF","en_dev_api_tools_marshoai_megakits_mk_info.md":"BJ4oiY1p","en_dev_api_tools_marshoai_megakits_mk_morse_code.md":"D9jpqguN","en_dev_api_tools_marshoai_megakits_mk_nya_code.md":"BFEjDzeJ","en_dev_api_tools_marshoai_memory_index.md":"CFtluJuC","en_dev_api_tools_marshoai_meogirl_index.md":"Bz7f_dXk","en_dev_api_tools_marshoai_meogirl_mg_info.md":"XSL809yZ","en_dev_api_tools_marshoai_meogirl_mg_introduce.md":"B9C0fcLo","en_dev_api_tools_marshoai_meogirl_mg_search.md":"CnuveyHi","en_dev_api_tools_wip_marshoai_memory_index.md":"Dof0UKI9","en_dev_api_util.md":"C3Ix0w8f","en_dev_api_util_hunyuan.md":"BCpNZGK5","en_dev_index.md":"DG35zGMQ","en_index.md":"fR4OoA7a","en_start_index.md":"DCunCG6I","en_start_install.md":"DdHi3Ttu","index.md":"C0OrEz4R","ja_index.md":"DFz97jLH","start_index.md":"CHwPvREK","start_install-old.md":"Ca7nPfgk","start_install.md":"BLebC2pi","start_use.md":"DeU3oXMj"} +{"dev_api_azure.md":"BWxHkwhT","dev_api_azure_onebot.md":"BsJhgztq","dev_api_config.md":"BZQygKZM","dev_api_constants.md":"BQXkHkcu","dev_api_deal_latex.md":"CcbPszxu","dev_api_dev.md":"D3bR8yUw","dev_api_hooks.md":"Dx3JiNYl","dev_api_hunyuan.md":"84ZOS2dB","dev_api_index.md":"CKz7r0xO","dev_api_instances.md":"D0EGVkFU","dev_api_marsho.md":"BfllRqHb","dev_api_marsho_onebot.md":"DVPrHwsF","dev_api_metadata.md":"DcWsjAzN","dev_api_models.md":"-PFe3xV6","dev_api_observer.md":"BxJvd7GM","dev_api_plugin_func_call_caller.md":"B-Afofa_","dev_api_plugin_func_call_index.md":"DJqaEalq","dev_api_plugin_func_call_models.md":"BzVX8der","dev_api_plugin_func_call_params.md":"GsAhbAnt","dev_api_plugin_func_call_utils.md":"Cv6vsuiA","dev_api_plugin_index.md":"C9mfk9HL","dev_api_plugin_load.md":"BaKQuUHB","dev_api_plugin_models.md":"Tm7t-ikW","dev_api_plugin_register.md":"DSL2EGTF","dev_api_plugin_typing.md":"CBPWUMVA","dev_api_plugin_utils.md":"BTfSKGuq","dev_api_plugins_builtin_tools_chat.md":"aFal8Gow","dev_api_plugins_builtin_tools_file_io.md":"BKz6hg1O","dev_api_plugins_builtin_tools_index.md":"-VV3V62O","dev_api_plugins_builtin_tools_liteyuki.md":"DzKH_VlV","dev_api_plugins_builtin_tools_manager.md":"BuenSvBP","dev_api_plugins_builtin_tools_network.md":"dF5tbLpw","dev_api_plugins_builtin_tools_utils.md":"CAzqH2x9","dev_api_plugins_marshoai_bangumi_index.md":"17VF_fLc","dev_api_plugins_marshoai_basic_index.md":"TTNgR0hC","dev_api_plugins_test_marshoai_basic_index.md":"BRO5viiM","dev_api_plugins_test_marshoai_memory_command.md":"Bweavysv","dev_api_plugins_test_marshoai_memory_config.md":"1MjwossB","dev_api_plugins_test_marshoai_memory_index.md":"DT78YGqo","dev_api_plugins_test_random_number_generator.md":"CMxdtMHP","dev_api_plugins_test_snowykami_testplugin_index.md":"CXbiHEYp","dev_api_plugins_test_weather_demo.md":"DqU_unWp","dev_api_plugins_twisuki_megakits_index.md":"-woi3Nla","dev_api_plugins_twisuki_megakits_mk_morse_code.md":"DcFUIHkA","dev_api_plugins_twisuki_megakits_mk_nya_code.md":"C3bf8sjb","dev_api_plugins_twisuki_petcat_index.md":"DrBGExmf","dev_api_plugins_twisuki_petcat_pc_cat.md":"CHiYX-sA","dev_api_plugins_twisuki_petcat_pc_info.md":"Bf0kh5d7","dev_api_plugins_twisuki_petcat_pc_shop.md":"DjOux-Bu","dev_api_plugins_twisuki_petcat_pc_token.md":"CUonlZEg","dev_api_tools_marshoai_bangumi_index.md":"AgX3pxXS","dev_api_tools_marshoai_basic_index.md":"Ch_Siirr","dev_api_tools_marshoai_megakits_index.md":"C7Wrewvp","dev_api_tools_marshoai_megakits_mk_common.md":"BM5eSRuV","dev_api_tools_marshoai_megakits_mk_info.md":"C1kleNHU","dev_api_tools_marshoai_megakits_mk_morse_code.md":"Ck4fcY80","dev_api_tools_marshoai_megakits_mk_nya_code.md":"BD-geeZX","dev_api_tools_marshoai_memory_index.md":"D12ATfZV","dev_api_tools_marshoai_meogirl_index.md":"D329UtlF","dev_api_tools_marshoai_meogirl_mg_info.md":"BGx2xHo4","dev_api_tools_marshoai_meogirl_mg_introduce.md":"DFmMY7uc","dev_api_tools_marshoai_meogirl_mg_search.md":"DQcDOb49","dev_api_tools_wip_marshoai_memory_index.md":"CVH4XmiE","dev_api_util.md":"DEeRUIe8","dev_api_util_hunyuan.md":"BKSF1JNE","dev_extension.md":"MeX5SXJC","dev_index.md":"ZMOYQWTr","dev_project.md":"CT7Wi5Sp","en_dev_api_azure.md":"D2NkLSs5","en_dev_api_azure_onebot.md":"CkpsHNA3","en_dev_api_config.md":"DeZ7DeZC","en_dev_api_constants.md":"9cK-2Rnd","en_dev_api_deal_latex.md":"CDNhgyqb","en_dev_api_dev.md":"DwQwAQ2O","en_dev_api_hooks.md":"B8fuQmIt","en_dev_api_hunyuan.md":"BREw4BH2","en_dev_api_index.md":"D6wqE3Go","en_dev_api_instances.md":"C-rZEpVa","en_dev_api_marsho.md":"D54YjST5","en_dev_api_marsho_onebot.md":"DnSZOfp1","en_dev_api_metadata.md":"D7OEYakw","en_dev_api_models.md":"ud2_nMfy","en_dev_api_observer.md":"Buavwltn","en_dev_api_plugin_func_call_caller.md":"CmmMyc7F","en_dev_api_plugin_func_call_index.md":"DHzPv4Ru","en_dev_api_plugin_func_call_models.md":"DEU3e-ya","en_dev_api_plugin_func_call_params.md":"DRLswz-P","en_dev_api_plugin_func_call_utils.md":"DsqMXz_K","en_dev_api_plugin_index.md":"BkRnWH4_","en_dev_api_plugin_load.md":"BqI5wsjI","en_dev_api_plugin_models.md":"oxy5gRRp","en_dev_api_plugin_register.md":"DX9dpKIB","en_dev_api_plugin_typing.md":"BkmgBa4M","en_dev_api_plugin_utils.md":"DU4V8pmV","en_dev_api_plugins_builtin_tools_chat.md":"NZM89geB","en_dev_api_plugins_builtin_tools_file_io.md":"tW4VmItn","en_dev_api_plugins_builtin_tools_index.md":"C-XkxGtY","en_dev_api_plugins_builtin_tools_liteyuki.md":"RQry7oYv","en_dev_api_plugins_builtin_tools_manager.md":"0b459wxY","en_dev_api_plugins_builtin_tools_network.md":"-ABGsH5V","en_dev_api_plugins_builtin_tools_utils.md":"YU2iLw8W","en_dev_api_plugins_marshoai_bangumi_index.md":"BybXEg8m","en_dev_api_plugins_marshoai_basic_index.md":"DeeLIVrI","en_dev_api_plugins_test_marshoai_basic_index.md":"wMr4Ve9L","en_dev_api_plugins_test_marshoai_memory_command.md":"C6E66iFg","en_dev_api_plugins_test_marshoai_memory_config.md":"INuymK3L","en_dev_api_plugins_test_marshoai_memory_index.md":"D6RlqtVH","en_dev_api_plugins_test_random_number_generator.md":"BX4GQvB8","en_dev_api_plugins_test_snowykami_testplugin_index.md":"BayHCb8s","en_dev_api_plugins_test_weather_demo.md":"CSDh9TgV","en_dev_api_plugins_twisuki_megakits_index.md":"ONfKcuRP","en_dev_api_plugins_twisuki_megakits_mk_morse_code.md":"YkyuSz4X","en_dev_api_plugins_twisuki_megakits_mk_nya_code.md":"C5O4Xv8O","en_dev_api_plugins_twisuki_petcat_index.md":"C7CHQqy2","en_dev_api_plugins_twisuki_petcat_pc_cat.md":"CRx4SeFR","en_dev_api_plugins_twisuki_petcat_pc_info.md":"DmAZ17n9","en_dev_api_plugins_twisuki_petcat_pc_shop.md":"tvO7JKea","en_dev_api_plugins_twisuki_petcat_pc_token.md":"Bs6TDv2w","en_dev_api_tools_marshoai_bangumi_index.md":"CQOz1f3Y","en_dev_api_tools_marshoai_basic_index.md":"DdtXVLj-","en_dev_api_tools_marshoai_megakits_index.md":"BD0eqLf4","en_dev_api_tools_marshoai_megakits_mk_common.md":"B2t_B3CF","en_dev_api_tools_marshoai_megakits_mk_info.md":"BJ4oiY1p","en_dev_api_tools_marshoai_megakits_mk_morse_code.md":"D9jpqguN","en_dev_api_tools_marshoai_megakits_mk_nya_code.md":"BFEjDzeJ","en_dev_api_tools_marshoai_memory_index.md":"CFtluJuC","en_dev_api_tools_marshoai_meogirl_index.md":"Bz7f_dXk","en_dev_api_tools_marshoai_meogirl_mg_info.md":"XSL809yZ","en_dev_api_tools_marshoai_meogirl_mg_introduce.md":"B9C0fcLo","en_dev_api_tools_marshoai_meogirl_mg_search.md":"CnuveyHi","en_dev_api_tools_wip_marshoai_memory_index.md":"Dof0UKI9","en_dev_api_util.md":"DJBRZ231","en_dev_api_util_hunyuan.md":"BCpNZGK5","en_dev_index.md":"DG35zGMQ","en_index.md":"fR4OoA7a","en_start_index.md":"DCunCG6I","en_start_install.md":"DdHi3Ttu","index.md":"C0OrEz4R","ja_index.md":"DFz97jLH","start_index.md":"CHwPvREK","start_install-old.md":"Ca7nPfgk","start_install.md":"BLebC2pi","start_use.md":"DeU3oXMj"} diff --git a/index.html b/index.html index e467eb19..1df60321 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 6b7f5888..6aa60d73 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 04769cbc..261c77e4 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 96ec73b2..8ca8fb5f 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 c0c48a2b..abc76a48 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 的基本系统提示词 ※部分模型(o1等)不支持系统提示词。
MARSHOAI_ADDITIONAL_PROMPTstrMarsho 的扩展系统提示词
MARSHOAI_ENFORCE_NICKNAMEbooltrue是否强制用户设置昵称
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_NICKNAME_LIMITint16昵称长度限制
MARSHOAI_TIMEOUTfloat50AI 请求超时时间(秒)

功能开关

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