mirror of
https://github.com/memohai/Memoh.git
synced 2026-04-25 07:00:48 +09:00
7 lines
8.0 KiB
JavaScript
7 lines
8.0 KiB
JavaScript
import{_ as a,o as t,c as e,ag as i}from"./chunks/framework.CAXxHpAX.js";const k=JSON.parse('{"title":"内置记忆","description":"","frontmatter":{},"headers":[],"relativePath":"zh/memory-providers/builtin.md","filePath":"zh/memory-providers/builtin.md","lastUpdated":1777012567000}'),r={name:"zh/memory-providers/builtin.md"};function n(o,s,d,l,h,p){return t(),e("div",null,[...s[0]||(s[0]=[i(`<h1 id="内置记忆" tabindex="-1">内置记忆 <a class="header-anchor" href="#内置记忆" aria-label="Permalink to "内置记忆""></a></h1><p>自带默认记忆后端,接 Memoh 的抽取/检索流程,支持:</p><ul><li>从对话里抽记忆</li><li>聊天时语义检索</li><li>手建、手改</li><li>记忆压缩、整库重建</li></ul><p>三种 <strong>memory mode</strong>,对基础设施和效果要求不同。</p><hr><h2 id="模式" tabindex="-1">模式 <a class="header-anchor" href="#模式" aria-label="Permalink to "模式""></a></h2><table tabindex="0"><thead><tr><th>模式</th><th>索引</th><th>要啥</th><th>适合</th></tr></thead><tbody><tr><td><strong>Off</strong></td><td>仅文件</td><td>无额外服务</td><td>最轻,不做向量</td></tr><tr><td><strong>Sparse</strong></td><td>神经稀疏向量</td><td>sparse 服务 + Qdrant(<code>--profile sparse</code> 等)</td><td>不想交 embedding API 钱、又要比纯词匹配强</td></tr><tr><td><strong>Dense</strong></td><td>稠密向量</td><td>embedding 模型 + Qdrant(<code>--profile qdrant</code>)</td><td>要稠密语义检索时</td></tr></tbody></table><h3 id="sparse-在干什么" tabindex="-1">Sparse 在干什么 <a class="header-anchor" href="#sparse-在干什么" aria-label="Permalink to "Sparse 在干什么""></a></h3><p>用 OpenSearch 项目放出来的 <a href="https://huggingface.co/opensearch-project/opensearch-neural-sparse-encoding-multilingual-v1" target="_blank" rel="noreferrer"><code>opensearch-neural-sparse-encoding-multilingual-v1</code></a> 把文字变成<strong>稀疏向量</strong>(一批 token 下标 + 权重)。不另买 embedding API,在 <code>sparse</code> 容器里本地跑。多语言,一般比只关键词强不少。</p><hr><h2 id="建一个" tabindex="-1">建一个 <a class="header-anchor" href="#建一个" aria-label="Permalink to "建一个""></a></h2><ol><li><strong>Memory Providers</strong>。</li><li><strong>Add Memory Provider</strong>。</li><li><strong>Name</strong>、<strong>Provider Type</strong> 选 <code>builtin</code>。</li><li><strong>Create</strong>。</li></ol><hr><h2 id="配置" tabindex="-1">配置 <a class="header-anchor" href="#配置" aria-label="Permalink to "配置""></a></h2><table tabindex="0"><thead><tr><th>字段</th><th>说明</th></tr></thead><tbody><tr><td><strong>Memory Mode</strong></td><td><code>off</code>(默认)/ <code>sparse</code> / <code>dense</code></td></tr><tr><td><strong>Embedding Model</strong></td><td>仅 <code>dense</code> 要,指向你的 embedding 模型</td></tr><tr><td><strong>Qdrant Collection</strong></td><td>集合名,默认常是 <code>memory_sparse</code> 等(以界面为准)</td></tr></tbody></table><p><strong>Edit</strong>、<strong>Delete</strong> 如常。</p><hr><h2 id="依赖" tabindex="-1">依赖 <a class="header-anchor" href="#依赖" aria-label="Permalink to "依赖""></a></h2><h3 id="off" tabindex="-1">Off <a class="header-anchor" href="#off" aria-label="Permalink to "Off""></a></h3><p>只要文件侧索引,无向量服务。</p><h3 id="sparse" tabindex="-1">Sparse <a class="header-anchor" href="#sparse" aria-label="Permalink to "Sparse""></a></h3><p>要 <strong>sparse 服务</strong> + <strong>Qdrant</strong>:</p><div class="language-bash vp-adaptive-theme"><button title="Copy Code" class="copy"></button><span class="lang">bash</span><pre class="shiki shiki-themes github-light github-dark vp-code" tabindex="0"><code><span class="line"><span style="--shiki-light:#6F42C1;--shiki-dark:#B392F0;">docker</span><span style="--shiki-light:#032F62;--shiki-dark:#9ECBFF;"> compose</span><span style="--shiki-light:#005CC5;--shiki-dark:#79B8FF;"> --profile</span><span style="--shiki-light:#032F62;--shiki-dark:#9ECBFF;"> qdrant</span><span style="--shiki-light:#005CC5;--shiki-dark:#79B8FF;"> --profile</span><span style="--shiki-light:#032F62;--shiki-dark:#9ECBFF;"> sparse</span><span style="--shiki-light:#032F62;--shiki-dark:#9ECBFF;"> up</span><span style="--shiki-light:#005CC5;--shiki-dark:#79B8FF;"> -d</span></span></code></pre></div><p><code>config.toml</code> 里至少要有类似:</p><div class="language-toml vp-adaptive-theme"><button title="Copy Code" class="copy"></button><span class="lang">toml</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 style="--shiki-light:#6F42C1;--shiki-dark:#B392F0;">qdrant</span><span style="--shiki-light:#24292E;--shiki-dark:#E1E4E8;">]</span></span>
|
||
<span class="line"><span style="--shiki-light:#24292E;--shiki-dark:#E1E4E8;">base_url = </span><span style="--shiki-light:#032F62;--shiki-dark:#9ECBFF;">"http://qdrant:6334"</span></span>
|
||
<span class="line"></span>
|
||
<span class="line"><span style="--shiki-light:#24292E;--shiki-dark:#E1E4E8;">[</span><span style="--shiki-light:#6F42C1;--shiki-dark:#B392F0;">sparse</span><span style="--shiki-light:#24292E;--shiki-dark:#E1E4E8;">]</span></span>
|
||
<span class="line"><span style="--shiki-light:#24292E;--shiki-dark:#E1E4E8;">base_url = </span><span style="--shiki-light:#032F62;--shiki-dark:#9ECBFF;">"http://sparse:8085"</span></span></code></pre></div><h3 id="dense" tabindex="-1">Dense <a class="header-anchor" href="#dense" aria-label="Permalink to "Dense""></a></h3><p>要 <strong>embedding 模型</strong>(在提供方里配)+ <strong>Qdrant</strong>:</p><div class="language-bash vp-adaptive-theme"><button title="Copy Code" class="copy"></button><span class="lang">bash</span><pre class="shiki shiki-themes github-light github-dark vp-code" tabindex="0"><code><span class="line"><span style="--shiki-light:#6F42C1;--shiki-dark:#B392F0;">docker</span><span style="--shiki-light:#032F62;--shiki-dark:#9ECBFF;"> compose</span><span style="--shiki-light:#005CC5;--shiki-dark:#79B8FF;"> --profile</span><span style="--shiki-light:#032F62;--shiki-dark:#9ECBFF;"> qdrant</span><span style="--shiki-light:#032F62;--shiki-dark:#9ECBFF;"> up</span><span style="--shiki-light:#005CC5;--shiki-dark:#79B8FF;"> -d</span></span></code></pre></div><div class="language-toml vp-adaptive-theme"><button title="Copy Code" class="copy"></button><span class="lang">toml</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 style="--shiki-light:#6F42C1;--shiki-dark:#B392F0;">qdrant</span><span style="--shiki-light:#24292E;--shiki-dark:#E1E4E8;">]</span></span>
|
||
<span class="line"><span style="--shiki-light:#24292E;--shiki-dark:#E1E4E8;">base_url = </span><span style="--shiki-light:#032F62;--shiki-dark:#9ECBFF;">"http://qdrant:6334"</span></span></code></pre></div><p>(稠密模式细节、embedding 在 UI 里选哪条,以你当前版本为准。)</p><hr><h2 id="绑到机器人" tabindex="-1">绑到机器人 <a class="header-anchor" href="#绑到机器人" aria-label="Permalink to "绑到机器人""></a></h2><ol><li><strong>Bots</strong> → 机器人</li><li><strong>General</strong> → <strong>Memory Provider</strong></li><li>保存</li></ol><p>若未选,运行层面不会用这条提供方。</p><hr><h2 id="配好之后" tabindex="-1">配好之后 <a class="header-anchor" href="#配好之后" aria-label="Permalink to "配好之后""></a></h2><p>在 <strong>Memory</strong> tab 可手建、从对话抽、搜、改、压、重建等。日常操作见 <a href="/zh/getting-started/memory.html">长期记忆</a>。</p>`,37)])])}const c=a(r,[["render",n]]);export{k as __pageData,c as default};
|