import{_ as i,c as a,o as t,ah as n}from"./chunks/framework.BJEpWshW.js";const o=JSON.parse('{"title":"代理设置","description":"","frontmatter":{},"headers":[],"relativePath":"config/proxy.md","filePath":"config/proxy.md"}'),l={name:"config/proxy.md"};function h(e,s,k,p,r,d){return t(),a("div",null,[...s[0]||(s[0]=[n(`<h1 id="代理设置" tabindex="-1">代理设置 <a class="header-anchor" href="#代理设置" aria-label="Permalink to “代理设置”">​</a></h1><p>WebAI2API 支持全局代理和实例级代理配置。</p><h2 id="代理优先级" tabindex="-1">代理优先级 <a class="header-anchor" href="#代理优先级" aria-label="Permalink to “代理优先级”">​</a></h2><ol><li><strong>实例级代理</strong> - 如果 Instance 配置了代理，使用该代理</li><li><strong>全局代理</strong> - 如果实例未配置，使用全局代理</li><li><strong>直连</strong> - 如果都未配置，直接连接</li></ol><h2 id="全局代理配置" tabindex="-1">全局代理配置 <a class="header-anchor" href="#全局代理配置" aria-label="Permalink to “全局代理配置”">​</a></h2><p>在 <code>browser.proxy</code> 中配置全局代理：</p><div class="language-yaml"><button title="Copy Code" class="copy"></button><span class="lang">yaml</span><pre class="shiki shiki-themes github-light github-dark" style="--shiki-light:#24292e;--shiki-dark:#e1e4e8;--shiki-light-bg:#fff;--shiki-dark-bg:#24292e;" tabindex="0" dir="ltr"><code><span class="line"><span style="--shiki-light:#22863A;--shiki-dark:#85E89D;">browser</span><span style="--shiki-light:#24292E;--shiki-dark:#E1E4E8;">:</span></span>
<span class="line"><span style="--shiki-light:#22863A;--shiki-dark:#85E89D;">  proxy</span><span style="--shiki-light:#24292E;--shiki-dark:#E1E4E8;">:</span></span>
<span class="line"><span style="--shiki-light:#22863A;--shiki-dark:#85E89D;">    enable</span><span style="--shiki-light:#24292E;--shiki-dark:#E1E4E8;">: </span><span style="--shiki-light:#005CC5;--shiki-dark:#79B8FF;">true</span></span>
<span class="line"><span style="--shiki-light:#22863A;--shiki-dark:#85E89D;">    type</span><span style="--shiki-light:#24292E;--shiki-dark:#E1E4E8;">: </span><span style="--shiki-light:#032F62;--shiki-dark:#9ECBFF;">http</span><span style="--shiki-light:#6A737D;--shiki-dark:#6A737D;">          # http 或 socks5</span></span>
<span class="line"><span style="--shiki-light:#22863A;--shiki-dark:#85E89D;">    host</span><span style="--shiki-light:#24292E;--shiki-dark:#E1E4E8;">: </span><span style="--shiki-light:#005CC5;--shiki-dark:#79B8FF;">127.0.0.1</span></span>
<span class="line"><span style="--shiki-light:#22863A;--shiki-dark:#85E89D;">    port</span><span style="--shiki-light:#24292E;--shiki-dark:#E1E4E8;">: </span><span style="--shiki-light:#005CC5;--shiki-dark:#79B8FF;">7890</span></span>
<span class="line"><span style="--shiki-light:#6A737D;--shiki-dark:#6A737D;">    # 可选认证</span></span>
<span class="line"><span style="--shiki-light:#22863A;--shiki-dark:#85E89D;">    user</span><span style="--shiki-light:#24292E;--shiki-dark:#E1E4E8;">: </span><span style="--shiki-light:#032F62;--shiki-dark:#9ECBFF;">username</span></span>
<span class="line"><span style="--shiki-light:#22863A;--shiki-dark:#85E89D;">    passwd</span><span style="--shiki-light:#24292E;--shiki-dark:#E1E4E8;">: </span><span style="--shiki-light:#032F62;--shiki-dark:#9ECBFF;">password</span></span></code></pre></div><h2 id="实例级代理配置" tabindex="-1">实例级代理配置 <a class="header-anchor" href="#实例级代理配置" aria-label="Permalink to “实例级代理配置”">​</a></h2><p>在 Instance 中配置专属代理：</p><div class="language-yaml"><button title="Copy Code" class="copy"></button><span class="lang">yaml</span><pre class="shiki shiki-themes github-light github-dark" style="--shiki-light:#24292e;--shiki-dark:#e1e4e8;--shiki-light-bg:#fff;--shiki-dark-bg:#24292e;" tabindex="0" dir="ltr"><code><span class="line"><span style="--shiki-light:#22863A;--shiki-dark:#85E89D;">backend</span><span style="--shiki-light:#24292E;--shiki-dark:#E1E4E8;">:</span></span>
<span class="line"><span style="--shiki-light:#22863A;--shiki-dark:#85E89D;">  pool</span><span style="--shiki-light:#24292E;--shiki-dark:#E1E4E8;">:</span></span>
<span class="line"><span style="--shiki-light:#22863A;--shiki-dark:#85E89D;">    instances</span><span style="--shiki-light:#24292E;--shiki-dark:#E1E4E8;">:</span></span>
<span class="line"><span style="--shiki-light:#24292E;--shiki-dark:#E1E4E8;">      - </span><span style="--shiki-light:#22863A;--shiki-dark:#85E89D;">name</span><span style="--shiki-light:#24292E;--shiki-dark:#E1E4E8;">: </span><span style="--shiki-light:#032F62;--shiki-dark:#9ECBFF;">&quot;browser_us&quot;</span></span>
<span class="line"><span style="--shiki-light:#22863A;--shiki-dark:#85E89D;">        proxy</span><span style="--shiki-light:#24292E;--shiki-dark:#E1E4E8;">:</span></span>
<span class="line"><span style="--shiki-light:#22863A;--shiki-dark:#85E89D;">          enable</span><span style="--shiki-light:#24292E;--shiki-dark:#E1E4E8;">: </span><span style="--shiki-light:#005CC5;--shiki-dark:#79B8FF;">true</span></span>
<span class="line"><span style="--shiki-light:#22863A;--shiki-dark:#85E89D;">          type</span><span style="--shiki-light:#24292E;--shiki-dark:#E1E4E8;">: </span><span style="--shiki-light:#032F62;--shiki-dark:#9ECBFF;">socks5</span></span>
<span class="line"><span style="--shiki-light:#22863A;--shiki-dark:#85E89D;">          host</span><span style="--shiki-light:#24292E;--shiki-dark:#E1E4E8;">: </span><span style="--shiki-light:#032F62;--shiki-dark:#9ECBFF;">us-proxy.example.com</span></span>
<span class="line"><span style="--shiki-light:#22863A;--shiki-dark:#85E89D;">          port</span><span style="--shiki-light:#24292E;--shiki-dark:#E1E4E8;">: </span><span style="--shiki-light:#005CC5;--shiki-dark:#79B8FF;">1080</span></span>
<span class="line"><span style="--shiki-light:#22863A;--shiki-dark:#85E89D;">          user</span><span style="--shiki-light:#24292E;--shiki-dark:#E1E4E8;">: </span><span style="--shiki-light:#032F62;--shiki-dark:#9ECBFF;">myuser</span></span>
<span class="line"><span style="--shiki-light:#22863A;--shiki-dark:#85E89D;">          passwd</span><span style="--shiki-light:#24292E;--shiki-dark:#E1E4E8;">: </span><span style="--shiki-light:#032F62;--shiki-dark:#9ECBFF;">mypassword</span></span>
<span class="line"><span style="--shiki-light:#22863A;--shiki-dark:#85E89D;">        workers</span><span style="--shiki-light:#24292E;--shiki-dark:#E1E4E8;">:</span></span>
<span class="line"><span style="--shiki-light:#24292E;--shiki-dark:#E1E4E8;">          - </span><span style="--shiki-light:#22863A;--shiki-dark:#85E89D;">name</span><span style="--shiki-light:#24292E;--shiki-dark:#E1E4E8;">: </span><span style="--shiki-light:#032F62;--shiki-dark:#9ECBFF;">&quot;us_worker&quot;</span></span>
<span class="line"><span style="--shiki-light:#22863A;--shiki-dark:#85E89D;">            type</span><span style="--shiki-light:#24292E;--shiki-dark:#E1E4E8;">: </span><span style="--shiki-light:#032F62;--shiki-dark:#9ECBFF;">lmarena</span></span></code></pre></div><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><code>enable</code></td><td>boolean</td><td>✅</td><td>是否启用代理</td></tr><tr><td><code>type</code></td><td>string</td><td>✅</td><td>代理类型：<code>http</code> 或 <code>socks5</code></td></tr><tr><td><code>host</code></td><td>string</td><td>✅</td><td>代理服务器地址</td></tr><tr><td><code>port</code></td><td>number</td><td>✅</td><td>代理服务器端口</td></tr><tr><td><code>user</code></td><td>string</td><td>❌</td><td>代理认证用户名</td></tr><tr><td><code>passwd</code></td><td>string</td><td>❌</td><td>代理认证密码</td></tr></tbody></table><h2 id="强制直连" tabindex="-1">强制直连 <a class="header-anchor" href="#强制直连" aria-label="Permalink to “强制直连”">​</a></h2><p>如果需要某个实例强制直连，即使配置了全局代理：</p><div class="language-yaml"><button title="Copy Code" class="copy"></button><span class="lang">yaml</span><pre class="shiki shiki-themes github-light github-dark" style="--shiki-light:#24292e;--shiki-dark:#e1e4e8;--shiki-light-bg:#fff;--shiki-dark-bg:#24292e;" tabindex="0" dir="ltr"><code><span class="line"><span style="--shiki-light:#22863A;--shiki-dark:#85E89D;">instances</span><span style="--shiki-light:#24292E;--shiki-dark:#E1E4E8;">:</span></span>
<span class="line"><span style="--shiki-light:#24292E;--shiki-dark:#E1E4E8;">  - </span><span style="--shiki-light:#22863A;--shiki-dark:#85E89D;">name</span><span style="--shiki-light:#24292E;--shiki-dark:#E1E4E8;">: </span><span style="--shiki-light:#032F62;--shiki-dark:#9ECBFF;">&quot;browser_direct&quot;</span></span>
<span class="line"><span style="--shiki-light:#22863A;--shiki-dark:#85E89D;">    proxy</span><span style="--shiki-light:#24292E;--shiki-dark:#E1E4E8;">:</span></span>
<span class="line"><span style="--shiki-light:#22863A;--shiki-dark:#85E89D;">      enable</span><span style="--shiki-light:#24292E;--shiki-dark:#E1E4E8;">: </span><span style="--shiki-light:#005CC5;--shiki-dark:#79B8FF;">false</span><span style="--shiki-light:#6A737D;--shiki-dark:#6A737D;">    # 显式禁用代理</span></span>
<span class="line"><span style="--shiki-light:#22863A;--shiki-dark:#85E89D;">    workers</span><span style="--shiki-light:#24292E;--shiki-dark:#E1E4E8;">:</span></span>
<span class="line"><span style="--shiki-light:#24292E;--shiki-dark:#E1E4E8;">      - </span><span style="--shiki-light:#22863A;--shiki-dark:#85E89D;">name</span><span style="--shiki-light:#24292E;--shiki-dark:#E1E4E8;">: </span><span style="--shiki-light:#032F62;--shiki-dark:#9ECBFF;">&quot;direct_worker&quot;</span></span>
<span class="line"><span style="--shiki-light:#22863A;--shiki-dark:#85E89D;">        type</span><span style="--shiki-light:#24292E;--shiki-dark:#E1E4E8;">: </span><span style="--shiki-light:#032F62;--shiki-dark:#9ECBFF;">lmarena</span></span></code></pre></div><h2 id="代理选型建议" tabindex="-1">代理选型建议 <a class="header-anchor" href="#代理选型建议" aria-label="Permalink to “代理选型建议”">​</a></h2><div class="tip custom-block"><p class="custom-block-title">推荐配置</p><ul><li><strong>类型</strong>: SOCKS5 代理通常比 HTTP 代理更通用</li><li><strong>稳定性</strong>: 选择稳定可靠的代理服务商</li><li><strong>IP 纯净度</strong>: 使用 <a href="https://ping0.cc" target="_blank" rel="noreferrer">ping0.cc</a> 等工具检查 IP 纯净度</li></ul></div><div class="warning custom-block"><p class="custom-block-title">注意事项</p><ul><li>代理质量会影响验证码触发频率</li><li>频繁更换 IP 可能导致账号风控</li><li>建议使用住宅 IP 或数据中心静态 IP</li></ul></div>`,18)])])}const g=i(l,[["render",h]]);export{o as __pageData,g as default};
