mirror of
https://github.com/memohai/Memoh.git
synced 2026-04-27 07:16:19 +09:00
2 lines
5.1 KiB
JavaScript
2 lines
5.1 KiB
JavaScript
import{_ as r,o as e,c as a,ag as o}from"./chunks/framework.CAXxHpAX.js";const p=JSON.parse('{"title":"浏览器上下文","description":"","frontmatter":{},"headers":[],"relativePath":"zh/getting-started/browser.md","filePath":"zh/getting-started/browser.md","lastUpdated":1777012567000}'),s={name:"zh/getting-started/browser.md"};function i(d,t,n,l,h,g){return e(),a("div",null,[...t[0]||(t[0]=[o('<h1 id="浏览器上下文" tabindex="-1">浏览器上下文 <a class="header-anchor" href="#浏览器上下文" aria-label="Permalink to "浏览器上下文""></a></h1><p>Memoh 通过 <strong>Browser Gateway</strong> 给机器人无头浏览器能力。<strong>Browser Context</strong> 里存视口、语言、时区、是否模拟手机等。绑到机器人后,可用工具打开页面、点按、填表、截图、读 DOM 等。</p><hr><h2 id="browser-gateway" tabindex="-1">Browser Gateway <a class="header-anchor" href="#browser-gateway" aria-label="Permalink to "Browser Gateway""></a></h2><p>基于 <strong>Playwright</strong>。一个 context 像一份可复用的「浏览器侧配置」。</p><p>适合:跳站、点链、填表、读渲染后内容、出图或 PDF 等。</p><hr><h2 id="建上下文" tabindex="-1">建上下文 <a class="header-anchor" href="#建上下文" aria-label="Permalink to "建上下文""></a></h2><p>侧栏 <strong>Browser Contexts</strong>:</p><ol><li><strong>Add Browser Context</strong></li><li>填 <strong>Name</strong></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>Name</strong></td><td>展示名</td></tr><tr><td><strong>Core</strong></td><td><code>chromium</code>(默认)或 <code>firefox</code></td></tr><tr><td><strong>Viewport Width / Height</strong></td><td>像素</td></tr><tr><td><strong>User Agent</strong></td><td>可选</td></tr><tr><td><strong>Device Scale Factor</strong></td><td>可选 DPR</td></tr><tr><td><strong>Locale</strong></td><td>如 <code>en-US</code>、<code>zh-CN</code></td></tr><tr><td><strong>Timezone ID</strong></td><td>如 <code>UTC</code>、<code>Asia/Shanghai</code></td></tr><tr><td><strong>Is Mobile</strong></td><td>手机行为</td></tr><tr><td><strong>Ignore HTTPS Errors</strong></td><td>坏证书站是否还进</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><ol><li><strong>Bots</strong> → 打开机器人</li><li><strong>General</strong></li><li><strong>Browser Context</strong> 下拉选</li><li>保存</li></ol><p>之后调浏览器工具时会用这个 profile。</p><hr><h2 id="机器人侧" tabindex="-1">机器人侧 <a class="header-anchor" href="#机器人侧" aria-label="Permalink to "机器人侧""></a></h2><p>常见内置如:</p><ul><li><code>browser_action</code>:导航、点击、填表、选、滚、多 tab、截图、PDF 等</li><li><code>browser_observe</code>:看当前页,给模型用</li></ul><p>让机器人能操作<strong>真页面</strong>,而不只有静态 HTML 或搜索摘要。</p><hr><h2 id="浏览器核" tabindex="-1">浏览器核 <a class="header-anchor" href="#浏览器核" aria-label="Permalink to "浏览器核""></a></h2><p>镜像里可带 Chromium、Firefox 或两者。构建时由 <code>BROWSER_CORES</code> 决定。一键安装脚本里会问;手搓例如:</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:#24292E;--shiki-dark:#E1E4E8;">BROWSER_CORES</span><span style="--shiki-light:#D73A49;--shiki-dark:#F97583;">=</span><span style="--shiki-light:#032F62;--shiki-dark:#9ECBFF;">chromium</span><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;"> browser</span><span style="--shiki-light:#032F62;--shiki-dark:#9ECBFF;"> build</span><span style="--shiki-light:#032F62;--shiki-dark:#9ECBFF;"> browser</span></span></code></pre></div><p>合法值:<code>chromium</code>、<code>firefox</code>、<code>chromium,firefox</code>(默认组合)。</p><hr><h2 id="接下来" tabindex="-1">接下来 <a class="header-anchor" href="#接下来" aria-label="Permalink to "接下来""></a></h2><ul><li>记忆与内置模式:<a href="/zh/memory-providers/builtin.html">内置记忆提供方</a></li><li>长期记忆操作:<a href="/zh/getting-started/memory.html">长期记忆</a></li></ul>',31)])])}const b=r(s,[["render",i]]);export{p as __pageData,b as default};
|