mirror of
https://github.com/LiteyukiStudio/nonebot-plugin-marshoai.git
synced 2025-06-18 13:47:49 +00:00
Deploying to docs from @ LiteyukiStudio/nonebot-plugin-marshoai@6885487709 🚀
This commit is contained in:
parent
1d74d111d5
commit
876759e81c
@ -1 +1 @@
|
||||
import{R as p}from"./chunks/theme.B1VGcao-.js";import{R as s,a0 as i,a1 as u,a2 as c,a3 as l,a4 as f,a5 as d,a6 as m,a7 as h,a8 as g,a9 as A,d as v,u as R,v as w,s as y,aa as C,ab as P,ac as b,ad as E}from"./chunks/framework.CTVYQtO4.js";function r(e){if(e.extends){const a=r(e.extends);return{...a,...e,async enhanceApp(t){a.enhanceApp&&await a.enhanceApp(t),e.enhanceApp&&await e.enhanceApp(t)}}}return e}const n=r(p),S=v({name:"VitePressApp",setup(){const{site:e,lang:a,dir:t}=R();return w(()=>{y(()=>{document.documentElement.lang=a.value,document.documentElement.dir=t.value})}),e.value.router.prefetchLinks&&C(),P(),b(),n.setup&&n.setup(),()=>E(n.Layout)}});async function T(){globalThis.__VITEPRESS__=!0;const e=_(),a=D();a.provide(u,e);const t=c(e.route);return a.provide(l,t),a.component("Content",f),a.component("ClientOnly",d),Object.defineProperties(a.config.globalProperties,{$frontmatter:{get(){return t.frontmatter.value}},$params:{get(){return t.page.value.params}}}),n.enhanceApp&&await n.enhanceApp({app:a,router:e,siteData:m}),{app:a,router:e,data:t}}function D(){return A(S)}function _(){let e=s;return h(a=>{let t=g(a),o=null;return t&&(e&&(t=t.replace(/\.js$/,".lean.js")),o=import(t)),s&&(e=!1),o},n.NotFound)}s&&T().then(({app:e,router:a,data:t})=>{a.go().then(()=>{i(a.route,t.site),e.mount("#app")})});export{T as createApp};
|
||||
import{R as p}from"./chunks/theme.RcKEpCgK.js";import{R as s,a0 as i,a1 as u,a2 as c,a3 as l,a4 as f,a5 as d,a6 as m,a7 as h,a8 as g,a9 as A,d as v,u as R,v as w,s as y,aa as C,ab as P,ac as b,ad as E}from"./chunks/framework.CTVYQtO4.js";function r(e){if(e.extends){const a=r(e.extends);return{...a,...e,async enhanceApp(t){a.enhanceApp&&await a.enhanceApp(t),e.enhanceApp&&await e.enhanceApp(t)}}}return e}const n=r(p),S=v({name:"VitePressApp",setup(){const{site:e,lang:a,dir:t}=R();return w(()=>{y(()=>{document.documentElement.lang=a.value,document.documentElement.dir=t.value})}),e.value.router.prefetchLinks&&C(),P(),b(),n.setup&&n.setup(),()=>E(n.Layout)}});async function T(){globalThis.__VITEPRESS__=!0;const e=_(),a=D();a.provide(u,e);const t=c(e.route);return a.provide(l,t),a.component("Content",f),a.component("ClientOnly",d),Object.defineProperties(a.config.globalProperties,{$frontmatter:{get(){return t.frontmatter.value}},$params:{get(){return t.page.value.params}}}),n.enhanceApp&&await n.enhanceApp({app:a,router:e,siteData:m}),{app:a,router:e,data:t}}function D(){return A(S)}function _(){let e=s;return h(a=>{let t=g(a),o=null;return t&&(e&&(t=t.replace(/\.js$/,".lean.js")),o=import(t)),s&&(e=!1),o},n.NotFound)}s&&T().then(({app:e,router:a,data:t})=>{a.go().then(()=>{i(a.route,t.site),e.mount("#app")})});export{T as createApp};
|
File diff suppressed because one or more lines are too long
@ -1,32 +1,32 @@
|
||||
import{_ as i,c as a,o as n,ae as h}from"./chunks/framework.CTVYQtO4.js";const d=JSON.parse('{"title":"marsho","description":"","frontmatter":{"title":"marsho","order":100},"headers":[],"relativePath":"dev/api/marsho.md","filePath":"zh/dev/api/marsho.md","lastUpdated":null}'),t={name:"dev/api/marsho.md"};function k(l,s,e,p,E,r){return n(),a("div",null,s[0]||(s[0]=[h(`<h1 id="模块-nonebot-plugin-marshoai-marsho" tabindex="-1"><strong>模块</strong> <code>nonebot_plugin_marshoai.marsho</code> <a class="header-anchor" href="#模块-nonebot-plugin-marshoai-marsho" aria-label="Permalink to "**模块** \`nonebot_plugin_marshoai.marsho\`""></a></h1><hr><h3 id="async-func-at-enable" tabindex="-1"><em><strong>async func</strong></em> <code>at_enable()</code> <a class="header-anchor" href="#async-func-at-enable" aria-label="Permalink to "***async func*** \`at_enable()\`""></a></h3><details><summary><b>源代码</b> 或 <a href="https://github.com/LiteyukiStudio/nonebot-plugin-marshoai/tree/main/nonebot_plugin_marshoai/marsho.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;">async</span><span style="--shiki-light:#D73A49;--shiki-dark:#F97583;"> def</span><span style="--shiki-light:#6F42C1;--shiki-dark:#B392F0;"> at_enable</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;"> config.marshoai_at</span></span></code></pre></div></details><hr><p><code>@add_usermsg_cmd.handle()</code></p><h3 id="async-func-add-usermsg-target-msgtarget-arg-message-commandarg" tabindex="-1"><em><strong>async func</strong></em> <code>add_usermsg(target: MsgTarget, arg: Message = CommandArg())</code> <a class="header-anchor" href="#async-func-add-usermsg-target-msgtarget-arg-message-commandarg" aria-label="Permalink to "***async func*** \`add_usermsg(target: MsgTarget, arg: Message = CommandArg())\`""></a></h3><details><summary><b>源代码</b> 或 <a href="https://github.com/LiteyukiStudio/nonebot-plugin-marshoai/tree/main/nonebot_plugin_marshoai/marsho.py#L93" 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:#6F42C1;--shiki-dark:#B392F0;">@add_usermsg_cmd.handle</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;"> config.marshoai_at</span></span></code></pre></div></details><hr><p><code>@add_usermsg_cmd.handle()</code></p><h3 id="async-func-add-usermsg-target-msgtarget-arg-message-commandarg" tabindex="-1"><em><strong>async func</strong></em> <code>add_usermsg(target: MsgTarget, arg: Message = CommandArg())</code> <a class="header-anchor" href="#async-func-add-usermsg-target-msgtarget-arg-message-commandarg" aria-label="Permalink to "***async func*** \`add_usermsg(target: MsgTarget, arg: Message = CommandArg())\`""></a></h3><details><summary><b>源代码</b> 或 <a href="https://github.com/LiteyukiStudio/nonebot-plugin-marshoai/tree/main/nonebot_plugin_marshoai/marsho.py#L99" 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:#6F42C1;--shiki-dark:#B392F0;">@add_usermsg_cmd.handle</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;"> def</span><span style="--shiki-light:#6F42C1;--shiki-dark:#B392F0;"> add_usermsg</span><span style="--shiki-light:#24292E;--shiki-dark:#E1E4E8;">(target: MsgTarget, arg: Message</span><span style="--shiki-light:#D73A49;--shiki-dark:#F97583;">=</span><span style="--shiki-light:#24292E;--shiki-dark:#E1E4E8;">CommandArg()):</span></span>
|
||||
<span class="line"><span style="--shiki-light:#D73A49;--shiki-dark:#F97583;"> if</span><span style="--shiki-light:#24292E;--shiki-dark:#E1E4E8;"> (msg </span><span style="--shiki-light:#D73A49;--shiki-dark:#F97583;">:=</span><span style="--shiki-light:#24292E;--shiki-dark:#E1E4E8;"> arg.extract_plain_text()):</span></span>
|
||||
<span class="line"><span style="--shiki-light:#24292E;--shiki-dark:#E1E4E8;"> context.append(UserMessage(</span><span style="--shiki-light:#E36209;--shiki-dark:#FFAB70;">content</span><span style="--shiki-light:#D73A49;--shiki-dark:#F97583;">=</span><span style="--shiki-light:#24292E;--shiki-dark:#E1E4E8;">msg).as_dict(), target.id, target.private)</span></span>
|
||||
<span class="line"><span style="--shiki-light:#D73A49;--shiki-dark:#F97583;"> await</span><span style="--shiki-light:#24292E;--shiki-dark:#E1E4E8;"> add_usermsg_cmd.finish(</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><p><code>@add_assistantmsg_cmd.handle()</code></p><h3 id="async-func-add-assistantmsg-target-msgtarget-arg-message-commandarg" tabindex="-1"><em><strong>async func</strong></em> <code>add_assistantmsg(target: MsgTarget, arg: Message = CommandArg())</code> <a class="header-anchor" href="#async-func-add-assistantmsg-target-msgtarget-arg-message-commandarg" aria-label="Permalink to "***async func*** \`add_assistantmsg(target: MsgTarget, arg: Message = CommandArg())\`""></a></h3><details><summary><b>源代码</b> 或 <a href="https://github.com/LiteyukiStudio/nonebot-plugin-marshoai/tree/main/nonebot_plugin_marshoai/marsho.py#L100" 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:#6F42C1;--shiki-dark:#B392F0;">@add_assistantmsg_cmd.handle</span><span style="--shiki-light:#24292E;--shiki-dark:#E1E4E8;">()</span></span>
|
||||
<span class="line"><span style="--shiki-light:#D73A49;--shiki-dark:#F97583;"> await</span><span style="--shiki-light:#24292E;--shiki-dark:#E1E4E8;"> add_usermsg_cmd.finish(</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><p><code>@add_assistantmsg_cmd.handle()</code></p><h3 id="async-func-add-assistantmsg-target-msgtarget-arg-message-commandarg" tabindex="-1"><em><strong>async func</strong></em> <code>add_assistantmsg(target: MsgTarget, arg: Message = CommandArg())</code> <a class="header-anchor" href="#async-func-add-assistantmsg-target-msgtarget-arg-message-commandarg" aria-label="Permalink to "***async func*** \`add_assistantmsg(target: MsgTarget, arg: Message = CommandArg())\`""></a></h3><details><summary><b>源代码</b> 或 <a href="https://github.com/LiteyukiStudio/nonebot-plugin-marshoai/tree/main/nonebot_plugin_marshoai/marsho.py#L106" 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:#6F42C1;--shiki-dark:#B392F0;">@add_assistantmsg_cmd.handle</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;"> def</span><span style="--shiki-light:#6F42C1;--shiki-dark:#B392F0;"> add_assistantmsg</span><span style="--shiki-light:#24292E;--shiki-dark:#E1E4E8;">(target: MsgTarget, arg: Message</span><span style="--shiki-light:#D73A49;--shiki-dark:#F97583;">=</span><span style="--shiki-light:#24292E;--shiki-dark:#E1E4E8;">CommandArg()):</span></span>
|
||||
<span class="line"><span style="--shiki-light:#D73A49;--shiki-dark:#F97583;"> if</span><span style="--shiki-light:#24292E;--shiki-dark:#E1E4E8;"> (msg </span><span style="--shiki-light:#D73A49;--shiki-dark:#F97583;">:=</span><span style="--shiki-light:#24292E;--shiki-dark:#E1E4E8;"> arg.extract_plain_text()):</span></span>
|
||||
<span class="line"><span style="--shiki-light:#24292E;--shiki-dark:#E1E4E8;"> context.append(AssistantMessage(</span><span style="--shiki-light:#E36209;--shiki-dark:#FFAB70;">content</span><span style="--shiki-light:#D73A49;--shiki-dark:#F97583;">=</span><span style="--shiki-light:#24292E;--shiki-dark:#E1E4E8;">msg).as_dict(), target.id, target.private)</span></span>
|
||||
<span class="line"><span style="--shiki-light:#D73A49;--shiki-dark:#F97583;"> await</span><span style="--shiki-light:#24292E;--shiki-dark:#E1E4E8;"> add_assistantmsg_cmd.finish(</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><p><code>@praises_cmd.handle()</code></p><h3 id="async-func-praises" tabindex="-1"><em><strong>async func</strong></em> <code>praises()</code> <a class="header-anchor" href="#async-func-praises" aria-label="Permalink to "***async func*** \`praises()\`""></a></h3><details><summary><b>源代码</b> 或 <a href="https://github.com/LiteyukiStudio/nonebot-plugin-marshoai/tree/main/nonebot_plugin_marshoai/marsho.py#L109" 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:#6F42C1;--shiki-dark:#B392F0;">@praises_cmd.handle</span><span style="--shiki-light:#24292E;--shiki-dark:#E1E4E8;">()</span></span>
|
||||
<span class="line"><span style="--shiki-light:#D73A49;--shiki-dark:#F97583;"> await</span><span style="--shiki-light:#24292E;--shiki-dark:#E1E4E8;"> add_assistantmsg_cmd.finish(</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><p><code>@praises_cmd.handle()</code></p><h3 id="async-func-praises" tabindex="-1"><em><strong>async func</strong></em> <code>praises()</code> <a class="header-anchor" href="#async-func-praises" aria-label="Permalink to "***async func*** \`praises()\`""></a></h3><details><summary><b>源代码</b> 或 <a href="https://github.com/LiteyukiStudio/nonebot-plugin-marshoai/tree/main/nonebot_plugin_marshoai/marsho.py#L115" 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:#6F42C1;--shiki-dark:#B392F0;">@praises_cmd.handle</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;"> def</span><span style="--shiki-light:#6F42C1;--shiki-dark:#B392F0;"> praises</span><span style="--shiki-light:#24292E;--shiki-dark:#E1E4E8;">():</span></span>
|
||||
<span class="line"><span style="--shiki-light:#D73A49;--shiki-dark:#F97583;"> await</span><span style="--shiki-light:#24292E;--shiki-dark:#E1E4E8;"> praises_cmd.finish(build_praises())</span></span></code></pre></div></details><hr><p><code>@contexts_cmd.handle()</code></p><h3 id="async-func-contexts-target-msgtarget" tabindex="-1"><em><strong>async func</strong></em> <code>contexts(target: MsgTarget)</code> <a class="header-anchor" href="#async-func-contexts-target-msgtarget" aria-label="Permalink to "***async func*** \`contexts(target: MsgTarget)\`""></a></h3><details><summary><b>源代码</b> 或 <a href="https://github.com/LiteyukiStudio/nonebot-plugin-marshoai/tree/main/nonebot_plugin_marshoai/marsho.py#L115" 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:#6F42C1;--shiki-dark:#B392F0;">@contexts_cmd.handle</span><span style="--shiki-light:#24292E;--shiki-dark:#E1E4E8;">()</span></span>
|
||||
<span class="line"><span style="--shiki-light:#D73A49;--shiki-dark:#F97583;"> await</span><span style="--shiki-light:#24292E;--shiki-dark:#E1E4E8;"> praises_cmd.finish(build_praises())</span></span></code></pre></div></details><hr><p><code>@contexts_cmd.handle()</code></p><h3 id="async-func-contexts-target-msgtarget" tabindex="-1"><em><strong>async func</strong></em> <code>contexts(target: MsgTarget)</code> <a class="header-anchor" href="#async-func-contexts-target-msgtarget" aria-label="Permalink to "***async func*** \`contexts(target: MsgTarget)\`""></a></h3><details><summary><b>源代码</b> 或 <a href="https://github.com/LiteyukiStudio/nonebot-plugin-marshoai/tree/main/nonebot_plugin_marshoai/marsho.py#L121" 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:#6F42C1;--shiki-dark:#B392F0;">@contexts_cmd.handle</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;"> def</span><span style="--shiki-light:#6F42C1;--shiki-dark:#B392F0;"> contexts</span><span style="--shiki-light:#24292E;--shiki-dark:#E1E4E8;">(target: MsgTarget):</span></span>
|
||||
<span class="line"><span style="--shiki-light:#24292E;--shiki-dark:#E1E4E8;"> backup_context </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;"> get_backup_context(target.id, target.private)</span></span>
|
||||
<span class="line"><span style="--shiki-light:#D73A49;--shiki-dark:#F97583;"> if</span><span style="--shiki-light:#24292E;--shiki-dark:#E1E4E8;"> backup_context:</span></span>
|
||||
<span class="line"><span style="--shiki-light:#24292E;--shiki-dark:#E1E4E8;"> context.set_context(backup_context, target.id, target.private)</span></span>
|
||||
<span class="line"><span style="--shiki-light:#D73A49;--shiki-dark:#F97583;"> await</span><span style="--shiki-light:#24292E;--shiki-dark:#E1E4E8;"> contexts_cmd.finish(</span><span style="--shiki-light:#005CC5;--shiki-dark:#79B8FF;">str</span><span style="--shiki-light:#24292E;--shiki-dark:#E1E4E8;">(context.build(target.id, target.private)))</span></span></code></pre></div></details><hr><p><code>@save_context_cmd.handle()</code></p><h3 id="async-func-save-context-target-msgtarget-arg-message-commandarg" tabindex="-1"><em><strong>async func</strong></em> <code>save_context(target: MsgTarget, arg: Message = CommandArg())</code> <a class="header-anchor" href="#async-func-save-context-target-msgtarget-arg-message-commandarg" aria-label="Permalink to "***async func*** \`save_context(target: MsgTarget, arg: Message = CommandArg())\`""></a></h3><details><summary><b>源代码</b> 或 <a href="https://github.com/LiteyukiStudio/nonebot-plugin-marshoai/tree/main/nonebot_plugin_marshoai/marsho.py#L123" 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:#6F42C1;--shiki-dark:#B392F0;">@save_context_cmd.handle</span><span style="--shiki-light:#24292E;--shiki-dark:#E1E4E8;">()</span></span>
|
||||
<span class="line"><span style="--shiki-light:#D73A49;--shiki-dark:#F97583;"> await</span><span style="--shiki-light:#24292E;--shiki-dark:#E1E4E8;"> contexts_cmd.finish(</span><span style="--shiki-light:#005CC5;--shiki-dark:#79B8FF;">str</span><span style="--shiki-light:#24292E;--shiki-dark:#E1E4E8;">(context.build(target.id, target.private)))</span></span></code></pre></div></details><hr><p><code>@save_context_cmd.handle()</code></p><h3 id="async-func-save-context-target-msgtarget-arg-message-commandarg" tabindex="-1"><em><strong>async func</strong></em> <code>save_context(target: MsgTarget, arg: Message = CommandArg())</code> <a class="header-anchor" href="#async-func-save-context-target-msgtarget-arg-message-commandarg" aria-label="Permalink to "***async func*** \`save_context(target: MsgTarget, arg: Message = CommandArg())\`""></a></h3><details><summary><b>源代码</b> 或 <a href="https://github.com/LiteyukiStudio/nonebot-plugin-marshoai/tree/main/nonebot_plugin_marshoai/marsho.py#L129" 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:#6F42C1;--shiki-dark:#B392F0;">@save_context_cmd.handle</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;"> def</span><span style="--shiki-light:#6F42C1;--shiki-dark:#B392F0;"> save_context</span><span style="--shiki-light:#24292E;--shiki-dark:#E1E4E8;">(target: MsgTarget, arg: Message</span><span style="--shiki-light:#D73A49;--shiki-dark:#F97583;">=</span><span style="--shiki-light:#24292E;--shiki-dark:#E1E4E8;">CommandArg()):</span></span>
|
||||
<span class="line"><span style="--shiki-light:#24292E;--shiki-dark:#E1E4E8;"> contexts_data </span><span style="--shiki-light:#D73A49;--shiki-dark:#F97583;">=</span><span style="--shiki-light:#24292E;--shiki-dark:#E1E4E8;"> context.build(target.id, target.private)</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;"> context:</span></span>
|
||||
<span class="line"><span style="--shiki-light:#D73A49;--shiki-dark:#F97583;"> await</span><span style="--shiki-light:#24292E;--shiki-dark:#E1E4E8;"> save_context_cmd.finish(</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:#24292E;--shiki-dark:#E1E4E8;"> (msg </span><span style="--shiki-light:#D73A49;--shiki-dark:#F97583;">:=</span><span style="--shiki-light:#24292E;--shiki-dark:#E1E4E8;"> arg.extract_plain_text()):</span></span>
|
||||
<span class="line"><span style="--shiki-light:#D73A49;--shiki-dark:#F97583;"> await</span><span style="--shiki-light:#24292E;--shiki-dark:#E1E4E8;"> save_context_to_json(msg, contexts_data, </span><span style="--shiki-light:#032F62;--shiki-dark:#9ECBFF;">'contexts'</span><span style="--shiki-light:#24292E;--shiki-dark:#E1E4E8;">)</span></span>
|
||||
<span class="line"><span style="--shiki-light:#D73A49;--shiki-dark:#F97583;"> await</span><span style="--shiki-light:#24292E;--shiki-dark:#E1E4E8;"> save_context_cmd.finish(</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><p><code>@load_context_cmd.handle()</code></p><h3 id="async-func-load-context-target-msgtarget-arg-message-commandarg" tabindex="-1"><em><strong>async func</strong></em> <code>load_context(target: MsgTarget, arg: Message = CommandArg())</code> <a class="header-anchor" href="#async-func-load-context-target-msgtarget-arg-message-commandarg" aria-label="Permalink to "***async func*** \`load_context(target: MsgTarget, arg: Message = CommandArg())\`""></a></h3><details><summary><b>源代码</b> 或 <a href="https://github.com/LiteyukiStudio/nonebot-plugin-marshoai/tree/main/nonebot_plugin_marshoai/marsho.py#L133" 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:#6F42C1;--shiki-dark:#B392F0;">@load_context_cmd.handle</span><span style="--shiki-light:#24292E;--shiki-dark:#E1E4E8;">()</span></span>
|
||||
<span class="line"><span style="--shiki-light:#D73A49;--shiki-dark:#F97583;"> await</span><span style="--shiki-light:#24292E;--shiki-dark:#E1E4E8;"> save_context_cmd.finish(</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><p><code>@load_context_cmd.handle()</code></p><h3 id="async-func-load-context-target-msgtarget-arg-message-commandarg" tabindex="-1"><em><strong>async func</strong></em> <code>load_context(target: MsgTarget, arg: Message = CommandArg())</code> <a class="header-anchor" href="#async-func-load-context-target-msgtarget-arg-message-commandarg" aria-label="Permalink to "***async func*** \`load_context(target: MsgTarget, arg: Message = CommandArg())\`""></a></h3><details><summary><b>源代码</b> 或 <a href="https://github.com/LiteyukiStudio/nonebot-plugin-marshoai/tree/main/nonebot_plugin_marshoai/marsho.py#L139" 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:#6F42C1;--shiki-dark:#B392F0;">@load_context_cmd.handle</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;"> def</span><span style="--shiki-light:#6F42C1;--shiki-dark:#B392F0;"> load_context</span><span style="--shiki-light:#24292E;--shiki-dark:#E1E4E8;">(target: MsgTarget, arg: Message</span><span style="--shiki-light:#D73A49;--shiki-dark:#F97583;">=</span><span style="--shiki-light:#24292E;--shiki-dark:#E1E4E8;">CommandArg()):</span></span>
|
||||
<span class="line"><span style="--shiki-light:#D73A49;--shiki-dark:#F97583;"> if</span><span style="--shiki-light:#24292E;--shiki-dark:#E1E4E8;"> (msg </span><span style="--shiki-light:#D73A49;--shiki-dark:#F97583;">:=</span><span style="--shiki-light:#24292E;--shiki-dark:#E1E4E8;"> arg.extract_plain_text()):</span></span>
|
||||
<span class="line"><span style="--shiki-light:#D73A49;--shiki-dark:#F97583;"> await</span><span style="--shiki-light:#24292E;--shiki-dark:#E1E4E8;"> get_backup_context(target.id, target.private)</span></span>
|
||||
<span class="line"><span style="--shiki-light:#24292E;--shiki-dark:#E1E4E8;"> context.set_context(</span><span style="--shiki-light:#D73A49;--shiki-dark:#F97583;">await</span><span style="--shiki-light:#24292E;--shiki-dark:#E1E4E8;"> load_context_from_json(msg, </span><span style="--shiki-light:#032F62;--shiki-dark:#9ECBFF;">'contexts'</span><span style="--shiki-light:#24292E;--shiki-dark:#E1E4E8;">), target.id, target.private)</span></span>
|
||||
<span class="line"><span style="--shiki-light:#D73A49;--shiki-dark:#F97583;"> await</span><span style="--shiki-light:#24292E;--shiki-dark:#E1E4E8;"> load_context_cmd.finish(</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><p><code>@resetmem_cmd.handle()</code></p><h3 id="async-func-resetmem-target-msgtarget" tabindex="-1"><em><strong>async func</strong></em> <code>resetmem(target: MsgTarget)</code> <a class="header-anchor" href="#async-func-resetmem-target-msgtarget" aria-label="Permalink to "***async func*** \`resetmem(target: MsgTarget)\`""></a></h3><details><summary><b>源代码</b> 或 <a href="https://github.com/LiteyukiStudio/nonebot-plugin-marshoai/tree/main/nonebot_plugin_marshoai/marsho.py#L145" 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:#6F42C1;--shiki-dark:#B392F0;">@resetmem_cmd.handle</span><span style="--shiki-light:#24292E;--shiki-dark:#E1E4E8;">()</span></span>
|
||||
<span class="line"><span style="--shiki-light:#D73A49;--shiki-dark:#F97583;"> await</span><span style="--shiki-light:#24292E;--shiki-dark:#E1E4E8;"> load_context_cmd.finish(</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><p><code>@resetmem_cmd.handle()</code></p><h3 id="async-func-resetmem-target-msgtarget" tabindex="-1"><em><strong>async func</strong></em> <code>resetmem(target: MsgTarget)</code> <a class="header-anchor" href="#async-func-resetmem-target-msgtarget" aria-label="Permalink to "***async func*** \`resetmem(target: MsgTarget)\`""></a></h3><details><summary><b>源代码</b> 或 <a href="https://github.com/LiteyukiStudio/nonebot-plugin-marshoai/tree/main/nonebot_plugin_marshoai/marsho.py#L151" 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:#6F42C1;--shiki-dark:#B392F0;">@resetmem_cmd.handle</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;"> def</span><span style="--shiki-light:#6F42C1;--shiki-dark:#B392F0;"> resetmem</span><span style="--shiki-light:#24292E;--shiki-dark:#E1E4E8;">(target: MsgTarget):</span></span>
|
||||
<span class="line"><span style="--shiki-light:#D73A49;--shiki-dark:#F97583;"> if</span><span style="--shiki-light:#24292E;--shiki-dark:#E1E4E8;"> [target.id, target.private] </span><span style="--shiki-light:#D73A49;--shiki-dark:#F97583;">not</span><span style="--shiki-light:#D73A49;--shiki-dark:#F97583;"> in</span><span style="--shiki-light:#24292E;--shiki-dark:#E1E4E8;"> target_list:</span></span>
|
||||
<span class="line"><span style="--shiki-light:#24292E;--shiki-dark:#E1E4E8;"> target_list.append([target.id, target.private])</span></span>
|
||||
@ -34,12 +34,12 @@ import{_ as i,c as a,o as n,ae as h}from"./chunks/framework.CTVYQtO4.js";const d
|
||||
<span class="line"><span style="--shiki-light:#D73A49;--shiki-dark:#F97583;"> if</span><span style="--shiki-light:#24292E;--shiki-dark:#E1E4E8;"> backup_context:</span></span>
|
||||
<span class="line"><span style="--shiki-light:#24292E;--shiki-dark:#E1E4E8;"> context.set_context(backup_context, target.id, target.private)</span></span>
|
||||
<span class="line"><span style="--shiki-light:#24292E;--shiki-dark:#E1E4E8;"> context.reset(target.id, target.private)</span></span>
|
||||
<span class="line"><span style="--shiki-light:#D73A49;--shiki-dark:#F97583;"> await</span><span style="--shiki-light:#24292E;--shiki-dark:#E1E4E8;"> resetmem_cmd.finish(</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><p><code>@changemodel_cmd.handle()</code></p><h3 id="async-func-changemodel-arg-message-commandarg" tabindex="-1"><em><strong>async func</strong></em> <code>changemodel(arg: Message = CommandArg())</code> <a class="header-anchor" href="#async-func-changemodel-arg-message-commandarg" aria-label="Permalink to "***async func*** \`changemodel(arg: Message = CommandArg())\`""></a></h3><details><summary><b>源代码</b> 或 <a href="https://github.com/LiteyukiStudio/nonebot-plugin-marshoai/tree/main/nonebot_plugin_marshoai/marsho.py#L156" 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:#6F42C1;--shiki-dark:#B392F0;">@changemodel_cmd.handle</span><span style="--shiki-light:#24292E;--shiki-dark:#E1E4E8;">()</span></span>
|
||||
<span class="line"><span style="--shiki-light:#D73A49;--shiki-dark:#F97583;"> await</span><span style="--shiki-light:#24292E;--shiki-dark:#E1E4E8;"> resetmem_cmd.finish(</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><p><code>@changemodel_cmd.handle()</code></p><h3 id="async-func-changemodel-arg-message-commandarg" tabindex="-1"><em><strong>async func</strong></em> <code>changemodel(arg: Message = CommandArg())</code> <a class="header-anchor" href="#async-func-changemodel-arg-message-commandarg" aria-label="Permalink to "***async func*** \`changemodel(arg: Message = CommandArg())\`""></a></h3><details><summary><b>源代码</b> 或 <a href="https://github.com/LiteyukiStudio/nonebot-plugin-marshoai/tree/main/nonebot_plugin_marshoai/marsho.py#L162" 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:#6F42C1;--shiki-dark:#B392F0;">@changemodel_cmd.handle</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;"> def</span><span style="--shiki-light:#6F42C1;--shiki-dark:#B392F0;"> changemodel</span><span style="--shiki-light:#24292E;--shiki-dark:#E1E4E8;">(arg: Message</span><span style="--shiki-light:#D73A49;--shiki-dark:#F97583;">=</span><span style="--shiki-light:#24292E;--shiki-dark:#E1E4E8;">CommandArg()):</span></span>
|
||||
<span class="line"><span style="--shiki-light:#D73A49;--shiki-dark:#F97583;"> global</span><span style="--shiki-light:#24292E;--shiki-dark:#E1E4E8;"> model_name</span></span>
|
||||
<span class="line"><span style="--shiki-light:#D73A49;--shiki-dark:#F97583;"> if</span><span style="--shiki-light:#24292E;--shiki-dark:#E1E4E8;"> (model </span><span style="--shiki-light:#D73A49;--shiki-dark:#F97583;">:=</span><span style="--shiki-light:#24292E;--shiki-dark:#E1E4E8;"> arg.extract_plain_text()):</span></span>
|
||||
<span class="line"><span style="--shiki-light:#24292E;--shiki-dark:#E1E4E8;"> model_name </span><span style="--shiki-light:#D73A49;--shiki-dark:#F97583;">=</span><span style="--shiki-light:#24292E;--shiki-dark:#E1E4E8;"> model</span></span>
|
||||
<span class="line"><span style="--shiki-light:#D73A49;--shiki-dark:#F97583;"> await</span><span style="--shiki-light:#24292E;--shiki-dark:#E1E4E8;"> changemodel_cmd.finish(</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><p><code>@nickname_cmd.handle()</code></p><h3 id="async-func-nickname-event-event-name-none" tabindex="-1"><em><strong>async func</strong></em> <code>nickname(event: Event, name = None)</code> <a class="header-anchor" href="#async-func-nickname-event-event-name-none" aria-label="Permalink to "***async func*** \`nickname(event: Event, name = None)\`""></a></h3><details><summary><b>源代码</b> 或 <a href="https://github.com/LiteyukiStudio/nonebot-plugin-marshoai/tree/main/nonebot_plugin_marshoai/marsho.py#L164" 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:#6F42C1;--shiki-dark:#B392F0;">@nickname_cmd.handle</span><span style="--shiki-light:#24292E;--shiki-dark:#E1E4E8;">()</span></span>
|
||||
<span class="line"><span style="--shiki-light:#D73A49;--shiki-dark:#F97583;"> await</span><span style="--shiki-light:#24292E;--shiki-dark:#E1E4E8;"> changemodel_cmd.finish(</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><p><code>@nickname_cmd.handle()</code></p><h3 id="async-func-nickname-event-event-name-none" tabindex="-1"><em><strong>async func</strong></em> <code>nickname(event: Event, name = None)</code> <a class="header-anchor" href="#async-func-nickname-event-event-name-none" aria-label="Permalink to "***async func*** \`nickname(event: Event, name = None)\`""></a></h3><details><summary><b>源代码</b> 或 <a href="https://github.com/LiteyukiStudio/nonebot-plugin-marshoai/tree/main/nonebot_plugin_marshoai/marsho.py#L170" 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:#6F42C1;--shiki-dark:#B392F0;">@nickname_cmd.handle</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;"> def</span><span style="--shiki-light:#6F42C1;--shiki-dark:#B392F0;"> nickname</span><span style="--shiki-light:#24292E;--shiki-dark:#E1E4E8;">(event: Event, name</span><span style="--shiki-light:#D73A49;--shiki-dark:#F97583;">=</span><span style="--shiki-light:#005CC5;--shiki-dark:#79B8FF;">None</span><span style="--shiki-light:#24292E;--shiki-dark:#E1E4E8;">):</span></span>
|
||||
<span class="line"><span style="--shiki-light:#24292E;--shiki-dark:#E1E4E8;"> nicknames </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;"> get_nicknames()</span></span>
|
||||
<span class="line"><span style="--shiki-light:#24292E;--shiki-dark:#E1E4E8;"> user_id </span><span style="--shiki-light:#D73A49;--shiki-dark:#F97583;">=</span><span style="--shiki-light:#24292E;--shiki-dark:#E1E4E8;"> event.get_user_id()</span></span>
|
||||
@ -54,15 +54,15 @@ import{_ as i,c as a,o as n,ae as h}from"./chunks/framework.CTVYQtO4.js";const d
|
||||
<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;">(name) </span><span style="--shiki-light:#D73A49;--shiki-dark:#F97583;">></span><span style="--shiki-light:#24292E;--shiki-dark:#E1E4E8;"> config.marshoai_nickname_limit:</span></span>
|
||||
<span class="line"><span style="--shiki-light:#D73A49;--shiki-dark:#F97583;"> await</span><span style="--shiki-light:#24292E;--shiki-dark:#E1E4E8;"> nickname_cmd.finish(</span><span style="--shiki-light:#032F62;--shiki-dark:#9ECBFF;">'昵称超出长度限制:'</span><span style="--shiki-light:#D73A49;--shiki-dark:#F97583;"> +</span><span style="--shiki-light:#005CC5;--shiki-dark:#79B8FF;"> str</span><span style="--shiki-light:#24292E;--shiki-dark:#E1E4E8;">(config.marshoai_nickname_limit))</span></span>
|
||||
<span class="line"><span style="--shiki-light:#D73A49;--shiki-dark:#F97583;"> await</span><span style="--shiki-light:#24292E;--shiki-dark:#E1E4E8;"> set_nickname(user_id, name)</span></span>
|
||||
<span class="line"><span style="--shiki-light:#D73A49;--shiki-dark:#F97583;"> await</span><span style="--shiki-light:#24292E;--shiki-dark:#E1E4E8;"> nickname_cmd.finish(</span><span style="--shiki-light:#032F62;--shiki-dark:#9ECBFF;">'已设置昵称为:'</span><span style="--shiki-light:#D73A49;--shiki-dark:#F97583;"> +</span><span style="--shiki-light:#24292E;--shiki-dark:#E1E4E8;"> name)</span></span></code></pre></div></details><hr><p><code>@refresh_data_cmd.handle()</code></p><h3 id="async-func-refresh-data" tabindex="-1"><em><strong>async func</strong></em> <code>refresh_data()</code> <a class="header-anchor" href="#async-func-refresh-data" aria-label="Permalink to "***async func*** \`refresh_data()\`""></a></h3><details><summary><b>源代码</b> 或 <a href="https://github.com/LiteyukiStudio/nonebot-plugin-marshoai/tree/main/nonebot_plugin_marshoai/marsho.py#L184" 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:#6F42C1;--shiki-dark:#B392F0;">@refresh_data_cmd.handle</span><span style="--shiki-light:#24292E;--shiki-dark:#E1E4E8;">()</span></span>
|
||||
<span class="line"><span style="--shiki-light:#D73A49;--shiki-dark:#F97583;"> await</span><span style="--shiki-light:#24292E;--shiki-dark:#E1E4E8;"> nickname_cmd.finish(</span><span style="--shiki-light:#032F62;--shiki-dark:#9ECBFF;">'已设置昵称为:'</span><span style="--shiki-light:#D73A49;--shiki-dark:#F97583;"> +</span><span style="--shiki-light:#24292E;--shiki-dark:#E1E4E8;"> name)</span></span></code></pre></div></details><hr><p><code>@refresh_data_cmd.handle()</code></p><h3 id="async-func-refresh-data" tabindex="-1"><em><strong>async func</strong></em> <code>refresh_data()</code> <a class="header-anchor" href="#async-func-refresh-data" aria-label="Permalink to "***async func*** \`refresh_data()\`""></a></h3><details><summary><b>源代码</b> 或 <a href="https://github.com/LiteyukiStudio/nonebot-plugin-marshoai/tree/main/nonebot_plugin_marshoai/marsho.py#L190" 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:#6F42C1;--shiki-dark:#B392F0;">@refresh_data_cmd.handle</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;"> def</span><span style="--shiki-light:#6F42C1;--shiki-dark:#B392F0;"> refresh_data</span><span style="--shiki-light:#24292E;--shiki-dark:#E1E4E8;">():</span></span>
|
||||
<span class="line"><span style="--shiki-light:#D73A49;--shiki-dark:#F97583;"> await</span><span style="--shiki-light:#24292E;--shiki-dark:#E1E4E8;"> refresh_nickname_json()</span></span>
|
||||
<span class="line"><span style="--shiki-light:#D73A49;--shiki-dark:#F97583;"> await</span><span style="--shiki-light:#24292E;--shiki-dark:#E1E4E8;"> refresh_praises_json()</span></span>
|
||||
<span class="line"><span style="--shiki-light:#D73A49;--shiki-dark:#F97583;"> await</span><span style="--shiki-light:#24292E;--shiki-dark:#E1E4E8;"> refresh_data_cmd.finish(</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><p><code>@marsho_help_cmd.handle()</code></p><h3 id="async-func-marsho-help" tabindex="-1"><em><strong>async func</strong></em> <code>marsho_help()</code> <a class="header-anchor" href="#async-func-marsho-help" aria-label="Permalink to "***async func*** \`marsho_help()\`""></a></h3><details><summary><b>源代码</b> 或 <a href="https://github.com/LiteyukiStudio/nonebot-plugin-marshoai/tree/main/nonebot_plugin_marshoai/marsho.py#L191" 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:#6F42C1;--shiki-dark:#B392F0;">@marsho_help_cmd.handle</span><span style="--shiki-light:#24292E;--shiki-dark:#E1E4E8;">()</span></span>
|
||||
<span class="line"><span style="--shiki-light:#D73A49;--shiki-dark:#F97583;"> await</span><span style="--shiki-light:#24292E;--shiki-dark:#E1E4E8;"> refresh_data_cmd.finish(</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><p><code>@marsho_help_cmd.handle()</code></p><h3 id="async-func-marsho-help" tabindex="-1"><em><strong>async func</strong></em> <code>marsho_help()</code> <a class="header-anchor" href="#async-func-marsho-help" aria-label="Permalink to "***async func*** \`marsho_help()\`""></a></h3><details><summary><b>源代码</b> 或 <a href="https://github.com/LiteyukiStudio/nonebot-plugin-marshoai/tree/main/nonebot_plugin_marshoai/marsho.py#L197" 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:#6F42C1;--shiki-dark:#B392F0;">@marsho_help_cmd.handle</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;"> def</span><span style="--shiki-light:#6F42C1;--shiki-dark:#B392F0;"> marsho_help</span><span style="--shiki-light:#24292E;--shiki-dark:#E1E4E8;">():</span></span>
|
||||
<span class="line"><span style="--shiki-light:#D73A49;--shiki-dark:#F97583;"> await</span><span style="--shiki-light:#24292E;--shiki-dark:#E1E4E8;"> marsho_help_cmd.finish(metadata.usage)</span></span></code></pre></div></details><hr><p><code>@marsho_status_cmd.handle()</code></p><h3 id="async-func-marsho-status-bot-bot" tabindex="-1"><em><strong>async func</strong></em> <code>marsho_status(bot: Bot)</code> <a class="header-anchor" href="#async-func-marsho-status-bot-bot" aria-label="Permalink to "***async func*** \`marsho_status(bot: Bot)\`""></a></h3><details><summary><b>源代码</b> 或 <a href="https://github.com/LiteyukiStudio/nonebot-plugin-marshoai/tree/main/nonebot_plugin_marshoai/marsho.py#L196" 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:#6F42C1;--shiki-dark:#B392F0;">@marsho_status_cmd.handle</span><span style="--shiki-light:#24292E;--shiki-dark:#E1E4E8;">()</span></span>
|
||||
<span class="line"><span style="--shiki-light:#D73A49;--shiki-dark:#F97583;"> await</span><span style="--shiki-light:#24292E;--shiki-dark:#E1E4E8;"> marsho_help_cmd.finish(metadata.usage)</span></span></code></pre></div></details><hr><p><code>@marsho_status_cmd.handle()</code></p><h3 id="async-func-marsho-status-bot-bot" tabindex="-1"><em><strong>async func</strong></em> <code>marsho_status(bot: Bot)</code> <a class="header-anchor" href="#async-func-marsho-status-bot-bot" aria-label="Permalink to "***async func*** \`marsho_status(bot: Bot)\`""></a></h3><details><summary><b>源代码</b> 或 <a href="https://github.com/LiteyukiStudio/nonebot-plugin-marshoai/tree/main/nonebot_plugin_marshoai/marsho.py#L202" 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:#6F42C1;--shiki-dark:#B392F0;">@marsho_status_cmd.handle</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;"> def</span><span style="--shiki-light:#6F42C1;--shiki-dark:#B392F0;"> marsho_status</span><span style="--shiki-light:#24292E;--shiki-dark:#E1E4E8;">(bot: Bot):</span></span>
|
||||
<span class="line"><span style="--shiki-light:#D73A49;--shiki-dark:#F97583;"> await</span><span style="--shiki-light:#24292E;--shiki-dark:#E1E4E8;"> marsho_status_cmd.finish(</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;">bot.adapter.get_name()</span><span style="--shiki-light:#005CC5;--shiki-dark:#79B8FF;">}\\n</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;">model_name</span><span style="--shiki-light:#005CC5;--shiki-dark:#79B8FF;">}\\n</span><span style="--shiki-light:#032F62;--shiki-dark:#9ECBFF;">当前支持图片的模型:</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;">SUPPORT_IMAGE_MODELS</span><span style="--shiki-light:#D73A49;--shiki-dark:#F97583;"> +</span><span style="--shiki-light:#24292E;--shiki-dark:#E1E4E8;"> config.marshoai_additional_image_models)</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><p><code>@marsho_at.handle()</code><code>@marsho_cmd.handle()</code></p><h3 id="async-func-marsho-target-msgtarget-event-event-bot-bot-state-t-state-matcher-matcher-text-optional-unimsg-none" tabindex="-1"><em><strong>async func</strong></em> <code>marsho(target: MsgTarget, event: Event, bot: Bot, state: T_State, matcher: Matcher, text: Optional[UniMsg] = None)</code> <a class="header-anchor" href="#async-func-marsho-target-msgtarget-event-event-bot-bot-state-t-state-matcher-matcher-text-optional-unimsg-none" aria-label="Permalink to "***async func*** \`marsho(target: MsgTarget, event: Event, bot: Bot, state: T_State, matcher: Matcher, text: Optional[UniMsg] = None)\`""></a></h3><details><summary><b>源代码</b> 或 <a href="https://github.com/LiteyukiStudio/nonebot-plugin-marshoai/tree/main/nonebot_plugin_marshoai/marsho.py#L208" 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:#6F42C1;--shiki-dark:#B392F0;">@marsho_at.handle</span><span style="--shiki-light:#24292E;--shiki-dark:#E1E4E8;">()</span></span>
|
||||
<span class="line"><span style="--shiki-light:#D73A49;--shiki-dark:#F97583;"> await</span><span style="--shiki-light:#24292E;--shiki-dark:#E1E4E8;"> marsho_status_cmd.finish(</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;">bot.adapter.get_name()</span><span style="--shiki-light:#005CC5;--shiki-dark:#79B8FF;">}\\n</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;">model_name</span><span style="--shiki-light:#005CC5;--shiki-dark:#79B8FF;">}\\n</span><span style="--shiki-light:#032F62;--shiki-dark:#9ECBFF;">当前支持图片的模型:</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;">SUPPORT_IMAGE_MODELS</span><span style="--shiki-light:#D73A49;--shiki-dark:#F97583;"> +</span><span style="--shiki-light:#24292E;--shiki-dark:#E1E4E8;"> config.marshoai_additional_image_models)</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><p><code>@marsho_at.handle()</code><code>@marsho_cmd.handle()</code></p><h3 id="async-func-marsho-target-msgtarget-event-event-bot-bot-state-t-state-matcher-matcher-text-optional-unimsg-none" tabindex="-1"><em><strong>async func</strong></em> <code>marsho(target: MsgTarget, event: Event, bot: Bot, state: T_State, matcher: Matcher, text: Optional[UniMsg] = None)</code> <a class="header-anchor" href="#async-func-marsho-target-msgtarget-event-event-bot-bot-state-t-state-matcher-matcher-text-optional-unimsg-none" aria-label="Permalink to "***async func*** \`marsho(target: MsgTarget, event: Event, bot: Bot, state: T_State, matcher: Matcher, text: Optional[UniMsg] = None)\`""></a></h3><details><summary><b>源代码</b> 或 <a href="https://github.com/LiteyukiStudio/nonebot-plugin-marshoai/tree/main/nonebot_plugin_marshoai/marsho.py#L214" 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:#6F42C1;--shiki-dark:#B392F0;">@marsho_at.handle</span><span style="--shiki-light:#24292E;--shiki-dark:#E1E4E8;">()</span></span>
|
||||
<span class="line"><span style="--shiki-light:#6F42C1;--shiki-dark:#B392F0;">@marsho_cmd.handle</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;"> def</span><span style="--shiki-light:#6F42C1;--shiki-dark:#B392F0;"> marsho</span><span style="--shiki-light:#24292E;--shiki-dark:#E1E4E8;">(target: MsgTarget, event: Event, bot: Bot, state: T_State, matcher: Matcher, text: Optional[UniMsg]</span><span style="--shiki-light:#D73A49;--shiki-dark:#F97583;">=</span><span style="--shiki-light:#005CC5;--shiki-dark:#79B8FF;">None</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;"> target_list</span></span>
|
||||
@ -173,7 +173,7 @@ import{_ as i,c as a,o as n,ae as h}from"./chunks/framework.CTVYQtO4.js";const d
|
||||
<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:#D73A49;--shiki-dark:#F97583;"> await</span><span style="--shiki-light:#24292E;--shiki-dark:#E1E4E8;"> UniMessage(</span><span style="--shiki-light:#005CC5;--shiki-dark:#79B8FF;">str</span><span style="--shiki-light:#24292E;--shiki-dark:#E1E4E8;">(e) </span><span style="--shiki-light:#D73A49;--shiki-dark:#F97583;">+</span><span style="--shiki-light:#24292E;--shiki-dark:#E1E4E8;"> suggest_solution(</span><span style="--shiki-light:#005CC5;--shiki-dark:#79B8FF;">str</span><span style="--shiki-light:#24292E;--shiki-dark:#E1E4E8;">(e))).send()</span></span>
|
||||
<span class="line"><span style="--shiki-light:#24292E;--shiki-dark:#E1E4E8;"> traceback.print_exc()</span></span>
|
||||
<span class="line"><span style="--shiki-light:#D73A49;--shiki-dark:#F97583;"> return</span></span></code></pre></div></details><hr><p><code>@poke_notify.handle()</code></p><h3 id="async-func-poke-event-event" tabindex="-1"><em><strong>async func</strong></em> <code>poke(event: Event)</code> <a class="header-anchor" href="#async-func-poke-event-event" aria-label="Permalink to "***async func*** \`poke(event: Event)\`""></a></h3><details><summary><b>源代码</b> 或 <a href="https://github.com/LiteyukiStudio/nonebot-plugin-marshoai/tree/main/nonebot_plugin_marshoai/marsho.py#L446" 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:#6F42C1;--shiki-dark:#B392F0;">@poke_notify.handle</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></code></pre></div></details><hr><p><code>@poke_notify.handle()</code></p><h3 id="async-func-poke-event-event" tabindex="-1"><em><strong>async func</strong></em> <code>poke(event: Event)</code> <a class="header-anchor" href="#async-func-poke-event-event" aria-label="Permalink to "***async func*** \`poke(event: Event)\`""></a></h3><details><summary><b>源代码</b> 或 <a href="https://github.com/LiteyukiStudio/nonebot-plugin-marshoai/tree/main/nonebot_plugin_marshoai/marsho.py#L452" 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:#6F42C1;--shiki-dark:#B392F0;">@poke_notify.handle</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;"> def</span><span style="--shiki-light:#6F42C1;--shiki-dark:#B392F0;"> poke</span><span style="--shiki-light:#24292E;--shiki-dark:#E1E4E8;">(event: Event):</span></span>
|
||||
<span class="line"><span style="--shiki-light:#24292E;--shiki-dark:#E1E4E8;"> user_id </span><span style="--shiki-light:#D73A49;--shiki-dark:#F97583;">=</span><span style="--shiki-light:#24292E;--shiki-dark:#E1E4E8;"> event.get_user_id()</span></span>
|
||||
<span class="line"><span style="--shiki-light:#24292E;--shiki-dark:#E1E4E8;"> nicknames </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;"> get_nicknames()</span></span>
|
@ -1,32 +1,32 @@
|
||||
import{_ as i,c as a,o as n,ae as h}from"./chunks/framework.CTVYQtO4.js";const g=JSON.parse('{"title":"marsho","description":"","frontmatter":{"title":"marsho","order":100},"headers":[],"relativePath":"en/dev/api/marsho.md","filePath":"en/dev/api/marsho.md","lastUpdated":null}'),t={name:"en/dev/api/marsho.md"};function k(l,s,e,p,r,E){return n(),a("div",null,s[0]||(s[0]=[h(`<h1 id="module-nonebot-plugin-marshoai-marsho" tabindex="-1"><strong>Module</strong> <code>nonebot_plugin_marshoai.marsho</code> <a class="header-anchor" href="#module-nonebot-plugin-marshoai-marsho" aria-label="Permalink to "**Module** \`nonebot_plugin_marshoai.marsho\`""></a></h1><hr><h3 id="async-func-at-enable" tabindex="-1"><em><strong>async func</strong></em> <code>at_enable()</code> <a class="header-anchor" href="#async-func-at-enable" aria-label="Permalink to "***async func*** \`at_enable()\`""></a></h3><details><summary><b>Source code</b> or <a href="https://github.com/LiteyukiStudio/nonebot-plugin-marshoai/tree/main/nonebot_plugin_marshoai/marsho.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;">async</span><span style="--shiki-light:#D73A49;--shiki-dark:#F97583;"> def</span><span style="--shiki-light:#6F42C1;--shiki-dark:#B392F0;"> at_enable</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;"> config.marshoai_at</span></span></code></pre></div></details><hr><p><code>@add_usermsg_cmd.handle()</code></p><h3 id="async-func-add-usermsg-target-msgtarget-arg-message-commandarg" tabindex="-1"><em><strong>async func</strong></em> <code>add_usermsg(target: MsgTarget, arg: Message = CommandArg())</code> <a class="header-anchor" href="#async-func-add-usermsg-target-msgtarget-arg-message-commandarg" aria-label="Permalink to "***async func*** \`add_usermsg(target: MsgTarget, arg: Message = CommandArg())\`""></a></h3><details><summary><b>Source code</b> or <a href="https://github.com/LiteyukiStudio/nonebot-plugin-marshoai/tree/main/nonebot_plugin_marshoai/marsho.py#L93" 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:#6F42C1;--shiki-dark:#B392F0;">@add_usermsg_cmd.handle</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;"> config.marshoai_at</span></span></code></pre></div></details><hr><p><code>@add_usermsg_cmd.handle()</code></p><h3 id="async-func-add-usermsg-target-msgtarget-arg-message-commandarg" tabindex="-1"><em><strong>async func</strong></em> <code>add_usermsg(target: MsgTarget, arg: Message = CommandArg())</code> <a class="header-anchor" href="#async-func-add-usermsg-target-msgtarget-arg-message-commandarg" aria-label="Permalink to "***async func*** \`add_usermsg(target: MsgTarget, arg: Message = CommandArg())\`""></a></h3><details><summary><b>Source code</b> or <a href="https://github.com/LiteyukiStudio/nonebot-plugin-marshoai/tree/main/nonebot_plugin_marshoai/marsho.py#L99" 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:#6F42C1;--shiki-dark:#B392F0;">@add_usermsg_cmd.handle</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;"> def</span><span style="--shiki-light:#6F42C1;--shiki-dark:#B392F0;"> add_usermsg</span><span style="--shiki-light:#24292E;--shiki-dark:#E1E4E8;">(target: MsgTarget, arg: Message</span><span style="--shiki-light:#D73A49;--shiki-dark:#F97583;">=</span><span style="--shiki-light:#24292E;--shiki-dark:#E1E4E8;">CommandArg()):</span></span>
|
||||
<span class="line"><span style="--shiki-light:#D73A49;--shiki-dark:#F97583;"> if</span><span style="--shiki-light:#24292E;--shiki-dark:#E1E4E8;"> (msg </span><span style="--shiki-light:#D73A49;--shiki-dark:#F97583;">:=</span><span style="--shiki-light:#24292E;--shiki-dark:#E1E4E8;"> arg.extract_plain_text()):</span></span>
|
||||
<span class="line"><span style="--shiki-light:#24292E;--shiki-dark:#E1E4E8;"> context.append(UserMessage(</span><span style="--shiki-light:#E36209;--shiki-dark:#FFAB70;">content</span><span style="--shiki-light:#D73A49;--shiki-dark:#F97583;">=</span><span style="--shiki-light:#24292E;--shiki-dark:#E1E4E8;">msg).as_dict(), target.id, target.private)</span></span>
|
||||
<span class="line"><span style="--shiki-light:#D73A49;--shiki-dark:#F97583;"> await</span><span style="--shiki-light:#24292E;--shiki-dark:#E1E4E8;"> add_usermsg_cmd.finish(</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><p><code>@add_assistantmsg_cmd.handle()</code></p><h3 id="async-func-add-assistantmsg-target-msgtarget-arg-message-commandarg" tabindex="-1"><em><strong>async func</strong></em> <code>add_assistantmsg(target: MsgTarget, arg: Message = CommandArg())</code> <a class="header-anchor" href="#async-func-add-assistantmsg-target-msgtarget-arg-message-commandarg" aria-label="Permalink to "***async func*** \`add_assistantmsg(target: MsgTarget, arg: Message = CommandArg())\`""></a></h3><details><summary><b>Source code</b> or <a href="https://github.com/LiteyukiStudio/nonebot-plugin-marshoai/tree/main/nonebot_plugin_marshoai/marsho.py#L100" 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:#6F42C1;--shiki-dark:#B392F0;">@add_assistantmsg_cmd.handle</span><span style="--shiki-light:#24292E;--shiki-dark:#E1E4E8;">()</span></span>
|
||||
<span class="line"><span style="--shiki-light:#D73A49;--shiki-dark:#F97583;"> await</span><span style="--shiki-light:#24292E;--shiki-dark:#E1E4E8;"> add_usermsg_cmd.finish(</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><p><code>@add_assistantmsg_cmd.handle()</code></p><h3 id="async-func-add-assistantmsg-target-msgtarget-arg-message-commandarg" tabindex="-1"><em><strong>async func</strong></em> <code>add_assistantmsg(target: MsgTarget, arg: Message = CommandArg())</code> <a class="header-anchor" href="#async-func-add-assistantmsg-target-msgtarget-arg-message-commandarg" aria-label="Permalink to "***async func*** \`add_assistantmsg(target: MsgTarget, arg: Message = CommandArg())\`""></a></h3><details><summary><b>Source code</b> or <a href="https://github.com/LiteyukiStudio/nonebot-plugin-marshoai/tree/main/nonebot_plugin_marshoai/marsho.py#L106" 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:#6F42C1;--shiki-dark:#B392F0;">@add_assistantmsg_cmd.handle</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;"> def</span><span style="--shiki-light:#6F42C1;--shiki-dark:#B392F0;"> add_assistantmsg</span><span style="--shiki-light:#24292E;--shiki-dark:#E1E4E8;">(target: MsgTarget, arg: Message</span><span style="--shiki-light:#D73A49;--shiki-dark:#F97583;">=</span><span style="--shiki-light:#24292E;--shiki-dark:#E1E4E8;">CommandArg()):</span></span>
|
||||
<span class="line"><span style="--shiki-light:#D73A49;--shiki-dark:#F97583;"> if</span><span style="--shiki-light:#24292E;--shiki-dark:#E1E4E8;"> (msg </span><span style="--shiki-light:#D73A49;--shiki-dark:#F97583;">:=</span><span style="--shiki-light:#24292E;--shiki-dark:#E1E4E8;"> arg.extract_plain_text()):</span></span>
|
||||
<span class="line"><span style="--shiki-light:#24292E;--shiki-dark:#E1E4E8;"> context.append(AssistantMessage(</span><span style="--shiki-light:#E36209;--shiki-dark:#FFAB70;">content</span><span style="--shiki-light:#D73A49;--shiki-dark:#F97583;">=</span><span style="--shiki-light:#24292E;--shiki-dark:#E1E4E8;">msg).as_dict(), target.id, target.private)</span></span>
|
||||
<span class="line"><span style="--shiki-light:#D73A49;--shiki-dark:#F97583;"> await</span><span style="--shiki-light:#24292E;--shiki-dark:#E1E4E8;"> add_assistantmsg_cmd.finish(</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><p><code>@praises_cmd.handle()</code></p><h3 id="async-func-praises" tabindex="-1"><em><strong>async func</strong></em> <code>praises()</code> <a class="header-anchor" href="#async-func-praises" aria-label="Permalink to "***async func*** \`praises()\`""></a></h3><details><summary><b>Source code</b> or <a href="https://github.com/LiteyukiStudio/nonebot-plugin-marshoai/tree/main/nonebot_plugin_marshoai/marsho.py#L109" 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:#6F42C1;--shiki-dark:#B392F0;">@praises_cmd.handle</span><span style="--shiki-light:#24292E;--shiki-dark:#E1E4E8;">()</span></span>
|
||||
<span class="line"><span style="--shiki-light:#D73A49;--shiki-dark:#F97583;"> await</span><span style="--shiki-light:#24292E;--shiki-dark:#E1E4E8;"> add_assistantmsg_cmd.finish(</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><p><code>@praises_cmd.handle()</code></p><h3 id="async-func-praises" tabindex="-1"><em><strong>async func</strong></em> <code>praises()</code> <a class="header-anchor" href="#async-func-praises" aria-label="Permalink to "***async func*** \`praises()\`""></a></h3><details><summary><b>Source code</b> or <a href="https://github.com/LiteyukiStudio/nonebot-plugin-marshoai/tree/main/nonebot_plugin_marshoai/marsho.py#L115" 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:#6F42C1;--shiki-dark:#B392F0;">@praises_cmd.handle</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;"> def</span><span style="--shiki-light:#6F42C1;--shiki-dark:#B392F0;"> praises</span><span style="--shiki-light:#24292E;--shiki-dark:#E1E4E8;">():</span></span>
|
||||
<span class="line"><span style="--shiki-light:#D73A49;--shiki-dark:#F97583;"> await</span><span style="--shiki-light:#24292E;--shiki-dark:#E1E4E8;"> praises_cmd.finish(build_praises())</span></span></code></pre></div></details><hr><p><code>@contexts_cmd.handle()</code></p><h3 id="async-func-contexts-target-msgtarget" tabindex="-1"><em><strong>async func</strong></em> <code>contexts(target: MsgTarget)</code> <a class="header-anchor" href="#async-func-contexts-target-msgtarget" aria-label="Permalink to "***async func*** \`contexts(target: MsgTarget)\`""></a></h3><details><summary><b>Source code</b> or <a href="https://github.com/LiteyukiStudio/nonebot-plugin-marshoai/tree/main/nonebot_plugin_marshoai/marsho.py#L115" 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:#6F42C1;--shiki-dark:#B392F0;">@contexts_cmd.handle</span><span style="--shiki-light:#24292E;--shiki-dark:#E1E4E8;">()</span></span>
|
||||
<span class="line"><span style="--shiki-light:#D73A49;--shiki-dark:#F97583;"> await</span><span style="--shiki-light:#24292E;--shiki-dark:#E1E4E8;"> praises_cmd.finish(build_praises())</span></span></code></pre></div></details><hr><p><code>@contexts_cmd.handle()</code></p><h3 id="async-func-contexts-target-msgtarget" tabindex="-1"><em><strong>async func</strong></em> <code>contexts(target: MsgTarget)</code> <a class="header-anchor" href="#async-func-contexts-target-msgtarget" aria-label="Permalink to "***async func*** \`contexts(target: MsgTarget)\`""></a></h3><details><summary><b>Source code</b> or <a href="https://github.com/LiteyukiStudio/nonebot-plugin-marshoai/tree/main/nonebot_plugin_marshoai/marsho.py#L121" 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:#6F42C1;--shiki-dark:#B392F0;">@contexts_cmd.handle</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;"> def</span><span style="--shiki-light:#6F42C1;--shiki-dark:#B392F0;"> contexts</span><span style="--shiki-light:#24292E;--shiki-dark:#E1E4E8;">(target: MsgTarget):</span></span>
|
||||
<span class="line"><span style="--shiki-light:#24292E;--shiki-dark:#E1E4E8;"> backup_context </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;"> get_backup_context(target.id, target.private)</span></span>
|
||||
<span class="line"><span style="--shiki-light:#D73A49;--shiki-dark:#F97583;"> if</span><span style="--shiki-light:#24292E;--shiki-dark:#E1E4E8;"> backup_context:</span></span>
|
||||
<span class="line"><span style="--shiki-light:#24292E;--shiki-dark:#E1E4E8;"> context.set_context(backup_context, target.id, target.private)</span></span>
|
||||
<span class="line"><span style="--shiki-light:#D73A49;--shiki-dark:#F97583;"> await</span><span style="--shiki-light:#24292E;--shiki-dark:#E1E4E8;"> contexts_cmd.finish(</span><span style="--shiki-light:#005CC5;--shiki-dark:#79B8FF;">str</span><span style="--shiki-light:#24292E;--shiki-dark:#E1E4E8;">(context.build(target.id, target.private)))</span></span></code></pre></div></details><hr><p><code>@save_context_cmd.handle()</code></p><h3 id="async-func-save-context-target-msgtarget-arg-message-commandarg" tabindex="-1"><em><strong>async func</strong></em> <code>save_context(target: MsgTarget, arg: Message = CommandArg())</code> <a class="header-anchor" href="#async-func-save-context-target-msgtarget-arg-message-commandarg" aria-label="Permalink to "***async func*** \`save_context(target: MsgTarget, arg: Message = CommandArg())\`""></a></h3><details><summary><b>Source code</b> or <a href="https://github.com/LiteyukiStudio/nonebot-plugin-marshoai/tree/main/nonebot_plugin_marshoai/marsho.py#L123" 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:#6F42C1;--shiki-dark:#B392F0;">@save_context_cmd.handle</span><span style="--shiki-light:#24292E;--shiki-dark:#E1E4E8;">()</span></span>
|
||||
<span class="line"><span style="--shiki-light:#D73A49;--shiki-dark:#F97583;"> await</span><span style="--shiki-light:#24292E;--shiki-dark:#E1E4E8;"> contexts_cmd.finish(</span><span style="--shiki-light:#005CC5;--shiki-dark:#79B8FF;">str</span><span style="--shiki-light:#24292E;--shiki-dark:#E1E4E8;">(context.build(target.id, target.private)))</span></span></code></pre></div></details><hr><p><code>@save_context_cmd.handle()</code></p><h3 id="async-func-save-context-target-msgtarget-arg-message-commandarg" tabindex="-1"><em><strong>async func</strong></em> <code>save_context(target: MsgTarget, arg: Message = CommandArg())</code> <a class="header-anchor" href="#async-func-save-context-target-msgtarget-arg-message-commandarg" aria-label="Permalink to "***async func*** \`save_context(target: MsgTarget, arg: Message = CommandArg())\`""></a></h3><details><summary><b>Source code</b> or <a href="https://github.com/LiteyukiStudio/nonebot-plugin-marshoai/tree/main/nonebot_plugin_marshoai/marsho.py#L129" 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:#6F42C1;--shiki-dark:#B392F0;">@save_context_cmd.handle</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;"> def</span><span style="--shiki-light:#6F42C1;--shiki-dark:#B392F0;"> save_context</span><span style="--shiki-light:#24292E;--shiki-dark:#E1E4E8;">(target: MsgTarget, arg: Message</span><span style="--shiki-light:#D73A49;--shiki-dark:#F97583;">=</span><span style="--shiki-light:#24292E;--shiki-dark:#E1E4E8;">CommandArg()):</span></span>
|
||||
<span class="line"><span style="--shiki-light:#24292E;--shiki-dark:#E1E4E8;"> contexts_data </span><span style="--shiki-light:#D73A49;--shiki-dark:#F97583;">=</span><span style="--shiki-light:#24292E;--shiki-dark:#E1E4E8;"> context.build(target.id, target.private)</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;"> context:</span></span>
|
||||
<span class="line"><span style="--shiki-light:#D73A49;--shiki-dark:#F97583;"> await</span><span style="--shiki-light:#24292E;--shiki-dark:#E1E4E8;"> save_context_cmd.finish(</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:#24292E;--shiki-dark:#E1E4E8;"> (msg </span><span style="--shiki-light:#D73A49;--shiki-dark:#F97583;">:=</span><span style="--shiki-light:#24292E;--shiki-dark:#E1E4E8;"> arg.extract_plain_text()):</span></span>
|
||||
<span class="line"><span style="--shiki-light:#D73A49;--shiki-dark:#F97583;"> await</span><span style="--shiki-light:#24292E;--shiki-dark:#E1E4E8;"> save_context_to_json(msg, contexts_data, </span><span style="--shiki-light:#032F62;--shiki-dark:#9ECBFF;">'contexts'</span><span style="--shiki-light:#24292E;--shiki-dark:#E1E4E8;">)</span></span>
|
||||
<span class="line"><span style="--shiki-light:#D73A49;--shiki-dark:#F97583;"> await</span><span style="--shiki-light:#24292E;--shiki-dark:#E1E4E8;"> save_context_cmd.finish(</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><p><code>@load_context_cmd.handle()</code></p><h3 id="async-func-load-context-target-msgtarget-arg-message-commandarg" tabindex="-1"><em><strong>async func</strong></em> <code>load_context(target: MsgTarget, arg: Message = CommandArg())</code> <a class="header-anchor" href="#async-func-load-context-target-msgtarget-arg-message-commandarg" aria-label="Permalink to "***async func*** \`load_context(target: MsgTarget, arg: Message = CommandArg())\`""></a></h3><details><summary><b>Source code</b> or <a href="https://github.com/LiteyukiStudio/nonebot-plugin-marshoai/tree/main/nonebot_plugin_marshoai/marsho.py#L133" 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:#6F42C1;--shiki-dark:#B392F0;">@load_context_cmd.handle</span><span style="--shiki-light:#24292E;--shiki-dark:#E1E4E8;">()</span></span>
|
||||
<span class="line"><span style="--shiki-light:#D73A49;--shiki-dark:#F97583;"> await</span><span style="--shiki-light:#24292E;--shiki-dark:#E1E4E8;"> save_context_cmd.finish(</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><p><code>@load_context_cmd.handle()</code></p><h3 id="async-func-load-context-target-msgtarget-arg-message-commandarg" tabindex="-1"><em><strong>async func</strong></em> <code>load_context(target: MsgTarget, arg: Message = CommandArg())</code> <a class="header-anchor" href="#async-func-load-context-target-msgtarget-arg-message-commandarg" aria-label="Permalink to "***async func*** \`load_context(target: MsgTarget, arg: Message = CommandArg())\`""></a></h3><details><summary><b>Source code</b> or <a href="https://github.com/LiteyukiStudio/nonebot-plugin-marshoai/tree/main/nonebot_plugin_marshoai/marsho.py#L139" 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:#6F42C1;--shiki-dark:#B392F0;">@load_context_cmd.handle</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;"> def</span><span style="--shiki-light:#6F42C1;--shiki-dark:#B392F0;"> load_context</span><span style="--shiki-light:#24292E;--shiki-dark:#E1E4E8;">(target: MsgTarget, arg: Message</span><span style="--shiki-light:#D73A49;--shiki-dark:#F97583;">=</span><span style="--shiki-light:#24292E;--shiki-dark:#E1E4E8;">CommandArg()):</span></span>
|
||||
<span class="line"><span style="--shiki-light:#D73A49;--shiki-dark:#F97583;"> if</span><span style="--shiki-light:#24292E;--shiki-dark:#E1E4E8;"> (msg </span><span style="--shiki-light:#D73A49;--shiki-dark:#F97583;">:=</span><span style="--shiki-light:#24292E;--shiki-dark:#E1E4E8;"> arg.extract_plain_text()):</span></span>
|
||||
<span class="line"><span style="--shiki-light:#D73A49;--shiki-dark:#F97583;"> await</span><span style="--shiki-light:#24292E;--shiki-dark:#E1E4E8;"> get_backup_context(target.id, target.private)</span></span>
|
||||
<span class="line"><span style="--shiki-light:#24292E;--shiki-dark:#E1E4E8;"> context.set_context(</span><span style="--shiki-light:#D73A49;--shiki-dark:#F97583;">await</span><span style="--shiki-light:#24292E;--shiki-dark:#E1E4E8;"> load_context_from_json(msg, </span><span style="--shiki-light:#032F62;--shiki-dark:#9ECBFF;">'contexts'</span><span style="--shiki-light:#24292E;--shiki-dark:#E1E4E8;">), target.id, target.private)</span></span>
|
||||
<span class="line"><span style="--shiki-light:#D73A49;--shiki-dark:#F97583;"> await</span><span style="--shiki-light:#24292E;--shiki-dark:#E1E4E8;"> load_context_cmd.finish(</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><p><code>@resetmem_cmd.handle()</code></p><h3 id="async-func-resetmem-target-msgtarget" tabindex="-1"><em><strong>async func</strong></em> <code>resetmem(target: MsgTarget)</code> <a class="header-anchor" href="#async-func-resetmem-target-msgtarget" aria-label="Permalink to "***async func*** \`resetmem(target: MsgTarget)\`""></a></h3><details><summary><b>Source code</b> or <a href="https://github.com/LiteyukiStudio/nonebot-plugin-marshoai/tree/main/nonebot_plugin_marshoai/marsho.py#L145" 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:#6F42C1;--shiki-dark:#B392F0;">@resetmem_cmd.handle</span><span style="--shiki-light:#24292E;--shiki-dark:#E1E4E8;">()</span></span>
|
||||
<span class="line"><span style="--shiki-light:#D73A49;--shiki-dark:#F97583;"> await</span><span style="--shiki-light:#24292E;--shiki-dark:#E1E4E8;"> load_context_cmd.finish(</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><p><code>@resetmem_cmd.handle()</code></p><h3 id="async-func-resetmem-target-msgtarget" tabindex="-1"><em><strong>async func</strong></em> <code>resetmem(target: MsgTarget)</code> <a class="header-anchor" href="#async-func-resetmem-target-msgtarget" aria-label="Permalink to "***async func*** \`resetmem(target: MsgTarget)\`""></a></h3><details><summary><b>Source code</b> or <a href="https://github.com/LiteyukiStudio/nonebot-plugin-marshoai/tree/main/nonebot_plugin_marshoai/marsho.py#L151" 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:#6F42C1;--shiki-dark:#B392F0;">@resetmem_cmd.handle</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;"> def</span><span style="--shiki-light:#6F42C1;--shiki-dark:#B392F0;"> resetmem</span><span style="--shiki-light:#24292E;--shiki-dark:#E1E4E8;">(target: MsgTarget):</span></span>
|
||||
<span class="line"><span style="--shiki-light:#D73A49;--shiki-dark:#F97583;"> if</span><span style="--shiki-light:#24292E;--shiki-dark:#E1E4E8;"> [target.id, target.private] </span><span style="--shiki-light:#D73A49;--shiki-dark:#F97583;">not</span><span style="--shiki-light:#D73A49;--shiki-dark:#F97583;"> in</span><span style="--shiki-light:#24292E;--shiki-dark:#E1E4E8;"> target_list:</span></span>
|
||||
<span class="line"><span style="--shiki-light:#24292E;--shiki-dark:#E1E4E8;"> target_list.append([target.id, target.private])</span></span>
|
||||
@ -34,12 +34,12 @@ import{_ as i,c as a,o as n,ae as h}from"./chunks/framework.CTVYQtO4.js";const g
|
||||
<span class="line"><span style="--shiki-light:#D73A49;--shiki-dark:#F97583;"> if</span><span style="--shiki-light:#24292E;--shiki-dark:#E1E4E8;"> backup_context:</span></span>
|
||||
<span class="line"><span style="--shiki-light:#24292E;--shiki-dark:#E1E4E8;"> context.set_context(backup_context, target.id, target.private)</span></span>
|
||||
<span class="line"><span style="--shiki-light:#24292E;--shiki-dark:#E1E4E8;"> context.reset(target.id, target.private)</span></span>
|
||||
<span class="line"><span style="--shiki-light:#D73A49;--shiki-dark:#F97583;"> await</span><span style="--shiki-light:#24292E;--shiki-dark:#E1E4E8;"> resetmem_cmd.finish(</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><p><code>@changemodel_cmd.handle()</code></p><h3 id="async-func-changemodel-arg-message-commandarg" tabindex="-1"><em><strong>async func</strong></em> <code>changemodel(arg: Message = CommandArg())</code> <a class="header-anchor" href="#async-func-changemodel-arg-message-commandarg" aria-label="Permalink to "***async func*** \`changemodel(arg: Message = CommandArg())\`""></a></h3><details><summary><b>Source code</b> or <a href="https://github.com/LiteyukiStudio/nonebot-plugin-marshoai/tree/main/nonebot_plugin_marshoai/marsho.py#L156" 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:#6F42C1;--shiki-dark:#B392F0;">@changemodel_cmd.handle</span><span style="--shiki-light:#24292E;--shiki-dark:#E1E4E8;">()</span></span>
|
||||
<span class="line"><span style="--shiki-light:#D73A49;--shiki-dark:#F97583;"> await</span><span style="--shiki-light:#24292E;--shiki-dark:#E1E4E8;"> resetmem_cmd.finish(</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><p><code>@changemodel_cmd.handle()</code></p><h3 id="async-func-changemodel-arg-message-commandarg" tabindex="-1"><em><strong>async func</strong></em> <code>changemodel(arg: Message = CommandArg())</code> <a class="header-anchor" href="#async-func-changemodel-arg-message-commandarg" aria-label="Permalink to "***async func*** \`changemodel(arg: Message = CommandArg())\`""></a></h3><details><summary><b>Source code</b> or <a href="https://github.com/LiteyukiStudio/nonebot-plugin-marshoai/tree/main/nonebot_plugin_marshoai/marsho.py#L162" 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:#6F42C1;--shiki-dark:#B392F0;">@changemodel_cmd.handle</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;"> def</span><span style="--shiki-light:#6F42C1;--shiki-dark:#B392F0;"> changemodel</span><span style="--shiki-light:#24292E;--shiki-dark:#E1E4E8;">(arg: Message</span><span style="--shiki-light:#D73A49;--shiki-dark:#F97583;">=</span><span style="--shiki-light:#24292E;--shiki-dark:#E1E4E8;">CommandArg()):</span></span>
|
||||
<span class="line"><span style="--shiki-light:#D73A49;--shiki-dark:#F97583;"> global</span><span style="--shiki-light:#24292E;--shiki-dark:#E1E4E8;"> model_name</span></span>
|
||||
<span class="line"><span style="--shiki-light:#D73A49;--shiki-dark:#F97583;"> if</span><span style="--shiki-light:#24292E;--shiki-dark:#E1E4E8;"> (model </span><span style="--shiki-light:#D73A49;--shiki-dark:#F97583;">:=</span><span style="--shiki-light:#24292E;--shiki-dark:#E1E4E8;"> arg.extract_plain_text()):</span></span>
|
||||
<span class="line"><span style="--shiki-light:#24292E;--shiki-dark:#E1E4E8;"> model_name </span><span style="--shiki-light:#D73A49;--shiki-dark:#F97583;">=</span><span style="--shiki-light:#24292E;--shiki-dark:#E1E4E8;"> model</span></span>
|
||||
<span class="line"><span style="--shiki-light:#D73A49;--shiki-dark:#F97583;"> await</span><span style="--shiki-light:#24292E;--shiki-dark:#E1E4E8;"> changemodel_cmd.finish(</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><p><code>@nickname_cmd.handle()</code></p><h3 id="async-func-nickname-event-event-name-none" tabindex="-1"><em><strong>async func</strong></em> <code>nickname(event: Event, name = None)</code> <a class="header-anchor" href="#async-func-nickname-event-event-name-none" aria-label="Permalink to "***async func*** \`nickname(event: Event, name = None)\`""></a></h3><details><summary><b>Source code</b> or <a href="https://github.com/LiteyukiStudio/nonebot-plugin-marshoai/tree/main/nonebot_plugin_marshoai/marsho.py#L164" 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:#6F42C1;--shiki-dark:#B392F0;">@nickname_cmd.handle</span><span style="--shiki-light:#24292E;--shiki-dark:#E1E4E8;">()</span></span>
|
||||
<span class="line"><span style="--shiki-light:#D73A49;--shiki-dark:#F97583;"> await</span><span style="--shiki-light:#24292E;--shiki-dark:#E1E4E8;"> changemodel_cmd.finish(</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><p><code>@nickname_cmd.handle()</code></p><h3 id="async-func-nickname-event-event-name-none" tabindex="-1"><em><strong>async func</strong></em> <code>nickname(event: Event, name = None)</code> <a class="header-anchor" href="#async-func-nickname-event-event-name-none" aria-label="Permalink to "***async func*** \`nickname(event: Event, name = None)\`""></a></h3><details><summary><b>Source code</b> or <a href="https://github.com/LiteyukiStudio/nonebot-plugin-marshoai/tree/main/nonebot_plugin_marshoai/marsho.py#L170" 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:#6F42C1;--shiki-dark:#B392F0;">@nickname_cmd.handle</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;"> def</span><span style="--shiki-light:#6F42C1;--shiki-dark:#B392F0;"> nickname</span><span style="--shiki-light:#24292E;--shiki-dark:#E1E4E8;">(event: Event, name</span><span style="--shiki-light:#D73A49;--shiki-dark:#F97583;">=</span><span style="--shiki-light:#005CC5;--shiki-dark:#79B8FF;">None</span><span style="--shiki-light:#24292E;--shiki-dark:#E1E4E8;">):</span></span>
|
||||
<span class="line"><span style="--shiki-light:#24292E;--shiki-dark:#E1E4E8;"> nicknames </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;"> get_nicknames()</span></span>
|
||||
<span class="line"><span style="--shiki-light:#24292E;--shiki-dark:#E1E4E8;"> user_id </span><span style="--shiki-light:#D73A49;--shiki-dark:#F97583;">=</span><span style="--shiki-light:#24292E;--shiki-dark:#E1E4E8;"> event.get_user_id()</span></span>
|
||||
@ -54,15 +54,15 @@ import{_ as i,c as a,o as n,ae as h}from"./chunks/framework.CTVYQtO4.js";const g
|
||||
<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;">(name) </span><span style="--shiki-light:#D73A49;--shiki-dark:#F97583;">></span><span style="--shiki-light:#24292E;--shiki-dark:#E1E4E8;"> config.marshoai_nickname_limit:</span></span>
|
||||
<span class="line"><span style="--shiki-light:#D73A49;--shiki-dark:#F97583;"> await</span><span style="--shiki-light:#24292E;--shiki-dark:#E1E4E8;"> nickname_cmd.finish(</span><span style="--shiki-light:#032F62;--shiki-dark:#9ECBFF;">'昵称超出长度限制:'</span><span style="--shiki-light:#D73A49;--shiki-dark:#F97583;"> +</span><span style="--shiki-light:#005CC5;--shiki-dark:#79B8FF;"> str</span><span style="--shiki-light:#24292E;--shiki-dark:#E1E4E8;">(config.marshoai_nickname_limit))</span></span>
|
||||
<span class="line"><span style="--shiki-light:#D73A49;--shiki-dark:#F97583;"> await</span><span style="--shiki-light:#24292E;--shiki-dark:#E1E4E8;"> set_nickname(user_id, name)</span></span>
|
||||
<span class="line"><span style="--shiki-light:#D73A49;--shiki-dark:#F97583;"> await</span><span style="--shiki-light:#24292E;--shiki-dark:#E1E4E8;"> nickname_cmd.finish(</span><span style="--shiki-light:#032F62;--shiki-dark:#9ECBFF;">'已设置昵称为:'</span><span style="--shiki-light:#D73A49;--shiki-dark:#F97583;"> +</span><span style="--shiki-light:#24292E;--shiki-dark:#E1E4E8;"> name)</span></span></code></pre></div></details><hr><p><code>@refresh_data_cmd.handle()</code></p><h3 id="async-func-refresh-data" tabindex="-1"><em><strong>async func</strong></em> <code>refresh_data()</code> <a class="header-anchor" href="#async-func-refresh-data" aria-label="Permalink to "***async func*** \`refresh_data()\`""></a></h3><details><summary><b>Source code</b> or <a href="https://github.com/LiteyukiStudio/nonebot-plugin-marshoai/tree/main/nonebot_plugin_marshoai/marsho.py#L184" 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:#6F42C1;--shiki-dark:#B392F0;">@refresh_data_cmd.handle</span><span style="--shiki-light:#24292E;--shiki-dark:#E1E4E8;">()</span></span>
|
||||
<span class="line"><span style="--shiki-light:#D73A49;--shiki-dark:#F97583;"> await</span><span style="--shiki-light:#24292E;--shiki-dark:#E1E4E8;"> nickname_cmd.finish(</span><span style="--shiki-light:#032F62;--shiki-dark:#9ECBFF;">'已设置昵称为:'</span><span style="--shiki-light:#D73A49;--shiki-dark:#F97583;"> +</span><span style="--shiki-light:#24292E;--shiki-dark:#E1E4E8;"> name)</span></span></code></pre></div></details><hr><p><code>@refresh_data_cmd.handle()</code></p><h3 id="async-func-refresh-data" tabindex="-1"><em><strong>async func</strong></em> <code>refresh_data()</code> <a class="header-anchor" href="#async-func-refresh-data" aria-label="Permalink to "***async func*** \`refresh_data()\`""></a></h3><details><summary><b>Source code</b> or <a href="https://github.com/LiteyukiStudio/nonebot-plugin-marshoai/tree/main/nonebot_plugin_marshoai/marsho.py#L190" 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:#6F42C1;--shiki-dark:#B392F0;">@refresh_data_cmd.handle</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;"> def</span><span style="--shiki-light:#6F42C1;--shiki-dark:#B392F0;"> refresh_data</span><span style="--shiki-light:#24292E;--shiki-dark:#E1E4E8;">():</span></span>
|
||||
<span class="line"><span style="--shiki-light:#D73A49;--shiki-dark:#F97583;"> await</span><span style="--shiki-light:#24292E;--shiki-dark:#E1E4E8;"> refresh_nickname_json()</span></span>
|
||||
<span class="line"><span style="--shiki-light:#D73A49;--shiki-dark:#F97583;"> await</span><span style="--shiki-light:#24292E;--shiki-dark:#E1E4E8;"> refresh_praises_json()</span></span>
|
||||
<span class="line"><span style="--shiki-light:#D73A49;--shiki-dark:#F97583;"> await</span><span style="--shiki-light:#24292E;--shiki-dark:#E1E4E8;"> refresh_data_cmd.finish(</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><p><code>@marsho_help_cmd.handle()</code></p><h3 id="async-func-marsho-help" tabindex="-1"><em><strong>async func</strong></em> <code>marsho_help()</code> <a class="header-anchor" href="#async-func-marsho-help" aria-label="Permalink to "***async func*** \`marsho_help()\`""></a></h3><details><summary><b>Source code</b> or <a href="https://github.com/LiteyukiStudio/nonebot-plugin-marshoai/tree/main/nonebot_plugin_marshoai/marsho.py#L191" 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:#6F42C1;--shiki-dark:#B392F0;">@marsho_help_cmd.handle</span><span style="--shiki-light:#24292E;--shiki-dark:#E1E4E8;">()</span></span>
|
||||
<span class="line"><span style="--shiki-light:#D73A49;--shiki-dark:#F97583;"> await</span><span style="--shiki-light:#24292E;--shiki-dark:#E1E4E8;"> refresh_data_cmd.finish(</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><p><code>@marsho_help_cmd.handle()</code></p><h3 id="async-func-marsho-help" tabindex="-1"><em><strong>async func</strong></em> <code>marsho_help()</code> <a class="header-anchor" href="#async-func-marsho-help" aria-label="Permalink to "***async func*** \`marsho_help()\`""></a></h3><details><summary><b>Source code</b> or <a href="https://github.com/LiteyukiStudio/nonebot-plugin-marshoai/tree/main/nonebot_plugin_marshoai/marsho.py#L197" 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:#6F42C1;--shiki-dark:#B392F0;">@marsho_help_cmd.handle</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;"> def</span><span style="--shiki-light:#6F42C1;--shiki-dark:#B392F0;"> marsho_help</span><span style="--shiki-light:#24292E;--shiki-dark:#E1E4E8;">():</span></span>
|
||||
<span class="line"><span style="--shiki-light:#D73A49;--shiki-dark:#F97583;"> await</span><span style="--shiki-light:#24292E;--shiki-dark:#E1E4E8;"> marsho_help_cmd.finish(metadata.usage)</span></span></code></pre></div></details><hr><p><code>@marsho_status_cmd.handle()</code></p><h3 id="async-func-marsho-status-bot-bot" tabindex="-1"><em><strong>async func</strong></em> <code>marsho_status(bot: Bot)</code> <a class="header-anchor" href="#async-func-marsho-status-bot-bot" aria-label="Permalink to "***async func*** \`marsho_status(bot: Bot)\`""></a></h3><details><summary><b>Source code</b> or <a href="https://github.com/LiteyukiStudio/nonebot-plugin-marshoai/tree/main/nonebot_plugin_marshoai/marsho.py#L196" 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:#6F42C1;--shiki-dark:#B392F0;">@marsho_status_cmd.handle</span><span style="--shiki-light:#24292E;--shiki-dark:#E1E4E8;">()</span></span>
|
||||
<span class="line"><span style="--shiki-light:#D73A49;--shiki-dark:#F97583;"> await</span><span style="--shiki-light:#24292E;--shiki-dark:#E1E4E8;"> marsho_help_cmd.finish(metadata.usage)</span></span></code></pre></div></details><hr><p><code>@marsho_status_cmd.handle()</code></p><h3 id="async-func-marsho-status-bot-bot" tabindex="-1"><em><strong>async func</strong></em> <code>marsho_status(bot: Bot)</code> <a class="header-anchor" href="#async-func-marsho-status-bot-bot" aria-label="Permalink to "***async func*** \`marsho_status(bot: Bot)\`""></a></h3><details><summary><b>Source code</b> or <a href="https://github.com/LiteyukiStudio/nonebot-plugin-marshoai/tree/main/nonebot_plugin_marshoai/marsho.py#L202" 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:#6F42C1;--shiki-dark:#B392F0;">@marsho_status_cmd.handle</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;"> def</span><span style="--shiki-light:#6F42C1;--shiki-dark:#B392F0;"> marsho_status</span><span style="--shiki-light:#24292E;--shiki-dark:#E1E4E8;">(bot: Bot):</span></span>
|
||||
<span class="line"><span style="--shiki-light:#D73A49;--shiki-dark:#F97583;"> await</span><span style="--shiki-light:#24292E;--shiki-dark:#E1E4E8;"> marsho_status_cmd.finish(</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;">bot.adapter.get_name()</span><span style="--shiki-light:#005CC5;--shiki-dark:#79B8FF;">}\\n</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;">model_name</span><span style="--shiki-light:#005CC5;--shiki-dark:#79B8FF;">}\\n</span><span style="--shiki-light:#032F62;--shiki-dark:#9ECBFF;">当前支持图片的模型:</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;">SUPPORT_IMAGE_MODELS</span><span style="--shiki-light:#D73A49;--shiki-dark:#F97583;"> +</span><span style="--shiki-light:#24292E;--shiki-dark:#E1E4E8;"> config.marshoai_additional_image_models)</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><p><code>@marsho_at.handle()</code><code>@marsho_cmd.handle()</code></p><h3 id="async-func-marsho-target-msgtarget-event-event-bot-bot-state-t-state-matcher-matcher-text-optional-unimsg-none" tabindex="-1"><em><strong>async func</strong></em> <code>marsho(target: MsgTarget, event: Event, bot: Bot, state: T_State, matcher: Matcher, text: Optional[UniMsg] = None)</code> <a class="header-anchor" href="#async-func-marsho-target-msgtarget-event-event-bot-bot-state-t-state-matcher-matcher-text-optional-unimsg-none" aria-label="Permalink to "***async func*** \`marsho(target: MsgTarget, event: Event, bot: Bot, state: T_State, matcher: Matcher, text: Optional[UniMsg] = None)\`""></a></h3><details><summary><b>Source code</b> or <a href="https://github.com/LiteyukiStudio/nonebot-plugin-marshoai/tree/main/nonebot_plugin_marshoai/marsho.py#L208" 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:#6F42C1;--shiki-dark:#B392F0;">@marsho_at.handle</span><span style="--shiki-light:#24292E;--shiki-dark:#E1E4E8;">()</span></span>
|
||||
<span class="line"><span style="--shiki-light:#D73A49;--shiki-dark:#F97583;"> await</span><span style="--shiki-light:#24292E;--shiki-dark:#E1E4E8;"> marsho_status_cmd.finish(</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;">bot.adapter.get_name()</span><span style="--shiki-light:#005CC5;--shiki-dark:#79B8FF;">}\\n</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;">model_name</span><span style="--shiki-light:#005CC5;--shiki-dark:#79B8FF;">}\\n</span><span style="--shiki-light:#032F62;--shiki-dark:#9ECBFF;">当前支持图片的模型:</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;">SUPPORT_IMAGE_MODELS</span><span style="--shiki-light:#D73A49;--shiki-dark:#F97583;"> +</span><span style="--shiki-light:#24292E;--shiki-dark:#E1E4E8;"> config.marshoai_additional_image_models)</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><p><code>@marsho_at.handle()</code><code>@marsho_cmd.handle()</code></p><h3 id="async-func-marsho-target-msgtarget-event-event-bot-bot-state-t-state-matcher-matcher-text-optional-unimsg-none" tabindex="-1"><em><strong>async func</strong></em> <code>marsho(target: MsgTarget, event: Event, bot: Bot, state: T_State, matcher: Matcher, text: Optional[UniMsg] = None)</code> <a class="header-anchor" href="#async-func-marsho-target-msgtarget-event-event-bot-bot-state-t-state-matcher-matcher-text-optional-unimsg-none" aria-label="Permalink to "***async func*** \`marsho(target: MsgTarget, event: Event, bot: Bot, state: T_State, matcher: Matcher, text: Optional[UniMsg] = None)\`""></a></h3><details><summary><b>Source code</b> or <a href="https://github.com/LiteyukiStudio/nonebot-plugin-marshoai/tree/main/nonebot_plugin_marshoai/marsho.py#L214" 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:#6F42C1;--shiki-dark:#B392F0;">@marsho_at.handle</span><span style="--shiki-light:#24292E;--shiki-dark:#E1E4E8;">()</span></span>
|
||||
<span class="line"><span style="--shiki-light:#6F42C1;--shiki-dark:#B392F0;">@marsho_cmd.handle</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;"> def</span><span style="--shiki-light:#6F42C1;--shiki-dark:#B392F0;"> marsho</span><span style="--shiki-light:#24292E;--shiki-dark:#E1E4E8;">(target: MsgTarget, event: Event, bot: Bot, state: T_State, matcher: Matcher, text: Optional[UniMsg]</span><span style="--shiki-light:#D73A49;--shiki-dark:#F97583;">=</span><span style="--shiki-light:#005CC5;--shiki-dark:#79B8FF;">None</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;"> target_list</span></span>
|
||||
@ -173,7 +173,7 @@ import{_ as i,c as a,o as n,ae as h}from"./chunks/framework.CTVYQtO4.js";const g
|
||||
<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:#D73A49;--shiki-dark:#F97583;"> await</span><span style="--shiki-light:#24292E;--shiki-dark:#E1E4E8;"> UniMessage(</span><span style="--shiki-light:#005CC5;--shiki-dark:#79B8FF;">str</span><span style="--shiki-light:#24292E;--shiki-dark:#E1E4E8;">(e) </span><span style="--shiki-light:#D73A49;--shiki-dark:#F97583;">+</span><span style="--shiki-light:#24292E;--shiki-dark:#E1E4E8;"> suggest_solution(</span><span style="--shiki-light:#005CC5;--shiki-dark:#79B8FF;">str</span><span style="--shiki-light:#24292E;--shiki-dark:#E1E4E8;">(e))).send()</span></span>
|
||||
<span class="line"><span style="--shiki-light:#24292E;--shiki-dark:#E1E4E8;"> traceback.print_exc()</span></span>
|
||||
<span class="line"><span style="--shiki-light:#D73A49;--shiki-dark:#F97583;"> return</span></span></code></pre></div></details><hr><p><code>@poke_notify.handle()</code></p><h3 id="async-func-poke-event-event" tabindex="-1"><em><strong>async func</strong></em> <code>poke(event: Event)</code> <a class="header-anchor" href="#async-func-poke-event-event" aria-label="Permalink to "***async func*** \`poke(event: Event)\`""></a></h3><details><summary><b>Source code</b> or <a href="https://github.com/LiteyukiStudio/nonebot-plugin-marshoai/tree/main/nonebot_plugin_marshoai/marsho.py#L446" 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:#6F42C1;--shiki-dark:#B392F0;">@poke_notify.handle</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></code></pre></div></details><hr><p><code>@poke_notify.handle()</code></p><h3 id="async-func-poke-event-event" tabindex="-1"><em><strong>async func</strong></em> <code>poke(event: Event)</code> <a class="header-anchor" href="#async-func-poke-event-event" aria-label="Permalink to "***async func*** \`poke(event: Event)\`""></a></h3><details><summary><b>Source code</b> or <a href="https://github.com/LiteyukiStudio/nonebot-plugin-marshoai/tree/main/nonebot_plugin_marshoai/marsho.py#L452" 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:#6F42C1;--shiki-dark:#B392F0;">@poke_notify.handle</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;"> def</span><span style="--shiki-light:#6F42C1;--shiki-dark:#B392F0;"> poke</span><span style="--shiki-light:#24292E;--shiki-dark:#E1E4E8;">(event: Event):</span></span>
|
||||
<span class="line"><span style="--shiki-light:#24292E;--shiki-dark:#E1E4E8;"> user_id </span><span style="--shiki-light:#D73A49;--shiki-dark:#F97583;">=</span><span style="--shiki-light:#24292E;--shiki-dark:#E1E4E8;"> event.get_user_id()</span></span>
|
||||
<span class="line"><span style="--shiki-light:#24292E;--shiki-dark:#E1E4E8;"> nicknames </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;"> get_nicknames()</span></span>
|
@ -1,7 +1,8 @@
|
||||
import{_ as i,c as a,o as e,ae as t}from"./chunks/framework.CTVYQtO4.js";const c=JSON.parse('{"title":"使用","description":"","frontmatter":{"title":"使用"},"headers":[],"relativePath":"start/use.md","filePath":"zh/start/use.md","lastUpdated":1738327524000}'),n={name:"start/use.md"};function l(p,s,h,k,o,d){return e(),a("div",null,s[0]||(s[0]=[t(`<h1 id="安装" tabindex="-1">安装 <a class="header-anchor" href="#安装" aria-label="Permalink to "安装""></a></h1><ul><li>请查看 <a href="./install">安装文档</a></li></ul><h1 id="使用" tabindex="-1">使用 <a class="header-anchor" href="#使用" aria-label="Permalink to "使用""></a></h1><h3 id="api-部署" tabindex="-1">API 部署 <a class="header-anchor" href="#api-部署" aria-label="Permalink to "API 部署""></a></h3><p>本插件推荐使用 <a href="https://github.com/songquanpeng/one-api" target="_blank" rel="noreferrer">one-api</a> 作为中转以调用 LLM。</p><h3 id="配置调整" tabindex="-1">配置调整 <a class="header-anchor" href="#配置调整" aria-label="Permalink to "配置调整""></a></h3><p>本插件理论上可兼容大部分可通过 OpenAI 兼容 API 调用的 LLM,部分模型可能需要调整插件配置。</p><p>例如:</p><ul><li>对于不支持 Function Call 的模型(Cohere Command R,DeepSeek-R1等):<div class="language-dotenv vp-adaptive-theme"><button title="Copy Code" class="copy"></button><span class="lang">dotenv</span><pre class="shiki shiki-themes github-light github-dark vp-code" tabindex="0"><code><span class="line"><span style="--shiki-light:#E36209;--shiki-dark:#FFAB70;">MARSHOAI_ENABLE_PLUGINS</span><span style="--shiki-light:#D73A49;--shiki-dark:#F97583;">=</span><span style="--shiki-light:#24292E;--shiki-dark:#E1E4E8;">false</span></span>
|
||||
import{_ as i,c as a,o as e,ae as t}from"./chunks/framework.CTVYQtO4.js";const c=JSON.parse('{"title":"使用","description":"","frontmatter":{"title":"使用"},"headers":[],"relativePath":"start/use.md","filePath":"zh/start/use.md","lastUpdated":1739354634000}'),n={name:"start/use.md"};function l(p,s,h,k,o,d){return e(),a("div",null,s[0]||(s[0]=[t(`<h1 id="安装" tabindex="-1">安装 <a class="header-anchor" href="#安装" aria-label="Permalink to "安装""></a></h1><ul><li>请查看 <a href="./install">安装文档</a></li></ul><h1 id="使用" tabindex="-1">使用 <a class="header-anchor" href="#使用" aria-label="Permalink to "使用""></a></h1><h3 id="api-部署" tabindex="-1">API 部署 <a class="header-anchor" href="#api-部署" aria-label="Permalink to "API 部署""></a></h3><p>本插件推荐使用 <a href="https://github.com/songquanpeng/one-api" target="_blank" rel="noreferrer">one-api</a> 作为中转以调用 LLM。</p><h3 id="配置调整" tabindex="-1">配置调整 <a class="header-anchor" href="#配置调整" aria-label="Permalink to "配置调整""></a></h3><p>本插件理论上可兼容大部分可通过 OpenAI 兼容 API 调用的 LLM,部分模型可能需要调整插件配置。</p><p>例如:</p><ul><li>对于不支持 Function Call 的模型(Cohere Command R,DeepSeek-R1等):<div class="language-dotenv vp-adaptive-theme"><button title="Copy Code" class="copy"></button><span class="lang">dotenv</span><pre class="shiki shiki-themes github-light github-dark vp-code" tabindex="0"><code><span class="line"><span style="--shiki-light:#E36209;--shiki-dark:#FFAB70;">MARSHOAI_ENABLE_PLUGINS</span><span style="--shiki-light:#D73A49;--shiki-dark:#F97583;">=</span><span style="--shiki-light:#24292E;--shiki-dark:#E1E4E8;">false</span></span>
|
||||
<span class="line"><span style="--shiki-light:#E36209;--shiki-dark:#FFAB70;">MARSHOAI_ENABLE_TOOLS</span><span style="--shiki-light:#D73A49;--shiki-dark:#F97583;">=</span><span style="--shiki-light:#24292E;--shiki-dark:#E1E4E8;">false</span></span></code></pre></div></li><li>对于支持图片处理的模型(hunyuan-vision等):<div class="language-dotenv vp-adaptive-theme"><button title="Copy Code" class="copy"></button><span class="lang">dotenv</span><pre class="shiki shiki-themes github-light github-dark vp-code" tabindex="0"><code><span class="line"><span style="--shiki-light:#E36209;--shiki-dark:#FFAB70;">MARSHOAI_ADDITIONAL_IMAGE_MODELS</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;">"hunyuan-vision"</span><span style="--shiki-light:#24292E;--shiki-dark:#E1E4E8;">]</span></span></code></pre></div></li></ul><h3 id="使用-deepseek-r1-模型" tabindex="-1">使用 DeepSeek-R1 模型 <a class="header-anchor" href="#使用-deepseek-r1-模型" aria-label="Permalink to "使用 DeepSeek-R1 模型""></a></h3><p>MarshoAI 兼容 DeepSeek-R1 模型,你可通过以下步骤来使用:</p><ol><li>获取 API Key<br> 前往<a href="https://platform.deepseek.com/api_keys" target="_blank" rel="noreferrer">此处</a>获取 API Key。</li><li>配置插件<div class="language-dotenv vp-adaptive-theme"><button title="Copy Code" class="copy"></button><span class="lang">dotenv</span><pre class="shiki shiki-themes github-light github-dark vp-code" tabindex="0"><code><span class="line"><span style="--shiki-light:#E36209;--shiki-dark:#FFAB70;">MARSHOAI_TOKEN</span><span style="--shiki-light:#D73A49;--shiki-dark:#F97583;">=</span><span style="--shiki-light:#032F62;--shiki-dark:#9ECBFF;">"<你的 API Key>"</span></span>
|
||||
<span class="line"><span style="--shiki-light:#E36209;--shiki-dark:#FFAB70;">MARSHOAI_AZURE_ENDPOINT</span><span style="--shiki-light:#D73A49;--shiki-dark:#F97583;">=</span><span style="--shiki-light:#032F62;--shiki-dark:#9ECBFF;">"https://api.deepseek.com"</span></span>
|
||||
<span class="line"><span style="--shiki-light:#E36209;--shiki-dark:#FFAB70;">MARSHOAI_DEFAULT_MODEL</span><span style="--shiki-light:#D73A49;--shiki-dark:#F97583;">=</span><span style="--shiki-light:#032F62;--shiki-dark:#9ECBFF;">"deepseek-reasoner"</span></span></code></pre></div>你可修改 <code>MARSHOAI_DEFAULT_MODEL</code> 为 其它模型名来调用其它 DeepSeek 模型。<div class="tip custom-block"><p class="custom-block-title">TIP</p><p>如果使用 one-api 作为中转,你可将 <code>MARSHOAI_AZURE_ENDPOINT</code> 设置为 one-api 的地址,将 <code>MARSHOAI_TOKEN</code> 设为 one-api 配置的令牌,在 one-api 中添加 DeepSeek 渠道。</p></div></li></ol><h3 id="使用-vllm-部署本地模型" tabindex="-1">使用 vLLM 部署本地模型 <a class="header-anchor" href="#使用-vllm-部署本地模型" aria-label="Permalink to "使用 vLLM 部署本地模型""></a></h3><p>你可使用 vLLM 部署一个本地 LLM,并使用 OpenAI 兼容 API 调用。<br> 本文档以 Qwen2.5-7B-Instruct-GPTQ-Int4 模型及 <a href="https://github.com/Moemu/Muice-Chatbot" target="_blank" rel="noreferrer">Muice-Chatbot</a> 提供的 LoRA 微调模型为例,并假设你的系统及硬件可运行 vLLM。</p><div class="warning custom-block"><p class="custom-block-title">WARNING</p><p>vLLM 仅支持 Linux 系统。</p></div><ol><li>安装 vLLM<div class="language-bash vp-adaptive-theme"><button title="Copy Code" class="copy"></button><span class="lang">bash</span><pre class="shiki shiki-themes github-light github-dark vp-code" tabindex="0"><code><span class="line"><span style="--shiki-light:#6F42C1;--shiki-dark:#B392F0;">pip</span><span style="--shiki-light:#032F62;--shiki-dark:#9ECBFF;"> install</span><span style="--shiki-light:#032F62;--shiki-dark:#9ECBFF;"> vllm</span></span></code></pre></div></li><li>下载 Muice-Chatbot 提供的 LoRA 微调模型<br> 前往 Muice-Chatbot 的 <a href="https://github.com/Moemu/Muice-Chatbot/releases" target="_blank" rel="noreferrer">Releases</a> 下载模型文件。此处以<code>2.7.1</code>版本的模型为例。<div class="language-bash vp-adaptive-theme"><button title="Copy Code" class="copy"></button><span class="lang">bash</span><pre class="shiki shiki-themes github-light github-dark vp-code" tabindex="0"><code><span class="line"><span style="--shiki-light:#6F42C1;--shiki-dark:#B392F0;">wget</span><span style="--shiki-light:#032F62;--shiki-dark:#9ECBFF;"> https://github.com/Moemu/Muice-Chatbot/releases/download/1.4/Muice-2.7.1-Qwen2.5-7B-Instruct-GPTQ-Int4-8e-4.7z</span></span></code></pre></div></li><li>解压模型文件<div class="language-bash vp-adaptive-theme"><button title="Copy Code" class="copy"></button><span class="lang">bash</span><pre class="shiki shiki-themes github-light github-dark vp-code" tabindex="0"><code><span class="line"><span style="--shiki-light:#6F42C1;--shiki-dark:#B392F0;">7z</span><span style="--shiki-light:#032F62;--shiki-dark:#9ECBFF;"> x</span><span style="--shiki-light:#032F62;--shiki-dark:#9ECBFF;"> Muice-2.7.1-Qwen2.5-7B-Instruct-GPTQ-Int4-8e-4.7z</span><span style="--shiki-light:#005CC5;--shiki-dark:#79B8FF;"> -oMuice-2.7.1-Qwen2.5-7B-Instruct-GPTQ-Int4-8e-4</span></span></code></pre></div></li><li>启动 vLLM<div class="language-bash vp-adaptive-theme"><button title="Copy Code" class="copy"></button><span class="lang">bash</span><pre class="shiki shiki-themes github-light github-dark vp-code" tabindex="0"><code><span class="line"><span style="--shiki-light:#6F42C1;--shiki-dark:#B392F0;">vllm</span><span style="--shiki-light:#032F62;--shiki-dark:#9ECBFF;"> serve</span><span style="--shiki-light:#032F62;--shiki-dark:#9ECBFF;"> Qwen/Qwen2.5-7B-Instruct-GPTQ-Int4</span><span style="--shiki-light:#005CC5;--shiki-dark:#79B8FF;"> \\</span></span>
|
||||
<span class="line"><span style="--shiki-light:#E36209;--shiki-dark:#FFAB70;">MARSHOAI_DEFAULT_MODEL</span><span style="--shiki-light:#D73A49;--shiki-dark:#F97583;">=</span><span style="--shiki-light:#032F62;--shiki-dark:#9ECBFF;">"deepseek-reasoner"</span></span>
|
||||
<span class="line"><span style="--shiki-light:#E36209;--shiki-dark:#FFAB70;">MARSHOAI_ENABLE_PLUGINS</span><span style="--shiki-light:#D73A49;--shiki-dark:#F97583;">=</span><span style="--shiki-light:#24292E;--shiki-dark:#E1E4E8;">false</span></span></code></pre></div>你可修改 <code>MARSHOAI_DEFAULT_MODEL</code> 为 其它模型名来调用其它 DeepSeek 模型。<div class="tip custom-block"><p class="custom-block-title">TIP</p><p>如果使用 one-api 作为中转,你可将 <code>MARSHOAI_AZURE_ENDPOINT</code> 设置为 one-api 的地址,将 <code>MARSHOAI_TOKEN</code> 设为 one-api 配置的令牌,在 one-api 中添加 DeepSeek 渠道。<br> 同样可使用其它提供商(例如 <a href="https://siliconflow.cn/" target="_blank" rel="noreferrer">SiliconFlow</a>)提供的 DeepSeek 等模型。</p></div></li></ol><h3 id="使用-vllm-部署本地模型" tabindex="-1">使用 vLLM 部署本地模型 <a class="header-anchor" href="#使用-vllm-部署本地模型" aria-label="Permalink to "使用 vLLM 部署本地模型""></a></h3><p>你可使用 vLLM 部署一个本地 LLM,并使用 OpenAI 兼容 API 调用。<br> 本文档以 Qwen2.5-7B-Instruct-GPTQ-Int4 模型及 <a href="https://github.com/Moemu/Muice-Chatbot" target="_blank" rel="noreferrer">Muice-Chatbot</a> 提供的 LoRA 微调模型为例,并假设你的系统及硬件可运行 vLLM。</p><div class="warning custom-block"><p class="custom-block-title">WARNING</p><p>vLLM 仅支持 Linux 系统。</p></div><ol><li>安装 vLLM<div class="language-bash vp-adaptive-theme"><button title="Copy Code" class="copy"></button><span class="lang">bash</span><pre class="shiki shiki-themes github-light github-dark vp-code" tabindex="0"><code><span class="line"><span style="--shiki-light:#6F42C1;--shiki-dark:#B392F0;">pip</span><span style="--shiki-light:#032F62;--shiki-dark:#9ECBFF;"> install</span><span style="--shiki-light:#032F62;--shiki-dark:#9ECBFF;"> vllm</span></span></code></pre></div></li><li>下载 Muice-Chatbot 提供的 LoRA 微调模型<br> 前往 Muice-Chatbot 的 <a href="https://github.com/Moemu/Muice-Chatbot/releases" target="_blank" rel="noreferrer">Releases</a> 下载模型文件。此处以<code>2.7.1</code>版本的模型为例。<div class="language-bash vp-adaptive-theme"><button title="Copy Code" class="copy"></button><span class="lang">bash</span><pre class="shiki shiki-themes github-light github-dark vp-code" tabindex="0"><code><span class="line"><span style="--shiki-light:#6F42C1;--shiki-dark:#B392F0;">wget</span><span style="--shiki-light:#032F62;--shiki-dark:#9ECBFF;"> https://github.com/Moemu/Muice-Chatbot/releases/download/1.4/Muice-2.7.1-Qwen2.5-7B-Instruct-GPTQ-Int4-8e-4.7z</span></span></code></pre></div></li><li>解压模型文件<div class="language-bash vp-adaptive-theme"><button title="Copy Code" class="copy"></button><span class="lang">bash</span><pre class="shiki shiki-themes github-light github-dark vp-code" tabindex="0"><code><span class="line"><span style="--shiki-light:#6F42C1;--shiki-dark:#B392F0;">7z</span><span style="--shiki-light:#032F62;--shiki-dark:#9ECBFF;"> x</span><span style="--shiki-light:#032F62;--shiki-dark:#9ECBFF;"> Muice-2.7.1-Qwen2.5-7B-Instruct-GPTQ-Int4-8e-4.7z</span><span style="--shiki-light:#005CC5;--shiki-dark:#79B8FF;"> -oMuice-2.7.1-Qwen2.5-7B-Instruct-GPTQ-Int4-8e-4</span></span></code></pre></div></li><li>启动 vLLM<div class="language-bash vp-adaptive-theme"><button title="Copy Code" class="copy"></button><span class="lang">bash</span><pre class="shiki shiki-themes github-light github-dark vp-code" tabindex="0"><code><span class="line"><span style="--shiki-light:#6F42C1;--shiki-dark:#B392F0;">vllm</span><span style="--shiki-light:#032F62;--shiki-dark:#9ECBFF;"> serve</span><span style="--shiki-light:#032F62;--shiki-dark:#9ECBFF;"> Qwen/Qwen2.5-7B-Instruct-GPTQ-Int4</span><span style="--shiki-light:#005CC5;--shiki-dark:#79B8FF;"> \\</span></span>
|
||||
<span class="line"><span style="--shiki-light:#005CC5;--shiki-dark:#79B8FF;"> --enable-lora</span><span style="--shiki-light:#005CC5;--shiki-dark:#79B8FF;"> \\</span></span>
|
||||
<span class="line"><span style="--shiki-light:#005CC5;--shiki-dark:#79B8FF;"> --lora-modules</span><span style="--shiki-light:#032F62;--shiki-dark:#9ECBFF;"> '{"name": "muice-lora", "path": "/root/Muice-2.7.1-Qwen2.5-7B-Instruct-GPTQ-Int4-8e-4", "base_model_name": "Qwen/Qwen2.5-7B-Instruct-GPTQ-Int4"}'</span><span style="--shiki-light:#005CC5;--shiki-dark:#79B8FF;"> \\</span></span>
|
||||
<span class="line"><span style="--shiki-light:#005CC5;--shiki-dark:#79B8FF;"> --port</span><span style="--shiki-light:#005CC5;--shiki-dark:#79B8FF;"> 6006</span></span></code></pre></div>此示例命令将在 <code>6006</code> 端口启动 vLLM,并加载 Muice-Chatbot 提供的 LoRA 微调模型,该模型位于 <code>/root/Muice-2.7.1-Qwen2.5-7B-Instruct-GPTQ-Int4-8e-4</code> 目录下。</li><li>配置插件<div class="language-dotenv vp-adaptive-theme"><button title="Copy Code" class="copy"></button><span class="lang">dotenv</span><pre class="shiki shiki-themes github-light github-dark vp-code" tabindex="0"><code><span class="line"><span style="--shiki-light:#E36209;--shiki-dark:#FFAB70;">MARSHOAI_AZURE_ENDPOINT</span><span style="--shiki-light:#D73A49;--shiki-dark:#F97583;">=</span><span style="--shiki-light:#032F62;--shiki-dark:#9ECBFF;">"http://127.0.0.1:6006/v1"</span></span>
|
@ -1 +1 @@
|
||||
import{_ as i,c as a,o as e,ae as t}from"./chunks/framework.CTVYQtO4.js";const c=JSON.parse('{"title":"使用","description":"","frontmatter":{"title":"使用"},"headers":[],"relativePath":"start/use.md","filePath":"zh/start/use.md","lastUpdated":1738327524000}'),n={name:"start/use.md"};function l(p,s,h,k,o,d){return e(),a("div",null,s[0]||(s[0]=[t("",17)]))}const u=i(n,[["render",l]]);export{c as __pageData,u as default};
|
||||
import{_ as i,c as a,o as e,ae as t}from"./chunks/framework.CTVYQtO4.js";const c=JSON.parse('{"title":"使用","description":"","frontmatter":{"title":"使用"},"headers":[],"relativePath":"start/use.md","filePath":"zh/start/use.md","lastUpdated":1739354634000}'),n={name:"start/use.md"};function l(p,s,h,k,o,d){return e(),a("div",null,s[0]||(s[0]=[t("",17)]))}const u=i(n,[["render",l]]);export{c as __pageData,u as default};
|
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
Some files were not shown because too many files have changed in this diff Show More
Loading…
x
Reference in New Issue
Block a user