nonebot-plugin-marshoai/assets/start_install.md.C7_de2qq.js

20 lines
13 KiB
JavaScript
Raw Blame History

This file contains invisible Unicode characters

This file contains invisible Unicode characters that are indistinguishable to humans but may be processed differently by a computer. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

import{_ as d,c as e,ae as a,o}from"./chunks/framework.BzDBnRMZ.js";const A=JSON.parse('{"title":"安装","description":"","frontmatter":{"title":"安装"},"headers":[],"relativePath":"start/install.md","filePath":"zh/start/install.md","lastUpdated":1737825849000}'),s={name:"start/install.md"};function i(r,t,n,l,c,h){return o(),e("div",null,t[0]||(t[0]=[a(`<h2 id="💿-安装" tabindex="-1">💿 安装 <a class="header-anchor" href="#💿-安装" aria-label="Permalink to &quot;💿 安装&quot;"></a></h2><details open><summary>使用 nb-cli 安装</summary> 在 nonebot2 项目的根目录下打开命令行, 输入以下指令即可安装 <pre><code>nb plugin install nonebot-plugin-marshoai
</code></pre></details><details><summary>使用包管理器安装</summary> 在 nonebot2 项目的插件目录下, 打开命令行, 根据你使用的包管理器, 输入相应的安装命令 <details><summary>pip</summary><pre><code>pip install nonebot-plugin-marshoai
</code></pre></details><details><summary>pdm</summary><pre><code>pdm add nonebot-plugin-marshoai
</code></pre></details><details><summary>poetry</summary><pre><code>poetry add nonebot-plugin-marshoai
</code></pre></details><details><summary>conda</summary><pre><code>conda install nonebot-plugin-marshoai
</code></pre></details><p>打开 nonebot2 项目根目录下的 <code>pyproject.toml</code> 文件, 在 <code>[tool.nonebot]</code> 部分追加写入</p><pre><code>plugins = [&quot;nonebot_plugin_marshoai&quot;]
</code></pre></details><h2 id="🤖-获取-token-github-models" tabindex="-1">🤖 获取 token(GitHub Models) <a class="header-anchor" href="#🤖-获取-token-github-models" aria-label="Permalink to &quot;🤖 获取 token(GitHub Models)&quot;"></a></h2><ul><li>新建一个<a href="https://github.com/settings/tokens/new" target="_blank" rel="noreferrer">personal access token</a><strong>不需要给予任何权限</strong>。</li><li>将新建的 token 复制,添加到<code>.env</code>文件中的<code>marshoai_token</code>配置项中。</li></ul><div class="warning custom-block"><p class="custom-block-title">WARNING</p><p>GitHub Models API 的限制较多,不建议使用,建议通过修改<code>MARSHOAI_AZURE_ENDPOINT</code>配置项来使用其它提供者的模型。</p></div><h2 id="🎉-使用" tabindex="-1">🎉 使用 <a class="header-anchor" href="#🎉-使用" aria-label="Permalink to &quot;🎉 使用&quot;"></a></h2><p>发送<code>marsho</code>指令可以获取使用说明(若在配置中自定义了指令前缀请使用自定义的指令前缀)。</p><h4 id="👉-戳一戳" tabindex="-1">👉 戳一戳 <a class="header-anchor" href="#👉-戳一戳" aria-label="Permalink to &quot;👉 戳一戳&quot;"></a></h4><p>当 nonebot 连接到支持的 OneBot v11 实现端时,可以接收头像双击戳一戳消息并进行响应。详见<code>MARSHOAI_POKE_SUFFIX</code>配置项。</p><h2 id="🛠️-小棉工具-已弃用" tabindex="-1">🛠️ <s>小棉工具</s>(已弃用) <a class="header-anchor" href="#🛠️-小棉工具-已弃用" aria-label="Permalink to &quot;🛠️ ~~小棉工具~~(已弃用)&quot;"></a></h2><p>小棉工具(MarshoTools)是<code>v0.5.0</code>版本的新增功能,支持加载外部函数库来为 Marsho 提供 Function Call 功能。</p><h2 id="🧩-小棉插件" tabindex="-1">🧩 小棉插件 <a class="header-anchor" href="#🧩-小棉插件" aria-label="Permalink to &quot;🧩 小棉插件&quot;"></a></h2><p>小棉插件是<code>v1.0.0</code>的新增功能,替代旧的小棉工具功能。<a href="https://marsho.liteyuki.icu/dev/extension" target="_blank" rel="noreferrer">使用文档</a></p><h2 id="👍-夸赞名单" tabindex="-1">👍 夸赞名单 <a class="header-anchor" href="#👍-夸赞名单" aria-label="Permalink to &quot;👍 夸赞名单&quot;"></a></h2><p>夸赞名单存储于插件数据目录下的<code>praises.json</code>里(该目录路径会在 Bot 启动时输出到日志),当配置项为<code>true</code> 时发起一次聊天后自动生成,包含人物名字与人物优点两个基本数据。 存储于其中的人物会被 Marsho “认识”和“喜欢”。 其结构类似于:</p><div class="language-json vp-adaptive-theme"><button title="Copy Code" class="copy"></button><span class="lang">json</span><pre class="shiki shiki-themes github-light github-dark vp-code" tabindex="0"><code><span class="line"><span style="--shiki-light:#24292E;--shiki-dark:#E1E4E8;">{</span></span>
<span class="line"><span style="--shiki-light:#005CC5;--shiki-dark:#79B8FF;"> &quot;like&quot;</span><span style="--shiki-light:#24292E;--shiki-dark:#E1E4E8;">: [</span></span>
<span class="line"><span style="--shiki-light:#24292E;--shiki-dark:#E1E4E8;"> {</span></span>
<span class="line"><span style="--shiki-light:#005CC5;--shiki-dark:#79B8FF;"> &quot;name&quot;</span><span style="--shiki-light:#24292E;--shiki-dark:#E1E4E8;">: </span><span style="--shiki-light:#032F62;--shiki-dark:#9ECBFF;">&quot;Asankilp&quot;</span><span style="--shiki-light:#24292E;--shiki-dark:#E1E4E8;">,</span></span>
<span class="line"><span style="--shiki-light:#005CC5;--shiki-dark:#79B8FF;"> &quot;advantages&quot;</span><span style="--shiki-light:#24292E;--shiki-dark:#E1E4E8;">: </span><span style="--shiki-light:#032F62;--shiki-dark:#9ECBFF;">&quot;赋予了Marsho猫娘人格使用vim与vscode为Marsho写了许多代码使Marsho更加可爱&quot;</span></span>
<span class="line"><span style="--shiki-light:#24292E;--shiki-dark:#E1E4E8;"> },</span></span>
<span class="line"><span style="--shiki-light:#24292E;--shiki-dark:#E1E4E8;"> {</span></span>
<span class="line"><span style="--shiki-light:#005CC5;--shiki-dark:#79B8FF;"> &quot;name&quot;</span><span style="--shiki-light:#24292E;--shiki-dark:#E1E4E8;">: </span><span style="--shiki-light:#032F62;--shiki-dark:#9ECBFF;">&quot;神羽(snowykami)&quot;</span><span style="--shiki-light:#24292E;--shiki-dark:#E1E4E8;">,</span></span>
<span class="line"><span style="--shiki-light:#005CC5;--shiki-dark:#79B8FF;"> &quot;advantages&quot;</span><span style="--shiki-light:#24292E;--shiki-dark:#E1E4E8;">: </span><span style="--shiki-light:#032F62;--shiki-dark:#9ECBFF;">&quot;人脉很广,经常找小伙伴们开银趴,很会写后端代码&quot;</span></span>
<span class="line"><span style="--shiki-light:#24292E;--shiki-dark:#E1E4E8;"> },</span></span>
<span class="line"><span style="--shiki-light:#B31D28;--shiki-light-font-style:italic;--shiki-dark:#FDAEB7;--shiki-dark-font-style:italic;"> ...</span></span>
<span class="line"><span style="--shiki-light:#24292E;--shiki-dark:#E1E4E8;"> ]</span></span>
<span class="line"><span style="--shiki-light:#24292E;--shiki-dark:#E1E4E8;">}</span></span></code></pre></div><h2 id="⚙️-可配置项" tabindex="-1">⚙️ 可配置项 <a class="header-anchor" href="#⚙️-可配置项" aria-label="Permalink to &quot;⚙️ 可配置项&quot;"></a></h2><p>在 nonebot2 项目的<code>.env</code>文件中添加下表中的配置</p><h4 id="插件行为" tabindex="-1">插件行为 <a class="header-anchor" href="#插件行为" aria-label="Permalink to &quot;插件行为&quot;"></a></h4><table tabindex="0"><thead><tr><th>配置项</th><th>类型</th><th>默认值</th><th>说明</th></tr></thead><tbody><tr><td>MARSHOAI_USE_YAML_CONFIG</td><td><code>bool</code></td><td><code>false</code></td><td>是否使用 YAML 配置文件格式</td></tr><tr><td>MARSHOAI_DEVMODE</td><td><code>bool</code></td><td><code>false</code></td><td>是否启用开发者模式</td></tr></tbody></table><h4 id="marsho-使用方式" tabindex="-1">Marsho 使用方式 <a class="header-anchor" href="#marsho-使用方式" aria-label="Permalink to &quot;Marsho 使用方式&quot;"></a></h4><table tabindex="0"><thead><tr><th>配置项</th><th>类型</th><th>默认值</th><th>说明</th></tr></thead><tbody><tr><td>MARSHOAI_DEFAULT_NAME</td><td><code>str</code></td><td><code>marsho</code></td><td>调用 Marsho 默认的命令前缀</td></tr><tr><td>MARSHOAI_ALIASES</td><td><code>set[str]</code></td><td><code>list[&quot;小棉&quot;]</code></td><td>调用 Marsho 的命令别名</td></tr><tr><td>MARSHOAI_AT</td><td><code>bool</code></td><td><code>false</code></td><td>决定是否使用at触发</td></tr><tr><td>MARSHOAI_MAIN_COLOUR</td><td><code>str</code></td><td><code>FFAAAA</code></td><td>主题色,部分工具和功能可用</td></tr></tbody></table><h4 id="ai-调用" tabindex="-1">AI 调用 <a class="header-anchor" href="#ai-调用" aria-label="Permalink to &quot;AI 调用&quot;"></a></h4><table tabindex="0"><thead><tr><th>配置项</th><th>类型</th><th>默认值</th><th>说明</th></tr></thead><tbody><tr><td>MARSHOAI_TOKEN</td><td><code>str</code></td><td></td><td>调用 AI API 所需的 token</td></tr><tr><td>MARSHOAI_DEFAULT_MODEL</td><td><code>str</code></td><td><code>gpt-4o-mini</code></td><td>Marsho 默认调用的模型</td></tr><tr><td>MARSHOAI_PROMPT</td><td><code>str</code></td><td>猫娘 Marsho 人设提示词</td><td>Marsho 的基本系统提示词 <strong>※部分模型(o1等)不支持系统提示词。</strong></td></tr><tr><td>MARSHOAI_ADDITIONAL_PROMPT</td><td><code>str</code></td><td></td><td>Marsho 的扩展系统提示词</td></tr><tr><td>MARSHOAI_ENFORCE_NICKNAME</td><td><code>bool</code></td><td><code>true</code></td><td>是否强制用户设置昵称</td></tr><tr><td>MARSHOAI_POKE_SUFFIX</td><td><code>str</code></td><td><code>揉了揉你的猫耳</code></td><td>对 Marsho 所连接的 OneBot 用户进行双击戳一戳时,构建的聊天内容。此配置项为空字符串时,戳一戳响应功能会被禁用。例如,默认值构建的聊天内容将为<code>*[昵称]揉了揉你的猫耳。</code></td></tr><tr><td>MARSHOAI_AZURE_ENDPOINT</td><td><code>str</code></td><td><code>https://models.inference.ai.azure.com</code></td><td>OpenAI 标准格式 API 端点</td></tr><tr><td>MARSHOAI_TEMPERATURE</td><td><code>float</code></td><td><code>null</code></td><td>推理生成多样性(温度)参数</td></tr><tr><td>MARSHOAI_TOP_P</td><td><code>float</code></td><td><code>null</code></td><td>推理核采样参数</td></tr><tr><td>MARSHOAI_MAX_TOKENS</td><td><code>int</code></td><td><code>null</code></td><td>最大生成 token 数</td></tr><tr><td>MARSHOAI_ADDITIONAL_IMAGE_MODELS</td><td><code>list</code></td><td><code>[]</code></td><td>额外添加的支持图片的模型列表,例如<code>hunyuan-vision</code></td></tr><tr><td>MARSHOAI_NICKNAME_LIMIT</td><td><code>int</code></td><td><code>16</code></td><td>昵称长度限制</td></tr><tr><td>MARSHOAI_FIX_TOOLCALLS</td><td><code>bool</code></td><td><code>true</code></td><td>是否修复工具调用(部分模型须关闭,使用 vLLM 部署的模型时须关闭)</td></tr></tbody></table><h4 id="功能开关" tabindex="-1">功能开关 <a class="header-anchor" href="#功能开关" aria-label="Permalink to &quot;功能开关&quot;"></a></h4><table tabindex="0"><thead><tr><th>配置项</th><th>类型</th><th>默认值</th><th>说明</th></tr></thead><tbody><tr><td>MARSHOAI_ENABLE_SUPPORT_IMAGE_TIP</td><td><code>bool</code></td><td><code>true</code></td><td>启用后用户发送带图请求时若模型不支持图片,则提示用户</td></tr><tr><td>MARSHOAI_ENABLE_NICKNAME_TIP</td><td><code>bool</code></td><td><code>true</code></td><td>启用后用户未设置昵称时提示用户设置</td></tr><tr><td>MARSHOAI_ENABLE_PRAISES</td><td><code>bool</code></td><td><code>true</code></td><td>是否启用夸赞名单功能</td></tr><tr><td>MARSHOAI_ENABLE_TIME_PROMPT</td><td><code>bool</code></td><td><code>true</code></td><td>是否启用实时更新的日期与时间(精确到秒)与农历日期系统提示词</td></tr><tr><td>MARSHOAI_ENABLE_TOOLS</td><td><code>bool</code></td><td><code>false</code></td><td>是否启用小棉工具</td></tr><tr><td>MARSHOAI_ENABLE_PLUGINS</td><td><code>bool</code></td><td><code>true</code></td><td>是否启用小棉插件</td></tr><tr><td>MARSHOAI_PLUGINS</td><td><code>list[str]</code></td><td><code>[]</code></td><td>要从<code>sys.path</code>加载的插件的名称例如从pypi安装的包</td></tr><tr><td>MARSHOAI_PLUGIN_DIRS</td><td><code>list[str]</code></td><td><code>[]</code></td><td>插件目录路径列表</td></tr><tr><td>MARSHOAI_LOAD_BUILTIN_TOOLS</td><td><code>bool</code></td><td><code>true</code></td><td>是否加载内置工具包</td></tr><tr><td>MARSHOAI_TOOLSET_DIR</td><td><code>list</code></td><td><code>[]</code></td><td>外部工具集路径列表</td></tr><tr><td>MARSHOAI_DISABLED_TOOLKITS</td><td><code>list</code></td><td><code>[]</code></td><td>禁用的工具包包名列表</td></tr><tr><td>MARSHOAI_ENABLE_RICHTEXT_PARSE</td><td><code>bool</code></td><td><code>true</code></td><td>是否启用自动解析消息若包含图片链接则发送图片、若包含LaTeX公式则发送公式图</td></tr><tr><td>MARSHOAI_SINGLE_LATEX_PARSE</td><td><code>bool</code></td><td><code>false</code></td><td>单行公式是否渲染(当消息富文本解析启用时可用)(如果单行也渲……只能说不好看)</td></tr></tbody></table><h4 id="开发及调试选项" tabindex="-1">开发及调试选项 <a class="header-anchor" href="#开发及调试选项" aria-label="Permalink to &quot;开发及调试选项&quot;"></a></h4><table tabindex="0"><thead><tr><th>配置项</th><th>类型</th><th>默认值</th><th>说明</th></tr></thead><tbody><tr><td>MARSHOAI_DEVMODE</td><td><code>bool</code></td><td><code>false</code></td><td>是否启用开发者模式</td></tr></tbody></table>`,29)]))}const E=d(s,[["render",i]]);export{A as __pageData,E as default};