mirror of
https://github.com/LiteyukiStudio/nonebot-plugin-marshoai.git
synced 2026-04-23 04:45:37 +00:00
Deploying to docs from @ LiteyukiStudio/nonebot-plugin-marshoai@0b6ac9f73e 🚀
This commit is contained in:
File diff suppressed because one or more lines are too long
@@ -1 +1 @@
|
||||
import{_ as s,c as i,o as t,ae as e}from"./chunks/framework.BHrE6nLq.js";const k=JSON.parse('{"title":"config","description":"","frontmatter":{"title":"config","order":100},"headers":[],"relativePath":"dev/api/config.md","filePath":"zh/dev/api/config.md","lastUpdated":1738311067000}'),o={name:"dev/api/config.md"};function r(n,a,l,h,d,m){return t(),i("div",null,a[0]||(a[0]=[e("",53)]))}const c=s(o,[["render",r]]);export{k as __pageData,c as default};
|
||||
import{_ as s,c as i,o as t,ae as e}from"./chunks/framework.BHrE6nLq.js";const k=JSON.parse('{"title":"config","description":"","frontmatter":{"title":"config","order":100},"headers":[],"relativePath":"dev/api/config.md","filePath":"zh/dev/api/config.md","lastUpdated":1738311067000}'),r={name:"dev/api/config.md"};function o(n,a,l,h,d,m){return t(),i("div",null,a[0]||(a[0]=[e("",53)]))}const c=s(r,[["render",o]]);export{k as __pageData,c as default};
|
||||
@@ -1,13 +1,13 @@
|
||||
import{_ as i,c as a,o as t,ae as n}from"./chunks/framework.BHrE6nLq.js";const g=JSON.parse('{"title":"models","description":"","frontmatter":{"title":"models","order":100},"headers":[],"relativePath":"dev/api/models.md","filePath":"zh/dev/api/models.md","lastUpdated":1734175019000}'),l={name:"dev/api/models.md"};function e(h,s,p,k,r,o){return t(),a("div",null,s[0]||(s[0]=[n(`<h1 id="模块-nonebot-plugin-marshoai-models" tabindex="-1"><strong>模块</strong> <code>nonebot_plugin_marshoai.models</code> <a class="header-anchor" href="#模块-nonebot-plugin-marshoai-models" aria-label="Permalink to "**模块** \`nonebot_plugin_marshoai.models\`""></a></h1><h3 id="class-marshocontext" tabindex="-1"><em><strong>class</strong></em> <code>MarshoContext</code> <a class="header-anchor" href="#class-marshocontext" aria-label="Permalink to "***class*** \`MarshoContext\`""></a></h3><hr><h4 id="func-init-self" tabindex="-1"><em><strong>func</strong></em> <code>__init__(self)</code> <a class="header-anchor" href="#func-init-self" aria-label="Permalink to "***func*** \`__init__(self)\`""></a></h4><details><summary><b>源代码</b> 或 <a href="https://github.com/LiteyukiStudio/nonebot-plugin-marshoai/tree/main/nonebot_plugin_marshoai/models.py#L20" target="_blank">在GitHub上查看</a></summary><div class="language-python vp-adaptive-theme"><button title="Copy Code" class="copy"></button><span class="lang">python</span><pre class="shiki shiki-themes github-light github-dark vp-code" tabindex="0"><code><span class="line"><span style="--shiki-light:#D73A49;--shiki-dark:#F97583;">def</span><span style="--shiki-light:#005CC5;--shiki-dark:#79B8FF;"> __init__</span><span style="--shiki-light:#24292E;--shiki-dark:#E1E4E8;">(self):</span></span>
|
||||
<span class="line"><span style="--shiki-light:#005CC5;--shiki-dark:#79B8FF;"> self</span><span style="--shiki-light:#24292E;--shiki-dark:#E1E4E8;">.contents </span><span style="--shiki-light:#D73A49;--shiki-dark:#F97583;">=</span><span style="--shiki-light:#24292E;--shiki-dark:#E1E4E8;"> {</span><span style="--shiki-light:#032F62;--shiki-dark:#9ECBFF;">'private'</span><span style="--shiki-light:#24292E;--shiki-dark:#E1E4E8;">: {}, </span><span style="--shiki-light:#032F62;--shiki-dark:#9ECBFF;">'non-private'</span><span style="--shiki-light:#24292E;--shiki-dark:#E1E4E8;">: {}}</span></span></code></pre></div></details><hr><h4 id="func-append-self-content-target-id-str-is-private-bool" tabindex="-1"><em><strong>func</strong></em> <code>append(self, content, target_id: str, is_private: bool)</code> <a class="header-anchor" href="#func-append-self-content-target-id-str-is-private-bool" aria-label="Permalink to "***func*** \`append(self, content, target_id: str, is_private: bool)\`""></a></h4><p><strong>说明</strong>: 往上下文中添加消息</p><details><summary><b>源代码</b> 或 <a href="https://github.com/LiteyukiStudio/nonebot-plugin-marshoai/tree/main/nonebot_plugin_marshoai/models.py#L26" target="_blank">在GitHub上查看</a></summary><div class="language-python vp-adaptive-theme"><button title="Copy Code" class="copy"></button><span class="lang">python</span><pre class="shiki shiki-themes github-light github-dark vp-code" tabindex="0"><code><span class="line"><span style="--shiki-light:#D73A49;--shiki-dark:#F97583;">def</span><span style="--shiki-light:#6F42C1;--shiki-dark:#B392F0;"> append</span><span style="--shiki-light:#24292E;--shiki-dark:#E1E4E8;">(self, content, target_id: </span><span style="--shiki-light:#005CC5;--shiki-dark:#79B8FF;">str</span><span style="--shiki-light:#24292E;--shiki-dark:#E1E4E8;">, is_private: </span><span style="--shiki-light:#005CC5;--shiki-dark:#79B8FF;">bool</span><span style="--shiki-light:#24292E;--shiki-dark:#E1E4E8;">):</span></span>
|
||||
import{_ as i,c as a,o as t,ae as n}from"./chunks/framework.BHrE6nLq.js";const g=JSON.parse('{"title":"models","description":"","frontmatter":{"title":"models","order":100},"headers":[],"relativePath":"dev/api/models.md","filePath":"zh/dev/api/models.md","lastUpdated":1734175019000}'),l={name:"dev/api/models.md"};function e(h,s,p,k,r,o){return t(),a("div",null,s[0]||(s[0]=[n(`<h1 id="模块-nonebot-plugin-marshoai-models" tabindex="-1"><strong>模块</strong> <code>nonebot_plugin_marshoai.models</code> <a class="header-anchor" href="#模块-nonebot-plugin-marshoai-models" aria-label="Permalink to "**模块** \`nonebot_plugin_marshoai.models\`""></a></h1><h3 id="class-marshocontext" tabindex="-1"><em><strong>class</strong></em> <code>MarshoContext</code> <a class="header-anchor" href="#class-marshocontext" aria-label="Permalink to "***class*** \`MarshoContext\`""></a></h3><hr><h4 id="func-init-self" tabindex="-1"><em><strong>func</strong></em> <code>__init__(self)</code> <a class="header-anchor" href="#func-init-self" aria-label="Permalink to "***func*** \`__init__(self)\`""></a></h4><details><summary><b>源代码</b> 或 <a href="https://github.com/LiteyukiStudio/nonebot-plugin-marshoai/tree/main/nonebot_plugin_marshoai/models.py#L19" target="_blank">在GitHub上查看</a></summary><div class="language-python vp-adaptive-theme"><button title="Copy Code" class="copy"></button><span class="lang">python</span><pre class="shiki shiki-themes github-light github-dark vp-code" tabindex="0"><code><span class="line"><span style="--shiki-light:#D73A49;--shiki-dark:#F97583;">def</span><span style="--shiki-light:#005CC5;--shiki-dark:#79B8FF;"> __init__</span><span style="--shiki-light:#24292E;--shiki-dark:#E1E4E8;">(self):</span></span>
|
||||
<span class="line"><span style="--shiki-light:#005CC5;--shiki-dark:#79B8FF;"> self</span><span style="--shiki-light:#24292E;--shiki-dark:#E1E4E8;">.contents </span><span style="--shiki-light:#D73A49;--shiki-dark:#F97583;">=</span><span style="--shiki-light:#24292E;--shiki-dark:#E1E4E8;"> {</span><span style="--shiki-light:#032F62;--shiki-dark:#9ECBFF;">'private'</span><span style="--shiki-light:#24292E;--shiki-dark:#E1E4E8;">: {}, </span><span style="--shiki-light:#032F62;--shiki-dark:#9ECBFF;">'non-private'</span><span style="--shiki-light:#24292E;--shiki-dark:#E1E4E8;">: {}}</span></span></code></pre></div></details><hr><h4 id="func-append-self-content-target-id-str-is-private-bool" tabindex="-1"><em><strong>func</strong></em> <code>append(self, content, target_id: str, is_private: bool)</code> <a class="header-anchor" href="#func-append-self-content-target-id-str-is-private-bool" aria-label="Permalink to "***func*** \`append(self, content, target_id: str, is_private: bool)\`""></a></h4><p><strong>说明</strong>: 往上下文中添加消息</p><details><summary><b>源代码</b> 或 <a href="https://github.com/LiteyukiStudio/nonebot-plugin-marshoai/tree/main/nonebot_plugin_marshoai/models.py#L25" target="_blank">在GitHub上查看</a></summary><div class="language-python vp-adaptive-theme"><button title="Copy Code" class="copy"></button><span class="lang">python</span><pre class="shiki shiki-themes github-light github-dark vp-code" tabindex="0"><code><span class="line"><span style="--shiki-light:#D73A49;--shiki-dark:#F97583;">def</span><span style="--shiki-light:#6F42C1;--shiki-dark:#B392F0;"> append</span><span style="--shiki-light:#24292E;--shiki-dark:#E1E4E8;">(self, content, target_id: </span><span style="--shiki-light:#005CC5;--shiki-dark:#79B8FF;">str</span><span style="--shiki-light:#24292E;--shiki-dark:#E1E4E8;">, is_private: </span><span style="--shiki-light:#005CC5;--shiki-dark:#79B8FF;">bool</span><span style="--shiki-light:#24292E;--shiki-dark:#E1E4E8;">):</span></span>
|
||||
<span class="line"><span style="--shiki-light:#24292E;--shiki-dark:#E1E4E8;"> target_dict </span><span style="--shiki-light:#D73A49;--shiki-dark:#F97583;">=</span><span style="--shiki-light:#005CC5;--shiki-dark:#79B8FF;"> self</span><span style="--shiki-light:#24292E;--shiki-dark:#E1E4E8;">._get_target_dict(is_private)</span></span>
|
||||
<span class="line"><span style="--shiki-light:#24292E;--shiki-dark:#E1E4E8;"> target_dict.setdefault(target_id, []).append(content)</span></span></code></pre></div></details><hr><h4 id="func-set-context-self-contexts-target-id-str-is-private-bool" tabindex="-1"><em><strong>func</strong></em> <code>set_context(self, contexts, target_id: str, is_private: bool)</code> <a class="header-anchor" href="#func-set-context-self-contexts-target-id-str-is-private-bool" aria-label="Permalink to "***func*** \`set_context(self, contexts, target_id: str, is_private: bool)\`""></a></h4><p><strong>说明</strong>: 设置上下文</p><details><summary><b>源代码</b> 或 <a href="https://github.com/LiteyukiStudio/nonebot-plugin-marshoai/tree/main/nonebot_plugin_marshoai/models.py#L33" target="_blank">在GitHub上查看</a></summary><div class="language-python vp-adaptive-theme"><button title="Copy Code" class="copy"></button><span class="lang">python</span><pre class="shiki shiki-themes github-light github-dark vp-code" tabindex="0"><code><span class="line"><span style="--shiki-light:#D73A49;--shiki-dark:#F97583;">def</span><span style="--shiki-light:#6F42C1;--shiki-dark:#B392F0;"> set_context</span><span style="--shiki-light:#24292E;--shiki-dark:#E1E4E8;">(self, contexts, target_id: </span><span style="--shiki-light:#005CC5;--shiki-dark:#79B8FF;">str</span><span style="--shiki-light:#24292E;--shiki-dark:#E1E4E8;">, is_private: </span><span style="--shiki-light:#005CC5;--shiki-dark:#79B8FF;">bool</span><span style="--shiki-light:#24292E;--shiki-dark:#E1E4E8;">):</span></span>
|
||||
<span class="line"><span style="--shiki-light:#005CC5;--shiki-dark:#79B8FF;"> self</span><span style="--shiki-light:#24292E;--shiki-dark:#E1E4E8;">._get_target_dict(is_private)[target_id] </span><span style="--shiki-light:#D73A49;--shiki-dark:#F97583;">=</span><span style="--shiki-light:#24292E;--shiki-dark:#E1E4E8;"> contexts</span></span></code></pre></div></details><hr><h4 id="func-reset-self-target-id-str-is-private-bool" tabindex="-1"><em><strong>func</strong></em> <code>reset(self, target_id: str, is_private: bool)</code> <a class="header-anchor" href="#func-reset-self-target-id-str-is-private-bool" aria-label="Permalink to "***func*** \`reset(self, target_id: str, is_private: bool)\`""></a></h4><p><strong>说明</strong>: 重置上下文</p><details><summary><b>源代码</b> 或 <a href="https://github.com/LiteyukiStudio/nonebot-plugin-marshoai/tree/main/nonebot_plugin_marshoai/models.py#L39" target="_blank">在GitHub上查看</a></summary><div class="language-python vp-adaptive-theme"><button title="Copy Code" class="copy"></button><span class="lang">python</span><pre class="shiki shiki-themes github-light github-dark vp-code" tabindex="0"><code><span class="line"><span style="--shiki-light:#D73A49;--shiki-dark:#F97583;">def</span><span style="--shiki-light:#6F42C1;--shiki-dark:#B392F0;"> reset</span><span style="--shiki-light:#24292E;--shiki-dark:#E1E4E8;">(self, target_id: </span><span style="--shiki-light:#005CC5;--shiki-dark:#79B8FF;">str</span><span style="--shiki-light:#24292E;--shiki-dark:#E1E4E8;">, is_private: </span><span style="--shiki-light:#005CC5;--shiki-dark:#79B8FF;">bool</span><span style="--shiki-light:#24292E;--shiki-dark:#E1E4E8;">):</span></span>
|
||||
<span class="line"><span style="--shiki-light:#005CC5;--shiki-dark:#79B8FF;"> self</span><span style="--shiki-light:#24292E;--shiki-dark:#E1E4E8;">._get_target_dict(is_private).pop(target_id, </span><span style="--shiki-light:#005CC5;--shiki-dark:#79B8FF;">None</span><span style="--shiki-light:#24292E;--shiki-dark:#E1E4E8;">)</span></span></code></pre></div></details><hr><h4 id="func-reset-all-self" tabindex="-1"><em><strong>func</strong></em> <code>reset_all(self)</code> <a class="header-anchor" href="#func-reset-all-self" aria-label="Permalink to "***func*** \`reset_all(self)\`""></a></h4><p><strong>说明</strong>: 重置所有上下文</p><details><summary><b>源代码</b> 或 <a href="https://github.com/LiteyukiStudio/nonebot-plugin-marshoai/tree/main/nonebot_plugin_marshoai/models.py#L45" target="_blank">在GitHub上查看</a></summary><div class="language-python vp-adaptive-theme"><button title="Copy Code" class="copy"></button><span class="lang">python</span><pre class="shiki shiki-themes github-light github-dark vp-code" tabindex="0"><code><span class="line"><span style="--shiki-light:#D73A49;--shiki-dark:#F97583;">def</span><span style="--shiki-light:#6F42C1;--shiki-dark:#B392F0;"> reset_all</span><span style="--shiki-light:#24292E;--shiki-dark:#E1E4E8;">(self):</span></span>
|
||||
<span class="line"><span style="--shiki-light:#005CC5;--shiki-dark:#79B8FF;"> self</span><span style="--shiki-light:#24292E;--shiki-dark:#E1E4E8;">.contents </span><span style="--shiki-light:#D73A49;--shiki-dark:#F97583;">=</span><span style="--shiki-light:#24292E;--shiki-dark:#E1E4E8;"> {</span><span style="--shiki-light:#032F62;--shiki-dark:#9ECBFF;">'private'</span><span style="--shiki-light:#24292E;--shiki-dark:#E1E4E8;">: {}, </span><span style="--shiki-light:#032F62;--shiki-dark:#9ECBFF;">'non-private'</span><span style="--shiki-light:#24292E;--shiki-dark:#E1E4E8;">: {}}</span></span></code></pre></div></details><hr><h4 id="func-build-self-target-id-str-is-private-bool-list" tabindex="-1"><em><strong>func</strong></em> <code>build(self, target_id: str, is_private: bool) -> list</code> <a class="header-anchor" href="#func-build-self-target-id-str-is-private-bool-list" aria-label="Permalink to "***func*** \`build(self, target_id: str, is_private: bool) -> list\`""></a></h4><p><strong>说明</strong>: 构建返回的上下文,不包括系统消息</p><details><summary><b>源代码</b> 或 <a href="https://github.com/LiteyukiStudio/nonebot-plugin-marshoai/tree/main/nonebot_plugin_marshoai/models.py#L51" target="_blank">在GitHub上查看</a></summary><div class="language-python vp-adaptive-theme"><button title="Copy Code" class="copy"></button><span class="lang">python</span><pre class="shiki shiki-themes github-light github-dark vp-code" tabindex="0"><code><span class="line"><span style="--shiki-light:#D73A49;--shiki-dark:#F97583;">def</span><span style="--shiki-light:#6F42C1;--shiki-dark:#B392F0;"> build</span><span style="--shiki-light:#24292E;--shiki-dark:#E1E4E8;">(self, target_id: </span><span style="--shiki-light:#005CC5;--shiki-dark:#79B8FF;">str</span><span style="--shiki-light:#24292E;--shiki-dark:#E1E4E8;">, is_private: </span><span style="--shiki-light:#005CC5;--shiki-dark:#79B8FF;">bool</span><span style="--shiki-light:#24292E;--shiki-dark:#E1E4E8;">) -> </span><span style="--shiki-light:#005CC5;--shiki-dark:#79B8FF;">list</span><span style="--shiki-light:#24292E;--shiki-dark:#E1E4E8;">:</span></span>
|
||||
<span class="line"><span style="--shiki-light:#D73A49;--shiki-dark:#F97583;"> return</span><span style="--shiki-light:#005CC5;--shiki-dark:#79B8FF;"> self</span><span style="--shiki-light:#24292E;--shiki-dark:#E1E4E8;">._get_target_dict(is_private).setdefault(target_id, [])</span></span></code></pre></div></details><h3 id="class-marshotools" tabindex="-1"><em><strong>class</strong></em> <code>MarshoTools</code> <a class="header-anchor" href="#class-marshotools" aria-label="Permalink to "***class*** \`MarshoTools\`""></a></h3><hr><h4 id="func-init-self-1" tabindex="-1"><em><strong>func</strong></em> <code>__init__(self)</code> <a class="header-anchor" href="#func-init-self-1" aria-label="Permalink to "***func*** \`__init__(self)\`""></a></h4><details><summary><b>源代码</b> 或 <a href="https://github.com/LiteyukiStudio/nonebot-plugin-marshoai/tree/main/nonebot_plugin_marshoai/models.py#L63" target="_blank">在GitHub上查看</a></summary><div class="language-python vp-adaptive-theme"><button title="Copy Code" class="copy"></button><span class="lang">python</span><pre class="shiki shiki-themes github-light github-dark vp-code" tabindex="0"><code><span class="line"><span style="--shiki-light:#D73A49;--shiki-dark:#F97583;">def</span><span style="--shiki-light:#005CC5;--shiki-dark:#79B8FF;"> __init__</span><span style="--shiki-light:#24292E;--shiki-dark:#E1E4E8;">(self):</span></span>
|
||||
<span class="line"><span style="--shiki-light:#24292E;--shiki-dark:#E1E4E8;"> target_dict.setdefault(target_id, []).append(content)</span></span></code></pre></div></details><hr><h4 id="func-set-context-self-contexts-target-id-str-is-private-bool" tabindex="-1"><em><strong>func</strong></em> <code>set_context(self, contexts, target_id: str, is_private: bool)</code> <a class="header-anchor" href="#func-set-context-self-contexts-target-id-str-is-private-bool" aria-label="Permalink to "***func*** \`set_context(self, contexts, target_id: str, is_private: bool)\`""></a></h4><p><strong>说明</strong>: 设置上下文</p><details><summary><b>源代码</b> 或 <a href="https://github.com/LiteyukiStudio/nonebot-plugin-marshoai/tree/main/nonebot_plugin_marshoai/models.py#L32" target="_blank">在GitHub上查看</a></summary><div class="language-python vp-adaptive-theme"><button title="Copy Code" class="copy"></button><span class="lang">python</span><pre class="shiki shiki-themes github-light github-dark vp-code" tabindex="0"><code><span class="line"><span style="--shiki-light:#D73A49;--shiki-dark:#F97583;">def</span><span style="--shiki-light:#6F42C1;--shiki-dark:#B392F0;"> set_context</span><span style="--shiki-light:#24292E;--shiki-dark:#E1E4E8;">(self, contexts, target_id: </span><span style="--shiki-light:#005CC5;--shiki-dark:#79B8FF;">str</span><span style="--shiki-light:#24292E;--shiki-dark:#E1E4E8;">, is_private: </span><span style="--shiki-light:#005CC5;--shiki-dark:#79B8FF;">bool</span><span style="--shiki-light:#24292E;--shiki-dark:#E1E4E8;">):</span></span>
|
||||
<span class="line"><span style="--shiki-light:#005CC5;--shiki-dark:#79B8FF;"> self</span><span style="--shiki-light:#24292E;--shiki-dark:#E1E4E8;">._get_target_dict(is_private)[target_id] </span><span style="--shiki-light:#D73A49;--shiki-dark:#F97583;">=</span><span style="--shiki-light:#24292E;--shiki-dark:#E1E4E8;"> contexts</span></span></code></pre></div></details><hr><h4 id="func-reset-self-target-id-str-is-private-bool" tabindex="-1"><em><strong>func</strong></em> <code>reset(self, target_id: str, is_private: bool)</code> <a class="header-anchor" href="#func-reset-self-target-id-str-is-private-bool" aria-label="Permalink to "***func*** \`reset(self, target_id: str, is_private: bool)\`""></a></h4><p><strong>说明</strong>: 重置上下文</p><details><summary><b>源代码</b> 或 <a href="https://github.com/LiteyukiStudio/nonebot-plugin-marshoai/tree/main/nonebot_plugin_marshoai/models.py#L38" target="_blank">在GitHub上查看</a></summary><div class="language-python vp-adaptive-theme"><button title="Copy Code" class="copy"></button><span class="lang">python</span><pre class="shiki shiki-themes github-light github-dark vp-code" tabindex="0"><code><span class="line"><span style="--shiki-light:#D73A49;--shiki-dark:#F97583;">def</span><span style="--shiki-light:#6F42C1;--shiki-dark:#B392F0;"> reset</span><span style="--shiki-light:#24292E;--shiki-dark:#E1E4E8;">(self, target_id: </span><span style="--shiki-light:#005CC5;--shiki-dark:#79B8FF;">str</span><span style="--shiki-light:#24292E;--shiki-dark:#E1E4E8;">, is_private: </span><span style="--shiki-light:#005CC5;--shiki-dark:#79B8FF;">bool</span><span style="--shiki-light:#24292E;--shiki-dark:#E1E4E8;">):</span></span>
|
||||
<span class="line"><span style="--shiki-light:#005CC5;--shiki-dark:#79B8FF;"> self</span><span style="--shiki-light:#24292E;--shiki-dark:#E1E4E8;">._get_target_dict(is_private).pop(target_id, </span><span style="--shiki-light:#005CC5;--shiki-dark:#79B8FF;">None</span><span style="--shiki-light:#24292E;--shiki-dark:#E1E4E8;">)</span></span></code></pre></div></details><hr><h4 id="func-reset-all-self" tabindex="-1"><em><strong>func</strong></em> <code>reset_all(self)</code> <a class="header-anchor" href="#func-reset-all-self" aria-label="Permalink to "***func*** \`reset_all(self)\`""></a></h4><p><strong>说明</strong>: 重置所有上下文</p><details><summary><b>源代码</b> 或 <a href="https://github.com/LiteyukiStudio/nonebot-plugin-marshoai/tree/main/nonebot_plugin_marshoai/models.py#L44" target="_blank">在GitHub上查看</a></summary><div class="language-python vp-adaptive-theme"><button title="Copy Code" class="copy"></button><span class="lang">python</span><pre class="shiki shiki-themes github-light github-dark vp-code" tabindex="0"><code><span class="line"><span style="--shiki-light:#D73A49;--shiki-dark:#F97583;">def</span><span style="--shiki-light:#6F42C1;--shiki-dark:#B392F0;"> reset_all</span><span style="--shiki-light:#24292E;--shiki-dark:#E1E4E8;">(self):</span></span>
|
||||
<span class="line"><span style="--shiki-light:#005CC5;--shiki-dark:#79B8FF;"> self</span><span style="--shiki-light:#24292E;--shiki-dark:#E1E4E8;">.contents </span><span style="--shiki-light:#D73A49;--shiki-dark:#F97583;">=</span><span style="--shiki-light:#24292E;--shiki-dark:#E1E4E8;"> {</span><span style="--shiki-light:#032F62;--shiki-dark:#9ECBFF;">'private'</span><span style="--shiki-light:#24292E;--shiki-dark:#E1E4E8;">: {}, </span><span style="--shiki-light:#032F62;--shiki-dark:#9ECBFF;">'non-private'</span><span style="--shiki-light:#24292E;--shiki-dark:#E1E4E8;">: {}}</span></span></code></pre></div></details><hr><h4 id="func-build-self-target-id-str-is-private-bool-list" tabindex="-1"><em><strong>func</strong></em> <code>build(self, target_id: str, is_private: bool) -> list</code> <a class="header-anchor" href="#func-build-self-target-id-str-is-private-bool-list" aria-label="Permalink to "***func*** \`build(self, target_id: str, is_private: bool) -> list\`""></a></h4><p><strong>说明</strong>: 构建返回的上下文,不包括系统消息</p><details><summary><b>源代码</b> 或 <a href="https://github.com/LiteyukiStudio/nonebot-plugin-marshoai/tree/main/nonebot_plugin_marshoai/models.py#L50" target="_blank">在GitHub上查看</a></summary><div class="language-python vp-adaptive-theme"><button title="Copy Code" class="copy"></button><span class="lang">python</span><pre class="shiki shiki-themes github-light github-dark vp-code" tabindex="0"><code><span class="line"><span style="--shiki-light:#D73A49;--shiki-dark:#F97583;">def</span><span style="--shiki-light:#6F42C1;--shiki-dark:#B392F0;"> build</span><span style="--shiki-light:#24292E;--shiki-dark:#E1E4E8;">(self, target_id: </span><span style="--shiki-light:#005CC5;--shiki-dark:#79B8FF;">str</span><span style="--shiki-light:#24292E;--shiki-dark:#E1E4E8;">, is_private: </span><span style="--shiki-light:#005CC5;--shiki-dark:#79B8FF;">bool</span><span style="--shiki-light:#24292E;--shiki-dark:#E1E4E8;">) -> </span><span style="--shiki-light:#005CC5;--shiki-dark:#79B8FF;">list</span><span style="--shiki-light:#24292E;--shiki-dark:#E1E4E8;">:</span></span>
|
||||
<span class="line"><span style="--shiki-light:#D73A49;--shiki-dark:#F97583;"> return</span><span style="--shiki-light:#005CC5;--shiki-dark:#79B8FF;"> self</span><span style="--shiki-light:#24292E;--shiki-dark:#E1E4E8;">._get_target_dict(is_private).setdefault(target_id, [])</span></span></code></pre></div></details><h3 id="class-marshotools" tabindex="-1"><em><strong>class</strong></em> <code>MarshoTools</code> <a class="header-anchor" href="#class-marshotools" aria-label="Permalink to "***class*** \`MarshoTools\`""></a></h3><hr><h4 id="func-init-self-1" tabindex="-1"><em><strong>func</strong></em> <code>__init__(self)</code> <a class="header-anchor" href="#func-init-self-1" aria-label="Permalink to "***func*** \`__init__(self)\`""></a></h4><details><summary><b>源代码</b> 或 <a href="https://github.com/LiteyukiStudio/nonebot-plugin-marshoai/tree/main/nonebot_plugin_marshoai/models.py#L62" target="_blank">在GitHub上查看</a></summary><div class="language-python vp-adaptive-theme"><button title="Copy Code" class="copy"></button><span class="lang">python</span><pre class="shiki shiki-themes github-light github-dark vp-code" tabindex="0"><code><span class="line"><span style="--shiki-light:#D73A49;--shiki-dark:#F97583;">def</span><span style="--shiki-light:#005CC5;--shiki-dark:#79B8FF;"> __init__</span><span style="--shiki-light:#24292E;--shiki-dark:#E1E4E8;">(self):</span></span>
|
||||
<span class="line"><span style="--shiki-light:#005CC5;--shiki-dark:#79B8FF;"> self</span><span style="--shiki-light:#24292E;--shiki-dark:#E1E4E8;">.tools_list </span><span style="--shiki-light:#D73A49;--shiki-dark:#F97583;">=</span><span style="--shiki-light:#24292E;--shiki-dark:#E1E4E8;"> []</span></span>
|
||||
<span class="line"><span style="--shiki-light:#005CC5;--shiki-dark:#79B8FF;"> self</span><span style="--shiki-light:#24292E;--shiki-dark:#E1E4E8;">.imported_packages </span><span style="--shiki-light:#D73A49;--shiki-dark:#F97583;">=</span><span style="--shiki-light:#24292E;--shiki-dark:#E1E4E8;"> {}</span></span></code></pre></div></details><hr><h4 id="func-load-tools-self-tools-dir" tabindex="-1"><em><strong>func</strong></em> <code>load_tools(self, tools_dir)</code> <a class="header-anchor" href="#func-load-tools-self-tools-dir" aria-label="Permalink to "***func*** \`load_tools(self, tools_dir)\`""></a></h4><p><strong>说明</strong>: 从指定路径加载工具包</p><details><summary><b>源代码</b> 或 <a href="https://github.com/LiteyukiStudio/nonebot-plugin-marshoai/tree/main/nonebot_plugin_marshoai/models.py#L67" target="_blank">在GitHub上查看</a></summary><div class="language-python vp-adaptive-theme"><button title="Copy Code" class="copy"></button><span class="lang">python</span><pre class="shiki shiki-themes github-light github-dark vp-code" tabindex="0"><code><span class="line"><span style="--shiki-light:#D73A49;--shiki-dark:#F97583;">def</span><span style="--shiki-light:#6F42C1;--shiki-dark:#B392F0;"> load_tools</span><span style="--shiki-light:#24292E;--shiki-dark:#E1E4E8;">(self, tools_dir):</span></span>
|
||||
<span class="line"><span style="--shiki-light:#005CC5;--shiki-dark:#79B8FF;"> self</span><span style="--shiki-light:#24292E;--shiki-dark:#E1E4E8;">.imported_packages </span><span style="--shiki-light:#D73A49;--shiki-dark:#F97583;">=</span><span style="--shiki-light:#24292E;--shiki-dark:#E1E4E8;"> {}</span></span></code></pre></div></details><hr><h4 id="func-load-tools-self-tools-dir" tabindex="-1"><em><strong>func</strong></em> <code>load_tools(self, tools_dir)</code> <a class="header-anchor" href="#func-load-tools-self-tools-dir" aria-label="Permalink to "***func*** \`load_tools(self, tools_dir)\`""></a></h4><p><strong>说明</strong>: 从指定路径加载工具包</p><details><summary><b>源代码</b> 或 <a href="https://github.com/LiteyukiStudio/nonebot-plugin-marshoai/tree/main/nonebot_plugin_marshoai/models.py#L66" target="_blank">在GitHub上查看</a></summary><div class="language-python vp-adaptive-theme"><button title="Copy Code" class="copy"></button><span class="lang">python</span><pre class="shiki shiki-themes github-light github-dark vp-code" tabindex="0"><code><span class="line"><span style="--shiki-light:#D73A49;--shiki-dark:#F97583;">def</span><span style="--shiki-light:#6F42C1;--shiki-dark:#B392F0;"> load_tools</span><span style="--shiki-light:#24292E;--shiki-dark:#E1E4E8;">(self, tools_dir):</span></span>
|
||||
<span class="line"><span style="--shiki-light:#D73A49;--shiki-dark:#F97583;"> if</span><span style="--shiki-light:#D73A49;--shiki-dark:#F97583;"> not</span><span style="--shiki-light:#24292E;--shiki-dark:#E1E4E8;"> os.path.exists(tools_dir):</span></span>
|
||||
<span class="line"><span style="--shiki-light:#24292E;--shiki-dark:#E1E4E8;"> logger.error(</span><span style="--shiki-light:#D73A49;--shiki-dark:#F97583;">f</span><span style="--shiki-light:#032F62;--shiki-dark:#9ECBFF;">'工具集目录 </span><span style="--shiki-light:#005CC5;--shiki-dark:#79B8FF;">{</span><span style="--shiki-light:#24292E;--shiki-dark:#E1E4E8;">tools_dir</span><span style="--shiki-light:#005CC5;--shiki-dark:#79B8FF;">}</span><span style="--shiki-light:#032F62;--shiki-dark:#9ECBFF;"> 不存在。'</span><span style="--shiki-light:#24292E;--shiki-dark:#E1E4E8;">)</span></span>
|
||||
<span class="line"><span style="--shiki-light:#D73A49;--shiki-dark:#F97583;"> return</span></span>
|
||||
@@ -19,7 +19,7 @@ import{_ as i,c as a,o as t,ae as n}from"./chunks/framework.BHrE6nLq.js";const g
|
||||
<span class="line"><span style="--shiki-light:#D73A49;--shiki-dark:#F97583;"> if</span><span style="--shiki-light:#24292E;--shiki-dark:#E1E4E8;"> os.path.isdir(package_path) </span><span style="--shiki-light:#D73A49;--shiki-dark:#F97583;">and</span><span style="--shiki-light:#24292E;--shiki-dark:#E1E4E8;"> os.path.exists(os.path.join(package_path, </span><span style="--shiki-light:#032F62;--shiki-dark:#9ECBFF;">'__init__.py'</span><span style="--shiki-light:#24292E;--shiki-dark:#E1E4E8;">)):</span></span>
|
||||
<span class="line"><span style="--shiki-light:#005CC5;--shiki-dark:#79B8FF;"> self</span><span style="--shiki-light:#24292E;--shiki-dark:#E1E4E8;">._load_package(package_name, package_path)</span></span>
|
||||
<span class="line"><span style="--shiki-light:#D73A49;--shiki-dark:#F97583;"> else</span><span style="--shiki-light:#24292E;--shiki-dark:#E1E4E8;">:</span></span>
|
||||
<span class="line"><span style="--shiki-light:#24292E;--shiki-dark:#E1E4E8;"> logger.warning(</span><span style="--shiki-light:#D73A49;--shiki-dark:#F97583;">f</span><span style="--shiki-light:#032F62;--shiki-dark:#9ECBFF;">'</span><span style="--shiki-light:#005CC5;--shiki-dark:#79B8FF;">{</span><span style="--shiki-light:#24292E;--shiki-dark:#E1E4E8;">package_path</span><span style="--shiki-light:#005CC5;--shiki-dark:#79B8FF;">}</span><span style="--shiki-light:#032F62;--shiki-dark:#9ECBFF;"> 不是有效的工具包路径,跳过加载。'</span><span style="--shiki-light:#24292E;--shiki-dark:#E1E4E8;">)</span></span></code></pre></div></details><hr><h4 id="async-func-call-self-full-function-name-str-args-dict" tabindex="-1"><em><strong>async func</strong></em> <code>call(self, full_function_name: str, args: dict)</code> <a class="header-anchor" href="#async-func-call-self-full-function-name-str-args-dict" aria-label="Permalink to "***async func*** \`call(self, full_function_name: str, args: dict)\`""></a></h4><p><strong>说明</strong>: 调用指定的函数</p><details><summary><b>源代码</b> 或 <a href="https://github.com/LiteyukiStudio/nonebot-plugin-marshoai/tree/main/nonebot_plugin_marshoai/models.py#L114" target="_blank">在GitHub上查看</a></summary><div class="language-python vp-adaptive-theme"><button title="Copy Code" class="copy"></button><span class="lang">python</span><pre class="shiki shiki-themes github-light github-dark vp-code" tabindex="0"><code><span class="line"><span style="--shiki-light:#D73A49;--shiki-dark:#F97583;">async</span><span style="--shiki-light:#D73A49;--shiki-dark:#F97583;"> def</span><span style="--shiki-light:#6F42C1;--shiki-dark:#B392F0;"> call</span><span style="--shiki-light:#24292E;--shiki-dark:#E1E4E8;">(self, full_function_name: </span><span style="--shiki-light:#005CC5;--shiki-dark:#79B8FF;">str</span><span style="--shiki-light:#24292E;--shiki-dark:#E1E4E8;">, args: </span><span style="--shiki-light:#005CC5;--shiki-dark:#79B8FF;">dict</span><span style="--shiki-light:#24292E;--shiki-dark:#E1E4E8;">):</span></span>
|
||||
<span class="line"><span style="--shiki-light:#24292E;--shiki-dark:#E1E4E8;"> logger.warning(</span><span style="--shiki-light:#D73A49;--shiki-dark:#F97583;">f</span><span style="--shiki-light:#032F62;--shiki-dark:#9ECBFF;">'</span><span style="--shiki-light:#005CC5;--shiki-dark:#79B8FF;">{</span><span style="--shiki-light:#24292E;--shiki-dark:#E1E4E8;">package_path</span><span style="--shiki-light:#005CC5;--shiki-dark:#79B8FF;">}</span><span style="--shiki-light:#032F62;--shiki-dark:#9ECBFF;"> 不是有效的工具包路径,跳过加载。'</span><span style="--shiki-light:#24292E;--shiki-dark:#E1E4E8;">)</span></span></code></pre></div></details><hr><h4 id="async-func-call-self-full-function-name-str-args-dict" tabindex="-1"><em><strong>async func</strong></em> <code>call(self, full_function_name: str, args: dict)</code> <a class="header-anchor" href="#async-func-call-self-full-function-name-str-args-dict" aria-label="Permalink to "***async func*** \`call(self, full_function_name: str, args: dict)\`""></a></h4><p><strong>说明</strong>: 调用指定的函数</p><details><summary><b>源代码</b> 或 <a href="https://github.com/LiteyukiStudio/nonebot-plugin-marshoai/tree/main/nonebot_plugin_marshoai/models.py#L113" target="_blank">在GitHub上查看</a></summary><div class="language-python vp-adaptive-theme"><button title="Copy Code" class="copy"></button><span class="lang">python</span><pre class="shiki shiki-themes github-light github-dark vp-code" tabindex="0"><code><span class="line"><span style="--shiki-light:#D73A49;--shiki-dark:#F97583;">async</span><span style="--shiki-light:#D73A49;--shiki-dark:#F97583;"> def</span><span style="--shiki-light:#6F42C1;--shiki-dark:#B392F0;"> call</span><span style="--shiki-light:#24292E;--shiki-dark:#E1E4E8;">(self, full_function_name: </span><span style="--shiki-light:#005CC5;--shiki-dark:#79B8FF;">str</span><span style="--shiki-light:#24292E;--shiki-dark:#E1E4E8;">, args: </span><span style="--shiki-light:#005CC5;--shiki-dark:#79B8FF;">dict</span><span style="--shiki-light:#24292E;--shiki-dark:#E1E4E8;">):</span></span>
|
||||
<span class="line"><span style="--shiki-light:#24292E;--shiki-dark:#E1E4E8;"> parts </span><span style="--shiki-light:#D73A49;--shiki-dark:#F97583;">=</span><span style="--shiki-light:#24292E;--shiki-dark:#E1E4E8;"> full_function_name.split(</span><span style="--shiki-light:#032F62;--shiki-dark:#9ECBFF;">'__'</span><span style="--shiki-light:#24292E;--shiki-dark:#E1E4E8;">)</span></span>
|
||||
<span class="line"><span style="--shiki-light:#D73A49;--shiki-dark:#F97583;"> if</span><span style="--shiki-light:#005CC5;--shiki-dark:#79B8FF;"> len</span><span style="--shiki-light:#24292E;--shiki-dark:#E1E4E8;">(parts) </span><span style="--shiki-light:#D73A49;--shiki-dark:#F97583;">!=</span><span style="--shiki-light:#005CC5;--shiki-dark:#79B8FF;"> 2</span><span style="--shiki-light:#24292E;--shiki-dark:#E1E4E8;">:</span></span>
|
||||
<span class="line"><span style="--shiki-light:#24292E;--shiki-dark:#E1E4E8;"> logger.error(</span><span style="--shiki-light:#032F62;--shiki-dark:#9ECBFF;">'函数名无效'</span><span style="--shiki-light:#24292E;--shiki-dark:#E1E4E8;">)</span></span>
|
||||
@@ -35,12 +35,12 @@ import{_ as i,c as a,o as t,ae as n}from"./chunks/framework.BHrE6nLq.js";const g
|
||||
<span class="line"><span style="--shiki-light:#24292E;--shiki-dark:#E1E4E8;"> logger.error(errinfo)</span></span>
|
||||
<span class="line"><span style="--shiki-light:#D73A49;--shiki-dark:#F97583;"> return</span><span style="--shiki-light:#24292E;--shiki-dark:#E1E4E8;"> errinfo</span></span>
|
||||
<span class="line"><span style="--shiki-light:#D73A49;--shiki-dark:#F97583;"> else</span><span style="--shiki-light:#24292E;--shiki-dark:#E1E4E8;">:</span></span>
|
||||
<span class="line"><span style="--shiki-light:#24292E;--shiki-dark:#E1E4E8;"> logger.error(</span><span style="--shiki-light:#D73A49;--shiki-dark:#F97583;">f</span><span style="--shiki-light:#032F62;--shiki-dark:#9ECBFF;">"工具包 '</span><span style="--shiki-light:#005CC5;--shiki-dark:#79B8FF;">{</span><span style="--shiki-light:#24292E;--shiki-dark:#E1E4E8;">package_name</span><span style="--shiki-light:#005CC5;--shiki-dark:#79B8FF;">}</span><span style="--shiki-light:#032F62;--shiki-dark:#9ECBFF;">' 未导入"</span><span style="--shiki-light:#24292E;--shiki-dark:#E1E4E8;">)</span></span></code></pre></div></details><hr><h4 id="func-has-function-self-full-function-name-str-bool" tabindex="-1"><em><strong>func</strong></em> <code>has_function(self, full_function_name: str) -> bool</code> <a class="header-anchor" href="#func-has-function-self-full-function-name-str-bool" aria-label="Permalink to "***func*** \`has_function(self, full_function_name: str) -> bool\`""></a></h4><p><strong>说明</strong>: 检查是否存在指定的函数</p><details><summary><b>源代码</b> 或 <a href="https://github.com/LiteyukiStudio/nonebot-plugin-marshoai/tree/main/nonebot_plugin_marshoai/models.py#L136" target="_blank">在GitHub上查看</a></summary><div class="language-python vp-adaptive-theme"><button title="Copy Code" class="copy"></button><span class="lang">python</span><pre class="shiki shiki-themes github-light github-dark vp-code" tabindex="0"><code><span class="line"><span style="--shiki-light:#D73A49;--shiki-dark:#F97583;">def</span><span style="--shiki-light:#6F42C1;--shiki-dark:#B392F0;"> has_function</span><span style="--shiki-light:#24292E;--shiki-dark:#E1E4E8;">(self, full_function_name: </span><span style="--shiki-light:#005CC5;--shiki-dark:#79B8FF;">str</span><span style="--shiki-light:#24292E;--shiki-dark:#E1E4E8;">) -> </span><span style="--shiki-light:#005CC5;--shiki-dark:#79B8FF;">bool</span><span style="--shiki-light:#24292E;--shiki-dark:#E1E4E8;">:</span></span>
|
||||
<span class="line"><span style="--shiki-light:#24292E;--shiki-dark:#E1E4E8;"> logger.error(</span><span style="--shiki-light:#D73A49;--shiki-dark:#F97583;">f</span><span style="--shiki-light:#032F62;--shiki-dark:#9ECBFF;">"工具包 '</span><span style="--shiki-light:#005CC5;--shiki-dark:#79B8FF;">{</span><span style="--shiki-light:#24292E;--shiki-dark:#E1E4E8;">package_name</span><span style="--shiki-light:#005CC5;--shiki-dark:#79B8FF;">}</span><span style="--shiki-light:#032F62;--shiki-dark:#9ECBFF;">' 未导入"</span><span style="--shiki-light:#24292E;--shiki-dark:#E1E4E8;">)</span></span></code></pre></div></details><hr><h4 id="func-has-function-self-full-function-name-str-bool" tabindex="-1"><em><strong>func</strong></em> <code>has_function(self, full_function_name: str) -> bool</code> <a class="header-anchor" href="#func-has-function-self-full-function-name-str-bool" aria-label="Permalink to "***func*** \`has_function(self, full_function_name: str) -> bool\`""></a></h4><p><strong>说明</strong>: 检查是否存在指定的函数</p><details><summary><b>源代码</b> 或 <a href="https://github.com/LiteyukiStudio/nonebot-plugin-marshoai/tree/main/nonebot_plugin_marshoai/models.py#L135" target="_blank">在GitHub上查看</a></summary><div class="language-python vp-adaptive-theme"><button title="Copy Code" class="copy"></button><span class="lang">python</span><pre class="shiki shiki-themes github-light github-dark vp-code" tabindex="0"><code><span class="line"><span style="--shiki-light:#D73A49;--shiki-dark:#F97583;">def</span><span style="--shiki-light:#6F42C1;--shiki-dark:#B392F0;"> has_function</span><span style="--shiki-light:#24292E;--shiki-dark:#E1E4E8;">(self, full_function_name: </span><span style="--shiki-light:#005CC5;--shiki-dark:#79B8FF;">str</span><span style="--shiki-light:#24292E;--shiki-dark:#E1E4E8;">) -> </span><span style="--shiki-light:#005CC5;--shiki-dark:#79B8FF;">bool</span><span style="--shiki-light:#24292E;--shiki-dark:#E1E4E8;">:</span></span>
|
||||
<span class="line"><span style="--shiki-light:#D73A49;--shiki-dark:#F97583;"> try</span><span style="--shiki-light:#24292E;--shiki-dark:#E1E4E8;">:</span></span>
|
||||
<span class="line"><span style="--shiki-light:#D73A49;--shiki-dark:#F97583;"> return</span><span style="--shiki-light:#005CC5;--shiki-dark:#79B8FF;"> any</span><span style="--shiki-light:#24292E;--shiki-dark:#E1E4E8;">((t[</span><span style="--shiki-light:#032F62;--shiki-dark:#9ECBFF;">'function'</span><span style="--shiki-light:#24292E;--shiki-dark:#E1E4E8;">][</span><span style="--shiki-light:#032F62;--shiki-dark:#9ECBFF;">'name'</span><span style="--shiki-light:#24292E;--shiki-dark:#E1E4E8;">].replace(</span><span style="--shiki-light:#032F62;--shiki-dark:#9ECBFF;">'-'</span><span style="--shiki-light:#24292E;--shiki-dark:#E1E4E8;">, </span><span style="--shiki-light:#032F62;--shiki-dark:#9ECBFF;">'_'</span><span style="--shiki-light:#24292E;--shiki-dark:#E1E4E8;">) </span><span style="--shiki-light:#D73A49;--shiki-dark:#F97583;">==</span><span style="--shiki-light:#24292E;--shiki-dark:#E1E4E8;"> full_function_name.replace(</span><span style="--shiki-light:#032F62;--shiki-dark:#9ECBFF;">'-'</span><span style="--shiki-light:#24292E;--shiki-dark:#E1E4E8;">, </span><span style="--shiki-light:#032F62;--shiki-dark:#9ECBFF;">'_'</span><span style="--shiki-light:#24292E;--shiki-dark:#E1E4E8;">) </span><span style="--shiki-light:#D73A49;--shiki-dark:#F97583;">for</span><span style="--shiki-light:#24292E;--shiki-dark:#E1E4E8;"> t </span><span style="--shiki-light:#D73A49;--shiki-dark:#F97583;">in</span><span style="--shiki-light:#005CC5;--shiki-dark:#79B8FF;"> self</span><span style="--shiki-light:#24292E;--shiki-dark:#E1E4E8;">.tools_list))</span></span>
|
||||
<span class="line"><span style="--shiki-light:#D73A49;--shiki-dark:#F97583;"> except</span><span style="--shiki-light:#005CC5;--shiki-dark:#79B8FF;"> Exception</span><span style="--shiki-light:#D73A49;--shiki-dark:#F97583;"> as</span><span style="--shiki-light:#24292E;--shiki-dark:#E1E4E8;"> e:</span></span>
|
||||
<span class="line"><span style="--shiki-light:#24292E;--shiki-dark:#E1E4E8;"> logger.error(</span><span style="--shiki-light:#D73A49;--shiki-dark:#F97583;">f</span><span style="--shiki-light:#032F62;--shiki-dark:#9ECBFF;">"检查函数 '</span><span style="--shiki-light:#005CC5;--shiki-dark:#79B8FF;">{</span><span style="--shiki-light:#24292E;--shiki-dark:#E1E4E8;">full_function_name</span><span style="--shiki-light:#005CC5;--shiki-dark:#79B8FF;">}</span><span style="--shiki-light:#032F62;--shiki-dark:#9ECBFF;">' 时发生错误:</span><span style="--shiki-light:#005CC5;--shiki-dark:#79B8FF;">{</span><span style="--shiki-light:#24292E;--shiki-dark:#E1E4E8;">e</span><span style="--shiki-light:#005CC5;--shiki-dark:#79B8FF;">}</span><span style="--shiki-light:#032F62;--shiki-dark:#9ECBFF;">"</span><span style="--shiki-light:#24292E;--shiki-dark:#E1E4E8;">)</span></span>
|
||||
<span class="line"><span style="--shiki-light:#D73A49;--shiki-dark:#F97583;"> return</span><span style="--shiki-light:#005CC5;--shiki-dark:#79B8FF;"> False</span></span></code></pre></div></details><hr><h4 id="func-get-tools-list-self" tabindex="-1"><em><strong>func</strong></em> <code>get_tools_list(self)</code> <a class="header-anchor" href="#func-get-tools-list-self" aria-label="Permalink to "***func*** \`get_tools_list(self)\`""></a></h4><details><summary><b>源代码</b> 或 <a href="https://github.com/LiteyukiStudio/nonebot-plugin-marshoai/tree/main/nonebot_plugin_marshoai/models.py#L150" target="_blank">在GitHub上查看</a></summary><div class="language-python vp-adaptive-theme"><button title="Copy Code" class="copy"></button><span class="lang">python</span><pre class="shiki shiki-themes github-light github-dark vp-code" tabindex="0"><code><span class="line"><span style="--shiki-light:#D73A49;--shiki-dark:#F97583;">def</span><span style="--shiki-light:#6F42C1;--shiki-dark:#B392F0;"> get_tools_list</span><span style="--shiki-light:#24292E;--shiki-dark:#E1E4E8;">(self):</span></span>
|
||||
<span class="line"><span style="--shiki-light:#D73A49;--shiki-dark:#F97583;"> return</span><span style="--shiki-light:#005CC5;--shiki-dark:#79B8FF;"> False</span></span></code></pre></div></details><hr><h4 id="func-get-tools-list-self" tabindex="-1"><em><strong>func</strong></em> <code>get_tools_list(self)</code> <a class="header-anchor" href="#func-get-tools-list-self" aria-label="Permalink to "***func*** \`get_tools_list(self)\`""></a></h4><details><summary><b>源代码</b> 或 <a href="https://github.com/LiteyukiStudio/nonebot-plugin-marshoai/tree/main/nonebot_plugin_marshoai/models.py#L149" target="_blank">在GitHub上查看</a></summary><div class="language-python vp-adaptive-theme"><button title="Copy Code" class="copy"></button><span class="lang">python</span><pre class="shiki shiki-themes github-light github-dark vp-code" tabindex="0"><code><span class="line"><span style="--shiki-light:#D73A49;--shiki-dark:#F97583;">def</span><span style="--shiki-light:#6F42C1;--shiki-dark:#B392F0;"> get_tools_list</span><span style="--shiki-light:#24292E;--shiki-dark:#E1E4E8;">(self):</span></span>
|
||||
<span class="line"><span style="--shiki-light:#D73A49;--shiki-dark:#F97583;"> if</span><span style="--shiki-light:#D73A49;--shiki-dark:#F97583;"> not</span><span style="--shiki-light:#005CC5;--shiki-dark:#79B8FF;"> self</span><span style="--shiki-light:#24292E;--shiki-dark:#E1E4E8;">.tools_list </span><span style="--shiki-light:#D73A49;--shiki-dark:#F97583;">or</span><span style="--shiki-light:#D73A49;--shiki-dark:#F97583;"> not</span><span style="--shiki-light:#24292E;--shiki-dark:#E1E4E8;"> config.marshoai_enable_tools:</span></span>
|
||||
<span class="line"><span style="--shiki-light:#D73A49;--shiki-dark:#F97583;"> return</span><span style="--shiki-light:#005CC5;--shiki-dark:#79B8FF;"> None</span></span>
|
||||
<span class="line"><span style="--shiki-light:#D73A49;--shiki-dark:#F97583;"> return</span><span style="--shiki-light:#005CC5;--shiki-dark:#79B8FF;"> self</span><span style="--shiki-light:#24292E;--shiki-dark:#E1E4E8;">.tools_list</span></span></code></pre></div></details>`,44)]))}const E=i(l,[["render",e]]);export{g as __pageData,E as default};
|
||||
@@ -1,4 +1,4 @@
|
||||
import{_ as i,c as a,o as n,ae as t}from"./chunks/framework.BHrE6nLq.js";const g=JSON.parse('{"title":"util","description":"","frontmatter":{"title":"util","order":100},"headers":[],"relativePath":"dev/api/util.md","filePath":"zh/dev/api/util.md","lastUpdated":1734175019000}'),h={name:"dev/api/util.md"};function k(l,s,p,e,r,E){return n(),a("div",null,s[0]||(s[0]=[t(`<h1 id="模块-nonebot-plugin-marshoai-util" tabindex="-1"><strong>模块</strong> <code>nonebot_plugin_marshoai.util</code> <a class="header-anchor" href="#模块-nonebot-plugin-marshoai-util" aria-label="Permalink to "**模块** \`nonebot_plugin_marshoai.util\`""></a></h1><h3 id="var-nickname-json" tabindex="-1">var <code>nickname_json</code> <a class="header-anchor" href="#var-nickname-json" aria-label="Permalink to "var \`nickname_json\`""></a></h3><ul><li><p><strong>说明</strong>: 记录昵称</p></li><li><p><strong>默认值</strong>: <code>None</code></p></li></ul><h3 id="var-praises-json" tabindex="-1">var <code>praises_json</code> <a class="header-anchor" href="#var-praises-json" aria-label="Permalink to "var \`praises_json\`""></a></h3><ul><li><p><strong>说明</strong>: 记录夸赞名单</p></li><li><p><strong>默认值</strong>: <code>None</code></p></li></ul><h3 id="var-loaded-target-list" tabindex="-1">var <code>loaded_target_list</code> <a class="header-anchor" href="#var-loaded-target-list" aria-label="Permalink to "var \`loaded_target_list\`""></a></h3><ul><li><p><strong>说明</strong>: 记录已恢复备份的上下文的列表</p></li><li><p><strong>默认值</strong>: <code>[]</code></p></li></ul><hr><h3 id="async-func-get-image-raw-and-type-url-str-timeout-int-10-optional-tuple-bytes-str" tabindex="-1"><em><strong>async func</strong></em> <code>get_image_raw_and_type(url: str, timeout: int = 10) -> Optional[tuple[bytes, str]]</code> <a class="header-anchor" href="#async-func-get-image-raw-and-type-url-str-timeout-int-10-optional-tuple-bytes-str" aria-label="Permalink to "***async func*** \`get_image_raw_and_type(url: str, timeout: int = 10) -> Optional[tuple[bytes, str]]\`""></a></h3><p><strong>说明</strong>: 获取图片的二进制数据</p><p><strong>参数</strong>:</p><blockquote><ul><li>url: str 图片链接</li><li>timeout: int 超时时间 秒</li></ul></blockquote><details><summary><b>源代码</b> 或 <a href="https://github.com/LiteyukiStudio/nonebot-plugin-marshoai/tree/main/nonebot_plugin_marshoai/util.py#L62" target="_blank">在GitHub上查看</a></summary><div class="language-python vp-adaptive-theme"><button title="Copy Code" class="copy"></button><span class="lang">python</span><pre class="shiki shiki-themes github-light github-dark vp-code" tabindex="0"><code><span class="line"><span style="--shiki-light:#D73A49;--shiki-dark:#F97583;">async</span><span style="--shiki-light:#D73A49;--shiki-dark:#F97583;"> def</span><span style="--shiki-light:#6F42C1;--shiki-dark:#B392F0;"> get_image_raw_and_type</span><span style="--shiki-light:#24292E;--shiki-dark:#E1E4E8;">(url: </span><span style="--shiki-light:#005CC5;--shiki-dark:#79B8FF;">str</span><span style="--shiki-light:#24292E;--shiki-dark:#E1E4E8;">, timeout: </span><span style="--shiki-light:#005CC5;--shiki-dark:#79B8FF;">int</span><span style="--shiki-light:#D73A49;--shiki-dark:#F97583;">=</span><span style="--shiki-light:#005CC5;--shiki-dark:#79B8FF;">10</span><span style="--shiki-light:#24292E;--shiki-dark:#E1E4E8;">) -> Optional[tuple[</span><span style="--shiki-light:#005CC5;--shiki-dark:#79B8FF;">bytes</span><span style="--shiki-light:#24292E;--shiki-dark:#E1E4E8;">, </span><span style="--shiki-light:#005CC5;--shiki-dark:#79B8FF;">str</span><span style="--shiki-light:#24292E;--shiki-dark:#E1E4E8;">]]:</span></span>
|
||||
import{_ as i,c as a,o as n,ae as t}from"./chunks/framework.BHrE6nLq.js";const g=JSON.parse('{"title":"util","description":"","frontmatter":{"title":"util","order":100},"headers":[],"relativePath":"dev/api/util.md","filePath":"zh/dev/api/util.md","lastUpdated":1734175019000}'),h={name:"dev/api/util.md"};function k(l,s,p,e,r,E){return n(),a("div",null,s[0]||(s[0]=[t(`<h1 id="模块-nonebot-plugin-marshoai-util" tabindex="-1"><strong>模块</strong> <code>nonebot_plugin_marshoai.util</code> <a class="header-anchor" href="#模块-nonebot-plugin-marshoai-util" aria-label="Permalink to "**模块** \`nonebot_plugin_marshoai.util\`""></a></h1><h3 id="var-nickname-json" tabindex="-1">var <code>nickname_json</code> <a class="header-anchor" href="#var-nickname-json" aria-label="Permalink to "var \`nickname_json\`""></a></h3><ul><li><p><strong>说明</strong>: 记录昵称</p></li><li><p><strong>默认值</strong>: <code>None</code></p></li></ul><h3 id="var-praises-json" tabindex="-1">var <code>praises_json</code> <a class="header-anchor" href="#var-praises-json" aria-label="Permalink to "var \`praises_json\`""></a></h3><ul><li><p><strong>说明</strong>: 记录夸赞名单</p></li><li><p><strong>默认值</strong>: <code>None</code></p></li></ul><h3 id="var-loaded-target-list" tabindex="-1">var <code>loaded_target_list</code> <a class="header-anchor" href="#var-loaded-target-list" aria-label="Permalink to "var \`loaded_target_list\`""></a></h3><ul><li><p><strong>说明</strong>: 记录已恢复备份的上下文的列表</p></li><li><p><strong>类型</strong>: <code>List[str]</code></p></li><li><p><strong>默认值</strong>: <code>[]</code></p></li></ul><hr><h3 id="async-func-get-image-raw-and-type-url-str-timeout-int-10-optional-tuple-bytes-str" tabindex="-1"><em><strong>async func</strong></em> <code>get_image_raw_and_type(url: str, timeout: int = 10) -> Optional[tuple[bytes, str]]</code> <a class="header-anchor" href="#async-func-get-image-raw-and-type-url-str-timeout-int-10-optional-tuple-bytes-str" aria-label="Permalink to "***async func*** \`get_image_raw_and_type(url: str, timeout: int = 10) -> Optional[tuple[bytes, str]]\`""></a></h3><p><strong>说明</strong>: 获取图片的二进制数据</p><p><strong>参数</strong>:</p><blockquote><ul><li>url: str 图片链接</li><li>timeout: int 超时时间 秒</li></ul></blockquote><details><summary><b>源代码</b> 或 <a href="https://github.com/LiteyukiStudio/nonebot-plugin-marshoai/tree/main/nonebot_plugin_marshoai/util.py#L62" target="_blank">在GitHub上查看</a></summary><div class="language-python vp-adaptive-theme"><button title="Copy Code" class="copy"></button><span class="lang">python</span><pre class="shiki shiki-themes github-light github-dark vp-code" tabindex="0"><code><span class="line"><span style="--shiki-light:#D73A49;--shiki-dark:#F97583;">async</span><span style="--shiki-light:#D73A49;--shiki-dark:#F97583;"> def</span><span style="--shiki-light:#6F42C1;--shiki-dark:#B392F0;"> get_image_raw_and_type</span><span style="--shiki-light:#24292E;--shiki-dark:#E1E4E8;">(url: </span><span style="--shiki-light:#005CC5;--shiki-dark:#79B8FF;">str</span><span style="--shiki-light:#24292E;--shiki-dark:#E1E4E8;">, timeout: </span><span style="--shiki-light:#005CC5;--shiki-dark:#79B8FF;">int</span><span style="--shiki-light:#D73A49;--shiki-dark:#F97583;">=</span><span style="--shiki-light:#005CC5;--shiki-dark:#79B8FF;">10</span><span style="--shiki-light:#24292E;--shiki-dark:#E1E4E8;">) -> Optional[tuple[</span><span style="--shiki-light:#005CC5;--shiki-dark:#79B8FF;">bytes</span><span style="--shiki-light:#24292E;--shiki-dark:#E1E4E8;">, </span><span style="--shiki-light:#005CC5;--shiki-dark:#79B8FF;">str</span><span style="--shiki-light:#24292E;--shiki-dark:#E1E4E8;">]]:</span></span>
|
||||
<span class="line"><span style="--shiki-light:#D73A49;--shiki-dark:#F97583;"> async</span><span style="--shiki-light:#D73A49;--shiki-dark:#F97583;"> with</span><span style="--shiki-light:#24292E;--shiki-dark:#E1E4E8;"> httpx.AsyncClient() </span><span style="--shiki-light:#D73A49;--shiki-dark:#F97583;">as</span><span style="--shiki-light:#24292E;--shiki-dark:#E1E4E8;"> client:</span></span>
|
||||
<span class="line"><span style="--shiki-light:#24292E;--shiki-dark:#E1E4E8;"> response </span><span style="--shiki-light:#D73A49;--shiki-dark:#F97583;">=</span><span style="--shiki-light:#D73A49;--shiki-dark:#F97583;"> await</span><span style="--shiki-light:#24292E;--shiki-dark:#E1E4E8;"> client.get(url, </span><span style="--shiki-light:#E36209;--shiki-dark:#FFAB70;">headers</span><span style="--shiki-light:#D73A49;--shiki-dark:#F97583;">=</span><span style="--shiki-light:#24292E;--shiki-dark:#E1E4E8;">_browser_headers, </span><span style="--shiki-light:#E36209;--shiki-dark:#FFAB70;">timeout</span><span style="--shiki-light:#D73A49;--shiki-dark:#F97583;">=</span><span style="--shiki-light:#24292E;--shiki-dark:#E1E4E8;">timeout)</span></span>
|
||||
<span class="line"><span style="--shiki-light:#D73A49;--shiki-dark:#F97583;"> if</span><span style="--shiki-light:#24292E;--shiki-dark:#E1E4E8;"> response.status_code </span><span style="--shiki-light:#D73A49;--shiki-dark:#F97583;">==</span><span style="--shiki-light:#005CC5;--shiki-dark:#79B8FF;"> 200</span><span style="--shiki-light:#24292E;--shiki-dark:#E1E4E8;">:</span></span>
|
||||
@@ -54,7 +54,7 @@ import{_ as i,c as a,o as n,ae as t}from"./chunks/framework.BHrE6nLq.js";const g
|
||||
<span class="line"><span style="--shiki-light:#D73A49;--shiki-dark:#F97583;"> try</span><span style="--shiki-light:#24292E;--shiki-dark:#E1E4E8;">:</span></span>
|
||||
<span class="line"><span style="--shiki-light:#D73A49;--shiki-dark:#F97583;"> async</span><span style="--shiki-light:#D73A49;--shiki-dark:#F97583;"> with</span><span style="--shiki-light:#24292E;--shiki-dark:#E1E4E8;"> aiofiles.open(filename, </span><span style="--shiki-light:#032F62;--shiki-dark:#9ECBFF;">'r'</span><span style="--shiki-light:#24292E;--shiki-dark:#E1E4E8;">, </span><span style="--shiki-light:#E36209;--shiki-dark:#FFAB70;">encoding</span><span style="--shiki-light:#D73A49;--shiki-dark:#F97583;">=</span><span style="--shiki-light:#032F62;--shiki-dark:#9ECBFF;">'utf-8'</span><span style="--shiki-light:#24292E;--shiki-dark:#E1E4E8;">) </span><span style="--shiki-light:#D73A49;--shiki-dark:#F97583;">as</span><span style="--shiki-light:#24292E;--shiki-dark:#E1E4E8;"> f:</span></span>
|
||||
<span class="line"><span style="--shiki-light:#24292E;--shiki-dark:#E1E4E8;"> nickname_json </span><span style="--shiki-light:#D73A49;--shiki-dark:#F97583;">=</span><span style="--shiki-light:#24292E;--shiki-dark:#E1E4E8;"> json.loads(</span><span style="--shiki-light:#D73A49;--shiki-dark:#F97583;">await</span><span style="--shiki-light:#24292E;--shiki-dark:#E1E4E8;"> f.read())</span></span>
|
||||
<span class="line"><span style="--shiki-light:#D73A49;--shiki-dark:#F97583;"> except</span><span style="--shiki-light:#005CC5;--shiki-dark:#79B8FF;"> Exception</span><span style="--shiki-light:#24292E;--shiki-dark:#E1E4E8;">:</span></span>
|
||||
<span class="line"><span style="--shiki-light:#D73A49;--shiki-dark:#F97583;"> except</span><span style="--shiki-light:#24292E;--shiki-dark:#E1E4E8;"> (json.JSONDecodeError, </span><span style="--shiki-light:#005CC5;--shiki-dark:#79B8FF;">FileNotFoundError</span><span style="--shiki-light:#24292E;--shiki-dark:#E1E4E8;">):</span></span>
|
||||
<span class="line"><span style="--shiki-light:#24292E;--shiki-dark:#E1E4E8;"> nickname_json </span><span style="--shiki-light:#D73A49;--shiki-dark:#F97583;">=</span><span style="--shiki-light:#24292E;--shiki-dark:#E1E4E8;"> {}</span></span>
|
||||
<span class="line"><span style="--shiki-light:#D73A49;--shiki-dark:#F97583;"> return</span><span style="--shiki-light:#24292E;--shiki-dark:#E1E4E8;"> nickname_json</span></span></code></pre></div></details><hr><h3 id="async-func-set-nickname-user-id-str-name-str" tabindex="-1"><em><strong>async func</strong></em> <code>set_nickname(user_id: str, name: str)</code> <a class="header-anchor" href="#async-func-set-nickname-user-id-str-name-str" aria-label="Permalink to "***async func*** \`set_nickname(user_id: str, name: str)\`""></a></h3><details><summary><b>源代码</b> 或 <a href="https://github.com/LiteyukiStudio/nonebot-plugin-marshoai/tree/main/nonebot_plugin_marshoai/util.py#L227" target="_blank">在GitHub上查看</a></summary><div class="language-python vp-adaptive-theme"><button title="Copy Code" class="copy"></button><span class="lang">python</span><pre class="shiki shiki-themes github-light github-dark vp-code" tabindex="0"><code><span class="line"><span style="--shiki-light:#D73A49;--shiki-dark:#F97583;">async</span><span style="--shiki-light:#D73A49;--shiki-dark:#F97583;"> def</span><span style="--shiki-light:#6F42C1;--shiki-dark:#B392F0;"> set_nickname</span><span style="--shiki-light:#24292E;--shiki-dark:#E1E4E8;">(user_id: </span><span style="--shiki-light:#005CC5;--shiki-dark:#79B8FF;">str</span><span style="--shiki-light:#24292E;--shiki-dark:#E1E4E8;">, name: </span><span style="--shiki-light:#005CC5;--shiki-dark:#79B8FF;">str</span><span style="--shiki-light:#24292E;--shiki-dark:#E1E4E8;">):</span></span>
|
||||
<span class="line"><span style="--shiki-light:#D73A49;--shiki-dark:#F97583;"> global</span><span style="--shiki-light:#24292E;--shiki-dark:#E1E4E8;"> nickname_json</span></span>
|
||||
@@ -74,7 +74,7 @@ import{_ as i,c as a,o as n,ae as t}from"./chunks/framework.BHrE6nLq.js";const g
|
||||
<span class="line"><span style="--shiki-light:#D73A49;--shiki-dark:#F97583;"> try</span><span style="--shiki-light:#24292E;--shiki-dark:#E1E4E8;">:</span></span>
|
||||
<span class="line"><span style="--shiki-light:#D73A49;--shiki-dark:#F97583;"> async</span><span style="--shiki-light:#D73A49;--shiki-dark:#F97583;"> with</span><span style="--shiki-light:#24292E;--shiki-dark:#E1E4E8;"> aiofiles.open(store.get_plugin_data_file(</span><span style="--shiki-light:#032F62;--shiki-dark:#9ECBFF;">'nickname.json'</span><span style="--shiki-light:#24292E;--shiki-dark:#E1E4E8;">), </span><span style="--shiki-light:#032F62;--shiki-dark:#9ECBFF;">'r'</span><span style="--shiki-light:#24292E;--shiki-dark:#E1E4E8;">, </span><span style="--shiki-light:#E36209;--shiki-dark:#FFAB70;">encoding</span><span style="--shiki-light:#D73A49;--shiki-dark:#F97583;">=</span><span style="--shiki-light:#032F62;--shiki-dark:#9ECBFF;">'utf-8'</span><span style="--shiki-light:#24292E;--shiki-dark:#E1E4E8;">) </span><span style="--shiki-light:#D73A49;--shiki-dark:#F97583;">as</span><span style="--shiki-light:#24292E;--shiki-dark:#E1E4E8;"> f:</span></span>
|
||||
<span class="line"><span style="--shiki-light:#24292E;--shiki-dark:#E1E4E8;"> nickname_json </span><span style="--shiki-light:#D73A49;--shiki-dark:#F97583;">=</span><span style="--shiki-light:#24292E;--shiki-dark:#E1E4E8;"> json.loads(</span><span style="--shiki-light:#D73A49;--shiki-dark:#F97583;">await</span><span style="--shiki-light:#24292E;--shiki-dark:#E1E4E8;"> f.read())</span></span>
|
||||
<span class="line"><span style="--shiki-light:#D73A49;--shiki-dark:#F97583;"> except</span><span style="--shiki-light:#005CC5;--shiki-dark:#79B8FF;"> Exception</span><span style="--shiki-light:#24292E;--shiki-dark:#E1E4E8;">:</span></span>
|
||||
<span class="line"><span style="--shiki-light:#D73A49;--shiki-dark:#F97583;"> except</span><span style="--shiki-light:#24292E;--shiki-dark:#E1E4E8;"> (json.JSONDecodeError, </span><span style="--shiki-light:#005CC5;--shiki-dark:#79B8FF;">FileNotFoundError</span><span style="--shiki-light:#24292E;--shiki-dark:#E1E4E8;">):</span></span>
|
||||
<span class="line"><span style="--shiki-light:#24292E;--shiki-dark:#E1E4E8;"> logger.error(</span><span style="--shiki-light:#032F62;--shiki-dark:#9ECBFF;">'刷新 nickname_json 表错误:无法载入 nickname.json 文件'</span><span style="--shiki-light:#24292E;--shiki-dark:#E1E4E8;">)</span></span></code></pre></div></details><hr><h3 id="func-get-prompt-model-str-list-dict-str-any" tabindex="-1"><em><strong>func</strong></em> <code>get_prompt(model: str) -> List[Dict[str, Any]]</code> <a class="header-anchor" href="#func-get-prompt-model-str-list-dict-str-any" aria-label="Permalink to "***func*** \`get_prompt(model: str) -> List[Dict[str, Any]]\`""></a></h3><p><strong>说明</strong>: 获取系统提示词</p><details><summary><b>源代码</b> 或 <a href="https://github.com/LiteyukiStudio/nonebot-plugin-marshoai/tree/main/nonebot_plugin_marshoai/util.py#L256" target="_blank">在GitHub上查看</a></summary><div class="language-python vp-adaptive-theme"><button title="Copy Code" class="copy"></button><span class="lang">python</span><pre class="shiki shiki-themes github-light github-dark vp-code" tabindex="0"><code><span class="line"><span style="--shiki-light:#D73A49;--shiki-dark:#F97583;">def</span><span style="--shiki-light:#6F42C1;--shiki-dark:#B392F0;"> get_prompt</span><span style="--shiki-light:#24292E;--shiki-dark:#E1E4E8;">(model: </span><span style="--shiki-light:#005CC5;--shiki-dark:#79B8FF;">str</span><span style="--shiki-light:#24292E;--shiki-dark:#E1E4E8;">) -> List[Dict[</span><span style="--shiki-light:#005CC5;--shiki-dark:#79B8FF;">str</span><span style="--shiki-light:#24292E;--shiki-dark:#E1E4E8;">, Any]]:</span></span>
|
||||
<span class="line"><span style="--shiki-light:#24292E;--shiki-dark:#E1E4E8;"> prompts </span><span style="--shiki-light:#D73A49;--shiki-dark:#F97583;">=</span><span style="--shiki-light:#24292E;--shiki-dark:#E1E4E8;"> config.marshoai_additional_prompt</span></span>
|
||||
<span class="line"><span style="--shiki-light:#D73A49;--shiki-dark:#F97583;"> if</span><span style="--shiki-light:#24292E;--shiki-dark:#E1E4E8;"> config.marshoai_enable_praises:</span></span>
|
||||
File diff suppressed because one or more lines are too long
@@ -1 +1 @@
|
||||
import{_ as s,c as i,o as t,ae as e}from"./chunks/framework.BHrE6nLq.js";const k=JSON.parse('{"title":"config","description":"","frontmatter":{"title":"config","order":100},"headers":[],"relativePath":"en/dev/api/config.md","filePath":"en/dev/api/config.md","lastUpdated":1738311067000}'),o={name:"en/dev/api/config.md"};function r(n,a,l,h,d,m){return t(),i("div",null,a[0]||(a[0]=[e("",53)]))}const c=s(o,[["render",r]]);export{k as __pageData,c as default};
|
||||
import{_ as s,c as i,o as t,ae as e}from"./chunks/framework.BHrE6nLq.js";const k=JSON.parse('{"title":"config","description":"","frontmatter":{"title":"config","order":100},"headers":[],"relativePath":"en/dev/api/config.md","filePath":"en/dev/api/config.md","lastUpdated":1738311067000}'),r={name:"en/dev/api/config.md"};function o(n,a,l,h,d,m){return t(),i("div",null,a[0]||(a[0]=[e("",53)]))}const c=s(r,[["render",o]]);export{k as __pageData,c as default};
|
||||
@@ -1,13 +1,13 @@
|
||||
import{_ as i,c as a,o as t,ae as n}from"./chunks/framework.BHrE6nLq.js";const g=JSON.parse('{"title":"models","description":"","frontmatter":{"title":"models","order":100},"headers":[],"relativePath":"en/dev/api/models.md","filePath":"en/dev/api/models.md","lastUpdated":1734175019000}'),e={name:"en/dev/api/models.md"};function l(h,s,p,k,r,o){return t(),a("div",null,s[0]||(s[0]=[n(`<h1 id="module-nonebot-plugin-marshoai-models" tabindex="-1"><strong>Module</strong> <code>nonebot_plugin_marshoai.models</code> <a class="header-anchor" href="#module-nonebot-plugin-marshoai-models" aria-label="Permalink to "**Module** \`nonebot_plugin_marshoai.models\`""></a></h1><h3 id="class-marshocontext" tabindex="-1"><em><strong>class</strong></em> <code>MarshoContext</code> <a class="header-anchor" href="#class-marshocontext" aria-label="Permalink to "***class*** \`MarshoContext\`""></a></h3><hr><h4 id="func-init-self" tabindex="-1"><em><strong>func</strong></em> <code>__init__(self)</code> <a class="header-anchor" href="#func-init-self" aria-label="Permalink to "***func*** \`__init__(self)\`""></a></h4><details><summary><b>Source code</b> or <a href="https://github.com/LiteyukiStudio/nonebot-plugin-marshoai/tree/main/nonebot_plugin_marshoai/models.py#L20" target="_blank">View on GitHub</a></summary><div class="language-python vp-adaptive-theme"><button title="Copy Code" class="copy"></button><span class="lang">python</span><pre class="shiki shiki-themes github-light github-dark vp-code" tabindex="0"><code><span class="line"><span style="--shiki-light:#D73A49;--shiki-dark:#F97583;">def</span><span style="--shiki-light:#005CC5;--shiki-dark:#79B8FF;"> __init__</span><span style="--shiki-light:#24292E;--shiki-dark:#E1E4E8;">(self):</span></span>
|
||||
<span class="line"><span style="--shiki-light:#005CC5;--shiki-dark:#79B8FF;"> self</span><span style="--shiki-light:#24292E;--shiki-dark:#E1E4E8;">.contents </span><span style="--shiki-light:#D73A49;--shiki-dark:#F97583;">=</span><span style="--shiki-light:#24292E;--shiki-dark:#E1E4E8;"> {</span><span style="--shiki-light:#032F62;--shiki-dark:#9ECBFF;">'private'</span><span style="--shiki-light:#24292E;--shiki-dark:#E1E4E8;">: {}, </span><span style="--shiki-light:#032F62;--shiki-dark:#9ECBFF;">'non-private'</span><span style="--shiki-light:#24292E;--shiki-dark:#E1E4E8;">: {}}</span></span></code></pre></div></details><hr><h4 id="func-append-self-content-target-id-str-is-private-bool" tabindex="-1"><em><strong>func</strong></em> <code>append(self, content, target_id: str, is_private: bool)</code> <a class="header-anchor" href="#func-append-self-content-target-id-str-is-private-bool" aria-label="Permalink to "***func*** \`append(self, content, target_id: str, is_private: bool)\`""></a></h4><p><strong>Description</strong>: 往上下文中添加消息</p><details><summary><b>Source code</b> or <a href="https://github.com/LiteyukiStudio/nonebot-plugin-marshoai/tree/main/nonebot_plugin_marshoai/models.py#L26" target="_blank">View on GitHub</a></summary><div class="language-python vp-adaptive-theme"><button title="Copy Code" class="copy"></button><span class="lang">python</span><pre class="shiki shiki-themes github-light github-dark vp-code" tabindex="0"><code><span class="line"><span style="--shiki-light:#D73A49;--shiki-dark:#F97583;">def</span><span style="--shiki-light:#6F42C1;--shiki-dark:#B392F0;"> append</span><span style="--shiki-light:#24292E;--shiki-dark:#E1E4E8;">(self, content, target_id: </span><span style="--shiki-light:#005CC5;--shiki-dark:#79B8FF;">str</span><span style="--shiki-light:#24292E;--shiki-dark:#E1E4E8;">, is_private: </span><span style="--shiki-light:#005CC5;--shiki-dark:#79B8FF;">bool</span><span style="--shiki-light:#24292E;--shiki-dark:#E1E4E8;">):</span></span>
|
||||
import{_ as i,c as a,o as t,ae as n}from"./chunks/framework.BHrE6nLq.js";const g=JSON.parse('{"title":"models","description":"","frontmatter":{"title":"models","order":100},"headers":[],"relativePath":"en/dev/api/models.md","filePath":"en/dev/api/models.md","lastUpdated":1734175019000}'),e={name:"en/dev/api/models.md"};function l(h,s,p,k,r,o){return t(),a("div",null,s[0]||(s[0]=[n(`<h1 id="module-nonebot-plugin-marshoai-models" tabindex="-1"><strong>Module</strong> <code>nonebot_plugin_marshoai.models</code> <a class="header-anchor" href="#module-nonebot-plugin-marshoai-models" aria-label="Permalink to "**Module** \`nonebot_plugin_marshoai.models\`""></a></h1><h3 id="class-marshocontext" tabindex="-1"><em><strong>class</strong></em> <code>MarshoContext</code> <a class="header-anchor" href="#class-marshocontext" aria-label="Permalink to "***class*** \`MarshoContext\`""></a></h3><hr><h4 id="func-init-self" tabindex="-1"><em><strong>func</strong></em> <code>__init__(self)</code> <a class="header-anchor" href="#func-init-self" aria-label="Permalink to "***func*** \`__init__(self)\`""></a></h4><details><summary><b>Source code</b> or <a href="https://github.com/LiteyukiStudio/nonebot-plugin-marshoai/tree/main/nonebot_plugin_marshoai/models.py#L19" target="_blank">View on GitHub</a></summary><div class="language-python vp-adaptive-theme"><button title="Copy Code" class="copy"></button><span class="lang">python</span><pre class="shiki shiki-themes github-light github-dark vp-code" tabindex="0"><code><span class="line"><span style="--shiki-light:#D73A49;--shiki-dark:#F97583;">def</span><span style="--shiki-light:#005CC5;--shiki-dark:#79B8FF;"> __init__</span><span style="--shiki-light:#24292E;--shiki-dark:#E1E4E8;">(self):</span></span>
|
||||
<span class="line"><span style="--shiki-light:#005CC5;--shiki-dark:#79B8FF;"> self</span><span style="--shiki-light:#24292E;--shiki-dark:#E1E4E8;">.contents </span><span style="--shiki-light:#D73A49;--shiki-dark:#F97583;">=</span><span style="--shiki-light:#24292E;--shiki-dark:#E1E4E8;"> {</span><span style="--shiki-light:#032F62;--shiki-dark:#9ECBFF;">'private'</span><span style="--shiki-light:#24292E;--shiki-dark:#E1E4E8;">: {}, </span><span style="--shiki-light:#032F62;--shiki-dark:#9ECBFF;">'non-private'</span><span style="--shiki-light:#24292E;--shiki-dark:#E1E4E8;">: {}}</span></span></code></pre></div></details><hr><h4 id="func-append-self-content-target-id-str-is-private-bool" tabindex="-1"><em><strong>func</strong></em> <code>append(self, content, target_id: str, is_private: bool)</code> <a class="header-anchor" href="#func-append-self-content-target-id-str-is-private-bool" aria-label="Permalink to "***func*** \`append(self, content, target_id: str, is_private: bool)\`""></a></h4><p><strong>Description</strong>: 往上下文中添加消息</p><details><summary><b>Source code</b> or <a href="https://github.com/LiteyukiStudio/nonebot-plugin-marshoai/tree/main/nonebot_plugin_marshoai/models.py#L25" target="_blank">View on GitHub</a></summary><div class="language-python vp-adaptive-theme"><button title="Copy Code" class="copy"></button><span class="lang">python</span><pre class="shiki shiki-themes github-light github-dark vp-code" tabindex="0"><code><span class="line"><span style="--shiki-light:#D73A49;--shiki-dark:#F97583;">def</span><span style="--shiki-light:#6F42C1;--shiki-dark:#B392F0;"> append</span><span style="--shiki-light:#24292E;--shiki-dark:#E1E4E8;">(self, content, target_id: </span><span style="--shiki-light:#005CC5;--shiki-dark:#79B8FF;">str</span><span style="--shiki-light:#24292E;--shiki-dark:#E1E4E8;">, is_private: </span><span style="--shiki-light:#005CC5;--shiki-dark:#79B8FF;">bool</span><span style="--shiki-light:#24292E;--shiki-dark:#E1E4E8;">):</span></span>
|
||||
<span class="line"><span style="--shiki-light:#24292E;--shiki-dark:#E1E4E8;"> target_dict </span><span style="--shiki-light:#D73A49;--shiki-dark:#F97583;">=</span><span style="--shiki-light:#005CC5;--shiki-dark:#79B8FF;"> self</span><span style="--shiki-light:#24292E;--shiki-dark:#E1E4E8;">._get_target_dict(is_private)</span></span>
|
||||
<span class="line"><span style="--shiki-light:#24292E;--shiki-dark:#E1E4E8;"> target_dict.setdefault(target_id, []).append(content)</span></span></code></pre></div></details><hr><h4 id="func-set-context-self-contexts-target-id-str-is-private-bool" tabindex="-1"><em><strong>func</strong></em> <code>set_context(self, contexts, target_id: str, is_private: bool)</code> <a class="header-anchor" href="#func-set-context-self-contexts-target-id-str-is-private-bool" aria-label="Permalink to "***func*** \`set_context(self, contexts, target_id: str, is_private: bool)\`""></a></h4><p><strong>Description</strong>: 设置上下文</p><details><summary><b>Source code</b> or <a href="https://github.com/LiteyukiStudio/nonebot-plugin-marshoai/tree/main/nonebot_plugin_marshoai/models.py#L33" target="_blank">View on GitHub</a></summary><div class="language-python vp-adaptive-theme"><button title="Copy Code" class="copy"></button><span class="lang">python</span><pre class="shiki shiki-themes github-light github-dark vp-code" tabindex="0"><code><span class="line"><span style="--shiki-light:#D73A49;--shiki-dark:#F97583;">def</span><span style="--shiki-light:#6F42C1;--shiki-dark:#B392F0;"> set_context</span><span style="--shiki-light:#24292E;--shiki-dark:#E1E4E8;">(self, contexts, target_id: </span><span style="--shiki-light:#005CC5;--shiki-dark:#79B8FF;">str</span><span style="--shiki-light:#24292E;--shiki-dark:#E1E4E8;">, is_private: </span><span style="--shiki-light:#005CC5;--shiki-dark:#79B8FF;">bool</span><span style="--shiki-light:#24292E;--shiki-dark:#E1E4E8;">):</span></span>
|
||||
<span class="line"><span style="--shiki-light:#005CC5;--shiki-dark:#79B8FF;"> self</span><span style="--shiki-light:#24292E;--shiki-dark:#E1E4E8;">._get_target_dict(is_private)[target_id] </span><span style="--shiki-light:#D73A49;--shiki-dark:#F97583;">=</span><span style="--shiki-light:#24292E;--shiki-dark:#E1E4E8;"> contexts</span></span></code></pre></div></details><hr><h4 id="func-reset-self-target-id-str-is-private-bool" tabindex="-1"><em><strong>func</strong></em> <code>reset(self, target_id: str, is_private: bool)</code> <a class="header-anchor" href="#func-reset-self-target-id-str-is-private-bool" aria-label="Permalink to "***func*** \`reset(self, target_id: str, is_private: bool)\`""></a></h4><p><strong>Description</strong>: 重置上下文</p><details><summary><b>Source code</b> or <a href="https://github.com/LiteyukiStudio/nonebot-plugin-marshoai/tree/main/nonebot_plugin_marshoai/models.py#L39" target="_blank">View on GitHub</a></summary><div class="language-python vp-adaptive-theme"><button title="Copy Code" class="copy"></button><span class="lang">python</span><pre class="shiki shiki-themes github-light github-dark vp-code" tabindex="0"><code><span class="line"><span style="--shiki-light:#D73A49;--shiki-dark:#F97583;">def</span><span style="--shiki-light:#6F42C1;--shiki-dark:#B392F0;"> reset</span><span style="--shiki-light:#24292E;--shiki-dark:#E1E4E8;">(self, target_id: </span><span style="--shiki-light:#005CC5;--shiki-dark:#79B8FF;">str</span><span style="--shiki-light:#24292E;--shiki-dark:#E1E4E8;">, is_private: </span><span style="--shiki-light:#005CC5;--shiki-dark:#79B8FF;">bool</span><span style="--shiki-light:#24292E;--shiki-dark:#E1E4E8;">):</span></span>
|
||||
<span class="line"><span style="--shiki-light:#005CC5;--shiki-dark:#79B8FF;"> self</span><span style="--shiki-light:#24292E;--shiki-dark:#E1E4E8;">._get_target_dict(is_private).pop(target_id, </span><span style="--shiki-light:#005CC5;--shiki-dark:#79B8FF;">None</span><span style="--shiki-light:#24292E;--shiki-dark:#E1E4E8;">)</span></span></code></pre></div></details><hr><h4 id="func-reset-all-self" tabindex="-1"><em><strong>func</strong></em> <code>reset_all(self)</code> <a class="header-anchor" href="#func-reset-all-self" aria-label="Permalink to "***func*** \`reset_all(self)\`""></a></h4><p><strong>Description</strong>: 重置所有上下文</p><details><summary><b>Source code</b> or <a href="https://github.com/LiteyukiStudio/nonebot-plugin-marshoai/tree/main/nonebot_plugin_marshoai/models.py#L45" target="_blank">View on GitHub</a></summary><div class="language-python vp-adaptive-theme"><button title="Copy Code" class="copy"></button><span class="lang">python</span><pre class="shiki shiki-themes github-light github-dark vp-code" tabindex="0"><code><span class="line"><span style="--shiki-light:#D73A49;--shiki-dark:#F97583;">def</span><span style="--shiki-light:#6F42C1;--shiki-dark:#B392F0;"> reset_all</span><span style="--shiki-light:#24292E;--shiki-dark:#E1E4E8;">(self):</span></span>
|
||||
<span class="line"><span style="--shiki-light:#005CC5;--shiki-dark:#79B8FF;"> self</span><span style="--shiki-light:#24292E;--shiki-dark:#E1E4E8;">.contents </span><span style="--shiki-light:#D73A49;--shiki-dark:#F97583;">=</span><span style="--shiki-light:#24292E;--shiki-dark:#E1E4E8;"> {</span><span style="--shiki-light:#032F62;--shiki-dark:#9ECBFF;">'private'</span><span style="--shiki-light:#24292E;--shiki-dark:#E1E4E8;">: {}, </span><span style="--shiki-light:#032F62;--shiki-dark:#9ECBFF;">'non-private'</span><span style="--shiki-light:#24292E;--shiki-dark:#E1E4E8;">: {}}</span></span></code></pre></div></details><hr><h4 id="func-build-self-target-id-str-is-private-bool-list" tabindex="-1"><em><strong>func</strong></em> <code>build(self, target_id: str, is_private: bool) -> list</code> <a class="header-anchor" href="#func-build-self-target-id-str-is-private-bool-list" aria-label="Permalink to "***func*** \`build(self, target_id: str, is_private: bool) -> list\`""></a></h4><p><strong>Description</strong>: 构建返回的上下文,不包括系统消息</p><details><summary><b>Source code</b> or <a href="https://github.com/LiteyukiStudio/nonebot-plugin-marshoai/tree/main/nonebot_plugin_marshoai/models.py#L51" target="_blank">View on GitHub</a></summary><div class="language-python vp-adaptive-theme"><button title="Copy Code" class="copy"></button><span class="lang">python</span><pre class="shiki shiki-themes github-light github-dark vp-code" tabindex="0"><code><span class="line"><span style="--shiki-light:#D73A49;--shiki-dark:#F97583;">def</span><span style="--shiki-light:#6F42C1;--shiki-dark:#B392F0;"> build</span><span style="--shiki-light:#24292E;--shiki-dark:#E1E4E8;">(self, target_id: </span><span style="--shiki-light:#005CC5;--shiki-dark:#79B8FF;">str</span><span style="--shiki-light:#24292E;--shiki-dark:#E1E4E8;">, is_private: </span><span style="--shiki-light:#005CC5;--shiki-dark:#79B8FF;">bool</span><span style="--shiki-light:#24292E;--shiki-dark:#E1E4E8;">) -> </span><span style="--shiki-light:#005CC5;--shiki-dark:#79B8FF;">list</span><span style="--shiki-light:#24292E;--shiki-dark:#E1E4E8;">:</span></span>
|
||||
<span class="line"><span style="--shiki-light:#D73A49;--shiki-dark:#F97583;"> return</span><span style="--shiki-light:#005CC5;--shiki-dark:#79B8FF;"> self</span><span style="--shiki-light:#24292E;--shiki-dark:#E1E4E8;">._get_target_dict(is_private).setdefault(target_id, [])</span></span></code></pre></div></details><h3 id="class-marshotools" tabindex="-1"><em><strong>class</strong></em> <code>MarshoTools</code> <a class="header-anchor" href="#class-marshotools" aria-label="Permalink to "***class*** \`MarshoTools\`""></a></h3><hr><h4 id="func-init-self-1" tabindex="-1"><em><strong>func</strong></em> <code>__init__(self)</code> <a class="header-anchor" href="#func-init-self-1" aria-label="Permalink to "***func*** \`__init__(self)\`""></a></h4><details><summary><b>Source code</b> or <a href="https://github.com/LiteyukiStudio/nonebot-plugin-marshoai/tree/main/nonebot_plugin_marshoai/models.py#L63" target="_blank">View on GitHub</a></summary><div class="language-python vp-adaptive-theme"><button title="Copy Code" class="copy"></button><span class="lang">python</span><pre class="shiki shiki-themes github-light github-dark vp-code" tabindex="0"><code><span class="line"><span style="--shiki-light:#D73A49;--shiki-dark:#F97583;">def</span><span style="--shiki-light:#005CC5;--shiki-dark:#79B8FF;"> __init__</span><span style="--shiki-light:#24292E;--shiki-dark:#E1E4E8;">(self):</span></span>
|
||||
<span class="line"><span style="--shiki-light:#24292E;--shiki-dark:#E1E4E8;"> target_dict.setdefault(target_id, []).append(content)</span></span></code></pre></div></details><hr><h4 id="func-set-context-self-contexts-target-id-str-is-private-bool" tabindex="-1"><em><strong>func</strong></em> <code>set_context(self, contexts, target_id: str, is_private: bool)</code> <a class="header-anchor" href="#func-set-context-self-contexts-target-id-str-is-private-bool" aria-label="Permalink to "***func*** \`set_context(self, contexts, target_id: str, is_private: bool)\`""></a></h4><p><strong>Description</strong>: 设置上下文</p><details><summary><b>Source code</b> or <a href="https://github.com/LiteyukiStudio/nonebot-plugin-marshoai/tree/main/nonebot_plugin_marshoai/models.py#L32" target="_blank">View on GitHub</a></summary><div class="language-python vp-adaptive-theme"><button title="Copy Code" class="copy"></button><span class="lang">python</span><pre class="shiki shiki-themes github-light github-dark vp-code" tabindex="0"><code><span class="line"><span style="--shiki-light:#D73A49;--shiki-dark:#F97583;">def</span><span style="--shiki-light:#6F42C1;--shiki-dark:#B392F0;"> set_context</span><span style="--shiki-light:#24292E;--shiki-dark:#E1E4E8;">(self, contexts, target_id: </span><span style="--shiki-light:#005CC5;--shiki-dark:#79B8FF;">str</span><span style="--shiki-light:#24292E;--shiki-dark:#E1E4E8;">, is_private: </span><span style="--shiki-light:#005CC5;--shiki-dark:#79B8FF;">bool</span><span style="--shiki-light:#24292E;--shiki-dark:#E1E4E8;">):</span></span>
|
||||
<span class="line"><span style="--shiki-light:#005CC5;--shiki-dark:#79B8FF;"> self</span><span style="--shiki-light:#24292E;--shiki-dark:#E1E4E8;">._get_target_dict(is_private)[target_id] </span><span style="--shiki-light:#D73A49;--shiki-dark:#F97583;">=</span><span style="--shiki-light:#24292E;--shiki-dark:#E1E4E8;"> contexts</span></span></code></pre></div></details><hr><h4 id="func-reset-self-target-id-str-is-private-bool" tabindex="-1"><em><strong>func</strong></em> <code>reset(self, target_id: str, is_private: bool)</code> <a class="header-anchor" href="#func-reset-self-target-id-str-is-private-bool" aria-label="Permalink to "***func*** \`reset(self, target_id: str, is_private: bool)\`""></a></h4><p><strong>Description</strong>: 重置上下文</p><details><summary><b>Source code</b> or <a href="https://github.com/LiteyukiStudio/nonebot-plugin-marshoai/tree/main/nonebot_plugin_marshoai/models.py#L38" target="_blank">View on GitHub</a></summary><div class="language-python vp-adaptive-theme"><button title="Copy Code" class="copy"></button><span class="lang">python</span><pre class="shiki shiki-themes github-light github-dark vp-code" tabindex="0"><code><span class="line"><span style="--shiki-light:#D73A49;--shiki-dark:#F97583;">def</span><span style="--shiki-light:#6F42C1;--shiki-dark:#B392F0;"> reset</span><span style="--shiki-light:#24292E;--shiki-dark:#E1E4E8;">(self, target_id: </span><span style="--shiki-light:#005CC5;--shiki-dark:#79B8FF;">str</span><span style="--shiki-light:#24292E;--shiki-dark:#E1E4E8;">, is_private: </span><span style="--shiki-light:#005CC5;--shiki-dark:#79B8FF;">bool</span><span style="--shiki-light:#24292E;--shiki-dark:#E1E4E8;">):</span></span>
|
||||
<span class="line"><span style="--shiki-light:#005CC5;--shiki-dark:#79B8FF;"> self</span><span style="--shiki-light:#24292E;--shiki-dark:#E1E4E8;">._get_target_dict(is_private).pop(target_id, </span><span style="--shiki-light:#005CC5;--shiki-dark:#79B8FF;">None</span><span style="--shiki-light:#24292E;--shiki-dark:#E1E4E8;">)</span></span></code></pre></div></details><hr><h4 id="func-reset-all-self" tabindex="-1"><em><strong>func</strong></em> <code>reset_all(self)</code> <a class="header-anchor" href="#func-reset-all-self" aria-label="Permalink to "***func*** \`reset_all(self)\`""></a></h4><p><strong>Description</strong>: 重置所有上下文</p><details><summary><b>Source code</b> or <a href="https://github.com/LiteyukiStudio/nonebot-plugin-marshoai/tree/main/nonebot_plugin_marshoai/models.py#L44" target="_blank">View on GitHub</a></summary><div class="language-python vp-adaptive-theme"><button title="Copy Code" class="copy"></button><span class="lang">python</span><pre class="shiki shiki-themes github-light github-dark vp-code" tabindex="0"><code><span class="line"><span style="--shiki-light:#D73A49;--shiki-dark:#F97583;">def</span><span style="--shiki-light:#6F42C1;--shiki-dark:#B392F0;"> reset_all</span><span style="--shiki-light:#24292E;--shiki-dark:#E1E4E8;">(self):</span></span>
|
||||
<span class="line"><span style="--shiki-light:#005CC5;--shiki-dark:#79B8FF;"> self</span><span style="--shiki-light:#24292E;--shiki-dark:#E1E4E8;">.contents </span><span style="--shiki-light:#D73A49;--shiki-dark:#F97583;">=</span><span style="--shiki-light:#24292E;--shiki-dark:#E1E4E8;"> {</span><span style="--shiki-light:#032F62;--shiki-dark:#9ECBFF;">'private'</span><span style="--shiki-light:#24292E;--shiki-dark:#E1E4E8;">: {}, </span><span style="--shiki-light:#032F62;--shiki-dark:#9ECBFF;">'non-private'</span><span style="--shiki-light:#24292E;--shiki-dark:#E1E4E8;">: {}}</span></span></code></pre></div></details><hr><h4 id="func-build-self-target-id-str-is-private-bool-list" tabindex="-1"><em><strong>func</strong></em> <code>build(self, target_id: str, is_private: bool) -> list</code> <a class="header-anchor" href="#func-build-self-target-id-str-is-private-bool-list" aria-label="Permalink to "***func*** \`build(self, target_id: str, is_private: bool) -> list\`""></a></h4><p><strong>Description</strong>: 构建返回的上下文,不包括系统消息</p><details><summary><b>Source code</b> or <a href="https://github.com/LiteyukiStudio/nonebot-plugin-marshoai/tree/main/nonebot_plugin_marshoai/models.py#L50" target="_blank">View on GitHub</a></summary><div class="language-python vp-adaptive-theme"><button title="Copy Code" class="copy"></button><span class="lang">python</span><pre class="shiki shiki-themes github-light github-dark vp-code" tabindex="0"><code><span class="line"><span style="--shiki-light:#D73A49;--shiki-dark:#F97583;">def</span><span style="--shiki-light:#6F42C1;--shiki-dark:#B392F0;"> build</span><span style="--shiki-light:#24292E;--shiki-dark:#E1E4E8;">(self, target_id: </span><span style="--shiki-light:#005CC5;--shiki-dark:#79B8FF;">str</span><span style="--shiki-light:#24292E;--shiki-dark:#E1E4E8;">, is_private: </span><span style="--shiki-light:#005CC5;--shiki-dark:#79B8FF;">bool</span><span style="--shiki-light:#24292E;--shiki-dark:#E1E4E8;">) -> </span><span style="--shiki-light:#005CC5;--shiki-dark:#79B8FF;">list</span><span style="--shiki-light:#24292E;--shiki-dark:#E1E4E8;">:</span></span>
|
||||
<span class="line"><span style="--shiki-light:#D73A49;--shiki-dark:#F97583;"> return</span><span style="--shiki-light:#005CC5;--shiki-dark:#79B8FF;"> self</span><span style="--shiki-light:#24292E;--shiki-dark:#E1E4E8;">._get_target_dict(is_private).setdefault(target_id, [])</span></span></code></pre></div></details><h3 id="class-marshotools" tabindex="-1"><em><strong>class</strong></em> <code>MarshoTools</code> <a class="header-anchor" href="#class-marshotools" aria-label="Permalink to "***class*** \`MarshoTools\`""></a></h3><hr><h4 id="func-init-self-1" tabindex="-1"><em><strong>func</strong></em> <code>__init__(self)</code> <a class="header-anchor" href="#func-init-self-1" aria-label="Permalink to "***func*** \`__init__(self)\`""></a></h4><details><summary><b>Source code</b> or <a href="https://github.com/LiteyukiStudio/nonebot-plugin-marshoai/tree/main/nonebot_plugin_marshoai/models.py#L62" target="_blank">View on GitHub</a></summary><div class="language-python vp-adaptive-theme"><button title="Copy Code" class="copy"></button><span class="lang">python</span><pre class="shiki shiki-themes github-light github-dark vp-code" tabindex="0"><code><span class="line"><span style="--shiki-light:#D73A49;--shiki-dark:#F97583;">def</span><span style="--shiki-light:#005CC5;--shiki-dark:#79B8FF;"> __init__</span><span style="--shiki-light:#24292E;--shiki-dark:#E1E4E8;">(self):</span></span>
|
||||
<span class="line"><span style="--shiki-light:#005CC5;--shiki-dark:#79B8FF;"> self</span><span style="--shiki-light:#24292E;--shiki-dark:#E1E4E8;">.tools_list </span><span style="--shiki-light:#D73A49;--shiki-dark:#F97583;">=</span><span style="--shiki-light:#24292E;--shiki-dark:#E1E4E8;"> []</span></span>
|
||||
<span class="line"><span style="--shiki-light:#005CC5;--shiki-dark:#79B8FF;"> self</span><span style="--shiki-light:#24292E;--shiki-dark:#E1E4E8;">.imported_packages </span><span style="--shiki-light:#D73A49;--shiki-dark:#F97583;">=</span><span style="--shiki-light:#24292E;--shiki-dark:#E1E4E8;"> {}</span></span></code></pre></div></details><hr><h4 id="func-load-tools-self-tools-dir" tabindex="-1"><em><strong>func</strong></em> <code>load_tools(self, tools_dir)</code> <a class="header-anchor" href="#func-load-tools-self-tools-dir" aria-label="Permalink to "***func*** \`load_tools(self, tools_dir)\`""></a></h4><p><strong>Description</strong>: 从指定路径加载工具包</p><details><summary><b>Source code</b> or <a href="https://github.com/LiteyukiStudio/nonebot-plugin-marshoai/tree/main/nonebot_plugin_marshoai/models.py#L67" target="_blank">View on GitHub</a></summary><div class="language-python vp-adaptive-theme"><button title="Copy Code" class="copy"></button><span class="lang">python</span><pre class="shiki shiki-themes github-light github-dark vp-code" tabindex="0"><code><span class="line"><span style="--shiki-light:#D73A49;--shiki-dark:#F97583;">def</span><span style="--shiki-light:#6F42C1;--shiki-dark:#B392F0;"> load_tools</span><span style="--shiki-light:#24292E;--shiki-dark:#E1E4E8;">(self, tools_dir):</span></span>
|
||||
<span class="line"><span style="--shiki-light:#005CC5;--shiki-dark:#79B8FF;"> self</span><span style="--shiki-light:#24292E;--shiki-dark:#E1E4E8;">.imported_packages </span><span style="--shiki-light:#D73A49;--shiki-dark:#F97583;">=</span><span style="--shiki-light:#24292E;--shiki-dark:#E1E4E8;"> {}</span></span></code></pre></div></details><hr><h4 id="func-load-tools-self-tools-dir" tabindex="-1"><em><strong>func</strong></em> <code>load_tools(self, tools_dir)</code> <a class="header-anchor" href="#func-load-tools-self-tools-dir" aria-label="Permalink to "***func*** \`load_tools(self, tools_dir)\`""></a></h4><p><strong>Description</strong>: 从指定路径加载工具包</p><details><summary><b>Source code</b> or <a href="https://github.com/LiteyukiStudio/nonebot-plugin-marshoai/tree/main/nonebot_plugin_marshoai/models.py#L66" target="_blank">View on GitHub</a></summary><div class="language-python vp-adaptive-theme"><button title="Copy Code" class="copy"></button><span class="lang">python</span><pre class="shiki shiki-themes github-light github-dark vp-code" tabindex="0"><code><span class="line"><span style="--shiki-light:#D73A49;--shiki-dark:#F97583;">def</span><span style="--shiki-light:#6F42C1;--shiki-dark:#B392F0;"> load_tools</span><span style="--shiki-light:#24292E;--shiki-dark:#E1E4E8;">(self, tools_dir):</span></span>
|
||||
<span class="line"><span style="--shiki-light:#D73A49;--shiki-dark:#F97583;"> if</span><span style="--shiki-light:#D73A49;--shiki-dark:#F97583;"> not</span><span style="--shiki-light:#24292E;--shiki-dark:#E1E4E8;"> os.path.exists(tools_dir):</span></span>
|
||||
<span class="line"><span style="--shiki-light:#24292E;--shiki-dark:#E1E4E8;"> logger.error(</span><span style="--shiki-light:#D73A49;--shiki-dark:#F97583;">f</span><span style="--shiki-light:#032F62;--shiki-dark:#9ECBFF;">'工具集目录 </span><span style="--shiki-light:#005CC5;--shiki-dark:#79B8FF;">{</span><span style="--shiki-light:#24292E;--shiki-dark:#E1E4E8;">tools_dir</span><span style="--shiki-light:#005CC5;--shiki-dark:#79B8FF;">}</span><span style="--shiki-light:#032F62;--shiki-dark:#9ECBFF;"> 不存在。'</span><span style="--shiki-light:#24292E;--shiki-dark:#E1E4E8;">)</span></span>
|
||||
<span class="line"><span style="--shiki-light:#D73A49;--shiki-dark:#F97583;"> return</span></span>
|
||||
@@ -19,7 +19,7 @@ import{_ as i,c as a,o as t,ae as n}from"./chunks/framework.BHrE6nLq.js";const g
|
||||
<span class="line"><span style="--shiki-light:#D73A49;--shiki-dark:#F97583;"> if</span><span style="--shiki-light:#24292E;--shiki-dark:#E1E4E8;"> os.path.isdir(package_path) </span><span style="--shiki-light:#D73A49;--shiki-dark:#F97583;">and</span><span style="--shiki-light:#24292E;--shiki-dark:#E1E4E8;"> os.path.exists(os.path.join(package_path, </span><span style="--shiki-light:#032F62;--shiki-dark:#9ECBFF;">'__init__.py'</span><span style="--shiki-light:#24292E;--shiki-dark:#E1E4E8;">)):</span></span>
|
||||
<span class="line"><span style="--shiki-light:#005CC5;--shiki-dark:#79B8FF;"> self</span><span style="--shiki-light:#24292E;--shiki-dark:#E1E4E8;">._load_package(package_name, package_path)</span></span>
|
||||
<span class="line"><span style="--shiki-light:#D73A49;--shiki-dark:#F97583;"> else</span><span style="--shiki-light:#24292E;--shiki-dark:#E1E4E8;">:</span></span>
|
||||
<span class="line"><span style="--shiki-light:#24292E;--shiki-dark:#E1E4E8;"> logger.warning(</span><span style="--shiki-light:#D73A49;--shiki-dark:#F97583;">f</span><span style="--shiki-light:#032F62;--shiki-dark:#9ECBFF;">'</span><span style="--shiki-light:#005CC5;--shiki-dark:#79B8FF;">{</span><span style="--shiki-light:#24292E;--shiki-dark:#E1E4E8;">package_path</span><span style="--shiki-light:#005CC5;--shiki-dark:#79B8FF;">}</span><span style="--shiki-light:#032F62;--shiki-dark:#9ECBFF;"> 不是有效的工具包路径,跳过加载。'</span><span style="--shiki-light:#24292E;--shiki-dark:#E1E4E8;">)</span></span></code></pre></div></details><hr><h4 id="async-func-call-self-full-function-name-str-args-dict" tabindex="-1"><em><strong>async func</strong></em> <code>call(self, full_function_name: str, args: dict)</code> <a class="header-anchor" href="#async-func-call-self-full-function-name-str-args-dict" aria-label="Permalink to "***async func*** \`call(self, full_function_name: str, args: dict)\`""></a></h4><p><strong>Description</strong>: 调用指定的函数</p><details><summary><b>Source code</b> or <a href="https://github.com/LiteyukiStudio/nonebot-plugin-marshoai/tree/main/nonebot_plugin_marshoai/models.py#L114" target="_blank">View on GitHub</a></summary><div class="language-python vp-adaptive-theme"><button title="Copy Code" class="copy"></button><span class="lang">python</span><pre class="shiki shiki-themes github-light github-dark vp-code" tabindex="0"><code><span class="line"><span style="--shiki-light:#D73A49;--shiki-dark:#F97583;">async</span><span style="--shiki-light:#D73A49;--shiki-dark:#F97583;"> def</span><span style="--shiki-light:#6F42C1;--shiki-dark:#B392F0;"> call</span><span style="--shiki-light:#24292E;--shiki-dark:#E1E4E8;">(self, full_function_name: </span><span style="--shiki-light:#005CC5;--shiki-dark:#79B8FF;">str</span><span style="--shiki-light:#24292E;--shiki-dark:#E1E4E8;">, args: </span><span style="--shiki-light:#005CC5;--shiki-dark:#79B8FF;">dict</span><span style="--shiki-light:#24292E;--shiki-dark:#E1E4E8;">):</span></span>
|
||||
<span class="line"><span style="--shiki-light:#24292E;--shiki-dark:#E1E4E8;"> logger.warning(</span><span style="--shiki-light:#D73A49;--shiki-dark:#F97583;">f</span><span style="--shiki-light:#032F62;--shiki-dark:#9ECBFF;">'</span><span style="--shiki-light:#005CC5;--shiki-dark:#79B8FF;">{</span><span style="--shiki-light:#24292E;--shiki-dark:#E1E4E8;">package_path</span><span style="--shiki-light:#005CC5;--shiki-dark:#79B8FF;">}</span><span style="--shiki-light:#032F62;--shiki-dark:#9ECBFF;"> 不是有效的工具包路径,跳过加载。'</span><span style="--shiki-light:#24292E;--shiki-dark:#E1E4E8;">)</span></span></code></pre></div></details><hr><h4 id="async-func-call-self-full-function-name-str-args-dict" tabindex="-1"><em><strong>async func</strong></em> <code>call(self, full_function_name: str, args: dict)</code> <a class="header-anchor" href="#async-func-call-self-full-function-name-str-args-dict" aria-label="Permalink to "***async func*** \`call(self, full_function_name: str, args: dict)\`""></a></h4><p><strong>Description</strong>: 调用指定的函数</p><details><summary><b>Source code</b> or <a href="https://github.com/LiteyukiStudio/nonebot-plugin-marshoai/tree/main/nonebot_plugin_marshoai/models.py#L113" target="_blank">View on GitHub</a></summary><div class="language-python vp-adaptive-theme"><button title="Copy Code" class="copy"></button><span class="lang">python</span><pre class="shiki shiki-themes github-light github-dark vp-code" tabindex="0"><code><span class="line"><span style="--shiki-light:#D73A49;--shiki-dark:#F97583;">async</span><span style="--shiki-light:#D73A49;--shiki-dark:#F97583;"> def</span><span style="--shiki-light:#6F42C1;--shiki-dark:#B392F0;"> call</span><span style="--shiki-light:#24292E;--shiki-dark:#E1E4E8;">(self, full_function_name: </span><span style="--shiki-light:#005CC5;--shiki-dark:#79B8FF;">str</span><span style="--shiki-light:#24292E;--shiki-dark:#E1E4E8;">, args: </span><span style="--shiki-light:#005CC5;--shiki-dark:#79B8FF;">dict</span><span style="--shiki-light:#24292E;--shiki-dark:#E1E4E8;">):</span></span>
|
||||
<span class="line"><span style="--shiki-light:#24292E;--shiki-dark:#E1E4E8;"> parts </span><span style="--shiki-light:#D73A49;--shiki-dark:#F97583;">=</span><span style="--shiki-light:#24292E;--shiki-dark:#E1E4E8;"> full_function_name.split(</span><span style="--shiki-light:#032F62;--shiki-dark:#9ECBFF;">'__'</span><span style="--shiki-light:#24292E;--shiki-dark:#E1E4E8;">)</span></span>
|
||||
<span class="line"><span style="--shiki-light:#D73A49;--shiki-dark:#F97583;"> if</span><span style="--shiki-light:#005CC5;--shiki-dark:#79B8FF;"> len</span><span style="--shiki-light:#24292E;--shiki-dark:#E1E4E8;">(parts) </span><span style="--shiki-light:#D73A49;--shiki-dark:#F97583;">!=</span><span style="--shiki-light:#005CC5;--shiki-dark:#79B8FF;"> 2</span><span style="--shiki-light:#24292E;--shiki-dark:#E1E4E8;">:</span></span>
|
||||
<span class="line"><span style="--shiki-light:#24292E;--shiki-dark:#E1E4E8;"> logger.error(</span><span style="--shiki-light:#032F62;--shiki-dark:#9ECBFF;">'函数名无效'</span><span style="--shiki-light:#24292E;--shiki-dark:#E1E4E8;">)</span></span>
|
||||
@@ -35,12 +35,12 @@ import{_ as i,c as a,o as t,ae as n}from"./chunks/framework.BHrE6nLq.js";const g
|
||||
<span class="line"><span style="--shiki-light:#24292E;--shiki-dark:#E1E4E8;"> logger.error(errinfo)</span></span>
|
||||
<span class="line"><span style="--shiki-light:#D73A49;--shiki-dark:#F97583;"> return</span><span style="--shiki-light:#24292E;--shiki-dark:#E1E4E8;"> errinfo</span></span>
|
||||
<span class="line"><span style="--shiki-light:#D73A49;--shiki-dark:#F97583;"> else</span><span style="--shiki-light:#24292E;--shiki-dark:#E1E4E8;">:</span></span>
|
||||
<span class="line"><span style="--shiki-light:#24292E;--shiki-dark:#E1E4E8;"> logger.error(</span><span style="--shiki-light:#D73A49;--shiki-dark:#F97583;">f</span><span style="--shiki-light:#032F62;--shiki-dark:#9ECBFF;">"工具包 '</span><span style="--shiki-light:#005CC5;--shiki-dark:#79B8FF;">{</span><span style="--shiki-light:#24292E;--shiki-dark:#E1E4E8;">package_name</span><span style="--shiki-light:#005CC5;--shiki-dark:#79B8FF;">}</span><span style="--shiki-light:#032F62;--shiki-dark:#9ECBFF;">' 未导入"</span><span style="--shiki-light:#24292E;--shiki-dark:#E1E4E8;">)</span></span></code></pre></div></details><hr><h4 id="func-has-function-self-full-function-name-str-bool" tabindex="-1"><em><strong>func</strong></em> <code>has_function(self, full_function_name: str) -> bool</code> <a class="header-anchor" href="#func-has-function-self-full-function-name-str-bool" aria-label="Permalink to "***func*** \`has_function(self, full_function_name: str) -> bool\`""></a></h4><p><strong>Description</strong>: 检查是否存在指定的函数</p><details><summary><b>Source code</b> or <a href="https://github.com/LiteyukiStudio/nonebot-plugin-marshoai/tree/main/nonebot_plugin_marshoai/models.py#L136" target="_blank">View on GitHub</a></summary><div class="language-python vp-adaptive-theme"><button title="Copy Code" class="copy"></button><span class="lang">python</span><pre class="shiki shiki-themes github-light github-dark vp-code" tabindex="0"><code><span class="line"><span style="--shiki-light:#D73A49;--shiki-dark:#F97583;">def</span><span style="--shiki-light:#6F42C1;--shiki-dark:#B392F0;"> has_function</span><span style="--shiki-light:#24292E;--shiki-dark:#E1E4E8;">(self, full_function_name: </span><span style="--shiki-light:#005CC5;--shiki-dark:#79B8FF;">str</span><span style="--shiki-light:#24292E;--shiki-dark:#E1E4E8;">) -> </span><span style="--shiki-light:#005CC5;--shiki-dark:#79B8FF;">bool</span><span style="--shiki-light:#24292E;--shiki-dark:#E1E4E8;">:</span></span>
|
||||
<span class="line"><span style="--shiki-light:#24292E;--shiki-dark:#E1E4E8;"> logger.error(</span><span style="--shiki-light:#D73A49;--shiki-dark:#F97583;">f</span><span style="--shiki-light:#032F62;--shiki-dark:#9ECBFF;">"工具包 '</span><span style="--shiki-light:#005CC5;--shiki-dark:#79B8FF;">{</span><span style="--shiki-light:#24292E;--shiki-dark:#E1E4E8;">package_name</span><span style="--shiki-light:#005CC5;--shiki-dark:#79B8FF;">}</span><span style="--shiki-light:#032F62;--shiki-dark:#9ECBFF;">' 未导入"</span><span style="--shiki-light:#24292E;--shiki-dark:#E1E4E8;">)</span></span></code></pre></div></details><hr><h4 id="func-has-function-self-full-function-name-str-bool" tabindex="-1"><em><strong>func</strong></em> <code>has_function(self, full_function_name: str) -> bool</code> <a class="header-anchor" href="#func-has-function-self-full-function-name-str-bool" aria-label="Permalink to "***func*** \`has_function(self, full_function_name: str) -> bool\`""></a></h4><p><strong>Description</strong>: 检查是否存在指定的函数</p><details><summary><b>Source code</b> or <a href="https://github.com/LiteyukiStudio/nonebot-plugin-marshoai/tree/main/nonebot_plugin_marshoai/models.py#L135" target="_blank">View on GitHub</a></summary><div class="language-python vp-adaptive-theme"><button title="Copy Code" class="copy"></button><span class="lang">python</span><pre class="shiki shiki-themes github-light github-dark vp-code" tabindex="0"><code><span class="line"><span style="--shiki-light:#D73A49;--shiki-dark:#F97583;">def</span><span style="--shiki-light:#6F42C1;--shiki-dark:#B392F0;"> has_function</span><span style="--shiki-light:#24292E;--shiki-dark:#E1E4E8;">(self, full_function_name: </span><span style="--shiki-light:#005CC5;--shiki-dark:#79B8FF;">str</span><span style="--shiki-light:#24292E;--shiki-dark:#E1E4E8;">) -> </span><span style="--shiki-light:#005CC5;--shiki-dark:#79B8FF;">bool</span><span style="--shiki-light:#24292E;--shiki-dark:#E1E4E8;">:</span></span>
|
||||
<span class="line"><span style="--shiki-light:#D73A49;--shiki-dark:#F97583;"> try</span><span style="--shiki-light:#24292E;--shiki-dark:#E1E4E8;">:</span></span>
|
||||
<span class="line"><span style="--shiki-light:#D73A49;--shiki-dark:#F97583;"> return</span><span style="--shiki-light:#005CC5;--shiki-dark:#79B8FF;"> any</span><span style="--shiki-light:#24292E;--shiki-dark:#E1E4E8;">((t[</span><span style="--shiki-light:#032F62;--shiki-dark:#9ECBFF;">'function'</span><span style="--shiki-light:#24292E;--shiki-dark:#E1E4E8;">][</span><span style="--shiki-light:#032F62;--shiki-dark:#9ECBFF;">'name'</span><span style="--shiki-light:#24292E;--shiki-dark:#E1E4E8;">].replace(</span><span style="--shiki-light:#032F62;--shiki-dark:#9ECBFF;">'-'</span><span style="--shiki-light:#24292E;--shiki-dark:#E1E4E8;">, </span><span style="--shiki-light:#032F62;--shiki-dark:#9ECBFF;">'_'</span><span style="--shiki-light:#24292E;--shiki-dark:#E1E4E8;">) </span><span style="--shiki-light:#D73A49;--shiki-dark:#F97583;">==</span><span style="--shiki-light:#24292E;--shiki-dark:#E1E4E8;"> full_function_name.replace(</span><span style="--shiki-light:#032F62;--shiki-dark:#9ECBFF;">'-'</span><span style="--shiki-light:#24292E;--shiki-dark:#E1E4E8;">, </span><span style="--shiki-light:#032F62;--shiki-dark:#9ECBFF;">'_'</span><span style="--shiki-light:#24292E;--shiki-dark:#E1E4E8;">) </span><span style="--shiki-light:#D73A49;--shiki-dark:#F97583;">for</span><span style="--shiki-light:#24292E;--shiki-dark:#E1E4E8;"> t </span><span style="--shiki-light:#D73A49;--shiki-dark:#F97583;">in</span><span style="--shiki-light:#005CC5;--shiki-dark:#79B8FF;"> self</span><span style="--shiki-light:#24292E;--shiki-dark:#E1E4E8;">.tools_list))</span></span>
|
||||
<span class="line"><span style="--shiki-light:#D73A49;--shiki-dark:#F97583;"> except</span><span style="--shiki-light:#005CC5;--shiki-dark:#79B8FF;"> Exception</span><span style="--shiki-light:#D73A49;--shiki-dark:#F97583;"> as</span><span style="--shiki-light:#24292E;--shiki-dark:#E1E4E8;"> e:</span></span>
|
||||
<span class="line"><span style="--shiki-light:#24292E;--shiki-dark:#E1E4E8;"> logger.error(</span><span style="--shiki-light:#D73A49;--shiki-dark:#F97583;">f</span><span style="--shiki-light:#032F62;--shiki-dark:#9ECBFF;">"检查函数 '</span><span style="--shiki-light:#005CC5;--shiki-dark:#79B8FF;">{</span><span style="--shiki-light:#24292E;--shiki-dark:#E1E4E8;">full_function_name</span><span style="--shiki-light:#005CC5;--shiki-dark:#79B8FF;">}</span><span style="--shiki-light:#032F62;--shiki-dark:#9ECBFF;">' 时发生错误:</span><span style="--shiki-light:#005CC5;--shiki-dark:#79B8FF;">{</span><span style="--shiki-light:#24292E;--shiki-dark:#E1E4E8;">e</span><span style="--shiki-light:#005CC5;--shiki-dark:#79B8FF;">}</span><span style="--shiki-light:#032F62;--shiki-dark:#9ECBFF;">"</span><span style="--shiki-light:#24292E;--shiki-dark:#E1E4E8;">)</span></span>
|
||||
<span class="line"><span style="--shiki-light:#D73A49;--shiki-dark:#F97583;"> return</span><span style="--shiki-light:#005CC5;--shiki-dark:#79B8FF;"> False</span></span></code></pre></div></details><hr><h4 id="func-get-tools-list-self" tabindex="-1"><em><strong>func</strong></em> <code>get_tools_list(self)</code> <a class="header-anchor" href="#func-get-tools-list-self" aria-label="Permalink to "***func*** \`get_tools_list(self)\`""></a></h4><details><summary><b>Source code</b> or <a href="https://github.com/LiteyukiStudio/nonebot-plugin-marshoai/tree/main/nonebot_plugin_marshoai/models.py#L150" target="_blank">View on GitHub</a></summary><div class="language-python vp-adaptive-theme"><button title="Copy Code" class="copy"></button><span class="lang">python</span><pre class="shiki shiki-themes github-light github-dark vp-code" tabindex="0"><code><span class="line"><span style="--shiki-light:#D73A49;--shiki-dark:#F97583;">def</span><span style="--shiki-light:#6F42C1;--shiki-dark:#B392F0;"> get_tools_list</span><span style="--shiki-light:#24292E;--shiki-dark:#E1E4E8;">(self):</span></span>
|
||||
<span class="line"><span style="--shiki-light:#D73A49;--shiki-dark:#F97583;"> return</span><span style="--shiki-light:#005CC5;--shiki-dark:#79B8FF;"> False</span></span></code></pre></div></details><hr><h4 id="func-get-tools-list-self" tabindex="-1"><em><strong>func</strong></em> <code>get_tools_list(self)</code> <a class="header-anchor" href="#func-get-tools-list-self" aria-label="Permalink to "***func*** \`get_tools_list(self)\`""></a></h4><details><summary><b>Source code</b> or <a href="https://github.com/LiteyukiStudio/nonebot-plugin-marshoai/tree/main/nonebot_plugin_marshoai/models.py#L149" target="_blank">View on GitHub</a></summary><div class="language-python vp-adaptive-theme"><button title="Copy Code" class="copy"></button><span class="lang">python</span><pre class="shiki shiki-themes github-light github-dark vp-code" tabindex="0"><code><span class="line"><span style="--shiki-light:#D73A49;--shiki-dark:#F97583;">def</span><span style="--shiki-light:#6F42C1;--shiki-dark:#B392F0;"> get_tools_list</span><span style="--shiki-light:#24292E;--shiki-dark:#E1E4E8;">(self):</span></span>
|
||||
<span class="line"><span style="--shiki-light:#D73A49;--shiki-dark:#F97583;"> if</span><span style="--shiki-light:#D73A49;--shiki-dark:#F97583;"> not</span><span style="--shiki-light:#005CC5;--shiki-dark:#79B8FF;"> self</span><span style="--shiki-light:#24292E;--shiki-dark:#E1E4E8;">.tools_list </span><span style="--shiki-light:#D73A49;--shiki-dark:#F97583;">or</span><span style="--shiki-light:#D73A49;--shiki-dark:#F97583;"> not</span><span style="--shiki-light:#24292E;--shiki-dark:#E1E4E8;"> config.marshoai_enable_tools:</span></span>
|
||||
<span class="line"><span style="--shiki-light:#D73A49;--shiki-dark:#F97583;"> return</span><span style="--shiki-light:#005CC5;--shiki-dark:#79B8FF;"> None</span></span>
|
||||
<span class="line"><span style="--shiki-light:#D73A49;--shiki-dark:#F97583;"> return</span><span style="--shiki-light:#005CC5;--shiki-dark:#79B8FF;"> self</span><span style="--shiki-light:#24292E;--shiki-dark:#E1E4E8;">.tools_list</span></span></code></pre></div></details>`,44)]))}const E=i(e,[["render",l]]);export{g as __pageData,E as default};
|
||||
@@ -1,4 +1,4 @@
|
||||
import{_ as i,c as a,o as n,ae as t}from"./chunks/framework.BHrE6nLq.js";const g=JSON.parse('{"title":"util","description":"","frontmatter":{"title":"util","order":100},"headers":[],"relativePath":"en/dev/api/util.md","filePath":"en/dev/api/util.md","lastUpdated":1734175019000}'),h={name:"en/dev/api/util.md"};function k(l,s,p,e,r,E){return n(),a("div",null,s[0]||(s[0]=[t(`<h1 id="module-nonebot-plugin-marshoai-util" tabindex="-1"><strong>Module</strong> <code>nonebot_plugin_marshoai.util</code> <a class="header-anchor" href="#module-nonebot-plugin-marshoai-util" aria-label="Permalink to "**Module** \`nonebot_plugin_marshoai.util\`""></a></h1><h3 id="var-nickname-json" tabindex="-1">var <code>nickname_json</code> <a class="header-anchor" href="#var-nickname-json" aria-label="Permalink to "var \`nickname_json\`""></a></h3><ul><li><p><strong>Description</strong>: 记录昵称</p></li><li><p><strong>Default</strong>: <code>None</code></p></li></ul><h3 id="var-praises-json" tabindex="-1">var <code>praises_json</code> <a class="header-anchor" href="#var-praises-json" aria-label="Permalink to "var \`praises_json\`""></a></h3><ul><li><p><strong>Description</strong>: 记录夸赞名单</p></li><li><p><strong>Default</strong>: <code>None</code></p></li></ul><h3 id="var-loaded-target-list" tabindex="-1">var <code>loaded_target_list</code> <a class="header-anchor" href="#var-loaded-target-list" aria-label="Permalink to "var \`loaded_target_list\`""></a></h3><ul><li><p><strong>Description</strong>: 记录已恢复备份的上下文的列表</p></li><li><p><strong>Default</strong>: <code>[]</code></p></li></ul><hr><h3 id="async-func-get-image-raw-and-type-url-str-timeout-int-10-optional-tuple-bytes-str" tabindex="-1"><em><strong>async func</strong></em> <code>get_image_raw_and_type(url: str, timeout: int = 10) -> Optional[tuple[bytes, str]]</code> <a class="header-anchor" href="#async-func-get-image-raw-and-type-url-str-timeout-int-10-optional-tuple-bytes-str" aria-label="Permalink to "***async func*** \`get_image_raw_and_type(url: str, timeout: int = 10) -> Optional[tuple[bytes, str]]\`""></a></h3><p><strong>Description</strong>: 获取图片的二进制数据</p><p><strong>Arguments</strong>:</p><blockquote><ul><li>url: str 图片链接</li><li>timeout: int 超时时间 秒</li></ul></blockquote><details><summary><b>Source code</b> or <a href="https://github.com/LiteyukiStudio/nonebot-plugin-marshoai/tree/main/nonebot_plugin_marshoai/util.py#L62" target="_blank">View on GitHub</a></summary><div class="language-python vp-adaptive-theme"><button title="Copy Code" class="copy"></button><span class="lang">python</span><pre class="shiki shiki-themes github-light github-dark vp-code" tabindex="0"><code><span class="line"><span style="--shiki-light:#D73A49;--shiki-dark:#F97583;">async</span><span style="--shiki-light:#D73A49;--shiki-dark:#F97583;"> def</span><span style="--shiki-light:#6F42C1;--shiki-dark:#B392F0;"> get_image_raw_and_type</span><span style="--shiki-light:#24292E;--shiki-dark:#E1E4E8;">(url: </span><span style="--shiki-light:#005CC5;--shiki-dark:#79B8FF;">str</span><span style="--shiki-light:#24292E;--shiki-dark:#E1E4E8;">, timeout: </span><span style="--shiki-light:#005CC5;--shiki-dark:#79B8FF;">int</span><span style="--shiki-light:#D73A49;--shiki-dark:#F97583;">=</span><span style="--shiki-light:#005CC5;--shiki-dark:#79B8FF;">10</span><span style="--shiki-light:#24292E;--shiki-dark:#E1E4E8;">) -> Optional[tuple[</span><span style="--shiki-light:#005CC5;--shiki-dark:#79B8FF;">bytes</span><span style="--shiki-light:#24292E;--shiki-dark:#E1E4E8;">, </span><span style="--shiki-light:#005CC5;--shiki-dark:#79B8FF;">str</span><span style="--shiki-light:#24292E;--shiki-dark:#E1E4E8;">]]:</span></span>
|
||||
import{_ as i,c as a,o as n,ae as t}from"./chunks/framework.BHrE6nLq.js";const g=JSON.parse('{"title":"util","description":"","frontmatter":{"title":"util","order":100},"headers":[],"relativePath":"en/dev/api/util.md","filePath":"en/dev/api/util.md","lastUpdated":1734175019000}'),h={name:"en/dev/api/util.md"};function k(l,s,p,e,r,E){return n(),a("div",null,s[0]||(s[0]=[t(`<h1 id="module-nonebot-plugin-marshoai-util" tabindex="-1"><strong>Module</strong> <code>nonebot_plugin_marshoai.util</code> <a class="header-anchor" href="#module-nonebot-plugin-marshoai-util" aria-label="Permalink to "**Module** \`nonebot_plugin_marshoai.util\`""></a></h1><h3 id="var-nickname-json" tabindex="-1">var <code>nickname_json</code> <a class="header-anchor" href="#var-nickname-json" aria-label="Permalink to "var \`nickname_json\`""></a></h3><ul><li><p><strong>Description</strong>: 记录昵称</p></li><li><p><strong>Default</strong>: <code>None</code></p></li></ul><h3 id="var-praises-json" tabindex="-1">var <code>praises_json</code> <a class="header-anchor" href="#var-praises-json" aria-label="Permalink to "var \`praises_json\`""></a></h3><ul><li><p><strong>Description</strong>: 记录夸赞名单</p></li><li><p><strong>Default</strong>: <code>None</code></p></li></ul><h3 id="var-loaded-target-list" tabindex="-1">var <code>loaded_target_list</code> <a class="header-anchor" href="#var-loaded-target-list" aria-label="Permalink to "var \`loaded_target_list\`""></a></h3><ul><li><p><strong>Description</strong>: 记录已恢复备份的上下文的列表</p></li><li><p><strong>Type</strong>: <code>List[str]</code></p></li><li><p><strong>Default</strong>: <code>[]</code></p></li></ul><hr><h3 id="async-func-get-image-raw-and-type-url-str-timeout-int-10-optional-tuple-bytes-str" tabindex="-1"><em><strong>async func</strong></em> <code>get_image_raw_and_type(url: str, timeout: int = 10) -> Optional[tuple[bytes, str]]</code> <a class="header-anchor" href="#async-func-get-image-raw-and-type-url-str-timeout-int-10-optional-tuple-bytes-str" aria-label="Permalink to "***async func*** \`get_image_raw_and_type(url: str, timeout: int = 10) -> Optional[tuple[bytes, str]]\`""></a></h3><p><strong>Description</strong>: 获取图片的二进制数据</p><p><strong>Arguments</strong>:</p><blockquote><ul><li>url: str 图片链接</li><li>timeout: int 超时时间 秒</li></ul></blockquote><details><summary><b>Source code</b> or <a href="https://github.com/LiteyukiStudio/nonebot-plugin-marshoai/tree/main/nonebot_plugin_marshoai/util.py#L62" target="_blank">View on GitHub</a></summary><div class="language-python vp-adaptive-theme"><button title="Copy Code" class="copy"></button><span class="lang">python</span><pre class="shiki shiki-themes github-light github-dark vp-code" tabindex="0"><code><span class="line"><span style="--shiki-light:#D73A49;--shiki-dark:#F97583;">async</span><span style="--shiki-light:#D73A49;--shiki-dark:#F97583;"> def</span><span style="--shiki-light:#6F42C1;--shiki-dark:#B392F0;"> get_image_raw_and_type</span><span style="--shiki-light:#24292E;--shiki-dark:#E1E4E8;">(url: </span><span style="--shiki-light:#005CC5;--shiki-dark:#79B8FF;">str</span><span style="--shiki-light:#24292E;--shiki-dark:#E1E4E8;">, timeout: </span><span style="--shiki-light:#005CC5;--shiki-dark:#79B8FF;">int</span><span style="--shiki-light:#D73A49;--shiki-dark:#F97583;">=</span><span style="--shiki-light:#005CC5;--shiki-dark:#79B8FF;">10</span><span style="--shiki-light:#24292E;--shiki-dark:#E1E4E8;">) -> Optional[tuple[</span><span style="--shiki-light:#005CC5;--shiki-dark:#79B8FF;">bytes</span><span style="--shiki-light:#24292E;--shiki-dark:#E1E4E8;">, </span><span style="--shiki-light:#005CC5;--shiki-dark:#79B8FF;">str</span><span style="--shiki-light:#24292E;--shiki-dark:#E1E4E8;">]]:</span></span>
|
||||
<span class="line"><span style="--shiki-light:#D73A49;--shiki-dark:#F97583;"> async</span><span style="--shiki-light:#D73A49;--shiki-dark:#F97583;"> with</span><span style="--shiki-light:#24292E;--shiki-dark:#E1E4E8;"> httpx.AsyncClient() </span><span style="--shiki-light:#D73A49;--shiki-dark:#F97583;">as</span><span style="--shiki-light:#24292E;--shiki-dark:#E1E4E8;"> client:</span></span>
|
||||
<span class="line"><span style="--shiki-light:#24292E;--shiki-dark:#E1E4E8;"> response </span><span style="--shiki-light:#D73A49;--shiki-dark:#F97583;">=</span><span style="--shiki-light:#D73A49;--shiki-dark:#F97583;"> await</span><span style="--shiki-light:#24292E;--shiki-dark:#E1E4E8;"> client.get(url, </span><span style="--shiki-light:#E36209;--shiki-dark:#FFAB70;">headers</span><span style="--shiki-light:#D73A49;--shiki-dark:#F97583;">=</span><span style="--shiki-light:#24292E;--shiki-dark:#E1E4E8;">_browser_headers, </span><span style="--shiki-light:#E36209;--shiki-dark:#FFAB70;">timeout</span><span style="--shiki-light:#D73A49;--shiki-dark:#F97583;">=</span><span style="--shiki-light:#24292E;--shiki-dark:#E1E4E8;">timeout)</span></span>
|
||||
<span class="line"><span style="--shiki-light:#D73A49;--shiki-dark:#F97583;"> if</span><span style="--shiki-light:#24292E;--shiki-dark:#E1E4E8;"> response.status_code </span><span style="--shiki-light:#D73A49;--shiki-dark:#F97583;">==</span><span style="--shiki-light:#005CC5;--shiki-dark:#79B8FF;"> 200</span><span style="--shiki-light:#24292E;--shiki-dark:#E1E4E8;">:</span></span>
|
||||
@@ -54,7 +54,7 @@ import{_ as i,c as a,o as n,ae as t}from"./chunks/framework.BHrE6nLq.js";const g
|
||||
<span class="line"><span style="--shiki-light:#D73A49;--shiki-dark:#F97583;"> try</span><span style="--shiki-light:#24292E;--shiki-dark:#E1E4E8;">:</span></span>
|
||||
<span class="line"><span style="--shiki-light:#D73A49;--shiki-dark:#F97583;"> async</span><span style="--shiki-light:#D73A49;--shiki-dark:#F97583;"> with</span><span style="--shiki-light:#24292E;--shiki-dark:#E1E4E8;"> aiofiles.open(filename, </span><span style="--shiki-light:#032F62;--shiki-dark:#9ECBFF;">'r'</span><span style="--shiki-light:#24292E;--shiki-dark:#E1E4E8;">, </span><span style="--shiki-light:#E36209;--shiki-dark:#FFAB70;">encoding</span><span style="--shiki-light:#D73A49;--shiki-dark:#F97583;">=</span><span style="--shiki-light:#032F62;--shiki-dark:#9ECBFF;">'utf-8'</span><span style="--shiki-light:#24292E;--shiki-dark:#E1E4E8;">) </span><span style="--shiki-light:#D73A49;--shiki-dark:#F97583;">as</span><span style="--shiki-light:#24292E;--shiki-dark:#E1E4E8;"> f:</span></span>
|
||||
<span class="line"><span style="--shiki-light:#24292E;--shiki-dark:#E1E4E8;"> nickname_json </span><span style="--shiki-light:#D73A49;--shiki-dark:#F97583;">=</span><span style="--shiki-light:#24292E;--shiki-dark:#E1E4E8;"> json.loads(</span><span style="--shiki-light:#D73A49;--shiki-dark:#F97583;">await</span><span style="--shiki-light:#24292E;--shiki-dark:#E1E4E8;"> f.read())</span></span>
|
||||
<span class="line"><span style="--shiki-light:#D73A49;--shiki-dark:#F97583;"> except</span><span style="--shiki-light:#005CC5;--shiki-dark:#79B8FF;"> Exception</span><span style="--shiki-light:#24292E;--shiki-dark:#E1E4E8;">:</span></span>
|
||||
<span class="line"><span style="--shiki-light:#D73A49;--shiki-dark:#F97583;"> except</span><span style="--shiki-light:#24292E;--shiki-dark:#E1E4E8;"> (json.JSONDecodeError, </span><span style="--shiki-light:#005CC5;--shiki-dark:#79B8FF;">FileNotFoundError</span><span style="--shiki-light:#24292E;--shiki-dark:#E1E4E8;">):</span></span>
|
||||
<span class="line"><span style="--shiki-light:#24292E;--shiki-dark:#E1E4E8;"> nickname_json </span><span style="--shiki-light:#D73A49;--shiki-dark:#F97583;">=</span><span style="--shiki-light:#24292E;--shiki-dark:#E1E4E8;"> {}</span></span>
|
||||
<span class="line"><span style="--shiki-light:#D73A49;--shiki-dark:#F97583;"> return</span><span style="--shiki-light:#24292E;--shiki-dark:#E1E4E8;"> nickname_json</span></span></code></pre></div></details><hr><h3 id="async-func-set-nickname-user-id-str-name-str" tabindex="-1"><em><strong>async func</strong></em> <code>set_nickname(user_id: str, name: str)</code> <a class="header-anchor" href="#async-func-set-nickname-user-id-str-name-str" aria-label="Permalink to "***async func*** \`set_nickname(user_id: str, name: str)\`""></a></h3><details><summary><b>Source code</b> or <a href="https://github.com/LiteyukiStudio/nonebot-plugin-marshoai/tree/main/nonebot_plugin_marshoai/util.py#L227" target="_blank">View on GitHub</a></summary><div class="language-python vp-adaptive-theme"><button title="Copy Code" class="copy"></button><span class="lang">python</span><pre class="shiki shiki-themes github-light github-dark vp-code" tabindex="0"><code><span class="line"><span style="--shiki-light:#D73A49;--shiki-dark:#F97583;">async</span><span style="--shiki-light:#D73A49;--shiki-dark:#F97583;"> def</span><span style="--shiki-light:#6F42C1;--shiki-dark:#B392F0;"> set_nickname</span><span style="--shiki-light:#24292E;--shiki-dark:#E1E4E8;">(user_id: </span><span style="--shiki-light:#005CC5;--shiki-dark:#79B8FF;">str</span><span style="--shiki-light:#24292E;--shiki-dark:#E1E4E8;">, name: </span><span style="--shiki-light:#005CC5;--shiki-dark:#79B8FF;">str</span><span style="--shiki-light:#24292E;--shiki-dark:#E1E4E8;">):</span></span>
|
||||
<span class="line"><span style="--shiki-light:#D73A49;--shiki-dark:#F97583;"> global</span><span style="--shiki-light:#24292E;--shiki-dark:#E1E4E8;"> nickname_json</span></span>
|
||||
@@ -74,7 +74,7 @@ import{_ as i,c as a,o as n,ae as t}from"./chunks/framework.BHrE6nLq.js";const g
|
||||
<span class="line"><span style="--shiki-light:#D73A49;--shiki-dark:#F97583;"> try</span><span style="--shiki-light:#24292E;--shiki-dark:#E1E4E8;">:</span></span>
|
||||
<span class="line"><span style="--shiki-light:#D73A49;--shiki-dark:#F97583;"> async</span><span style="--shiki-light:#D73A49;--shiki-dark:#F97583;"> with</span><span style="--shiki-light:#24292E;--shiki-dark:#E1E4E8;"> aiofiles.open(store.get_plugin_data_file(</span><span style="--shiki-light:#032F62;--shiki-dark:#9ECBFF;">'nickname.json'</span><span style="--shiki-light:#24292E;--shiki-dark:#E1E4E8;">), </span><span style="--shiki-light:#032F62;--shiki-dark:#9ECBFF;">'r'</span><span style="--shiki-light:#24292E;--shiki-dark:#E1E4E8;">, </span><span style="--shiki-light:#E36209;--shiki-dark:#FFAB70;">encoding</span><span style="--shiki-light:#D73A49;--shiki-dark:#F97583;">=</span><span style="--shiki-light:#032F62;--shiki-dark:#9ECBFF;">'utf-8'</span><span style="--shiki-light:#24292E;--shiki-dark:#E1E4E8;">) </span><span style="--shiki-light:#D73A49;--shiki-dark:#F97583;">as</span><span style="--shiki-light:#24292E;--shiki-dark:#E1E4E8;"> f:</span></span>
|
||||
<span class="line"><span style="--shiki-light:#24292E;--shiki-dark:#E1E4E8;"> nickname_json </span><span style="--shiki-light:#D73A49;--shiki-dark:#F97583;">=</span><span style="--shiki-light:#24292E;--shiki-dark:#E1E4E8;"> json.loads(</span><span style="--shiki-light:#D73A49;--shiki-dark:#F97583;">await</span><span style="--shiki-light:#24292E;--shiki-dark:#E1E4E8;"> f.read())</span></span>
|
||||
<span class="line"><span style="--shiki-light:#D73A49;--shiki-dark:#F97583;"> except</span><span style="--shiki-light:#005CC5;--shiki-dark:#79B8FF;"> Exception</span><span style="--shiki-light:#24292E;--shiki-dark:#E1E4E8;">:</span></span>
|
||||
<span class="line"><span style="--shiki-light:#D73A49;--shiki-dark:#F97583;"> except</span><span style="--shiki-light:#24292E;--shiki-dark:#E1E4E8;"> (json.JSONDecodeError, </span><span style="--shiki-light:#005CC5;--shiki-dark:#79B8FF;">FileNotFoundError</span><span style="--shiki-light:#24292E;--shiki-dark:#E1E4E8;">):</span></span>
|
||||
<span class="line"><span style="--shiki-light:#24292E;--shiki-dark:#E1E4E8;"> logger.error(</span><span style="--shiki-light:#032F62;--shiki-dark:#9ECBFF;">'刷新 nickname_json 表错误:无法载入 nickname.json 文件'</span><span style="--shiki-light:#24292E;--shiki-dark:#E1E4E8;">)</span></span></code></pre></div></details><hr><h3 id="func-get-prompt-model-str-list-dict-str-any" tabindex="-1"><em><strong>func</strong></em> <code>get_prompt(model: str) -> List[Dict[str, Any]]</code> <a class="header-anchor" href="#func-get-prompt-model-str-list-dict-str-any" aria-label="Permalink to "***func*** \`get_prompt(model: str) -> List[Dict[str, Any]]\`""></a></h3><p><strong>Description</strong>: 获取系统提示词</p><details><summary><b>Source code</b> or <a href="https://github.com/LiteyukiStudio/nonebot-plugin-marshoai/tree/main/nonebot_plugin_marshoai/util.py#L256" target="_blank">View on GitHub</a></summary><div class="language-python vp-adaptive-theme"><button title="Copy Code" class="copy"></button><span class="lang">python</span><pre class="shiki shiki-themes github-light github-dark vp-code" tabindex="0"><code><span class="line"><span style="--shiki-light:#D73A49;--shiki-dark:#F97583;">def</span><span style="--shiki-light:#6F42C1;--shiki-dark:#B392F0;"> get_prompt</span><span style="--shiki-light:#24292E;--shiki-dark:#E1E4E8;">(model: </span><span style="--shiki-light:#005CC5;--shiki-dark:#79B8FF;">str</span><span style="--shiki-light:#24292E;--shiki-dark:#E1E4E8;">) -> List[Dict[</span><span style="--shiki-light:#005CC5;--shiki-dark:#79B8FF;">str</span><span style="--shiki-light:#24292E;--shiki-dark:#E1E4E8;">, Any]]:</span></span>
|
||||
<span class="line"><span style="--shiki-light:#24292E;--shiki-dark:#E1E4E8;"> prompts </span><span style="--shiki-light:#D73A49;--shiki-dark:#F97583;">=</span><span style="--shiki-light:#24292E;--shiki-dark:#E1E4E8;"> config.marshoai_additional_prompt</span></span>
|
||||
<span class="line"><span style="--shiki-light:#D73A49;--shiki-dark:#F97583;"> if</span><span style="--shiki-light:#24292E;--shiki-dark:#E1E4E8;"> config.marshoai_enable_praises:</span></span>
|
||||
Reference in New Issue
Block a user