mirror of
https://github.com/LiteyukiStudio/nonebot-plugin-marshoai.git
synced 2025-03-10 18:31:03 +08:00
Deploying to docs from @ LiteyukiStudio/nonebot-plugin-marshoai@2afe3c48ce 🚀
This commit is contained in:
parent
d7bb4af837
commit
7af0b41583
File diff suppressed because one or more lines are too long
@ -1 +1 @@
|
||||
import{_ as s,c as t,ae as i,o as e}from"./chunks/framework.BzDBnRMZ.js";const c=JSON.parse('{"title":"config","description":"","frontmatter":{"title":"config","order":100},"headers":[],"relativePath":"dev/api/config.md","filePath":"zh/dev/api/config.md","lastUpdated":1734175019000}'),o={name:"dev/api/config.md"};function r(n,a,l,h,d,m){return e(),t("div",null,a[0]||(a[0]=[i("",50)]))}const k=s(o,[["render",r]]);export{c as __pageData,k as default};
|
||||
import{_ as s,c as t,ae as i,o as e}from"./chunks/framework.BzDBnRMZ.js";const c=JSON.parse('{"title":"config","description":"","frontmatter":{"title":"config","order":100},"headers":[],"relativePath":"dev/api/config.md","filePath":"zh/dev/api/config.md","lastUpdated":1738311067000}'),o={name:"dev/api/config.md"};function r(n,a,l,h,d,m){return e(),t("div",null,a[0]||(a[0]=[i("",50)]))}const k=s(o,[["render",r]]);export{c as __pageData,k as default};
|
1
assets/dev_api_index.md.DCRutF9O.js
Normal file
1
assets/dev_api_index.md.DCRutF9O.js
Normal file
@ -0,0 +1 @@
|
||||
import{_ as i,c as n,j as e,a as o,o as a}from"./chunks/framework.BzDBnRMZ.js";const I=JSON.parse('{"title":"index","description":"","frontmatter":{"title":"index","order":100,"collapsed":true},"headers":[],"relativePath":"dev/api/index.md","filePath":"zh/dev/api/index.md","lastUpdated":1734175019000}'),s={name:"dev/api/index.md"};function r(l,t,d,T,p,O){return a(),n("div",null,t[0]||(t[0]=[e("h1",{id:"模块-nonebot-plugin-marshoai",tabindex:"-1"},[e("strong",null,"模块"),o(),e("code",null,"nonebot_plugin_marshoai"),o(),e("a",{class:"header-anchor",href:"#模块-nonebot-plugin-marshoai","aria-label":'Permalink to "**模块** `nonebot_plugin_marshoai`"'},"")],-1),e("p",null,"MIT License",-1),e("p",null,"Copyright (c) 2025 Asankilp & LiteyukiStudio",-1),e("p",null,'Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions:',-1),e("p",null,"The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.",-1),e("p",null,'THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.',-1)]))}const c=i(s,[["render",r]]);export{I as __pageData,c as default};
|
1
assets/dev_api_index.md.DCRutF9O.lean.js
Normal file
1
assets/dev_api_index.md.DCRutF9O.lean.js
Normal file
@ -0,0 +1 @@
|
||||
import{_ as i,c as n,j as e,a as o,o as a}from"./chunks/framework.BzDBnRMZ.js";const I=JSON.parse('{"title":"index","description":"","frontmatter":{"title":"index","order":100,"collapsed":true},"headers":[],"relativePath":"dev/api/index.md","filePath":"zh/dev/api/index.md","lastUpdated":1734175019000}'),s={name:"dev/api/index.md"};function r(l,t,d,T,p,O){return a(),n("div",null,t[0]||(t[0]=[e("h1",{id:"模块-nonebot-plugin-marshoai",tabindex:"-1"},[e("strong",null,"模块"),o(),e("code",null,"nonebot_plugin_marshoai"),o(),e("a",{class:"header-anchor",href:"#模块-nonebot-plugin-marshoai","aria-label":'Permalink to "**模块** `nonebot_plugin_marshoai`"'},"")],-1),e("p",null,"MIT License",-1),e("p",null,"Copyright (c) 2025 Asankilp & LiteyukiStudio",-1),e("p",null,'Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions:',-1),e("p",null,"The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.",-1),e("p",null,'THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.',-1)]))}const c=i(s,[["render",r]]);export{I as __pageData,c as default};
|
@ -1 +0,0 @@
|
||||
import{_ as t,c as o,j as e,a as n,o as r}from"./chunks/framework.BzDBnRMZ.js";const u=JSON.parse('{"title":"index","description":"","frontmatter":{"title":"index","order":100,"collapsed":true},"headers":[],"relativePath":"dev/api/index.md","filePath":"zh/dev/api/index.md","lastUpdated":1734175019000}'),i={name:"dev/api/index.md"};function d(s,a,l,p,c,m){return r(),o("div",null,a[0]||(a[0]=[e("h1",{id:"模块-nonebot-plugin-marshoai",tabindex:"-1"},[e("strong",null,"模块"),n(),e("code",null,"nonebot_plugin_marshoai"),n(),e("a",{class:"header-anchor",href:"#模块-nonebot-plugin-marshoai","aria-label":'Permalink to "**模块** `nonebot_plugin_marshoai`"'},"")],-1)]))}const h=t(i,[["render",d]]);export{u as __pageData,h as default};
|
@ -1 +0,0 @@
|
||||
import{_ as t,c as o,j as e,a as n,o as r}from"./chunks/framework.BzDBnRMZ.js";const u=JSON.parse('{"title":"index","description":"","frontmatter":{"title":"index","order":100,"collapsed":true},"headers":[],"relativePath":"dev/api/index.md","filePath":"zh/dev/api/index.md","lastUpdated":1734175019000}'),i={name:"dev/api/index.md"};function d(s,a,l,p,c,m){return r(),o("div",null,a[0]||(a[0]=[e("h1",{id:"模块-nonebot-plugin-marshoai",tabindex:"-1"},[e("strong",null,"模块"),n(),e("code",null,"nonebot_plugin_marshoai"),n(),e("a",{class:"header-anchor",href:"#模块-nonebot-plugin-marshoai","aria-label":'Permalink to "**模块** `nonebot_plugin_marshoai`"'},"")],-1)]))}const h=t(i,[["render",d]]);export{u as __pageData,h as default};
|
@ -1,9 +0,0 @@
|
||||
import{_ as i,c as a,ae as n,o as t}from"./chunks/framework.BzDBnRMZ.js";const g=JSON.parse('{"title":"index","description":"","frontmatter":{"title":"index","order":100,"collapsed":true},"headers":[],"relativePath":"dev/api/plugins_test/marshoai_basic/index.md","filePath":"zh/dev/api/plugins_test/marshoai_basic/index.md","lastUpdated":null}'),h={name:"dev/api/plugins_test/marshoai_basic/index.md"};function e(k,s,l,p,r,E){return t(),a("div",null,s[0]||(s[0]=[n(`<h1 id="模块-nonebot-plugin-marshoai-plugins-test-marshoai-basic" tabindex="-1"><strong>模块</strong> <code>nonebot_plugin_marshoai.plugins_test.marshoai_basic</code> <a class="header-anchor" href="#模块-nonebot-plugin-marshoai-plugins-test-marshoai-basic" aria-label="Permalink to "**模块** \`nonebot_plugin_marshoai.plugins_test.marshoai_basic\`""></a></h1><hr><p><code>@on_function_call(description='获取当前时间,日期和星期')</code></p><h3 id="async-func-get-current-time-str" tabindex="-1"><em><strong>async func</strong></em> <code>get_current_time() -> str</code> <a class="header-anchor" href="#async-func-get-current-time-str" aria-label="Permalink to "***async func*** \`get_current_time() -> str\`""></a></h3><p><strong>说明</strong>: 获取当前的时间和日期</p><details><summary><b>源代码</b> 或 <a href="https://github.com/LiteyukiStudio/nonebot-plugin-marshoai/tree/main/nonebot_plugin_marshoai/plugins_test/marshoai_basic/__init__.py#L17" 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;">@on_function_call</span><span style="--shiki-light:#24292E;--shiki-dark:#E1E4E8;">(</span><span style="--shiki-light:#E36209;--shiki-dark:#FFAB70;">description</span><span style="--shiki-light:#D73A49;--shiki-dark:#F97583;">=</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;">async</span><span style="--shiki-light:#D73A49;--shiki-dark:#F97583;"> def</span><span style="--shiki-light:#6F42C1;--shiki-dark:#B392F0;"> get_current_time</span><span style="--shiki-light:#24292E;--shiki-dark:#E1E4E8;">() -> </span><span style="--shiki-light:#005CC5;--shiki-dark:#79B8FF;">str</span><span style="--shiki-light:#24292E;--shiki-dark:#E1E4E8;">:</span></span>
|
||||
<span class="line"><span style="--shiki-light:#24292E;--shiki-dark:#E1E4E8;"> current_time </span><span style="--shiki-light:#D73A49;--shiki-dark:#F97583;">=</span><span style="--shiki-light:#24292E;--shiki-dark:#E1E4E8;"> DateTime.now().strftime(</span><span style="--shiki-light:#032F62;--shiki-dark:#9ECBFF;">'%Y.%m.</span><span style="--shiki-light:#005CC5;--shiki-dark:#79B8FF;">%d</span><span style="--shiki-light:#032F62;--shiki-dark:#9ECBFF;"> %H:%M:%S'</span><span style="--shiki-light:#24292E;--shiki-dark:#E1E4E8;">)</span></span>
|
||||
<span class="line"><span style="--shiki-light:#24292E;--shiki-dark:#E1E4E8;"> current_weekday </span><span style="--shiki-light:#D73A49;--shiki-dark:#F97583;">=</span><span style="--shiki-light:#24292E;--shiki-dark:#E1E4E8;"> DateTime.now().weekday()</span></span>
|
||||
<span class="line"><span style="--shiki-light:#24292E;--shiki-dark:#E1E4E8;"> weekdays </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;">'星期一'</span><span style="--shiki-light:#24292E;--shiki-dark:#E1E4E8;">, </span><span style="--shiki-light:#032F62;--shiki-dark:#9ECBFF;">'星期二'</span><span style="--shiki-light:#24292E;--shiki-dark:#E1E4E8;">, </span><span style="--shiki-light:#032F62;--shiki-dark:#9ECBFF;">'星期三'</span><span style="--shiki-light:#24292E;--shiki-dark:#E1E4E8;">, </span><span style="--shiki-light:#032F62;--shiki-dark:#9ECBFF;">'星期四'</span><span style="--shiki-light:#24292E;--shiki-dark:#E1E4E8;">, </span><span style="--shiki-light:#032F62;--shiki-dark:#9ECBFF;">'星期五'</span><span style="--shiki-light:#24292E;--shiki-dark:#E1E4E8;">, </span><span style="--shiki-light:#032F62;--shiki-dark:#9ECBFF;">'星期六'</span><span style="--shiki-light:#24292E;--shiki-dark:#E1E4E8;">, </span><span style="--shiki-light:#032F62;--shiki-dark:#9ECBFF;">'星期日'</span><span style="--shiki-light:#24292E;--shiki-dark:#E1E4E8;">]</span></span>
|
||||
<span class="line"><span style="--shiki-light:#24292E;--shiki-dark:#E1E4E8;"> current_weekday_name </span><span style="--shiki-light:#D73A49;--shiki-dark:#F97583;">=</span><span style="--shiki-light:#24292E;--shiki-dark:#E1E4E8;"> weekdays[current_weekday]</span></span>
|
||||
<span class="line"><span style="--shiki-light:#24292E;--shiki-dark:#E1E4E8;"> current_lunar_date </span><span style="--shiki-light:#D73A49;--shiki-dark:#F97583;">=</span><span style="--shiki-light:#24292E;--shiki-dark:#E1E4E8;"> DateTime.now().to_lunar().date_hanzify()[</span><span style="--shiki-light:#005CC5;--shiki-dark:#79B8FF;">5</span><span style="--shiki-light:#24292E;--shiki-dark:#E1E4E8;">:]</span></span>
|
||||
<span class="line"><span style="--shiki-light:#24292E;--shiki-dark:#E1E4E8;"> time_prompt </span><span style="--shiki-light:#D73A49;--shiki-dark:#F97583;">=</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;">current_time</span><span style="--shiki-light:#005CC5;--shiki-dark:#79B8FF;">}</span><span style="--shiki-light:#032F62;--shiki-dark:#9ECBFF;">,</span><span style="--shiki-light:#005CC5;--shiki-dark:#79B8FF;">{</span><span style="--shiki-light:#24292E;--shiki-dark:#E1E4E8;">current_weekday_name</span><span style="--shiki-light:#005CC5;--shiki-dark:#79B8FF;">}</span><span style="--shiki-light:#032F62;--shiki-dark:#9ECBFF;">,农历 </span><span style="--shiki-light:#005CC5;--shiki-dark:#79B8FF;">{</span><span style="--shiki-light:#24292E;--shiki-dark:#E1E4E8;">current_lunar_date</span><span style="--shiki-light:#005CC5;--shiki-dark:#79B8FF;">}</span><span style="--shiki-light:#032F62;--shiki-dark:#9ECBFF;">。'</span></span>
|
||||
<span class="line"><span style="--shiki-light:#D73A49;--shiki-dark:#F97583;"> return</span><span style="--shiki-light:#24292E;--shiki-dark:#E1E4E8;"> time_prompt</span></span></code></pre></div></details>`,6)]))}const o=i(h,[["render",e]]);export{g as __pageData,o as default};
|
@ -1 +0,0 @@
|
||||
import{_ as i,c as a,ae as n,o as t}from"./chunks/framework.BzDBnRMZ.js";const g=JSON.parse('{"title":"index","description":"","frontmatter":{"title":"index","order":100,"collapsed":true},"headers":[],"relativePath":"dev/api/plugins_test/marshoai_basic/index.md","filePath":"zh/dev/api/plugins_test/marshoai_basic/index.md","lastUpdated":null}'),h={name:"dev/api/plugins_test/marshoai_basic/index.md"};function e(k,s,l,p,r,E){return t(),a("div",null,s[0]||(s[0]=[n("",6)]))}const o=i(h,[["render",e]]);export{g as __pageData,o as default};
|
@ -0,0 +1 @@
|
||||
import{_ as i,c as a,ae as t,o as n}from"./chunks/framework.BzDBnRMZ.js";const g=JSON.parse('{"title":"index","description":"","frontmatter":{"title":"index","order":100,"collapsed":true},"headers":[],"relativePath":"dev/api/plugins_test/marshoai_basic/index.md","filePath":"zh/dev/api/plugins_test/marshoai_basic/index.md","lastUpdated":null}'),e={name:"dev/api/plugins_test/marshoai_basic/index.md"};function h(p,s,l,r,k,d){return n(),a("div",null,s[0]||(s[0]=[t('<h1 id="模块-nonebot-plugin-marshoai-plugins-test-marshoai-basic" tabindex="-1"><strong>模块</strong> <code>nonebot_plugin_marshoai.plugins_test.marshoai_basic</code> <a class="header-anchor" href="#模块-nonebot-plugin-marshoai-plugins-test-marshoai-basic" aria-label="Permalink to "**模块** `nonebot_plugin_marshoai.plugins_test.marshoai_basic`""></a></h1><hr><p><code>@on_function_call(description='获取当前时间,日期和星期')</code></p><h3 id="async-func-get-current-time-str" tabindex="-1"><em><strong>async func</strong></em> <code>get_current_time() -> str</code> <a class="header-anchor" href="#async-func-get-current-time-str" aria-label="Permalink to "***async func*** `get_current_time() -> str`""></a></h3><p><strong>说明</strong>: 获取当前的时间和日期</p><details><summary><b>源代码</b> 或 <a href="https://github.com/LiteyukiStudio/nonebot-plugin-marshoai/tree/main/nonebot_plugin_marshoai/plugins_test/marshoai_basic/__init__.py#L20" target="_blank">在GitHub上查看</a></summary><div class="language-python vp-adaptive-theme"><button title="Copy Code" class="copy"></button><span class="lang">python</span><pre class="shiki shiki-themes github-light github-dark vp-code" tabindex="0"><code><span class="line"><span style="--shiki-light:#6F42C1;--shiki-dark:#B392F0;">@on_function_call</span><span style="--shiki-light:#24292E;--shiki-dark:#E1E4E8;">(</span><span style="--shiki-light:#E36209;--shiki-dark:#FFAB70;">description</span><span style="--shiki-light:#D73A49;--shiki-dark:#F97583;">=</span><span style="--shiki-light:#032F62;--shiki-dark:#9ECBFF;">'获取当前时间,日期和星期'</span><span style="--shiki-light:#24292E;--shiki-dark:#E1E4E8;">)</span></span>\n<span class="line"><span style="--shiki-light:#D73A49;--shiki-dark:#F97583;">async</span><span style="--shiki-light:#D73A49;--shiki-dark:#F97583;"> def</span><span style="--shiki-light:#6F42C1;--shiki-dark:#B392F0;"> get_current_time</span><span style="--shiki-light:#24292E;--shiki-dark:#E1E4E8;">() -> </span><span style="--shiki-light:#005CC5;--shiki-dark:#79B8FF;">str</span><span style="--shiki-light:#24292E;--shiki-dark:#E1E4E8;">:</span></span>\n<span class="line"><span style="--shiki-light:#24292E;--shiki-dark:#E1E4E8;"> current_time </span><span style="--shiki-light:#D73A49;--shiki-dark:#F97583;">=</span><span style="--shiki-light:#24292E;--shiki-dark:#E1E4E8;"> DateTime.now()</span></span>\n<span class="line"><span style="--shiki-light:#24292E;--shiki-dark:#E1E4E8;"> time_prompt </span><span style="--shiki-light:#D73A49;--shiki-dark:#F97583;">=</span><span style="--shiki-light:#032F62;--shiki-dark:#9ECBFF;"> '现在的时间是 </span><span style="--shiki-light:#005CC5;--shiki-dark:#79B8FF;">{}</span><span style="--shiki-light:#032F62;--shiki-dark:#9ECBFF;">,</span><span style="--shiki-light:#005CC5;--shiki-dark:#79B8FF;">{}</span><span style="--shiki-light:#032F62;--shiki-dark:#9ECBFF;">,</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;">.format(current_time.strftime(</span><span style="--shiki-light:#032F62;--shiki-dark:#9ECBFF;">'%Y.%m.</span><span style="--shiki-light:#005CC5;--shiki-dark:#79B8FF;">%d</span><span style="--shiki-light:#032F62;--shiki-dark:#9ECBFF;"> %H:%M:%S'</span><span style="--shiki-light:#24292E;--shiki-dark:#E1E4E8;">), weekdays[current_time.weekday()], current_time.chinesize.date_hanzify(</span><span style="--shiki-light:#032F62;--shiki-dark:#9ECBFF;">'农历</span><span style="--shiki-light:#005CC5;--shiki-dark:#79B8FF;">{干支年}{生肖}</span><span style="--shiki-light:#032F62;--shiki-dark:#9ECBFF;">年 </span><span style="--shiki-light:#005CC5;--shiki-dark:#79B8FF;">{月份}</span><span style="--shiki-light:#032F62;--shiki-dark:#9ECBFF;">月</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>\n<span class="line"><span style="--shiki-light:#D73A49;--shiki-dark:#F97583;"> return</span><span style="--shiki-light:#24292E;--shiki-dark:#E1E4E8;"> time_prompt</span></span></code></pre></div></details>',6)]))}const c=i(e,[["render",h]]);export{g as __pageData,c as default};
|
@ -0,0 +1 @@
|
||||
import{_ as i,c as a,ae as t,o as n}from"./chunks/framework.BzDBnRMZ.js";const g=JSON.parse('{"title":"index","description":"","frontmatter":{"title":"index","order":100,"collapsed":true},"headers":[],"relativePath":"dev/api/plugins_test/marshoai_basic/index.md","filePath":"zh/dev/api/plugins_test/marshoai_basic/index.md","lastUpdated":null}'),e={name:"dev/api/plugins_test/marshoai_basic/index.md"};function h(p,s,l,r,k,d){return n(),a("div",null,s[0]||(s[0]=[t("",6)]))}const c=i(e,[["render",h]]);export{g as __pageData,c as default};
|
@ -76,21 +76,20 @@ import{_ as i,c as a,ae as n,o as t}from"./chunks/framework.BzDBnRMZ.js";const g
|
||||
<span class="line"><span style="--shiki-light:#24292E;--shiki-dark:#E1E4E8;"> nickname_json </span><span style="--shiki-light:#D73A49;--shiki-dark:#F97583;">=</span><span style="--shiki-light:#24292E;--shiki-dark:#E1E4E8;"> json.loads(</span><span style="--shiki-light:#D73A49;--shiki-dark:#F97583;">await</span><span style="--shiki-light:#24292E;--shiki-dark:#E1E4E8;"> f.read())</span></span>
|
||||
<span class="line"><span style="--shiki-light:#D73A49;--shiki-dark:#F97583;"> except</span><span style="--shiki-light:#005CC5;--shiki-dark:#79B8FF;"> Exception</span><span style="--shiki-light:#24292E;--shiki-dark:#E1E4E8;">:</span></span>
|
||||
<span class="line"><span style="--shiki-light:#24292E;--shiki-dark:#E1E4E8;"> logger.error(</span><span style="--shiki-light:#032F62;--shiki-dark:#9ECBFF;">'刷新 nickname_json 表错误:无法载入 nickname.json 文件'</span><span style="--shiki-light:#24292E;--shiki-dark:#E1E4E8;">)</span></span></code></pre></div></details><hr><h3 id="func-get-prompt" tabindex="-1"><em><strong>func</strong></em> <code>get_prompt()</code> <a class="header-anchor" href="#func-get-prompt" aria-label="Permalink to "***func*** \`get_prompt()\`""></a></h3><p><strong>说明</strong>: 获取系统提示词</p><details><summary><b>源代码</b> 或 <a href="https://github.com/LiteyukiStudio/nonebot-plugin-marshoai/tree/main/nonebot_plugin_marshoai/util.py#L255" target="_blank">在GitHub上查看</a></summary><div class="language-python vp-adaptive-theme"><button title="Copy Code" class="copy"></button><span class="lang">python</span><pre class="shiki shiki-themes github-light github-dark vp-code" tabindex="0"><code><span class="line"><span style="--shiki-light:#D73A49;--shiki-dark:#F97583;">def</span><span style="--shiki-light:#6F42C1;--shiki-dark:#B392F0;"> get_prompt</span><span style="--shiki-light:#24292E;--shiki-dark:#E1E4E8;">():</span></span>
|
||||
<span class="line"><span style="--shiki-light:#24292E;--shiki-dark:#E1E4E8;"> prompts </span><span style="--shiki-light:#D73A49;--shiki-dark:#F97583;">=</span><span style="--shiki-light:#032F62;--shiki-dark:#9ECBFF;"> ''</span></span>
|
||||
<span class="line"><span style="--shiki-light:#24292E;--shiki-dark:#E1E4E8;"> prompts </span><span style="--shiki-light:#D73A49;--shiki-dark:#F97583;">+=</span><span style="--shiki-light:#24292E;--shiki-dark:#E1E4E8;"> config.marshoai_additional_prompt</span></span>
|
||||
<span class="line"><span style="--shiki-light:#24292E;--shiki-dark:#E1E4E8;"> prompts </span><span style="--shiki-light:#D73A49;--shiki-dark:#F97583;">=</span><span style="--shiki-light:#24292E;--shiki-dark:#E1E4E8;"> config.marshoai_additional_prompt</span></span>
|
||||
<span class="line"><span style="--shiki-light:#D73A49;--shiki-dark:#F97583;"> if</span><span style="--shiki-light:#24292E;--shiki-dark:#E1E4E8;"> config.marshoai_enable_praises:</span></span>
|
||||
<span class="line"><span style="--shiki-light:#24292E;--shiki-dark:#E1E4E8;"> praises_prompt </span><span style="--shiki-light:#D73A49;--shiki-dark:#F97583;">=</span><span style="--shiki-light:#24292E;--shiki-dark:#E1E4E8;"> build_praises()</span></span>
|
||||
<span class="line"><span style="--shiki-light:#24292E;--shiki-dark:#E1E4E8;"> prompts </span><span style="--shiki-light:#D73A49;--shiki-dark:#F97583;">+=</span><span style="--shiki-light:#24292E;--shiki-dark:#E1E4E8;"> praises_prompt</span></span>
|
||||
<span class="line"><span style="--shiki-light:#D73A49;--shiki-dark:#F97583;"> if</span><span style="--shiki-light:#24292E;--shiki-dark:#E1E4E8;"> config.marshoai_enable_time_prompt:</span></span>
|
||||
<span class="line"><span style="--shiki-light:#24292E;--shiki-dark:#E1E4E8;"> prompts </span><span style="--shiki-light:#D73A49;--shiki-dark:#F97583;">+=</span><span style="--shiki-light:#24292E;--shiki-dark:#E1E4E8;"> _time_prompt.format(</span><span style="--shiki-light:#E36209;--shiki-dark:#FFAB70;">date_time</span><span style="--shiki-light:#D73A49;--shiki-dark:#F97583;">=</span><span style="--shiki-light:#24292E;--shiki-dark:#E1E4E8;">(current_time </span><span style="--shiki-light:#D73A49;--shiki-dark:#F97583;">:=</span><span style="--shiki-light:#24292E;--shiki-dark:#E1E4E8;"> DateTime.now()).strftime(</span><span style="--shiki-light:#032F62;--shiki-dark:#9ECBFF;">'%Y年%m月</span><span style="--shiki-light:#005CC5;--shiki-dark:#79B8FF;">%d</span><span style="--shiki-light:#032F62;--shiki-dark:#9ECBFF;">日 %H:%M:%S'</span><span style="--shiki-light:#24292E;--shiki-dark:#E1E4E8;">), </span><span style="--shiki-light:#E36209;--shiki-dark:#FFAB70;">weekday_name</span><span style="--shiki-light:#D73A49;--shiki-dark:#F97583;">=</span><span style="--shiki-light:#24292E;--shiki-dark:#E1E4E8;">_weekdays[current_time.weekday()], </span><span style="--shiki-light:#E36209;--shiki-dark:#FFAB70;">lunar_date</span><span style="--shiki-light:#D73A49;--shiki-dark:#F97583;">=</span><span style="--shiki-light:#24292E;--shiki-dark:#E1E4E8;">current_time.to_lunar().date_hanzify(</span><span style="--shiki-light:#032F62;--shiki-dark:#9ECBFF;">'</span><span style="--shiki-light:#005CC5;--shiki-dark:#79B8FF;">{干支年}{生肖}</span><span style="--shiki-light:#032F62;--shiki-dark:#9ECBFF;">年</span><span style="--shiki-light:#005CC5;--shiki-dark:#79B8FF;">{月份}</span><span style="--shiki-light:#032F62;--shiki-dark:#9ECBFF;">月</span><span style="--shiki-light:#005CC5;--shiki-dark:#79B8FF;">{日期}</span><span style="--shiki-light:#032F62;--shiki-dark:#9ECBFF;">日'</span><span style="--shiki-light:#24292E;--shiki-dark:#E1E4E8;">))</span></span>
|
||||
<span class="line"><span style="--shiki-light:#24292E;--shiki-dark:#E1E4E8;"> prompts </span><span style="--shiki-light:#D73A49;--shiki-dark:#F97583;">+=</span><span style="--shiki-light:#24292E;--shiki-dark:#E1E4E8;"> _time_prompt.format(</span><span style="--shiki-light:#E36209;--shiki-dark:#FFAB70;">date_time</span><span style="--shiki-light:#D73A49;--shiki-dark:#F97583;">=</span><span style="--shiki-light:#24292E;--shiki-dark:#E1E4E8;">(current_time </span><span style="--shiki-light:#D73A49;--shiki-dark:#F97583;">:=</span><span style="--shiki-light:#24292E;--shiki-dark:#E1E4E8;"> DateTime.now()).strftime(</span><span style="--shiki-light:#032F62;--shiki-dark:#9ECBFF;">'%Y年%m月</span><span style="--shiki-light:#005CC5;--shiki-dark:#79B8FF;">%d</span><span style="--shiki-light:#032F62;--shiki-dark:#9ECBFF;">日 %H:%M:%S'</span><span style="--shiki-light:#24292E;--shiki-dark:#E1E4E8;">), </span><span style="--shiki-light:#E36209;--shiki-dark:#FFAB70;">weekday_name</span><span style="--shiki-light:#D73A49;--shiki-dark:#F97583;">=</span><span style="--shiki-light:#24292E;--shiki-dark:#E1E4E8;">_weekdays[current_time.weekday()], </span><span style="--shiki-light:#E36209;--shiki-dark:#FFAB70;">lunar_date</span><span style="--shiki-light:#D73A49;--shiki-dark:#F97583;">=</span><span style="--shiki-light:#24292E;--shiki-dark:#E1E4E8;">current_time.chinesize.date_hanzify(</span><span style="--shiki-light:#032F62;--shiki-dark:#9ECBFF;">'农历</span><span style="--shiki-light:#005CC5;--shiki-dark:#79B8FF;">{干支年}{生肖}</span><span style="--shiki-light:#032F62;--shiki-dark:#9ECBFF;">年</span><span style="--shiki-light:#005CC5;--shiki-dark:#79B8FF;">{月份}</span><span style="--shiki-light:#032F62;--shiki-dark:#9ECBFF;">月</span><span style="--shiki-light:#005CC5;--shiki-dark:#79B8FF;">{日期}</span><span style="--shiki-light:#032F62;--shiki-dark:#9ECBFF;">'</span><span style="--shiki-light:#24292E;--shiki-dark:#E1E4E8;">))</span></span>
|
||||
<span class="line"><span style="--shiki-light:#24292E;--shiki-dark:#E1E4E8;"> marsho_prompt </span><span style="--shiki-light:#D73A49;--shiki-dark:#F97583;">=</span><span style="--shiki-light:#24292E;--shiki-dark:#E1E4E8;"> config.marshoai_prompt</span></span>
|
||||
<span class="line"><span style="--shiki-light:#24292E;--shiki-dark:#E1E4E8;"> spell </span><span style="--shiki-light:#D73A49;--shiki-dark:#F97583;">=</span><span style="--shiki-light:#24292E;--shiki-dark:#E1E4E8;"> SystemMessage(</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;">marsho_prompt </span><span style="--shiki-light:#D73A49;--shiki-dark:#F97583;">+</span><span style="--shiki-light:#24292E;--shiki-dark:#E1E4E8;"> prompts).as_dict()</span></span>
|
||||
<span class="line"><span style="--shiki-light:#D73A49;--shiki-dark:#F97583;"> return</span><span style="--shiki-light:#24292E;--shiki-dark:#E1E4E8;"> spell</span></span></code></pre></div></details><hr><h3 id="func-suggest-solution-errinfo-str-str" tabindex="-1"><em><strong>func</strong></em> <code>suggest_solution(errinfo: str) -> str</code> <a class="header-anchor" href="#func-suggest-solution-errinfo-str-str" aria-label="Permalink to "***func*** \`suggest_solution(errinfo: str) -> str\`""></a></h3><details><summary><b>源代码</b> 或 <a href="https://github.com/LiteyukiStudio/nonebot-plugin-marshoai/tree/main/nonebot_plugin_marshoai/util.py#L279" target="_blank">在GitHub上查看</a></summary><div class="language-python vp-adaptive-theme"><button title="Copy Code" class="copy"></button><span class="lang">python</span><pre class="shiki shiki-themes github-light github-dark vp-code" tabindex="0"><code><span class="line"><span style="--shiki-light:#D73A49;--shiki-dark:#F97583;">def</span><span style="--shiki-light:#6F42C1;--shiki-dark:#B392F0;"> suggest_solution</span><span style="--shiki-light:#24292E;--shiki-dark:#E1E4E8;">(errinfo: </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;">str</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;"> spell</span></span></code></pre></div></details><hr><h3 id="func-suggest-solution-errinfo-str-str" tabindex="-1"><em><strong>func</strong></em> <code>suggest_solution(errinfo: str) -> str</code> <a class="header-anchor" href="#func-suggest-solution-errinfo-str-str" aria-label="Permalink to "***func*** \`suggest_solution(errinfo: str) -> str\`""></a></h3><details><summary><b>源代码</b> 或 <a href="https://github.com/LiteyukiStudio/nonebot-plugin-marshoai/tree/main/nonebot_plugin_marshoai/util.py#L278" target="_blank">在GitHub上查看</a></summary><div class="language-python vp-adaptive-theme"><button title="Copy Code" class="copy"></button><span class="lang">python</span><pre class="shiki shiki-themes github-light github-dark vp-code" tabindex="0"><code><span class="line"><span style="--shiki-light:#D73A49;--shiki-dark:#F97583;">def</span><span style="--shiki-light:#6F42C1;--shiki-dark:#B392F0;"> suggest_solution</span><span style="--shiki-light:#24292E;--shiki-dark:#E1E4E8;">(errinfo: </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;">str</span><span style="--shiki-light:#24292E;--shiki-dark:#E1E4E8;">:</span></span>
|
||||
<span class="line"><span style="--shiki-light:#24292E;--shiki-dark:#E1E4E8;"> suggestions </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;">'content_filter'</span><span style="--shiki-light:#24292E;--shiki-dark:#E1E4E8;">: </span><span style="--shiki-light:#032F62;--shiki-dark:#9ECBFF;">'消息已被内容过滤器过滤。请调整聊天内容后重试。'</span><span style="--shiki-light:#24292E;--shiki-dark:#E1E4E8;">, </span><span style="--shiki-light:#032F62;--shiki-dark:#9ECBFF;">'RateLimitReached'</span><span style="--shiki-light:#24292E;--shiki-dark:#E1E4E8;">: </span><span style="--shiki-light:#032F62;--shiki-dark:#9ECBFF;">'模型达到调用速率限制。请稍等一段时间或联系Bot管理员。'</span><span style="--shiki-light:#24292E;--shiki-dark:#E1E4E8;">, </span><span style="--shiki-light:#032F62;--shiki-dark:#9ECBFF;">'tokens_limit_reached'</span><span style="--shiki-light:#24292E;--shiki-dark:#E1E4E8;">: </span><span style="--shiki-light:#032F62;--shiki-dark:#9ECBFF;">'请求token达到上限。请重置上下文。'</span><span style="--shiki-light:#24292E;--shiki-dark:#E1E4E8;">, </span><span style="--shiki-light:#032F62;--shiki-dark:#9ECBFF;">'content_length_limit'</span><span style="--shiki-light:#24292E;--shiki-dark:#E1E4E8;">: </span><span style="--shiki-light:#032F62;--shiki-dark:#9ECBFF;">'请求体过大。请重置上下文。'</span><span style="--shiki-light:#24292E;--shiki-dark:#E1E4E8;">, </span><span style="--shiki-light:#032F62;--shiki-dark:#9ECBFF;">'unauthorized'</span><span style="--shiki-light:#24292E;--shiki-dark:#E1E4E8;">: </span><span style="--shiki-light:#032F62;--shiki-dark:#9ECBFF;">'访问token无效。请联系Bot管理员。'</span><span style="--shiki-light:#24292E;--shiki-dark:#E1E4E8;">, </span><span style="--shiki-light:#032F62;--shiki-dark:#9ECBFF;">'invalid type: parameter messages.content is of type array but should be of type string.'</span><span style="--shiki-light:#24292E;--shiki-dark:#E1E4E8;">: </span><span style="--shiki-light:#032F62;--shiki-dark:#9ECBFF;">'聊天请求体包含此模型不支持的数据类型。请重置上下文。'</span><span style="--shiki-light:#24292E;--shiki-dark:#E1E4E8;">, </span><span style="--shiki-light:#032F62;--shiki-dark:#9ECBFF;">'At most 1 image(s) may be provided in one request.'</span><span style="--shiki-light:#24292E;--shiki-dark:#E1E4E8;">: </span><span style="--shiki-light:#032F62;--shiki-dark:#9ECBFF;">'此模型只能在上下文中包含1张图片。如果此前的聊天已经发送过图片,请重置上下文。'</span><span style="--shiki-light:#24292E;--shiki-dark:#E1E4E8;">}</span></span>
|
||||
<span class="line"><span style="--shiki-light:#D73A49;--shiki-dark:#F97583;"> for</span><span style="--shiki-light:#24292E;--shiki-dark:#E1E4E8;"> key, suggestion </span><span style="--shiki-light:#D73A49;--shiki-dark:#F97583;">in</span><span style="--shiki-light:#24292E;--shiki-dark:#E1E4E8;"> suggestions.items():</span></span>
|
||||
<span class="line"><span style="--shiki-light:#D73A49;--shiki-dark:#F97583;"> if</span><span style="--shiki-light:#24292E;--shiki-dark:#E1E4E8;"> key </span><span style="--shiki-light:#D73A49;--shiki-dark:#F97583;">in</span><span style="--shiki-light:#24292E;--shiki-dark:#E1E4E8;"> errinfo:</span></span>
|
||||
<span class="line"><span style="--shiki-light:#D73A49;--shiki-dark:#F97583;"> return</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;">\\n{</span><span style="--shiki-light:#24292E;--shiki-dark:#E1E4E8;">suggestion</span><span style="--shiki-light:#005CC5;--shiki-dark:#79B8FF;">}</span><span style="--shiki-light:#032F62;--shiki-dark:#9ECBFF;">'</span></span>
|
||||
<span class="line"><span style="--shiki-light:#D73A49;--shiki-dark:#F97583;"> return</span><span style="--shiki-light:#032F62;--shiki-dark:#9ECBFF;"> ''</span></span></code></pre></div></details><hr><h3 id="async-func-get-backup-context-target-id-str-target-private-bool-list" tabindex="-1"><em><strong>async func</strong></em> <code>get_backup_context(target_id: str, target_private: bool) -> list</code> <a class="header-anchor" href="#async-func-get-backup-context-target-id-str-target-private-bool-list" aria-label="Permalink to "***async func*** \`get_backup_context(target_id: str, target_private: bool) -> list\`""></a></h3><p><strong>说明</strong>: 获取历史上下文</p><details><summary><b>源代码</b> 或 <a href="https://github.com/LiteyukiStudio/nonebot-plugin-marshoai/tree/main/nonebot_plugin_marshoai/util.py#L298" target="_blank">在GitHub上查看</a></summary><div class="language-python vp-adaptive-theme"><button title="Copy Code" class="copy"></button><span class="lang">python</span><pre class="shiki shiki-themes github-light github-dark vp-code" tabindex="0"><code><span class="line"><span style="--shiki-light:#D73A49;--shiki-dark:#F97583;">async</span><span style="--shiki-light:#D73A49;--shiki-dark:#F97583;"> def</span><span style="--shiki-light:#6F42C1;--shiki-dark:#B392F0;"> get_backup_context</span><span style="--shiki-light:#24292E;--shiki-dark:#E1E4E8;">(target_id: </span><span style="--shiki-light:#005CC5;--shiki-dark:#79B8FF;">str</span><span style="--shiki-light:#24292E;--shiki-dark:#E1E4E8;">, target_private: </span><span style="--shiki-light:#005CC5;--shiki-dark:#79B8FF;">bool</span><span style="--shiki-light:#24292E;--shiki-dark:#E1E4E8;">) -> </span><span style="--shiki-light:#005CC5;--shiki-dark:#79B8FF;">list</span><span style="--shiki-light:#24292E;--shiki-dark:#E1E4E8;">:</span></span>
|
||||
<span class="line"><span style="--shiki-light:#D73A49;--shiki-dark:#F97583;"> return</span><span style="--shiki-light:#032F62;--shiki-dark:#9ECBFF;"> ''</span></span></code></pre></div></details><hr><h3 id="async-func-get-backup-context-target-id-str-target-private-bool-list" tabindex="-1"><em><strong>async func</strong></em> <code>get_backup_context(target_id: str, target_private: bool) -> list</code> <a class="header-anchor" href="#async-func-get-backup-context-target-id-str-target-private-bool-list" aria-label="Permalink to "***async func*** \`get_backup_context(target_id: str, target_private: bool) -> list\`""></a></h3><p><strong>说明</strong>: 获取历史上下文</p><details><summary><b>源代码</b> 或 <a href="https://github.com/LiteyukiStudio/nonebot-plugin-marshoai/tree/main/nonebot_plugin_marshoai/util.py#L297" target="_blank">在GitHub上查看</a></summary><div class="language-python vp-adaptive-theme"><button title="Copy Code" class="copy"></button><span class="lang">python</span><pre class="shiki shiki-themes github-light github-dark vp-code" tabindex="0"><code><span class="line"><span style="--shiki-light:#D73A49;--shiki-dark:#F97583;">async</span><span style="--shiki-light:#D73A49;--shiki-dark:#F97583;"> def</span><span style="--shiki-light:#6F42C1;--shiki-dark:#B392F0;"> get_backup_context</span><span style="--shiki-light:#24292E;--shiki-dark:#E1E4E8;">(target_id: </span><span style="--shiki-light:#005CC5;--shiki-dark:#79B8FF;">str</span><span style="--shiki-light:#24292E;--shiki-dark:#E1E4E8;">, target_private: </span><span style="--shiki-light:#005CC5;--shiki-dark:#79B8FF;">bool</span><span style="--shiki-light:#24292E;--shiki-dark:#E1E4E8;">) -> </span><span style="--shiki-light:#005CC5;--shiki-dark:#79B8FF;">list</span><span style="--shiki-light:#24292E;--shiki-dark:#E1E4E8;">:</span></span>
|
||||
<span class="line"><span style="--shiki-light:#D73A49;--shiki-dark:#F97583;"> global</span><span style="--shiki-light:#24292E;--shiki-dark:#E1E4E8;"> loaded_target_list</span></span>
|
||||
<span class="line"><span style="--shiki-light:#D73A49;--shiki-dark:#F97583;"> if</span><span style="--shiki-light:#24292E;--shiki-dark:#E1E4E8;"> target_private:</span></span>
|
||||
<span class="line"><span style="--shiki-light:#24292E;--shiki-dark:#E1E4E8;"> target_uid </span><span style="--shiki-light:#D73A49;--shiki-dark:#F97583;">=</span><span style="--shiki-light:#D73A49;--shiki-dark:#F97583;"> f</span><span style="--shiki-light:#032F62;--shiki-dark:#9ECBFF;">'private_</span><span style="--shiki-light:#005CC5;--shiki-dark:#79B8FF;">{</span><span style="--shiki-light:#24292E;--shiki-dark:#E1E4E8;">target_id</span><span style="--shiki-light:#005CC5;--shiki-dark:#79B8FF;">}</span><span style="--shiki-light:#032F62;--shiki-dark:#9ECBFF;">'</span></span>
|
||||
@ -99,12 +98,12 @@ import{_ as i,c as a,ae as n,o as t}from"./chunks/framework.BzDBnRMZ.js";const g
|
||||
<span class="line"><span style="--shiki-light:#D73A49;--shiki-dark:#F97583;"> if</span><span style="--shiki-light:#24292E;--shiki-dark:#E1E4E8;"> target_uid </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;"> loaded_target_list:</span></span>
|
||||
<span class="line"><span style="--shiki-light:#24292E;--shiki-dark:#E1E4E8;"> loaded_target_list.append(target_uid)</span></span>
|
||||
<span class="line"><span style="--shiki-light:#D73A49;--shiki-dark:#F97583;"> return</span><span style="--shiki-light:#D73A49;--shiki-dark:#F97583;"> await</span><span style="--shiki-light:#24292E;--shiki-dark:#E1E4E8;"> load_context_from_json(</span><span style="--shiki-light:#D73A49;--shiki-dark:#F97583;">f</span><span style="--shiki-light:#032F62;--shiki-dark:#9ECBFF;">'back_up_context_</span><span style="--shiki-light:#005CC5;--shiki-dark:#79B8FF;">{</span><span style="--shiki-light:#24292E;--shiki-dark:#E1E4E8;">target_uid</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 style="--shiki-light:#032F62;--shiki-dark:#9ECBFF;">'contexts/backup'</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;"> []</span></span></code></pre></div></details><h3 id="var-latex-convert" tabindex="-1">var <code>latex_convert</code> <a class="header-anchor" href="#var-latex-convert" aria-label="Permalink to "var \`latex_convert\`""></a></h3><ul><li><p><strong>说明</strong>: 开启一个转换实例</p></li><li><p><strong>默认值</strong>: <code>ConvertLatex()</code></p></li></ul><hr><p><code>@get_driver().on_bot_connect</code></p><h3 id="async-func-load-latex-convert" tabindex="-1"><em><strong>async func</strong></em> <code>load_latex_convert()</code> <a class="header-anchor" href="#async-func-load-latex-convert" aria-label="Permalink to "***async func*** \`load_latex_convert()\`""></a></h3><details><summary><b>源代码</b> 或 <a href="https://github.com/LiteyukiStudio/nonebot-plugin-marshoai/tree/main/nonebot_plugin_marshoai/util.py#L336" 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;">@get_driver</span><span style="--shiki-light:#24292E;--shiki-dark:#E1E4E8;">()</span><span style="--shiki-light:#B31D28;--shiki-light-font-style:italic;--shiki-dark:#FDAEB7;--shiki-dark-font-style:italic;">.on_bot_connect</span></span>
|
||||
<span class="line"><span style="--shiki-light:#D73A49;--shiki-dark:#F97583;"> return</span><span style="--shiki-light:#24292E;--shiki-dark:#E1E4E8;"> []</span></span></code></pre></div></details><h3 id="var-latex-convert" tabindex="-1">var <code>latex_convert</code> <a class="header-anchor" href="#var-latex-convert" aria-label="Permalink to "var \`latex_convert\`""></a></h3><ul><li><p><strong>说明</strong>: 开启一个转换实例</p></li><li><p><strong>默认值</strong>: <code>ConvertLatex()</code></p></li></ul><hr><p><code>@get_driver().on_bot_connect</code></p><h3 id="async-func-load-latex-convert" tabindex="-1"><em><strong>async func</strong></em> <code>load_latex_convert()</code> <a class="header-anchor" href="#async-func-load-latex-convert" aria-label="Permalink to "***async func*** \`load_latex_convert()\`""></a></h3><details><summary><b>源代码</b> 或 <a href="https://github.com/LiteyukiStudio/nonebot-plugin-marshoai/tree/main/nonebot_plugin_marshoai/util.py#L335" 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;">@get_driver</span><span style="--shiki-light:#24292E;--shiki-dark:#E1E4E8;">()</span><span style="--shiki-light:#B31D28;--shiki-light-font-style:italic;--shiki-dark:#FDAEB7;--shiki-dark-font-style:italic;">.on_bot_connect</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_latex_convert</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;"> latex_convert.load_channel(</span><span style="--shiki-light:#005CC5;--shiki-dark:#79B8FF;">None</span><span style="--shiki-light:#24292E;--shiki-dark:#E1E4E8;">)</span></span></code></pre></div></details><hr><h3 id="async-func-get-uuid-back2codeblock-msg-str-code-blank-uuid-map-list-tuple-str-str" tabindex="-1"><em><strong>async func</strong></em> <code>get_uuid_back2codeblock(msg: str, code_blank_uuid_map: list[tuple[str, str]])</code> <a class="header-anchor" href="#async-func-get-uuid-back2codeblock-msg-str-code-blank-uuid-map-list-tuple-str-str" aria-label="Permalink to "***async func*** \`get_uuid_back2codeblock(msg: str, code_blank_uuid_map: list[tuple[str, str]])\`""></a></h3><details><summary><b>源代码</b> 或 <a href="https://github.com/LiteyukiStudio/nonebot-plugin-marshoai/tree/main/nonebot_plugin_marshoai/util.py#L339" target="_blank">在GitHub上查看</a></summary><div class="language-python vp-adaptive-theme"><button title="Copy Code" class="copy"></button><span class="lang">python</span><pre class="shiki shiki-themes github-light github-dark vp-code" tabindex="0"><code><span class="line"><span style="--shiki-light:#D73A49;--shiki-dark:#F97583;">async</span><span style="--shiki-light:#D73A49;--shiki-dark:#F97583;"> def</span><span style="--shiki-light:#6F42C1;--shiki-dark:#B392F0;"> get_uuid_back2codeblock</span><span style="--shiki-light:#24292E;--shiki-dark:#E1E4E8;">(msg: </span><span style="--shiki-light:#005CC5;--shiki-dark:#79B8FF;">str</span><span style="--shiki-light:#24292E;--shiki-dark:#E1E4E8;">, code_blank_uuid_map: list[tuple[</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;">str</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;"> latex_convert.load_channel(</span><span style="--shiki-light:#005CC5;--shiki-dark:#79B8FF;">None</span><span style="--shiki-light:#24292E;--shiki-dark:#E1E4E8;">)</span></span></code></pre></div></details><hr><h3 id="async-func-get-uuid-back2codeblock-msg-str-code-blank-uuid-map-list-tuple-str-str" tabindex="-1"><em><strong>async func</strong></em> <code>get_uuid_back2codeblock(msg: str, code_blank_uuid_map: list[tuple[str, str]])</code> <a class="header-anchor" href="#async-func-get-uuid-back2codeblock-msg-str-code-blank-uuid-map-list-tuple-str-str" aria-label="Permalink to "***async func*** \`get_uuid_back2codeblock(msg: str, code_blank_uuid_map: list[tuple[str, str]])\`""></a></h3><details><summary><b>源代码</b> 或 <a href="https://github.com/LiteyukiStudio/nonebot-plugin-marshoai/tree/main/nonebot_plugin_marshoai/util.py#L338" target="_blank">在GitHub上查看</a></summary><div class="language-python vp-adaptive-theme"><button title="Copy Code" class="copy"></button><span class="lang">python</span><pre class="shiki shiki-themes github-light github-dark vp-code" tabindex="0"><code><span class="line"><span style="--shiki-light:#D73A49;--shiki-dark:#F97583;">async</span><span style="--shiki-light:#D73A49;--shiki-dark:#F97583;"> def</span><span style="--shiki-light:#6F42C1;--shiki-dark:#B392F0;"> get_uuid_back2codeblock</span><span style="--shiki-light:#24292E;--shiki-dark:#E1E4E8;">(msg: </span><span style="--shiki-light:#005CC5;--shiki-dark:#79B8FF;">str</span><span style="--shiki-light:#24292E;--shiki-dark:#E1E4E8;">, code_blank_uuid_map: list[tuple[</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;">str</span><span style="--shiki-light:#24292E;--shiki-dark:#E1E4E8;">]]):</span></span>
|
||||
<span class="line"><span style="--shiki-light:#D73A49;--shiki-dark:#F97583;"> for</span><span style="--shiki-light:#24292E;--shiki-dark:#E1E4E8;"> torep, rep </span><span style="--shiki-light:#D73A49;--shiki-dark:#F97583;">in</span><span style="--shiki-light:#24292E;--shiki-dark:#E1E4E8;"> code_blank_uuid_map:</span></span>
|
||||
<span class="line"><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;"> msg.replace(torep, rep)</span></span>
|
||||
<span class="line"><span style="--shiki-light:#D73A49;--shiki-dark:#F97583;"> return</span><span style="--shiki-light:#24292E;--shiki-dark:#E1E4E8;"> msg</span></span></code></pre></div></details><hr><h3 id="async-func-parse-richtext-msg-str-unimessage" tabindex="-1"><em><strong>async func</strong></em> <code>parse_richtext(msg: str) -> UniMessage</code> <a class="header-anchor" href="#async-func-parse-richtext-msg-str-unimessage" aria-label="Permalink to "***async func*** \`parse_richtext(msg: str) -> UniMessage\`""></a></h3><p><strong>说明</strong>: 人工智能给出的回答一般不会包含 HTML 嵌入其中,但是包含图片或者 LaTeX 公式、代码块,都很正常。 这个函数会把这些都以图片形式嵌入消息体。</p><details><summary><b>源代码</b> 或 <a href="https://github.com/LiteyukiStudio/nonebot-plugin-marshoai/tree/main/nonebot_plugin_marshoai/util.py#L348" 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;"> parse_richtext</span><span style="--shiki-light:#24292E;--shiki-dark:#E1E4E8;">(msg: </span><span style="--shiki-light:#005CC5;--shiki-dark:#79B8FF;">str</span><span style="--shiki-light:#24292E;--shiki-dark:#E1E4E8;">) -> UniMessage:</span></span>
|
||||
<span class="line"><span style="--shiki-light:#D73A49;--shiki-dark:#F97583;"> return</span><span style="--shiki-light:#24292E;--shiki-dark:#E1E4E8;"> msg</span></span></code></pre></div></details><hr><h3 id="async-func-parse-richtext-msg-str-unimessage" tabindex="-1"><em><strong>async func</strong></em> <code>parse_richtext(msg: str) -> UniMessage</code> <a class="header-anchor" href="#async-func-parse-richtext-msg-str-unimessage" aria-label="Permalink to "***async func*** \`parse_richtext(msg: str) -> UniMessage\`""></a></h3><p><strong>说明</strong>: 人工智能给出的回答一般不会包含 HTML 嵌入其中,但是包含图片或者 LaTeX 公式、代码块,都很正常。 这个函数会把这些都以图片形式嵌入消息体。</p><details><summary><b>源代码</b> 或 <a href="https://github.com/LiteyukiStudio/nonebot-plugin-marshoai/tree/main/nonebot_plugin_marshoai/util.py#L347" 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;"> parse_richtext</span><span style="--shiki-light:#24292E;--shiki-dark:#E1E4E8;">(msg: </span><span style="--shiki-light:#005CC5;--shiki-dark:#79B8FF;">str</span><span style="--shiki-light:#24292E;--shiki-dark:#E1E4E8;">) -> UniMessage:</span></span>
|
||||
<span class="line"><span style="--shiki-light:#D73A49;--shiki-dark:#F97583;"> if</span><span style="--shiki-light:#D73A49;--shiki-dark:#F97583;"> not</span><span style="--shiki-light:#005CC5;--shiki-dark:#79B8FF;"> IMG_LATEX_PATTERN</span><span style="--shiki-light:#24292E;--shiki-dark:#E1E4E8;">.search(msg):</span></span>
|
||||
<span class="line"><span style="--shiki-light:#D73A49;--shiki-dark:#F97583;"> return</span><span style="--shiki-light:#24292E;--shiki-dark:#E1E4E8;"> UniMessage(msg)</span></span>
|
||||
<span class="line"><span style="--shiki-light:#24292E;--shiki-dark:#E1E4E8;"> result_msg </span><span style="--shiki-light:#D73A49;--shiki-dark:#F97583;">=</span><span style="--shiki-light:#24292E;--shiki-dark:#E1E4E8;"> UniMessage()</span></span>
|
File diff suppressed because one or more lines are too long
@ -1 +1 @@
|
||||
import{_ as s,c as t,ae as i,o as e}from"./chunks/framework.BzDBnRMZ.js";const c=JSON.parse('{"title":"config","description":"","frontmatter":{"title":"config","order":100},"headers":[],"relativePath":"en/dev/api/config.md","filePath":"en/dev/api/config.md","lastUpdated":1734175019000}'),o={name:"en/dev/api/config.md"};function r(n,a,l,h,d,m){return e(),t("div",null,a[0]||(a[0]=[i("",50)]))}const k=s(o,[["render",r]]);export{c as __pageData,k as default};
|
||||
import{_ as s,c as t,ae as i,o as e}from"./chunks/framework.BzDBnRMZ.js";const c=JSON.parse('{"title":"config","description":"","frontmatter":{"title":"config","order":100},"headers":[],"relativePath":"en/dev/api/config.md","filePath":"en/dev/api/config.md","lastUpdated":1738311067000}'),o={name:"en/dev/api/config.md"};function r(n,a,l,h,d,m){return e(),t("div",null,a[0]||(a[0]=[i("",50)]))}const k=s(o,[["render",r]]);export{c as __pageData,k as default};
|
@ -1 +0,0 @@
|
||||
import{_ as o,c as t,j as e,a as n,o as d}from"./chunks/framework.BzDBnRMZ.js";const _=JSON.parse('{"title":"index","description":"","frontmatter":{"title":"index","order":100,"collapsed":true},"headers":[],"relativePath":"en/dev/api/index.md","filePath":"en/dev/api/index.md","lastUpdated":1734175019000}'),r={name:"en/dev/api/index.md"};function i(l,a,s,p,c,m){return d(),t("div",null,a[0]||(a[0]=[e("h1",{id:"module-nonebot-plugin-marshoai",tabindex:"-1"},[e("strong",null,"Module"),n(),e("code",null,"nonebot_plugin_marshoai"),n(),e("a",{class:"header-anchor",href:"#module-nonebot-plugin-marshoai","aria-label":'Permalink to "**Module** `nonebot_plugin_marshoai`"'},"")],-1)]))}const x=o(r,[["render",i]]);export{_ as __pageData,x as default};
|
@ -1 +0,0 @@
|
||||
import{_ as o,c as t,j as e,a as n,o as d}from"./chunks/framework.BzDBnRMZ.js";const _=JSON.parse('{"title":"index","description":"","frontmatter":{"title":"index","order":100,"collapsed":true},"headers":[],"relativePath":"en/dev/api/index.md","filePath":"en/dev/api/index.md","lastUpdated":1734175019000}'),r={name:"en/dev/api/index.md"};function i(l,a,s,p,c,m){return d(),t("div",null,a[0]||(a[0]=[e("h1",{id:"module-nonebot-plugin-marshoai",tabindex:"-1"},[e("strong",null,"Module"),n(),e("code",null,"nonebot_plugin_marshoai"),n(),e("a",{class:"header-anchor",href:"#module-nonebot-plugin-marshoai","aria-label":'Permalink to "**Module** `nonebot_plugin_marshoai`"'},"")],-1)]))}const x=o(r,[["render",i]]);export{_ as __pageData,x as default};
|
1
assets/en_dev_api_index.md.PTQTSFQN.js
Normal file
1
assets/en_dev_api_index.md.PTQTSFQN.js
Normal file
@ -0,0 +1 @@
|
||||
import{_ as i,c as n,j as e,a as t,o as a}from"./chunks/framework.BzDBnRMZ.js";const I=JSON.parse('{"title":"index","description":"","frontmatter":{"title":"index","order":100,"collapsed":true},"headers":[],"relativePath":"en/dev/api/index.md","filePath":"en/dev/api/index.md","lastUpdated":1734175019000}'),s={name:"en/dev/api/index.md"};function r(l,o,d,T,p,O){return a(),n("div",null,o[0]||(o[0]=[e("h1",{id:"module-nonebot-plugin-marshoai",tabindex:"-1"},[e("strong",null,"Module"),t(),e("code",null,"nonebot_plugin_marshoai"),t(),e("a",{class:"header-anchor",href:"#module-nonebot-plugin-marshoai","aria-label":'Permalink to "**Module** `nonebot_plugin_marshoai`"'},"")],-1),e("p",null,"MIT License",-1),e("p",null,"Copyright (c) 2025 Asankilp & LiteyukiStudio",-1),e("p",null,'Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions:',-1),e("p",null,"The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.",-1),e("p",null,'THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.',-1)]))}const c=i(s,[["render",r]]);export{I as __pageData,c as default};
|
1
assets/en_dev_api_index.md.PTQTSFQN.lean.js
Normal file
1
assets/en_dev_api_index.md.PTQTSFQN.lean.js
Normal file
@ -0,0 +1 @@
|
||||
import{_ as i,c as n,j as e,a as t,o as a}from"./chunks/framework.BzDBnRMZ.js";const I=JSON.parse('{"title":"index","description":"","frontmatter":{"title":"index","order":100,"collapsed":true},"headers":[],"relativePath":"en/dev/api/index.md","filePath":"en/dev/api/index.md","lastUpdated":1734175019000}'),s={name:"en/dev/api/index.md"};function r(l,o,d,T,p,O){return a(),n("div",null,o[0]||(o[0]=[e("h1",{id:"module-nonebot-plugin-marshoai",tabindex:"-1"},[e("strong",null,"Module"),t(),e("code",null,"nonebot_plugin_marshoai"),t(),e("a",{class:"header-anchor",href:"#module-nonebot-plugin-marshoai","aria-label":'Permalink to "**Module** `nonebot_plugin_marshoai`"'},"")],-1),e("p",null,"MIT License",-1),e("p",null,"Copyright (c) 2025 Asankilp & LiteyukiStudio",-1),e("p",null,'Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions:',-1),e("p",null,"The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.",-1),e("p",null,'THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.',-1)]))}const c=i(s,[["render",r]]);export{I as __pageData,c as default};
|
@ -0,0 +1 @@
|
||||
import{_ as i,c as a,ae as t,o as n}from"./chunks/framework.BzDBnRMZ.js";const g=JSON.parse('{"title":"index","description":"","frontmatter":{"title":"index","order":100,"collapsed":true},"headers":[],"relativePath":"en/dev/api/plugins_test/marshoai_basic/index.md","filePath":"en/dev/api/plugins_test/marshoai_basic/index.md","lastUpdated":null}'),e={name:"en/dev/api/plugins_test/marshoai_basic/index.md"};function h(l,s,p,r,k,d){return n(),a("div",null,s[0]||(s[0]=[t('<h1 id="module-nonebot-plugin-marshoai-plugins-test-marshoai-basic" tabindex="-1"><strong>Module</strong> <code>nonebot_plugin_marshoai.plugins_test.marshoai_basic</code> <a class="header-anchor" href="#module-nonebot-plugin-marshoai-plugins-test-marshoai-basic" aria-label="Permalink to "**Module** `nonebot_plugin_marshoai.plugins_test.marshoai_basic`""></a></h1><hr><p><code>@on_function_call(description='获取当前时间,日期和星期')</code></p><h3 id="async-func-get-current-time-str" tabindex="-1"><em><strong>async func</strong></em> <code>get_current_time() -> str</code> <a class="header-anchor" href="#async-func-get-current-time-str" aria-label="Permalink to "***async func*** `get_current_time() -> str`""></a></h3><p><strong>Description</strong>: 获取当前的时间和日期</p><details><summary><b>Source code</b> or <a href="https://github.com/LiteyukiStudio/nonebot-plugin-marshoai/tree/main/nonebot_plugin_marshoai/plugins_test/marshoai_basic/__init__.py#L20" target="_blank">View on GitHub</a></summary><div class="language-python vp-adaptive-theme"><button title="Copy Code" class="copy"></button><span class="lang">python</span><pre class="shiki shiki-themes github-light github-dark vp-code" tabindex="0"><code><span class="line"><span style="--shiki-light:#6F42C1;--shiki-dark:#B392F0;">@on_function_call</span><span style="--shiki-light:#24292E;--shiki-dark:#E1E4E8;">(</span><span style="--shiki-light:#E36209;--shiki-dark:#FFAB70;">description</span><span style="--shiki-light:#D73A49;--shiki-dark:#F97583;">=</span><span style="--shiki-light:#032F62;--shiki-dark:#9ECBFF;">'获取当前时间,日期和星期'</span><span style="--shiki-light:#24292E;--shiki-dark:#E1E4E8;">)</span></span>\n<span class="line"><span style="--shiki-light:#D73A49;--shiki-dark:#F97583;">async</span><span style="--shiki-light:#D73A49;--shiki-dark:#F97583;"> def</span><span style="--shiki-light:#6F42C1;--shiki-dark:#B392F0;"> get_current_time</span><span style="--shiki-light:#24292E;--shiki-dark:#E1E4E8;">() -> </span><span style="--shiki-light:#005CC5;--shiki-dark:#79B8FF;">str</span><span style="--shiki-light:#24292E;--shiki-dark:#E1E4E8;">:</span></span>\n<span class="line"><span style="--shiki-light:#24292E;--shiki-dark:#E1E4E8;"> current_time </span><span style="--shiki-light:#D73A49;--shiki-dark:#F97583;">=</span><span style="--shiki-light:#24292E;--shiki-dark:#E1E4E8;"> DateTime.now()</span></span>\n<span class="line"><span style="--shiki-light:#24292E;--shiki-dark:#E1E4E8;"> time_prompt </span><span style="--shiki-light:#D73A49;--shiki-dark:#F97583;">=</span><span style="--shiki-light:#032F62;--shiki-dark:#9ECBFF;"> '现在的时间是 </span><span style="--shiki-light:#005CC5;--shiki-dark:#79B8FF;">{}</span><span style="--shiki-light:#032F62;--shiki-dark:#9ECBFF;">,</span><span style="--shiki-light:#005CC5;--shiki-dark:#79B8FF;">{}</span><span style="--shiki-light:#032F62;--shiki-dark:#9ECBFF;">,</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;">.format(current_time.strftime(</span><span style="--shiki-light:#032F62;--shiki-dark:#9ECBFF;">'%Y.%m.</span><span style="--shiki-light:#005CC5;--shiki-dark:#79B8FF;">%d</span><span style="--shiki-light:#032F62;--shiki-dark:#9ECBFF;"> %H:%M:%S'</span><span style="--shiki-light:#24292E;--shiki-dark:#E1E4E8;">), weekdays[current_time.weekday()], current_time.chinesize.date_hanzify(</span><span style="--shiki-light:#032F62;--shiki-dark:#9ECBFF;">'农历</span><span style="--shiki-light:#005CC5;--shiki-dark:#79B8FF;">{干支年}{生肖}</span><span style="--shiki-light:#032F62;--shiki-dark:#9ECBFF;">年 </span><span style="--shiki-light:#005CC5;--shiki-dark:#79B8FF;">{月份}</span><span style="--shiki-light:#032F62;--shiki-dark:#9ECBFF;">月</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>\n<span class="line"><span style="--shiki-light:#D73A49;--shiki-dark:#F97583;"> return</span><span style="--shiki-light:#24292E;--shiki-dark:#E1E4E8;"> time_prompt</span></span></code></pre></div></details>',6)]))}const c=i(e,[["render",h]]);export{g as __pageData,c as default};
|
@ -1 +1 @@
|
||||
import{_ as i,c as a,ae as n,o as t}from"./chunks/framework.BzDBnRMZ.js";const g=JSON.parse('{"title":"index","description":"","frontmatter":{"title":"index","order":100,"collapsed":true},"headers":[],"relativePath":"en/dev/api/plugins_test/marshoai_basic/index.md","filePath":"en/dev/api/plugins_test/marshoai_basic/index.md","lastUpdated":null}'),e={name:"en/dev/api/plugins_test/marshoai_basic/index.md"};function h(k,s,l,p,r,d){return t(),a("div",null,s[0]||(s[0]=[n("",6)]))}const o=i(e,[["render",h]]);export{g as __pageData,o as default};
|
||||
import{_ as i,c as a,ae as t,o as n}from"./chunks/framework.BzDBnRMZ.js";const g=JSON.parse('{"title":"index","description":"","frontmatter":{"title":"index","order":100,"collapsed":true},"headers":[],"relativePath":"en/dev/api/plugins_test/marshoai_basic/index.md","filePath":"en/dev/api/plugins_test/marshoai_basic/index.md","lastUpdated":null}'),e={name:"en/dev/api/plugins_test/marshoai_basic/index.md"};function h(l,s,p,r,k,d){return n(),a("div",null,s[0]||(s[0]=[t("",6)]))}const c=i(e,[["render",h]]);export{g as __pageData,c as default};
|
@ -1,9 +0,0 @@
|
||||
import{_ as i,c as a,ae as n,o as t}from"./chunks/framework.BzDBnRMZ.js";const g=JSON.parse('{"title":"index","description":"","frontmatter":{"title":"index","order":100,"collapsed":true},"headers":[],"relativePath":"en/dev/api/plugins_test/marshoai_basic/index.md","filePath":"en/dev/api/plugins_test/marshoai_basic/index.md","lastUpdated":null}'),e={name:"en/dev/api/plugins_test/marshoai_basic/index.md"};function h(k,s,l,p,r,d){return t(),a("div",null,s[0]||(s[0]=[n(`<h1 id="module-nonebot-plugin-marshoai-plugins-test-marshoai-basic" tabindex="-1"><strong>Module</strong> <code>nonebot_plugin_marshoai.plugins_test.marshoai_basic</code> <a class="header-anchor" href="#module-nonebot-plugin-marshoai-plugins-test-marshoai-basic" aria-label="Permalink to "**Module** \`nonebot_plugin_marshoai.plugins_test.marshoai_basic\`""></a></h1><hr><p><code>@on_function_call(description='获取当前时间,日期和星期')</code></p><h3 id="async-func-get-current-time-str" tabindex="-1"><em><strong>async func</strong></em> <code>get_current_time() -> str</code> <a class="header-anchor" href="#async-func-get-current-time-str" aria-label="Permalink to "***async func*** \`get_current_time() -> str\`""></a></h3><p><strong>Description</strong>: 获取当前的时间和日期</p><details><summary><b>Source code</b> or <a href="https://github.com/LiteyukiStudio/nonebot-plugin-marshoai/tree/main/nonebot_plugin_marshoai/plugins_test/marshoai_basic/__init__.py#L17" 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;">@on_function_call</span><span style="--shiki-light:#24292E;--shiki-dark:#E1E4E8;">(</span><span style="--shiki-light:#E36209;--shiki-dark:#FFAB70;">description</span><span style="--shiki-light:#D73A49;--shiki-dark:#F97583;">=</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;">async</span><span style="--shiki-light:#D73A49;--shiki-dark:#F97583;"> def</span><span style="--shiki-light:#6F42C1;--shiki-dark:#B392F0;"> get_current_time</span><span style="--shiki-light:#24292E;--shiki-dark:#E1E4E8;">() -> </span><span style="--shiki-light:#005CC5;--shiki-dark:#79B8FF;">str</span><span style="--shiki-light:#24292E;--shiki-dark:#E1E4E8;">:</span></span>
|
||||
<span class="line"><span style="--shiki-light:#24292E;--shiki-dark:#E1E4E8;"> current_time </span><span style="--shiki-light:#D73A49;--shiki-dark:#F97583;">=</span><span style="--shiki-light:#24292E;--shiki-dark:#E1E4E8;"> DateTime.now().strftime(</span><span style="--shiki-light:#032F62;--shiki-dark:#9ECBFF;">'%Y.%m.</span><span style="--shiki-light:#005CC5;--shiki-dark:#79B8FF;">%d</span><span style="--shiki-light:#032F62;--shiki-dark:#9ECBFF;"> %H:%M:%S'</span><span style="--shiki-light:#24292E;--shiki-dark:#E1E4E8;">)</span></span>
|
||||
<span class="line"><span style="--shiki-light:#24292E;--shiki-dark:#E1E4E8;"> current_weekday </span><span style="--shiki-light:#D73A49;--shiki-dark:#F97583;">=</span><span style="--shiki-light:#24292E;--shiki-dark:#E1E4E8;"> DateTime.now().weekday()</span></span>
|
||||
<span class="line"><span style="--shiki-light:#24292E;--shiki-dark:#E1E4E8;"> weekdays </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;">'星期一'</span><span style="--shiki-light:#24292E;--shiki-dark:#E1E4E8;">, </span><span style="--shiki-light:#032F62;--shiki-dark:#9ECBFF;">'星期二'</span><span style="--shiki-light:#24292E;--shiki-dark:#E1E4E8;">, </span><span style="--shiki-light:#032F62;--shiki-dark:#9ECBFF;">'星期三'</span><span style="--shiki-light:#24292E;--shiki-dark:#E1E4E8;">, </span><span style="--shiki-light:#032F62;--shiki-dark:#9ECBFF;">'星期四'</span><span style="--shiki-light:#24292E;--shiki-dark:#E1E4E8;">, </span><span style="--shiki-light:#032F62;--shiki-dark:#9ECBFF;">'星期五'</span><span style="--shiki-light:#24292E;--shiki-dark:#E1E4E8;">, </span><span style="--shiki-light:#032F62;--shiki-dark:#9ECBFF;">'星期六'</span><span style="--shiki-light:#24292E;--shiki-dark:#E1E4E8;">, </span><span style="--shiki-light:#032F62;--shiki-dark:#9ECBFF;">'星期日'</span><span style="--shiki-light:#24292E;--shiki-dark:#E1E4E8;">]</span></span>
|
||||
<span class="line"><span style="--shiki-light:#24292E;--shiki-dark:#E1E4E8;"> current_weekday_name </span><span style="--shiki-light:#D73A49;--shiki-dark:#F97583;">=</span><span style="--shiki-light:#24292E;--shiki-dark:#E1E4E8;"> weekdays[current_weekday]</span></span>
|
||||
<span class="line"><span style="--shiki-light:#24292E;--shiki-dark:#E1E4E8;"> current_lunar_date </span><span style="--shiki-light:#D73A49;--shiki-dark:#F97583;">=</span><span style="--shiki-light:#24292E;--shiki-dark:#E1E4E8;"> DateTime.now().to_lunar().date_hanzify()[</span><span style="--shiki-light:#005CC5;--shiki-dark:#79B8FF;">5</span><span style="--shiki-light:#24292E;--shiki-dark:#E1E4E8;">:]</span></span>
|
||||
<span class="line"><span style="--shiki-light:#24292E;--shiki-dark:#E1E4E8;"> time_prompt </span><span style="--shiki-light:#D73A49;--shiki-dark:#F97583;">=</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;">current_time</span><span style="--shiki-light:#005CC5;--shiki-dark:#79B8FF;">}</span><span style="--shiki-light:#032F62;--shiki-dark:#9ECBFF;">,</span><span style="--shiki-light:#005CC5;--shiki-dark:#79B8FF;">{</span><span style="--shiki-light:#24292E;--shiki-dark:#E1E4E8;">current_weekday_name</span><span style="--shiki-light:#005CC5;--shiki-dark:#79B8FF;">}</span><span style="--shiki-light:#032F62;--shiki-dark:#9ECBFF;">,农历 </span><span style="--shiki-light:#005CC5;--shiki-dark:#79B8FF;">{</span><span style="--shiki-light:#24292E;--shiki-dark:#E1E4E8;">current_lunar_date</span><span style="--shiki-light:#005CC5;--shiki-dark:#79B8FF;">}</span><span style="--shiki-light:#032F62;--shiki-dark:#9ECBFF;">。'</span></span>
|
||||
<span class="line"><span style="--shiki-light:#D73A49;--shiki-dark:#F97583;"> return</span><span style="--shiki-light:#24292E;--shiki-dark:#E1E4E8;"> time_prompt</span></span></code></pre></div></details>`,6)]))}const o=i(e,[["render",h]]);export{g as __pageData,o as default};
|
@ -76,21 +76,20 @@ import{_ as i,c as a,ae as n,o as t}from"./chunks/framework.BzDBnRMZ.js";const g
|
||||
<span class="line"><span style="--shiki-light:#24292E;--shiki-dark:#E1E4E8;"> nickname_json </span><span style="--shiki-light:#D73A49;--shiki-dark:#F97583;">=</span><span style="--shiki-light:#24292E;--shiki-dark:#E1E4E8;"> json.loads(</span><span style="--shiki-light:#D73A49;--shiki-dark:#F97583;">await</span><span style="--shiki-light:#24292E;--shiki-dark:#E1E4E8;"> f.read())</span></span>
|
||||
<span class="line"><span style="--shiki-light:#D73A49;--shiki-dark:#F97583;"> except</span><span style="--shiki-light:#005CC5;--shiki-dark:#79B8FF;"> Exception</span><span style="--shiki-light:#24292E;--shiki-dark:#E1E4E8;">:</span></span>
|
||||
<span class="line"><span style="--shiki-light:#24292E;--shiki-dark:#E1E4E8;"> logger.error(</span><span style="--shiki-light:#032F62;--shiki-dark:#9ECBFF;">'刷新 nickname_json 表错误:无法载入 nickname.json 文件'</span><span style="--shiki-light:#24292E;--shiki-dark:#E1E4E8;">)</span></span></code></pre></div></details><hr><h3 id="func-get-prompt" tabindex="-1"><em><strong>func</strong></em> <code>get_prompt()</code> <a class="header-anchor" href="#func-get-prompt" aria-label="Permalink to "***func*** \`get_prompt()\`""></a></h3><p><strong>Description</strong>: 获取系统提示词</p><details><summary><b>Source code</b> or <a href="https://github.com/LiteyukiStudio/nonebot-plugin-marshoai/tree/main/nonebot_plugin_marshoai/util.py#L255" target="_blank">View on GitHub</a></summary><div class="language-python vp-adaptive-theme"><button title="Copy Code" class="copy"></button><span class="lang">python</span><pre class="shiki shiki-themes github-light github-dark vp-code" tabindex="0"><code><span class="line"><span style="--shiki-light:#D73A49;--shiki-dark:#F97583;">def</span><span style="--shiki-light:#6F42C1;--shiki-dark:#B392F0;"> get_prompt</span><span style="--shiki-light:#24292E;--shiki-dark:#E1E4E8;">():</span></span>
|
||||
<span class="line"><span style="--shiki-light:#24292E;--shiki-dark:#E1E4E8;"> prompts </span><span style="--shiki-light:#D73A49;--shiki-dark:#F97583;">=</span><span style="--shiki-light:#032F62;--shiki-dark:#9ECBFF;"> ''</span></span>
|
||||
<span class="line"><span style="--shiki-light:#24292E;--shiki-dark:#E1E4E8;"> prompts </span><span style="--shiki-light:#D73A49;--shiki-dark:#F97583;">+=</span><span style="--shiki-light:#24292E;--shiki-dark:#E1E4E8;"> config.marshoai_additional_prompt</span></span>
|
||||
<span class="line"><span style="--shiki-light:#24292E;--shiki-dark:#E1E4E8;"> prompts </span><span style="--shiki-light:#D73A49;--shiki-dark:#F97583;">=</span><span style="--shiki-light:#24292E;--shiki-dark:#E1E4E8;"> config.marshoai_additional_prompt</span></span>
|
||||
<span class="line"><span style="--shiki-light:#D73A49;--shiki-dark:#F97583;"> if</span><span style="--shiki-light:#24292E;--shiki-dark:#E1E4E8;"> config.marshoai_enable_praises:</span></span>
|
||||
<span class="line"><span style="--shiki-light:#24292E;--shiki-dark:#E1E4E8;"> praises_prompt </span><span style="--shiki-light:#D73A49;--shiki-dark:#F97583;">=</span><span style="--shiki-light:#24292E;--shiki-dark:#E1E4E8;"> build_praises()</span></span>
|
||||
<span class="line"><span style="--shiki-light:#24292E;--shiki-dark:#E1E4E8;"> prompts </span><span style="--shiki-light:#D73A49;--shiki-dark:#F97583;">+=</span><span style="--shiki-light:#24292E;--shiki-dark:#E1E4E8;"> praises_prompt</span></span>
|
||||
<span class="line"><span style="--shiki-light:#D73A49;--shiki-dark:#F97583;"> if</span><span style="--shiki-light:#24292E;--shiki-dark:#E1E4E8;"> config.marshoai_enable_time_prompt:</span></span>
|
||||
<span class="line"><span style="--shiki-light:#24292E;--shiki-dark:#E1E4E8;"> prompts </span><span style="--shiki-light:#D73A49;--shiki-dark:#F97583;">+=</span><span style="--shiki-light:#24292E;--shiki-dark:#E1E4E8;"> _time_prompt.format(</span><span style="--shiki-light:#E36209;--shiki-dark:#FFAB70;">date_time</span><span style="--shiki-light:#D73A49;--shiki-dark:#F97583;">=</span><span style="--shiki-light:#24292E;--shiki-dark:#E1E4E8;">(current_time </span><span style="--shiki-light:#D73A49;--shiki-dark:#F97583;">:=</span><span style="--shiki-light:#24292E;--shiki-dark:#E1E4E8;"> DateTime.now()).strftime(</span><span style="--shiki-light:#032F62;--shiki-dark:#9ECBFF;">'%Y年%m月</span><span style="--shiki-light:#005CC5;--shiki-dark:#79B8FF;">%d</span><span style="--shiki-light:#032F62;--shiki-dark:#9ECBFF;">日 %H:%M:%S'</span><span style="--shiki-light:#24292E;--shiki-dark:#E1E4E8;">), </span><span style="--shiki-light:#E36209;--shiki-dark:#FFAB70;">weekday_name</span><span style="--shiki-light:#D73A49;--shiki-dark:#F97583;">=</span><span style="--shiki-light:#24292E;--shiki-dark:#E1E4E8;">_weekdays[current_time.weekday()], </span><span style="--shiki-light:#E36209;--shiki-dark:#FFAB70;">lunar_date</span><span style="--shiki-light:#D73A49;--shiki-dark:#F97583;">=</span><span style="--shiki-light:#24292E;--shiki-dark:#E1E4E8;">current_time.to_lunar().date_hanzify(</span><span style="--shiki-light:#032F62;--shiki-dark:#9ECBFF;">'</span><span style="--shiki-light:#005CC5;--shiki-dark:#79B8FF;">{干支年}{生肖}</span><span style="--shiki-light:#032F62;--shiki-dark:#9ECBFF;">年</span><span style="--shiki-light:#005CC5;--shiki-dark:#79B8FF;">{月份}</span><span style="--shiki-light:#032F62;--shiki-dark:#9ECBFF;">月</span><span style="--shiki-light:#005CC5;--shiki-dark:#79B8FF;">{日期}</span><span style="--shiki-light:#032F62;--shiki-dark:#9ECBFF;">日'</span><span style="--shiki-light:#24292E;--shiki-dark:#E1E4E8;">))</span></span>
|
||||
<span class="line"><span style="--shiki-light:#24292E;--shiki-dark:#E1E4E8;"> prompts </span><span style="--shiki-light:#D73A49;--shiki-dark:#F97583;">+=</span><span style="--shiki-light:#24292E;--shiki-dark:#E1E4E8;"> _time_prompt.format(</span><span style="--shiki-light:#E36209;--shiki-dark:#FFAB70;">date_time</span><span style="--shiki-light:#D73A49;--shiki-dark:#F97583;">=</span><span style="--shiki-light:#24292E;--shiki-dark:#E1E4E8;">(current_time </span><span style="--shiki-light:#D73A49;--shiki-dark:#F97583;">:=</span><span style="--shiki-light:#24292E;--shiki-dark:#E1E4E8;"> DateTime.now()).strftime(</span><span style="--shiki-light:#032F62;--shiki-dark:#9ECBFF;">'%Y年%m月</span><span style="--shiki-light:#005CC5;--shiki-dark:#79B8FF;">%d</span><span style="--shiki-light:#032F62;--shiki-dark:#9ECBFF;">日 %H:%M:%S'</span><span style="--shiki-light:#24292E;--shiki-dark:#E1E4E8;">), </span><span style="--shiki-light:#E36209;--shiki-dark:#FFAB70;">weekday_name</span><span style="--shiki-light:#D73A49;--shiki-dark:#F97583;">=</span><span style="--shiki-light:#24292E;--shiki-dark:#E1E4E8;">_weekdays[current_time.weekday()], </span><span style="--shiki-light:#E36209;--shiki-dark:#FFAB70;">lunar_date</span><span style="--shiki-light:#D73A49;--shiki-dark:#F97583;">=</span><span style="--shiki-light:#24292E;--shiki-dark:#E1E4E8;">current_time.chinesize.date_hanzify(</span><span style="--shiki-light:#032F62;--shiki-dark:#9ECBFF;">'农历</span><span style="--shiki-light:#005CC5;--shiki-dark:#79B8FF;">{干支年}{生肖}</span><span style="--shiki-light:#032F62;--shiki-dark:#9ECBFF;">年</span><span style="--shiki-light:#005CC5;--shiki-dark:#79B8FF;">{月份}</span><span style="--shiki-light:#032F62;--shiki-dark:#9ECBFF;">月</span><span style="--shiki-light:#005CC5;--shiki-dark:#79B8FF;">{日期}</span><span style="--shiki-light:#032F62;--shiki-dark:#9ECBFF;">'</span><span style="--shiki-light:#24292E;--shiki-dark:#E1E4E8;">))</span></span>
|
||||
<span class="line"><span style="--shiki-light:#24292E;--shiki-dark:#E1E4E8;"> marsho_prompt </span><span style="--shiki-light:#D73A49;--shiki-dark:#F97583;">=</span><span style="--shiki-light:#24292E;--shiki-dark:#E1E4E8;"> config.marshoai_prompt</span></span>
|
||||
<span class="line"><span style="--shiki-light:#24292E;--shiki-dark:#E1E4E8;"> spell </span><span style="--shiki-light:#D73A49;--shiki-dark:#F97583;">=</span><span style="--shiki-light:#24292E;--shiki-dark:#E1E4E8;"> SystemMessage(</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;">marsho_prompt </span><span style="--shiki-light:#D73A49;--shiki-dark:#F97583;">+</span><span style="--shiki-light:#24292E;--shiki-dark:#E1E4E8;"> prompts).as_dict()</span></span>
|
||||
<span class="line"><span style="--shiki-light:#D73A49;--shiki-dark:#F97583;"> return</span><span style="--shiki-light:#24292E;--shiki-dark:#E1E4E8;"> spell</span></span></code></pre></div></details><hr><h3 id="func-suggest-solution-errinfo-str-str" tabindex="-1"><em><strong>func</strong></em> <code>suggest_solution(errinfo: str) -> str</code> <a class="header-anchor" href="#func-suggest-solution-errinfo-str-str" aria-label="Permalink to "***func*** \`suggest_solution(errinfo: str) -> str\`""></a></h3><details><summary><b>Source code</b> or <a href="https://github.com/LiteyukiStudio/nonebot-plugin-marshoai/tree/main/nonebot_plugin_marshoai/util.py#L279" target="_blank">View on GitHub</a></summary><div class="language-python vp-adaptive-theme"><button title="Copy Code" class="copy"></button><span class="lang">python</span><pre class="shiki shiki-themes github-light github-dark vp-code" tabindex="0"><code><span class="line"><span style="--shiki-light:#D73A49;--shiki-dark:#F97583;">def</span><span style="--shiki-light:#6F42C1;--shiki-dark:#B392F0;"> suggest_solution</span><span style="--shiki-light:#24292E;--shiki-dark:#E1E4E8;">(errinfo: </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;">str</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;"> spell</span></span></code></pre></div></details><hr><h3 id="func-suggest-solution-errinfo-str-str" tabindex="-1"><em><strong>func</strong></em> <code>suggest_solution(errinfo: str) -> str</code> <a class="header-anchor" href="#func-suggest-solution-errinfo-str-str" aria-label="Permalink to "***func*** \`suggest_solution(errinfo: str) -> str\`""></a></h3><details><summary><b>Source code</b> or <a href="https://github.com/LiteyukiStudio/nonebot-plugin-marshoai/tree/main/nonebot_plugin_marshoai/util.py#L278" target="_blank">View on GitHub</a></summary><div class="language-python vp-adaptive-theme"><button title="Copy Code" class="copy"></button><span class="lang">python</span><pre class="shiki shiki-themes github-light github-dark vp-code" tabindex="0"><code><span class="line"><span style="--shiki-light:#D73A49;--shiki-dark:#F97583;">def</span><span style="--shiki-light:#6F42C1;--shiki-dark:#B392F0;"> suggest_solution</span><span style="--shiki-light:#24292E;--shiki-dark:#E1E4E8;">(errinfo: </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;">str</span><span style="--shiki-light:#24292E;--shiki-dark:#E1E4E8;">:</span></span>
|
||||
<span class="line"><span style="--shiki-light:#24292E;--shiki-dark:#E1E4E8;"> suggestions </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;">'content_filter'</span><span style="--shiki-light:#24292E;--shiki-dark:#E1E4E8;">: </span><span style="--shiki-light:#032F62;--shiki-dark:#9ECBFF;">'消息已被内容过滤器过滤。请调整聊天内容后重试。'</span><span style="--shiki-light:#24292E;--shiki-dark:#E1E4E8;">, </span><span style="--shiki-light:#032F62;--shiki-dark:#9ECBFF;">'RateLimitReached'</span><span style="--shiki-light:#24292E;--shiki-dark:#E1E4E8;">: </span><span style="--shiki-light:#032F62;--shiki-dark:#9ECBFF;">'模型达到调用速率限制。请稍等一段时间或联系Bot管理员。'</span><span style="--shiki-light:#24292E;--shiki-dark:#E1E4E8;">, </span><span style="--shiki-light:#032F62;--shiki-dark:#9ECBFF;">'tokens_limit_reached'</span><span style="--shiki-light:#24292E;--shiki-dark:#E1E4E8;">: </span><span style="--shiki-light:#032F62;--shiki-dark:#9ECBFF;">'请求token达到上限。请重置上下文。'</span><span style="--shiki-light:#24292E;--shiki-dark:#E1E4E8;">, </span><span style="--shiki-light:#032F62;--shiki-dark:#9ECBFF;">'content_length_limit'</span><span style="--shiki-light:#24292E;--shiki-dark:#E1E4E8;">: </span><span style="--shiki-light:#032F62;--shiki-dark:#9ECBFF;">'请求体过大。请重置上下文。'</span><span style="--shiki-light:#24292E;--shiki-dark:#E1E4E8;">, </span><span style="--shiki-light:#032F62;--shiki-dark:#9ECBFF;">'unauthorized'</span><span style="--shiki-light:#24292E;--shiki-dark:#E1E4E8;">: </span><span style="--shiki-light:#032F62;--shiki-dark:#9ECBFF;">'访问token无效。请联系Bot管理员。'</span><span style="--shiki-light:#24292E;--shiki-dark:#E1E4E8;">, </span><span style="--shiki-light:#032F62;--shiki-dark:#9ECBFF;">'invalid type: parameter messages.content is of type array but should be of type string.'</span><span style="--shiki-light:#24292E;--shiki-dark:#E1E4E8;">: </span><span style="--shiki-light:#032F62;--shiki-dark:#9ECBFF;">'聊天请求体包含此模型不支持的数据类型。请重置上下文。'</span><span style="--shiki-light:#24292E;--shiki-dark:#E1E4E8;">, </span><span style="--shiki-light:#032F62;--shiki-dark:#9ECBFF;">'At most 1 image(s) may be provided in one request.'</span><span style="--shiki-light:#24292E;--shiki-dark:#E1E4E8;">: </span><span style="--shiki-light:#032F62;--shiki-dark:#9ECBFF;">'此模型只能在上下文中包含1张图片。如果此前的聊天已经发送过图片,请重置上下文。'</span><span style="--shiki-light:#24292E;--shiki-dark:#E1E4E8;">}</span></span>
|
||||
<span class="line"><span style="--shiki-light:#D73A49;--shiki-dark:#F97583;"> for</span><span style="--shiki-light:#24292E;--shiki-dark:#E1E4E8;"> key, suggestion </span><span style="--shiki-light:#D73A49;--shiki-dark:#F97583;">in</span><span style="--shiki-light:#24292E;--shiki-dark:#E1E4E8;"> suggestions.items():</span></span>
|
||||
<span class="line"><span style="--shiki-light:#D73A49;--shiki-dark:#F97583;"> if</span><span style="--shiki-light:#24292E;--shiki-dark:#E1E4E8;"> key </span><span style="--shiki-light:#D73A49;--shiki-dark:#F97583;">in</span><span style="--shiki-light:#24292E;--shiki-dark:#E1E4E8;"> errinfo:</span></span>
|
||||
<span class="line"><span style="--shiki-light:#D73A49;--shiki-dark:#F97583;"> return</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;">\\n{</span><span style="--shiki-light:#24292E;--shiki-dark:#E1E4E8;">suggestion</span><span style="--shiki-light:#005CC5;--shiki-dark:#79B8FF;">}</span><span style="--shiki-light:#032F62;--shiki-dark:#9ECBFF;">'</span></span>
|
||||
<span class="line"><span style="--shiki-light:#D73A49;--shiki-dark:#F97583;"> return</span><span style="--shiki-light:#032F62;--shiki-dark:#9ECBFF;"> ''</span></span></code></pre></div></details><hr><h3 id="async-func-get-backup-context-target-id-str-target-private-bool-list" tabindex="-1"><em><strong>async func</strong></em> <code>get_backup_context(target_id: str, target_private: bool) -> list</code> <a class="header-anchor" href="#async-func-get-backup-context-target-id-str-target-private-bool-list" aria-label="Permalink to "***async func*** \`get_backup_context(target_id: str, target_private: bool) -> list\`""></a></h3><p><strong>Description</strong>: 获取历史上下文</p><details><summary><b>Source code</b> or <a href="https://github.com/LiteyukiStudio/nonebot-plugin-marshoai/tree/main/nonebot_plugin_marshoai/util.py#L298" target="_blank">View on GitHub</a></summary><div class="language-python vp-adaptive-theme"><button title="Copy Code" class="copy"></button><span class="lang">python</span><pre class="shiki shiki-themes github-light github-dark vp-code" tabindex="0"><code><span class="line"><span style="--shiki-light:#D73A49;--shiki-dark:#F97583;">async</span><span style="--shiki-light:#D73A49;--shiki-dark:#F97583;"> def</span><span style="--shiki-light:#6F42C1;--shiki-dark:#B392F0;"> get_backup_context</span><span style="--shiki-light:#24292E;--shiki-dark:#E1E4E8;">(target_id: </span><span style="--shiki-light:#005CC5;--shiki-dark:#79B8FF;">str</span><span style="--shiki-light:#24292E;--shiki-dark:#E1E4E8;">, target_private: </span><span style="--shiki-light:#005CC5;--shiki-dark:#79B8FF;">bool</span><span style="--shiki-light:#24292E;--shiki-dark:#E1E4E8;">) -> </span><span style="--shiki-light:#005CC5;--shiki-dark:#79B8FF;">list</span><span style="--shiki-light:#24292E;--shiki-dark:#E1E4E8;">:</span></span>
|
||||
<span class="line"><span style="--shiki-light:#D73A49;--shiki-dark:#F97583;"> return</span><span style="--shiki-light:#032F62;--shiki-dark:#9ECBFF;"> ''</span></span></code></pre></div></details><hr><h3 id="async-func-get-backup-context-target-id-str-target-private-bool-list" tabindex="-1"><em><strong>async func</strong></em> <code>get_backup_context(target_id: str, target_private: bool) -> list</code> <a class="header-anchor" href="#async-func-get-backup-context-target-id-str-target-private-bool-list" aria-label="Permalink to "***async func*** \`get_backup_context(target_id: str, target_private: bool) -> list\`""></a></h3><p><strong>Description</strong>: 获取历史上下文</p><details><summary><b>Source code</b> or <a href="https://github.com/LiteyukiStudio/nonebot-plugin-marshoai/tree/main/nonebot_plugin_marshoai/util.py#L297" target="_blank">View on GitHub</a></summary><div class="language-python vp-adaptive-theme"><button title="Copy Code" class="copy"></button><span class="lang">python</span><pre class="shiki shiki-themes github-light github-dark vp-code" tabindex="0"><code><span class="line"><span style="--shiki-light:#D73A49;--shiki-dark:#F97583;">async</span><span style="--shiki-light:#D73A49;--shiki-dark:#F97583;"> def</span><span style="--shiki-light:#6F42C1;--shiki-dark:#B392F0;"> get_backup_context</span><span style="--shiki-light:#24292E;--shiki-dark:#E1E4E8;">(target_id: </span><span style="--shiki-light:#005CC5;--shiki-dark:#79B8FF;">str</span><span style="--shiki-light:#24292E;--shiki-dark:#E1E4E8;">, target_private: </span><span style="--shiki-light:#005CC5;--shiki-dark:#79B8FF;">bool</span><span style="--shiki-light:#24292E;--shiki-dark:#E1E4E8;">) -> </span><span style="--shiki-light:#005CC5;--shiki-dark:#79B8FF;">list</span><span style="--shiki-light:#24292E;--shiki-dark:#E1E4E8;">:</span></span>
|
||||
<span class="line"><span style="--shiki-light:#D73A49;--shiki-dark:#F97583;"> global</span><span style="--shiki-light:#24292E;--shiki-dark:#E1E4E8;"> loaded_target_list</span></span>
|
||||
<span class="line"><span style="--shiki-light:#D73A49;--shiki-dark:#F97583;"> if</span><span style="--shiki-light:#24292E;--shiki-dark:#E1E4E8;"> target_private:</span></span>
|
||||
<span class="line"><span style="--shiki-light:#24292E;--shiki-dark:#E1E4E8;"> target_uid </span><span style="--shiki-light:#D73A49;--shiki-dark:#F97583;">=</span><span style="--shiki-light:#D73A49;--shiki-dark:#F97583;"> f</span><span style="--shiki-light:#032F62;--shiki-dark:#9ECBFF;">'private_</span><span style="--shiki-light:#005CC5;--shiki-dark:#79B8FF;">{</span><span style="--shiki-light:#24292E;--shiki-dark:#E1E4E8;">target_id</span><span style="--shiki-light:#005CC5;--shiki-dark:#79B8FF;">}</span><span style="--shiki-light:#032F62;--shiki-dark:#9ECBFF;">'</span></span>
|
||||
@ -99,12 +98,12 @@ import{_ as i,c as a,ae as n,o as t}from"./chunks/framework.BzDBnRMZ.js";const g
|
||||
<span class="line"><span style="--shiki-light:#D73A49;--shiki-dark:#F97583;"> if</span><span style="--shiki-light:#24292E;--shiki-dark:#E1E4E8;"> target_uid </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;"> loaded_target_list:</span></span>
|
||||
<span class="line"><span style="--shiki-light:#24292E;--shiki-dark:#E1E4E8;"> loaded_target_list.append(target_uid)</span></span>
|
||||
<span class="line"><span style="--shiki-light:#D73A49;--shiki-dark:#F97583;"> return</span><span style="--shiki-light:#D73A49;--shiki-dark:#F97583;"> await</span><span style="--shiki-light:#24292E;--shiki-dark:#E1E4E8;"> load_context_from_json(</span><span style="--shiki-light:#D73A49;--shiki-dark:#F97583;">f</span><span style="--shiki-light:#032F62;--shiki-dark:#9ECBFF;">'back_up_context_</span><span style="--shiki-light:#005CC5;--shiki-dark:#79B8FF;">{</span><span style="--shiki-light:#24292E;--shiki-dark:#E1E4E8;">target_uid</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 style="--shiki-light:#032F62;--shiki-dark:#9ECBFF;">'contexts/backup'</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;"> []</span></span></code></pre></div></details><h3 id="var-latex-convert" tabindex="-1">var <code>latex_convert</code> <a class="header-anchor" href="#var-latex-convert" aria-label="Permalink to "var \`latex_convert\`""></a></h3><ul><li><p><strong>Description</strong>: 开启一个转换实例</p></li><li><p><strong>Default</strong>: <code>ConvertLatex()</code></p></li></ul><hr><p><code>@get_driver().on_bot_connect</code></p><h3 id="async-func-load-latex-convert" tabindex="-1"><em><strong>async func</strong></em> <code>load_latex_convert()</code> <a class="header-anchor" href="#async-func-load-latex-convert" aria-label="Permalink to "***async func*** \`load_latex_convert()\`""></a></h3><details><summary><b>Source code</b> or <a href="https://github.com/LiteyukiStudio/nonebot-plugin-marshoai/tree/main/nonebot_plugin_marshoai/util.py#L336" 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;">@get_driver</span><span style="--shiki-light:#24292E;--shiki-dark:#E1E4E8;">()</span><span style="--shiki-light:#B31D28;--shiki-light-font-style:italic;--shiki-dark:#FDAEB7;--shiki-dark-font-style:italic;">.on_bot_connect</span></span>
|
||||
<span class="line"><span style="--shiki-light:#D73A49;--shiki-dark:#F97583;"> return</span><span style="--shiki-light:#24292E;--shiki-dark:#E1E4E8;"> []</span></span></code></pre></div></details><h3 id="var-latex-convert" tabindex="-1">var <code>latex_convert</code> <a class="header-anchor" href="#var-latex-convert" aria-label="Permalink to "var \`latex_convert\`""></a></h3><ul><li><p><strong>Description</strong>: 开启一个转换实例</p></li><li><p><strong>Default</strong>: <code>ConvertLatex()</code></p></li></ul><hr><p><code>@get_driver().on_bot_connect</code></p><h3 id="async-func-load-latex-convert" tabindex="-1"><em><strong>async func</strong></em> <code>load_latex_convert()</code> <a class="header-anchor" href="#async-func-load-latex-convert" aria-label="Permalink to "***async func*** \`load_latex_convert()\`""></a></h3><details><summary><b>Source code</b> or <a href="https://github.com/LiteyukiStudio/nonebot-plugin-marshoai/tree/main/nonebot_plugin_marshoai/util.py#L335" 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;">@get_driver</span><span style="--shiki-light:#24292E;--shiki-dark:#E1E4E8;">()</span><span style="--shiki-light:#B31D28;--shiki-light-font-style:italic;--shiki-dark:#FDAEB7;--shiki-dark-font-style:italic;">.on_bot_connect</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_latex_convert</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;"> latex_convert.load_channel(</span><span style="--shiki-light:#005CC5;--shiki-dark:#79B8FF;">None</span><span style="--shiki-light:#24292E;--shiki-dark:#E1E4E8;">)</span></span></code></pre></div></details><hr><h3 id="async-func-get-uuid-back2codeblock-msg-str-code-blank-uuid-map-list-tuple-str-str" tabindex="-1"><em><strong>async func</strong></em> <code>get_uuid_back2codeblock(msg: str, code_blank_uuid_map: list[tuple[str, str]])</code> <a class="header-anchor" href="#async-func-get-uuid-back2codeblock-msg-str-code-blank-uuid-map-list-tuple-str-str" aria-label="Permalink to "***async func*** \`get_uuid_back2codeblock(msg: str, code_blank_uuid_map: list[tuple[str, str]])\`""></a></h3><details><summary><b>Source code</b> or <a href="https://github.com/LiteyukiStudio/nonebot-plugin-marshoai/tree/main/nonebot_plugin_marshoai/util.py#L339" target="_blank">View on GitHub</a></summary><div class="language-python vp-adaptive-theme"><button title="Copy Code" class="copy"></button><span class="lang">python</span><pre class="shiki shiki-themes github-light github-dark vp-code" tabindex="0"><code><span class="line"><span style="--shiki-light:#D73A49;--shiki-dark:#F97583;">async</span><span style="--shiki-light:#D73A49;--shiki-dark:#F97583;"> def</span><span style="--shiki-light:#6F42C1;--shiki-dark:#B392F0;"> get_uuid_back2codeblock</span><span style="--shiki-light:#24292E;--shiki-dark:#E1E4E8;">(msg: </span><span style="--shiki-light:#005CC5;--shiki-dark:#79B8FF;">str</span><span style="--shiki-light:#24292E;--shiki-dark:#E1E4E8;">, code_blank_uuid_map: list[tuple[</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;">str</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;"> latex_convert.load_channel(</span><span style="--shiki-light:#005CC5;--shiki-dark:#79B8FF;">None</span><span style="--shiki-light:#24292E;--shiki-dark:#E1E4E8;">)</span></span></code></pre></div></details><hr><h3 id="async-func-get-uuid-back2codeblock-msg-str-code-blank-uuid-map-list-tuple-str-str" tabindex="-1"><em><strong>async func</strong></em> <code>get_uuid_back2codeblock(msg: str, code_blank_uuid_map: list[tuple[str, str]])</code> <a class="header-anchor" href="#async-func-get-uuid-back2codeblock-msg-str-code-blank-uuid-map-list-tuple-str-str" aria-label="Permalink to "***async func*** \`get_uuid_back2codeblock(msg: str, code_blank_uuid_map: list[tuple[str, str]])\`""></a></h3><details><summary><b>Source code</b> or <a href="https://github.com/LiteyukiStudio/nonebot-plugin-marshoai/tree/main/nonebot_plugin_marshoai/util.py#L338" target="_blank">View on GitHub</a></summary><div class="language-python vp-adaptive-theme"><button title="Copy Code" class="copy"></button><span class="lang">python</span><pre class="shiki shiki-themes github-light github-dark vp-code" tabindex="0"><code><span class="line"><span style="--shiki-light:#D73A49;--shiki-dark:#F97583;">async</span><span style="--shiki-light:#D73A49;--shiki-dark:#F97583;"> def</span><span style="--shiki-light:#6F42C1;--shiki-dark:#B392F0;"> get_uuid_back2codeblock</span><span style="--shiki-light:#24292E;--shiki-dark:#E1E4E8;">(msg: </span><span style="--shiki-light:#005CC5;--shiki-dark:#79B8FF;">str</span><span style="--shiki-light:#24292E;--shiki-dark:#E1E4E8;">, code_blank_uuid_map: list[tuple[</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;">str</span><span style="--shiki-light:#24292E;--shiki-dark:#E1E4E8;">]]):</span></span>
|
||||
<span class="line"><span style="--shiki-light:#D73A49;--shiki-dark:#F97583;"> for</span><span style="--shiki-light:#24292E;--shiki-dark:#E1E4E8;"> torep, rep </span><span style="--shiki-light:#D73A49;--shiki-dark:#F97583;">in</span><span style="--shiki-light:#24292E;--shiki-dark:#E1E4E8;"> code_blank_uuid_map:</span></span>
|
||||
<span class="line"><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;"> msg.replace(torep, rep)</span></span>
|
||||
<span class="line"><span style="--shiki-light:#D73A49;--shiki-dark:#F97583;"> return</span><span style="--shiki-light:#24292E;--shiki-dark:#E1E4E8;"> msg</span></span></code></pre></div></details><hr><h3 id="async-func-parse-richtext-msg-str-unimessage" tabindex="-1"><em><strong>async func</strong></em> <code>parse_richtext(msg: str) -> UniMessage</code> <a class="header-anchor" href="#async-func-parse-richtext-msg-str-unimessage" aria-label="Permalink to "***async func*** \`parse_richtext(msg: str) -> UniMessage\`""></a></h3><p><strong>Description</strong>: 人工智能给出的回答一般不会包含 HTML 嵌入其中,但是包含图片或者 LaTeX 公式、代码块,都很正常。 这个函数会把这些都以图片形式嵌入消息体。</p><details><summary><b>Source code</b> or <a href="https://github.com/LiteyukiStudio/nonebot-plugin-marshoai/tree/main/nonebot_plugin_marshoai/util.py#L348" 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;"> parse_richtext</span><span style="--shiki-light:#24292E;--shiki-dark:#E1E4E8;">(msg: </span><span style="--shiki-light:#005CC5;--shiki-dark:#79B8FF;">str</span><span style="--shiki-light:#24292E;--shiki-dark:#E1E4E8;">) -> UniMessage:</span></span>
|
||||
<span class="line"><span style="--shiki-light:#D73A49;--shiki-dark:#F97583;"> return</span><span style="--shiki-light:#24292E;--shiki-dark:#E1E4E8;"> msg</span></span></code></pre></div></details><hr><h3 id="async-func-parse-richtext-msg-str-unimessage" tabindex="-1"><em><strong>async func</strong></em> <code>parse_richtext(msg: str) -> UniMessage</code> <a class="header-anchor" href="#async-func-parse-richtext-msg-str-unimessage" aria-label="Permalink to "***async func*** \`parse_richtext(msg: str) -> UniMessage\`""></a></h3><p><strong>Description</strong>: 人工智能给出的回答一般不会包含 HTML 嵌入其中,但是包含图片或者 LaTeX 公式、代码块,都很正常。 这个函数会把这些都以图片形式嵌入消息体。</p><details><summary><b>Source code</b> or <a href="https://github.com/LiteyukiStudio/nonebot-plugin-marshoai/tree/main/nonebot_plugin_marshoai/util.py#L347" 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;"> parse_richtext</span><span style="--shiki-light:#24292E;--shiki-dark:#E1E4E8;">(msg: </span><span style="--shiki-light:#005CC5;--shiki-dark:#79B8FF;">str</span><span style="--shiki-light:#24292E;--shiki-dark:#E1E4E8;">) -> UniMessage:</span></span>
|
||||
<span class="line"><span style="--shiki-light:#D73A49;--shiki-dark:#F97583;"> if</span><span style="--shiki-light:#D73A49;--shiki-dark:#F97583;"> not</span><span style="--shiki-light:#005CC5;--shiki-dark:#79B8FF;"> IMG_LATEX_PATTERN</span><span style="--shiki-light:#24292E;--shiki-dark:#E1E4E8;">.search(msg):</span></span>
|
||||
<span class="line"><span style="--shiki-light:#D73A49;--shiki-dark:#F97583;"> return</span><span style="--shiki-light:#24292E;--shiki-dark:#E1E4E8;"> UniMessage(msg)</span></span>
|
||||
<span class="line"><span style="--shiki-light:#24292E;--shiki-dark:#E1E4E8;"> result_msg </span><span style="--shiki-light:#D73A49;--shiki-dark:#F97583;">=</span><span style="--shiki-light:#24292E;--shiki-dark:#E1E4E8;"> UniMessage()</span></span>
|
File diff suppressed because one or more lines are too long
@ -1 +1 @@
|
||||
import{_ as e,c as d,ae as o,o as a}from"./chunks/framework.BzDBnRMZ.js";const u=JSON.parse('{"title":"","description":"","frontmatter":{},"headers":[],"relativePath":"en/start/install.md","filePath":"en/start/install.md","lastUpdated":1737975015000}'),s={name:"en/start/install.md"};function i(r,t,n,l,c,h){return a(),d("div",null,t[0]||(t[0]=[o("",29)]))}const m=e(s,[["render",i]]);export{u as __pageData,m as default};
|
||||
import{_ as e,c as d,ae as o,o as a}from"./chunks/framework.BzDBnRMZ.js";const u=JSON.parse('{"title":"","description":"","frontmatter":{},"headers":[],"relativePath":"en/start/install.md","filePath":"en/start/install.md","lastUpdated":1738311067000}'),s={name:"en/start/install.md"};function i(r,t,n,l,c,h){return a(),d("div",null,t[0]||(t[0]=[o("",29)]))}const m=e(s,[["render",i]]);export{u as __pageData,m as default};
|
File diff suppressed because one or more lines are too long
@ -1 +1 @@
|
||||
import{_ as d,c as e,ae as a,o}from"./chunks/framework.BzDBnRMZ.js";const k=JSON.parse('{"title":"安装","description":"","frontmatter":{"title":"安装"},"headers":[],"relativePath":"start/install-old.md","filePath":"zh/start/install-old.md","lastUpdated":1737825849000}'),s={name:"start/install-old.md"};function i(n,t,r,l,h,c){return o(),e("div",null,t[0]||(t[0]=[a("",24)]))}const E=d(s,[["render",i]]);export{k as __pageData,E as default};
|
||||
import{_ as d,c as e,ae as a,o}from"./chunks/framework.BzDBnRMZ.js";const k=JSON.parse('{"title":"安装","description":"","frontmatter":{"title":"安装"},"headers":[],"relativePath":"start/install-old.md","filePath":"zh/start/install-old.md","lastUpdated":1738311067000}'),s={name:"start/install-old.md"};function i(n,t,r,l,h,c){return o(),e("div",null,t[0]||(t[0]=[a("",24)]))}const E=d(s,[["render",i]]);export{k as __pageData,E as default};
|
File diff suppressed because one or more lines are too long
@ -1 +1 @@
|
||||
import{_ as d,c as e,ae as o,o as a}from"./chunks/framework.BzDBnRMZ.js";const A=JSON.parse('{"title":"安装","description":"","frontmatter":{"title":"安装"},"headers":[],"relativePath":"start/install.md","filePath":"zh/start/install.md","lastUpdated":1737975015000}'),s={name:"start/install.md"};function i(r,t,n,l,c,h){return a(),e("div",null,t[0]||(t[0]=[o("",29)]))}const E=d(s,[["render",i]]);export{A as __pageData,E as default};
|
||||
import{_ as d,c as e,ae as o,o as a}from"./chunks/framework.BzDBnRMZ.js";const A=JSON.parse('{"title":"安装","description":"","frontmatter":{"title":"安装"},"headers":[],"relativePath":"start/install.md","filePath":"zh/start/install.md","lastUpdated":1738311067000}'),s={name:"start/install.md"};function i(r,t,n,l,c,h){return a(),e("div",null,t[0]||(t[0]=[o("",29)]))}const E=d(s,[["render",i]]);export{A as __pageData,E 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
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