mirror of
https://github.com/foxhui/WebAI2API.git
synced 2026-06-16 21:03:59 +08:00
docs: 更新文档
This commit is contained in:
Vendored
+6
-6
@@ -1,25 +1,25 @@
|
||||
{
|
||||
"hash": "08caf282",
|
||||
"configHash": "6337dd35",
|
||||
"hash": "fd744d6e",
|
||||
"configHash": "f73de511",
|
||||
"lockfileHash": "5344cd3e",
|
||||
"browserHash": "89c2052f",
|
||||
"browserHash": "25f5b819",
|
||||
"optimized": {
|
||||
"vue": {
|
||||
"src": "../../../node_modules/.pnpm/vue@3.5.26/node_modules/vue/dist/vue.runtime.esm-bundler.js",
|
||||
"file": "vue.js",
|
||||
"fileHash": "450708e5",
|
||||
"fileHash": "420d640f",
|
||||
"needsInterop": false
|
||||
},
|
||||
"vitepress > @vue/devtools-api": {
|
||||
"src": "../../../node_modules/.pnpm/@vue+devtools-api@8.0.5/node_modules/@vue/devtools-api/dist/index.js",
|
||||
"file": "vitepress___@vue_devtools-api.js",
|
||||
"fileHash": "107c6593",
|
||||
"fileHash": "b88b7e99",
|
||||
"needsInterop": false
|
||||
},
|
||||
"vitepress > @vueuse/core": {
|
||||
"src": "../../../node_modules/.pnpm/@vueuse+core@14.1.0_vue@3.5.26/node_modules/@vueuse/core/dist/index.js",
|
||||
"file": "vitepress___@vueuse_core.js",
|
||||
"fileHash": "c6610847",
|
||||
"fileHash": "2f71f1c1",
|
||||
"needsInterop": false
|
||||
}
|
||||
},
|
||||
|
||||
@@ -11,6 +11,10 @@ export default defineConfig({
|
||||
['link', { rel: 'icon', href: '/favicon.png' }]
|
||||
],
|
||||
|
||||
ignoreDeadLinks: [
|
||||
/^http:\/\/localhost/
|
||||
],
|
||||
|
||||
themeConfig: {
|
||||
nav: [
|
||||
{ text: '首页', link: '/' },
|
||||
@@ -22,6 +26,7 @@ export default defineConfig({
|
||||
{
|
||||
text: '入门指南',
|
||||
items: [
|
||||
{ text: '项目介绍', link: '/guide/introduction' },
|
||||
{ text: '环境要求', link: '/guide/requirements' },
|
||||
{ text: '快速部署', link: '/guide/deployment' },
|
||||
{ text: '首次使用', link: '/guide/first-use' }
|
||||
|
||||
Vendored
+23
@@ -0,0 +1,23 @@
|
||||
<!DOCTYPE html>
|
||||
<html lang="zh-CN" dir="ltr">
|
||||
<head>
|
||||
<meta charset="utf-8">
|
||||
<meta name="viewport" content="width=device-width,initial-scale=1">
|
||||
<title>404 | WebAI2API</title>
|
||||
<meta name="description" content="Not Found">
|
||||
<meta name="generator" content="VitePress v2.0.0-alpha.15">
|
||||
<link rel="preload stylesheet" href="/assets/style.BZs0Eodj.css" as="style">
|
||||
<link rel="preload stylesheet" href="/vp-icons.css" as="style">
|
||||
|
||||
<script type="module" src="/assets/app.D6bDUwdY.js"></script>
|
||||
<link rel="preload" href="/assets/inter-roman-latin.Di8DUHzh.woff2" as="font" type="font/woff2" crossorigin="">
|
||||
<link rel="icon" href="/favicon.png">
|
||||
<script id="check-dark-mode">(()=>{const e=localStorage.getItem("vitepress-theme-appearance")||"auto",a=window.matchMedia("(prefers-color-scheme: dark)").matches;(!e||e==="auto"?a:e==="dark")&&document.documentElement.classList.add("dark")})();</script>
|
||||
<script id="check-mac-os">document.documentElement.classList.toggle("mac",/Mac|iPhone|iPod|iPad/i.test(navigator.platform));</script>
|
||||
</head>
|
||||
<body>
|
||||
<div id="app"></div>
|
||||
<script>window.__VP_HASH_MAP__=JSON.parse("{\"admin_linux.md\":\"C4pirr1w\",\"admin_troubleshooting.md\":\"BdBPvYAx\",\"admin_webui.md\":\"C6OfyL7c\",\"api_chat.md\":\"CVfvhFz2\",\"api_cookies.md\":\"BngFs3oo\",\"api_models.md\":\"BmD2H_2d\",\"api_overview.md\":\"BJJapNOd\",\"config_instances.md\":\"CvnejDKP\",\"config_overview.md\":\"-rOn3l_p\",\"config_proxy.md\":\"B7kjsU6e\",\"guide_deployment.md\":\"Browh70b\",\"guide_first-use.md\":\"C0Hv5lBx\",\"guide_introduction.md\":\"D7_DJb6Y\",\"guide_requirements.md\":\"ettCHBZs\",\"index.md\":\"C3b48Ls9\"}");window.__VP_SITE_DATA__=JSON.parse("{\"lang\":\"zh-CN\",\"dir\":\"ltr\",\"title\":\"WebAI2API\",\"description\":\"网页版 AI 服务转 OpenAI 兼容 API\",\"base\":\"/\",\"head\":[],\"router\":{\"prefetchLinks\":true},\"appearance\":true,\"themeConfig\":{\"nav\":[{\"text\":\"首页\",\"link\":\"/\"},{\"text\":\"入门指南\",\"link\":\"/guide/requirements\"},{\"text\":\"API 参考\",\"link\":\"/api/overview\"}],\"sidebar\":[{\"text\":\"入门指南\",\"items\":[{\"text\":\"项目介绍\",\"link\":\"/guide/introduction\"},{\"text\":\"环境要求\",\"link\":\"/guide/requirements\"},{\"text\":\"快速部署\",\"link\":\"/guide/deployment\"},{\"text\":\"首次使用\",\"link\":\"/guide/first-use\"}]},{\"text\":\"配置说明\",\"items\":[{\"text\":\"配置概览\",\"link\":\"/config/overview\"},{\"text\":\"实例配置\",\"link\":\"/config/instances\"},{\"text\":\"代理设置\",\"link\":\"/config/proxy\"}]},{\"text\":\"API 参考\",\"items\":[{\"text\":\"接口概览\",\"link\":\"/api/overview\"},{\"text\":\"Chat Completions\",\"link\":\"/api/chat\"},{\"text\":\"Models\",\"link\":\"/api/models\"},{\"text\":\"Cookies\",\"link\":\"/api/cookies\"}]},{\"text\":\"运维管理\",\"items\":[{\"text\":\"Web 管理界面\",\"link\":\"/admin/webui\"},{\"text\":\"Linux 部署\",\"link\":\"/admin/linux\"},{\"text\":\"故障排查\",\"link\":\"/admin/troubleshooting\"}]}],\"socialLinks\":[{\"icon\":\"github\",\"link\":\"https://github.com/foxhui/WebAI2API\"}],\"outline\":{\"label\":\"页面导航\"},\"docFooter\":{\"prev\":\"上一页\",\"next\":\"下一页\"}},\"locales\":{},\"scrollOffset\":134,\"cleanUrls\":false,\"additionalConfig\":{}}");</script>
|
||||
|
||||
</body>
|
||||
</html>
|
||||
Vendored
+33
File diff suppressed because one or more lines are too long
+27
File diff suppressed because one or more lines are too long
Vendored
+26
File diff suppressed because one or more lines are too long
Vendored
+109
File diff suppressed because one or more lines are too long
Vendored
+52
File diff suppressed because one or more lines are too long
Vendored
+50
File diff suppressed because one or more lines are too long
Vendored
+39
File diff suppressed because one or more lines are too long
@@ -0,0 +1,8 @@
|
||||
import{_ as s,c as a,o as h,ah as e}from"./chunks/framework.BJEpWshW.js";const F=JSON.parse('{"title":"Linux 部署","description":"","frontmatter":{},"headers":[],"relativePath":"admin/linux.md","filePath":"admin/linux.md"}'),l={name:"admin/linux.md"};function n(t,i,k,r,p,d){return h(),a("div",null,[...i[0]||(i[0]=[e(`<h1 id="linux-部署" tabindex="-1">Linux 部署 <a class="header-anchor" href="#linux-部署" aria-label="Permalink to “Linux 部署”"></a></h1><p>在 Linux 服务器上运行 WebAI2API 的特殊配置说明。</p><h2 id="显示方式选择" tabindex="-1">显示方式选择 <a class="header-anchor" href="#显示方式选择" aria-label="Permalink to “显示方式选择”"></a></h2><p>在 Linux 服务器上运行非无头模式时,需要配置显示环境。</p><h3 id="方式一-xvfb-vnc-推荐" tabindex="-1">方式一:Xvfb + VNC (推荐) <a class="header-anchor" href="#方式一-xvfb-vnc-推荐" aria-label="Permalink to “方式一:Xvfb + VNC (推荐)”"></a></h3><p>使用虚拟显示器运行程序,通过 VNC 远程查看。</p><h4 id="使用内置命令" tabindex="-1">使用内置命令 <a class="header-anchor" href="#使用内置命令" aria-label="Permalink to “使用内置命令”"></a></h4><div class="language-bash"><button title="Copy Code" class="copy"></button><span class="lang">bash</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:#6F42C1;--shiki-dark:#B392F0;">npm</span><span style="--shiki-light:#032F62;--shiki-dark:#9ECBFF;"> start</span><span style="--shiki-light:#005CC5;--shiki-dark:#79B8FF;"> --</span><span style="--shiki-light:#005CC5;--shiki-dark:#79B8FF;"> -xvfb</span><span style="--shiki-light:#005CC5;--shiki-dark:#79B8FF;"> -vnc</span></span></code></pre></div><p>这会自动:</p><ul><li>启动 Xvfb 虚拟显示器</li><li>启动 x11vnc 服务器</li><li>可通过 WebUI 直接查看 VNC 画面</li></ul><h4 id="手动配置" tabindex="-1">手动配置 <a class="header-anchor" href="#手动配置" aria-label="Permalink to “手动配置”"></a></h4><p>如果内置命令无法满足需求:</p><ol><li><strong>启动虚拟显示器</strong></li></ol><div class="language-bash"><button title="Copy Code" class="copy"></button><span class="lang">bash</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:#6F42C1;--shiki-dark:#B392F0;">xvfb-run</span><span style="--shiki-light:#005CC5;--shiki-dark:#79B8FF;"> --server-num=99</span><span style="--shiki-light:#005CC5;--shiki-dark:#79B8FF;"> --server-args=</span><span style="--shiki-light:#032F62;--shiki-dark:#9ECBFF;">"-ac -screen 0 1920x1080x24"</span><span style="--shiki-light:#032F62;--shiki-dark:#9ECBFF;"> npm</span><span style="--shiki-light:#032F62;--shiki-dark:#9ECBFF;"> start</span></span></code></pre></div><ol start="2"><li><strong>映射到 VNC</strong></li></ol><div class="language-bash"><button title="Copy Code" class="copy"></button><span class="lang">bash</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:#6F42C1;--shiki-dark:#B392F0;">x11vnc</span><span style="--shiki-light:#005CC5;--shiki-dark:#79B8FF;"> -display</span><span style="--shiki-light:#032F62;--shiki-dark:#9ECBFF;"> :99</span><span style="--shiki-light:#005CC5;--shiki-dark:#79B8FF;"> -localhost</span><span style="--shiki-light:#005CC5;--shiki-dark:#79B8FF;"> -nopw</span><span style="--shiki-light:#005CC5;--shiki-dark:#79B8FF;"> -forever</span><span style="--shiki-light:#005CC5;--shiki-dark:#79B8FF;"> -noxdamage</span></span></code></pre></div><h2 id="vnc-连接" tabindex="-1">VNC 连接 <a class="header-anchor" href="#vnc-连接" aria-label="Permalink to “VNC 连接”"></a></h2><h3 id="通过-ssh-隧道-推荐" tabindex="-1">通过 SSH 隧道 (推荐) <a class="header-anchor" href="#通过-ssh-隧道-推荐" aria-label="Permalink to “通过 SSH 隧道 (推荐)”"></a></h3><div class="language-bash"><button title="Copy Code" class="copy"></button><span class="lang">bash</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:#6A737D;--shiki-dark:#6A737D;"># 本地终端</span></span>
|
||||
<span class="line"><span style="--shiki-light:#6F42C1;--shiki-dark:#B392F0;">ssh</span><span style="--shiki-light:#005CC5;--shiki-dark:#79B8FF;"> -L</span><span style="--shiki-light:#032F62;--shiki-dark:#9ECBFF;"> 5900:127.0.0.1:5900</span><span style="--shiki-light:#032F62;--shiki-dark:#9ECBFF;"> root@服务器IP</span></span></code></pre></div><p>然后使用 VNC 客户端连接 <code>127.0.0.1:5900</code>。</p><h3 id="通过-webui" tabindex="-1">通过 WebUI <a class="header-anchor" href="#通过-webui" aria-label="Permalink to “通过 WebUI”"></a></h3><p>服务启动后,访问 WebUI 的「VNC 显示」页面即可直接查看。</p><h3 id="安装依赖" tabindex="-1">安装依赖 <a class="header-anchor" href="#安装依赖" aria-label="Permalink to “安装依赖”"></a></h3><h3 id="ubuntu-debian" tabindex="-1">Ubuntu/Debian <a class="header-anchor" href="#ubuntu-debian" aria-label="Permalink to “Ubuntu/Debian”"></a></h3><div class="language-bash"><button title="Copy Code" class="copy"></button><span class="lang">bash</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:#6F42C1;--shiki-dark:#B392F0;">sudo</span><span style="--shiki-light:#032F62;--shiki-dark:#9ECBFF;"> apt-get</span><span style="--shiki-light:#032F62;--shiki-dark:#9ECBFF;"> update</span></span>
|
||||
<span class="line"><span style="--shiki-light:#6F42C1;--shiki-dark:#B392F0;">sudo</span><span style="--shiki-light:#032F62;--shiki-dark:#9ECBFF;"> apt-get</span><span style="--shiki-light:#032F62;--shiki-dark:#9ECBFF;"> install</span><span style="--shiki-light:#032F62;--shiki-dark:#9ECBFF;"> xvfb</span><span style="--shiki-light:#032F62;--shiki-dark:#9ECBFF;"> x11vnc</span></span></code></pre></div><h3 id="centos-rhel" tabindex="-1">CentOS/RHEL <a class="header-anchor" href="#centos-rhel" aria-label="Permalink to “CentOS/RHEL”"></a></h3><div class="language-bash"><button title="Copy Code" class="copy"></button><span class="lang">bash</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:#6F42C1;--shiki-dark:#B392F0;">sudo</span><span style="--shiki-light:#032F62;--shiki-dark:#9ECBFF;"> yum</span><span style="--shiki-light:#032F62;--shiki-dark:#9ECBFF;"> install</span><span style="--shiki-light:#032F62;--shiki-dark:#9ECBFF;"> xorg-x11-server-Xvfb</span><span style="--shiki-light:#032F62;--shiki-dark:#9ECBFF;"> x11vnc</span></span></code></pre></div><h3 id="arch-linux" tabindex="-1">Arch Linux <a class="header-anchor" href="#arch-linux" aria-label="Permalink to “Arch Linux”"></a></h3><div class="language-bash"><button title="Copy Code" class="copy"></button><span class="lang">bash</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:#6F42C1;--shiki-dark:#B392F0;">sudo</span><span style="--shiki-light:#032F62;--shiki-dark:#9ECBFF;"> pacman</span><span style="--shiki-light:#005CC5;--shiki-dark:#79B8FF;"> -S</span><span style="--shiki-light:#032F62;--shiki-dark:#9ECBFF;"> xorg-server-xvfb</span><span style="--shiki-light:#032F62;--shiki-dark:#9ECBFF;"> x11vnc</span></span></code></pre></div><h3 id="方式二-x11-转发" tabindex="-1">方式二:X11 转发 <a class="header-anchor" href="#方式二-x11-转发" aria-label="Permalink to “方式二:X11 转发”"></a></h3><p>适用于通过 SSH 连接服务器的场景。</p><ol><li>在本地安装 X Server(如 VcXsrv、Xming)</li><li>使用支持 X11 转发的终端(如 WindTerm)</li><li>在 SSH 会话中启用 X11 转发</li></ol><div class="language-bash"><button title="Copy Code" class="copy"></button><span class="lang">bash</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:#6F42C1;--shiki-dark:#B392F0;">ssh</span><span style="--shiki-light:#005CC5;--shiki-dark:#79B8FF;"> -X</span><span style="--shiki-light:#032F62;--shiki-dark:#9ECBFF;"> user@server</span></span></code></pre></div><h2 id="docker-部署" tabindex="-1">Docker 部署 <a class="header-anchor" href="#docker-部署" aria-label="Permalink to “Docker 部署”"></a></h2><p>Docker 镜像已内置 Xvfb 和 VNC 支持:</p><div class="language-bash"><button title="Copy Code" class="copy"></button><span class="lang">bash</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:#6F42C1;--shiki-dark:#B392F0;">docker</span><span style="--shiki-light:#032F62;--shiki-dark:#9ECBFF;"> run</span><span style="--shiki-light:#005CC5;--shiki-dark:#79B8FF;"> -d</span><span style="--shiki-light:#005CC5;--shiki-dark:#79B8FF;"> --name</span><span style="--shiki-light:#032F62;--shiki-dark:#9ECBFF;"> webai2api</span><span style="--shiki-light:#005CC5;--shiki-dark:#79B8FF;"> \\</span></span>
|
||||
<span class="line"><span style="--shiki-light:#005CC5;--shiki-dark:#79B8FF;"> -p</span><span style="--shiki-light:#032F62;--shiki-dark:#9ECBFF;"> 3000:3000</span><span style="--shiki-light:#005CC5;--shiki-dark:#79B8FF;"> -p</span><span style="--shiki-light:#032F62;--shiki-dark:#9ECBFF;"> 5900:5900</span><span style="--shiki-light:#005CC5;--shiki-dark:#79B8FF;"> \\</span></span>
|
||||
<span class="line"><span style="--shiki-light:#005CC5;--shiki-dark:#79B8FF;"> -v</span><span style="--shiki-light:#032F62;--shiki-dark:#9ECBFF;"> "$(</span><span style="--shiki-light:#005CC5;--shiki-dark:#79B8FF;">pwd</span><span style="--shiki-light:#032F62;--shiki-dark:#9ECBFF;">)/data:/app/data"</span><span style="--shiki-light:#005CC5;--shiki-dark:#79B8FF;"> \\</span></span>
|
||||
<span class="line"><span style="--shiki-light:#005CC5;--shiki-dark:#79B8FF;"> -e</span><span style="--shiki-light:#032F62;--shiki-dark:#9ECBFF;"> LOGIN_MODE=</span><span style="--shiki-light:#005CC5;--shiki-dark:#79B8FF;">true</span><span style="--shiki-light:#005CC5;--shiki-dark:#79B8FF;"> \\</span></span>
|
||||
<span class="line"><span style="--shiki-light:#005CC5;--shiki-dark:#79B8FF;"> --shm-size=2gb</span><span style="--shiki-light:#005CC5;--shiki-dark:#79B8FF;"> \\</span></span>
|
||||
<span class="line"><span style="--shiki-light:#032F62;--shiki-dark:#9ECBFF;"> foxhui/lmarena-imagen-automator:latest</span></span></code></pre></div><p>通过 VNC 客户端连接 <code>localhost:5900</code> 完成登录。</p><h2 id="常见问题" tabindex="-1">常见问题 <a class="header-anchor" href="#常见问题" aria-label="Permalink to “常见问题”"></a></h2><h3 id="端口被占用" tabindex="-1">端口被占用 <a class="header-anchor" href="#端口被占用" aria-label="Permalink to “端口被占用”"></a></h3><p>如果 5900 端口已被占用,VNC 服务器会自动查找 5901-5999 范围内可用的端口。</p><h3 id="显示号冲突" tabindex="-1">显示号冲突 <a class="header-anchor" href="#显示号冲突" aria-label="Permalink to “显示号冲突”"></a></h3><p>Xvfb 会自动从 50 开始查找可用的显示号,避免与现有 X 服务器冲突。</p>`,42)])])}const o=s(l,[["render",n]]);export{F as __pageData,o as default};
|
||||
@@ -0,0 +1 @@
|
||||
import{_ as s,c as a,o as h,ah as e}from"./chunks/framework.BJEpWshW.js";const F=JSON.parse('{"title":"Linux 部署","description":"","frontmatter":{},"headers":[],"relativePath":"admin/linux.md","filePath":"admin/linux.md"}'),l={name:"admin/linux.md"};function n(t,i,k,r,p,d){return h(),a("div",null,[...i[0]||(i[0]=[e("",42)])])}const o=s(l,[["render",n]]);export{F as __pageData,o as default};
|
||||
@@ -0,0 +1,2 @@
|
||||
import{_ as e,c as i,o as l,ah as r}from"./chunks/framework.BJEpWshW.js";const g=JSON.parse('{"title":"故障排查","description":"","frontmatter":{},"headers":[],"relativePath":"admin/troubleshooting.md","filePath":"admin/troubleshooting.md"}'),t={name:"admin/troubleshooting.md"};function s(o,a,n,h,d,c){return l(),i("div",null,[...a[0]||(a[0]=[r(`<h1 id="故障排查" tabindex="-1">故障排查 <a class="header-anchor" href="#故障排查" aria-label="Permalink to “故障排查”"></a></h1><p>常见问题的诊断和解决方法。</p><h2 id="请求相关" tabindex="-1">请求相关 <a class="header-anchor" href="#请求相关" aria-label="Permalink to “请求相关”"></a></h2><h3 id="请求被拒绝-429-too-many-requests" tabindex="-1">请求被拒绝 (429 Too Many Requests) <a class="header-anchor" href="#请求被拒绝-429-too-many-requests" aria-label="Permalink to “请求被拒绝 (429 Too Many Requests)”"></a></h3><p><strong>问题</strong>:并发请求过多,队列已满。</p><p><strong>解决方案</strong>:</p><ul><li>启用流式模式 (<code>stream: true</code>),可无限排队</li><li>减少并发请求数量</li><li>增加 <code>queue.queueBuffer</code> 配置值</li></ul><h3 id="请求超时" tabindex="-1">请求超时 <a class="header-anchor" href="#请求超时" aria-label="Permalink to “请求超时”"></a></h3><p><strong>问题</strong>:任务超过 120 秒未完成。</p><p><strong>解决方案</strong>:</p><ul><li>启用流式模式,利用心跳保活</li><li>检查网络连接是否稳定</li><li>某些复杂提示词可能需要更长时间</li></ul><h2 id="验证相关" tabindex="-1">验证相关 <a class="header-anchor" href="#验证相关" aria-label="Permalink to “验证相关”"></a></h2><h3 id="recaptcha-验证失败" tabindex="-1">reCAPTCHA 验证失败 <a class="header-anchor" href="#recaptcha-验证失败" aria-label="Permalink to “reCAPTCHA 验证失败”"></a></h3><p><strong>问题</strong>:返回 <code>recaptcha validation failed</code>。</p><p><strong>解决方案</strong>:</p><ul><li>降低请求频率</li><li>进入登录模式手动完成验证</li><li>使用稳定纯净的 IP 地址</li><li>检查 IP 纯净度:<a href="https://ping0.cc" target="_blank" rel="noreferrer">ping0.cc</a></li></ul><h3 id="cloudflare-挑战" tabindex="-1">CloudFlare 挑战 <a class="header-anchor" href="#cloudflare-挑战" aria-label="Permalink to “CloudFlare 挑战”"></a></h3><p><strong>问题</strong>:浏览器卡在 CloudFlare 验证页面。</p><p><strong>解决方案</strong>:</p><ul><li>进入 VNC 手动完成验证</li><li>更换 IP 地址</li><li>避免使用数据中心 IP</li></ul><h2 id="登录相关" tabindex="-1">登录相关 <a class="header-anchor" href="#登录相关" aria-label="Permalink to “登录相关”"></a></h2><h3 id="登录状态丢失" tabindex="-1">登录状态丢失 <a class="header-anchor" href="#登录状态丢失" aria-label="Permalink to “登录状态丢失”"></a></h3><p><strong>问题</strong>:服务重启后需要重新登录。</p><p><strong>解决方案</strong>:</p><ul><li>确保 <code>data</code> 目录持久化</li><li>检查 <code>userDataMark</code> 配置是否正确</li><li>避免删除浏览器数据目录</li></ul><h3 id="oauth-登录失败" tabindex="-1">OAuth 登录失败 <a class="header-anchor" href="#oauth-登录失败" aria-label="Permalink to “OAuth 登录失败”"></a></h3><p><strong>问题</strong>:Google 等 OAuth 登录跳转失败。</p><p><strong>解决方案</strong>:</p><ul><li>确保可以访问 accounts.google.com</li><li>检查代理配置是否正确</li><li>尝试更换 IP 地址</li></ul><h2 id="浏览器相关" tabindex="-1">浏览器相关 <a class="header-anchor" href="#浏览器相关" aria-label="Permalink to “浏览器相关”"></a></h2><h3 id="浏览器启动失败" tabindex="-1">浏览器启动失败 <a class="header-anchor" href="#浏览器启动失败" aria-label="Permalink to “浏览器启动失败”"></a></h3><p><strong>问题</strong>:Camoufox 无法启动。</p><p><strong>解决方案</strong>:</p><div class="language-bash"><button title="Copy Code" class="copy"></button><span class="lang">bash</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:#6A737D;--shiki-dark:#6A737D;"># 重新初始化 Camoufox</span></span>
|
||||
<span class="line"><span style="--shiki-light:#6F42C1;--shiki-dark:#B392F0;">npm</span><span style="--shiki-light:#032F62;--shiki-dark:#9ECBFF;"> run</span><span style="--shiki-light:#032F62;--shiki-dark:#9ECBFF;"> init</span></span></code></pre></div><h3 id="内存不足" tabindex="-1">内存不足 <a class="header-anchor" href="#内存不足" aria-label="Permalink to “内存不足”"></a></h3><p><strong>问题</strong>:浏览器因内存不足崩溃。</p><p><strong>解决方案</strong>:</p><ul><li>增加服务器内存(建议 2GB+)</li><li>减少同时运行的浏览器实例数量</li><li>Docker 环境确保设置 <code>--shm-size=2gb</code></li></ul><h2 id="网络相关" tabindex="-1">网络相关 <a class="header-anchor" href="#网络相关" aria-label="Permalink to “网络相关”"></a></h2><h3 id="代理连接失败" tabindex="-1">代理连接失败 <a class="header-anchor" href="#代理连接失败" aria-label="Permalink to “代理连接失败”"></a></h3><p><strong>问题</strong>:无法连接到代理服务器。</p><p><strong>解决方案</strong>:</p><ul><li>检查代理服务器地址和端口</li><li>验证代理认证信息</li><li>测试代理服务器是否正常</li></ul><h3 id="目标网站不可访问" tabindex="-1">目标网站不可访问 <a class="header-anchor" href="#目标网站不可访问" aria-label="Permalink to “目标网站不可访问”"></a></h3><p><strong>问题</strong>:无法访问 LMArena/Gemini 等网站。</p><p><strong>解决方案</strong>:</p><ul><li>检查网络连接</li><li>尝试使用代理</li><li>确认目标网站未被封禁</li></ul><h2 id="日志诊断" tabindex="-1">日志诊断 <a class="header-anchor" href="#日志诊断" aria-label="Permalink to “日志诊断”"></a></h2><h3 id="查看详细日志" tabindex="-1">查看详细日志 <a class="header-anchor" href="#查看详细日志" aria-label="Permalink to “查看详细日志”"></a></h3><p>在 <code>config.yaml</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;">logLevel</span><span style="--shiki-light:#24292E;--shiki-dark:#E1E4E8;">: </span><span style="--shiki-light:#032F62;--shiki-dark:#9ECBFF;">debug</span></span></code></pre></div><h3 id="常见日志信息" tabindex="-1">常见日志信息 <a class="header-anchor" href="#常见日志信息" aria-label="Permalink to “常见日志信息”"></a></h3><table tabindex="0"><thead><tr><th>日志内容</th><th>说明</th></tr></thead><tbody><tr><td><code>工作池初始化失败</code></td><td>检查配置文件和网络</td></tr><tr><td><code>Worker 不支持模型</code></td><td>检查模型名称是否正确</td></tr><tr><td><code>验证超时</code></td><td>需要手动完成验证</td></tr><tr><td><code>页面已关闭</code></td><td>浏览器可能崩溃</td></tr></tbody></table><h2 id="获取帮助" tabindex="-1">获取帮助 <a class="header-anchor" href="#获取帮助" aria-label="Permalink to “获取帮助”"></a></h2><p>如果以上方法无法解决问题:</p><ol><li>查看 <a href="https://github.com/foxhui/WebAI2API/issues" target="_blank" rel="noreferrer">GitHub Issues</a></li><li>提交 Issue 并附上: <ul><li>日志输出(设置 <code>logLevel: debug</code>)</li><li>配置文件(隐藏敏感信息)</li><li>操作系统和 Node.js 版本</li></ul></li></ol>`,56)])])}const b=e(t,[["render",s]]);export{g as __pageData,b as default};
|
||||
@@ -0,0 +1 @@
|
||||
import{_ as e,c as i,o as l,ah as r}from"./chunks/framework.BJEpWshW.js";const g=JSON.parse('{"title":"故障排查","description":"","frontmatter":{},"headers":[],"relativePath":"admin/troubleshooting.md","filePath":"admin/troubleshooting.md"}'),t={name:"admin/troubleshooting.md"};function s(o,a,n,h,d,c){return l(),i("div",null,[...a[0]||(a[0]=[r("",56)])])}const b=e(t,[["render",s]]);export{g as __pageData,b as default};
|
||||
@@ -0,0 +1 @@
|
||||
import{_ as l,c as i,o as e,ah as r}from"./chunks/framework.BJEpWshW.js";const b=JSON.parse('{"title":"Web 管理界面","description":"","frontmatter":{},"headers":[],"relativePath":"admin/webui.md","filePath":"admin/webui.md"}'),t={name:"admin/webui.md"};function s(n,a,o,h,d,c){return e(),i("div",null,[...a[0]||(a[0]=[r('<h1 id="web-管理界面" tabindex="-1">Web 管理界面 <a class="header-anchor" href="#web-管理界面" aria-label="Permalink to “Web 管理界面”"></a></h1><p>WebAI2API 提供了内置的 Web 管理界面,用于监控和管理服务。</p><div class="warning custom-block"><p class="custom-block-title">注意</p><p>WebUI 以及管理接口仅在握手阶段使用 API Token 验证,传输阶段无任何加密,如果您在公网环境使用,请使用 Caddy 或 Nginx 等专业的网站服务器对连接进行 HTTPS 加密!</p></div><h2 id="访问地址" tabindex="-1">访问地址 <a class="header-anchor" href="#访问地址" aria-label="Permalink to “访问地址”"></a></h2><div class="language-"><button title="Copy Code" class="copy"></button><span class="lang"></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>http://localhost:3000</span></span></code></pre></div><p>首次访问需要输入配置文件中设置的 API Token 进行认证。</p><h2 id="功能模块" tabindex="-1">功能模块 <a class="header-anchor" href="#功能模块" aria-label="Permalink to “功能模块”"></a></h2><h3 id="仪表盘" tabindex="-1">仪表盘 <a class="header-anchor" href="#仪表盘" aria-label="Permalink to “仪表盘”"></a></h3><p>仪表盘页面显示系统运行状态:</p><ul><li><strong>系统状态</strong>:版本、运行时间、运行模式</li><li><strong>业务统计</strong>:窗口数量、实例数量</li><li><strong>队列状态</strong>:处理中/等待中的任务列表</li></ul><h3 id="系统管理" tabindex="-1">系统管理 <a class="header-anchor" href="#系统管理" aria-label="Permalink to “系统管理”"></a></h3><p>系统管理页面提供:</p><ul><li><p><strong>服务控制</strong></p><ul><li>普通重启</li><li>登录模式重启</li><li>指定 Worker 登录</li><li>停止服务</li></ul></li><li><p><strong>缓存管理</strong></p><ul><li>查看临时文件</li><li>清理缓存</li></ul></li><li><p><strong>数据管理</strong></p><ul><li>查看浏览器数据目录</li><li>删除未使用的数据目录</li></ul></li></ul><h3 id="vnc-显示" tabindex="-1">VNC 显示 <a class="header-anchor" href="#vnc-显示" aria-label="Permalink to “VNC 显示”"></a></h3><p>在 Linux 环境下使用 <code>-xvfb -vnc</code> 启动时,可以通过 WebUI 直接查看和操作虚拟显示器:</p><ul><li>连接/断开 VNC</li><li>全屏显示</li><li>查看 VNC 状态信息</li></ul><div class="tip custom-block"><p class="custom-block-title">说明</p><p>VNC 显示功能需要服务以 Xvfb + VNC 模式运行。</p></div><h3 id="配置管理" tabindex="-1">配置管理 <a class="header-anchor" href="#配置管理" aria-label="Permalink to “配置管理”"></a></h3><ul><li><strong>服务器配置</strong>:端口、认证、心跳设置</li><li><strong>适配器配置</strong>:各后端的专属配置</li><li><strong>浏览器设置</strong>:路径、无头模式、代理</li></ul><h3 id="实例管理" tabindex="-1">实例管理 <a class="header-anchor" href="#实例管理" aria-label="Permalink to “实例管理”"></a></h3><p>管理浏览器实例和 Worker 配置(需要重启生效)。</p><h2 id="快捷操作" tabindex="-1">快捷操作 <a class="header-anchor" href="#快捷操作" aria-label="Permalink to “快捷操作”"></a></h2><h3 id="登录模式重启" tabindex="-1">登录模式重启 <a class="header-anchor" href="#登录模式重启" aria-label="Permalink to “登录模式重启”"></a></h3><ol><li>进入「缓存与重启」页面</li><li>点击「重启」按钮旁的下拉箭头</li><li>选择重启模式: <ul><li><strong>普通重启</strong>:正常模式重启</li><li><strong>登录模式重启</strong>:以 <code>-login</code> 参数重启</li><li><strong>指定 Worker 登录</strong>:选择特定 Worker 进入登录模式</li></ul></li></ol><h3 id="清理缓存" tabindex="-1">清理缓存 <a class="header-anchor" href="#清理缓存" aria-label="Permalink to “清理缓存”"></a></h3><ol><li>进入「缓存与重启」页面</li><li>找到「缓存管理」区域</li><li>点击「清理缓存」按钮</li></ol>',26)])])}const g=l(t,[["render",s]]);export{b as __pageData,g as default};
|
||||
@@ -0,0 +1 @@
|
||||
import{_ as l,c as i,o as e,ah as r}from"./chunks/framework.BJEpWshW.js";const b=JSON.parse('{"title":"Web 管理界面","description":"","frontmatter":{},"headers":[],"relativePath":"admin/webui.md","filePath":"admin/webui.md"}'),t={name:"admin/webui.md"};function s(n,a,o,h,d,c){return e(),i("div",null,[...a[0]||(a[0]=[r("",26)])])}const g=l(t,[["render",s]]);export{b as __pageData,g as default};
|
||||
+84
@@ -0,0 +1,84 @@
|
||||
import{_ as i,c as a,o as t,ah as n}from"./chunks/framework.BJEpWshW.js";const E=JSON.parse('{"title":"Chat Completions","description":"","frontmatter":{},"headers":[],"relativePath":"api/chat.md","filePath":"api/chat.md"}'),l={name:"api/chat.md"};function h(e,s,p,k,o,d){return t(),a("div",null,[...s[0]||(s[0]=[n(`<h1 id="chat-completions" tabindex="-1">Chat Completions <a class="header-anchor" href="#chat-completions" aria-label="Permalink to “Chat Completions”"></a></h1><p>对话生成接口,兼容 OpenAI Chat Completions API。</p><h2 id="端点" tabindex="-1">端点 <a class="header-anchor" href="#端点" aria-label="Permalink to “端点”"></a></h2><div class="language-"><button title="Copy Code" class="copy"></button><span class="lang"></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>POST /v1/chat/completions</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>model</code></td><td>string</td><td>✅</td><td>模型名称</td></tr><tr><td><code>messages</code></td><td>array</td><td>✅</td><td>消息列表</td></tr><tr><td><code>stream</code></td><td>boolean</td><td>❌</td><td>是否启用流式响应(推荐开启)</td></tr></tbody></table><h3 id="messages-格式" tabindex="-1">messages 格式 <a class="header-anchor" href="#messages-格式" aria-label="Permalink to “messages 格式”"></a></h3><div class="language-json"><button title="Copy Code" class="copy"></button><span class="lang">json</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:#24292E;--shiki-dark:#E1E4E8;">{</span></span>
|
||||
<span class="line"><span style="--shiki-light:#005CC5;--shiki-dark:#79B8FF;"> "messages"</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;"> "role"</span><span style="--shiki-light:#24292E;--shiki-dark:#E1E4E8;">: </span><span style="--shiki-light:#032F62;--shiki-dark:#9ECBFF;">"user"</span><span style="--shiki-light:#24292E;--shiki-dark:#E1E4E8;">,</span></span>
|
||||
<span class="line"><span style="--shiki-light:#005CC5;--shiki-dark:#79B8FF;"> "content"</span><span style="--shiki-light:#24292E;--shiki-dark:#E1E4E8;">: </span><span style="--shiki-light:#032F62;--shiki-dark:#9ECBFF;">"生成一只可爱的猫"</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:#24292E;--shiki-dark:#E1E4E8;">}</span></span></code></pre></div><h3 id="多模态请求-图生图" tabindex="-1">多模态请求(图生图) <a class="header-anchor" href="#多模态请求-图生图" aria-label="Permalink to “多模态请求(图生图)”"></a></h3><div class="language-json"><button title="Copy Code" class="copy"></button><span class="lang">json</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:#24292E;--shiki-dark:#E1E4E8;">{</span></span>
|
||||
<span class="line"><span style="--shiki-light:#005CC5;--shiki-dark:#79B8FF;"> "messages"</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;"> "role"</span><span style="--shiki-light:#24292E;--shiki-dark:#E1E4E8;">: </span><span style="--shiki-light:#032F62;--shiki-dark:#9ECBFF;">"user"</span><span style="--shiki-light:#24292E;--shiki-dark:#E1E4E8;">,</span></span>
|
||||
<span class="line"><span style="--shiki-light:#005CC5;--shiki-dark:#79B8FF;"> "content"</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;"> "type"</span><span style="--shiki-light:#24292E;--shiki-dark:#E1E4E8;">: </span><span style="--shiki-light:#032F62;--shiki-dark:#9ECBFF;">"text"</span><span style="--shiki-light:#24292E;--shiki-dark:#E1E4E8;">,</span></span>
|
||||
<span class="line"><span style="--shiki-light:#005CC5;--shiki-dark:#79B8FF;"> "text"</span><span style="--shiki-light:#24292E;--shiki-dark:#E1E4E8;">: </span><span style="--shiki-light:#032F62;--shiki-dark:#9ECBFF;">"让这张图片更加鲜艳"</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;"> "type"</span><span style="--shiki-light:#24292E;--shiki-dark:#E1E4E8;">: </span><span style="--shiki-light:#032F62;--shiki-dark:#9ECBFF;">"image_url"</span><span style="--shiki-light:#24292E;--shiki-dark:#E1E4E8;">,</span></span>
|
||||
<span class="line"><span style="--shiki-light:#005CC5;--shiki-dark:#79B8FF;"> "image_url"</span><span style="--shiki-light:#24292E;--shiki-dark:#E1E4E8;">: {</span></span>
|
||||
<span class="line"><span style="--shiki-light:#005CC5;--shiki-dark:#79B8FF;"> "url"</span><span style="--shiki-light:#24292E;--shiki-dark:#E1E4E8;">: </span><span style="--shiki-light:#032F62;--shiki-dark:#9ECBFF;">"data:image/jpeg;base64,/9j/4AAQ..."</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:#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:#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 “图片限制”"></a></h2><table tabindex="0"><thead><tr><th>限制项</th><th>说明</th></tr></thead><tbody><tr><td>支持格式</td><td>PNG, JPEG, GIF, WebP</td></tr><tr><td>数量限制</td><td>默认 5 张,最大 10 张</td></tr><tr><td>数据格式</td><td>Base64 Data URL (<code>data:image/jpeg;base64,...</code>)</td></tr><tr><td>自动转换</td><td>服务器会自动转换为 JPG 格式</td></tr></tbody></table><h2 id="非流式响应" tabindex="-1">非流式响应 <a class="header-anchor" href="#非流式响应" aria-label="Permalink to “非流式响应”"></a></h2><h3 id="请求示例" tabindex="-1">请求示例 <a class="header-anchor" href="#请求示例" aria-label="Permalink to “请求示例”"></a></h3><div class="language-bash"><button title="Copy Code" class="copy"></button><span class="lang">bash</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:#6F42C1;--shiki-dark:#B392F0;">curl</span><span style="--shiki-light:#005CC5;--shiki-dark:#79B8FF;"> -X</span><span style="--shiki-light:#032F62;--shiki-dark:#9ECBFF;"> POST</span><span style="--shiki-light:#032F62;--shiki-dark:#9ECBFF;"> http://localhost:3000/v1/chat/completions</span><span style="--shiki-light:#005CC5;--shiki-dark:#79B8FF;"> \\</span></span>
|
||||
<span class="line"><span style="--shiki-light:#005CC5;--shiki-dark:#79B8FF;"> -H</span><span style="--shiki-light:#032F62;--shiki-dark:#9ECBFF;"> "Content-Type: application/json"</span><span style="--shiki-light:#005CC5;--shiki-dark:#79B8FF;"> \\</span></span>
|
||||
<span class="line"><span style="--shiki-light:#005CC5;--shiki-dark:#79B8FF;"> -H</span><span style="--shiki-light:#032F62;--shiki-dark:#9ECBFF;"> "Authorization: Bearer sk-your-key"</span><span style="--shiki-light:#005CC5;--shiki-dark:#79B8FF;"> \\</span></span>
|
||||
<span class="line"><span style="--shiki-light:#005CC5;--shiki-dark:#79B8FF;"> -d</span><span style="--shiki-light:#032F62;--shiki-dark:#9ECBFF;"> '{</span></span>
|
||||
<span class="line"><span style="--shiki-light:#032F62;--shiki-dark:#9ECBFF;"> "model": "gemini-3-pro-image-preview",</span></span>
|
||||
<span class="line"><span style="--shiki-light:#032F62;--shiki-dark:#9ECBFF;"> "messages": [</span></span>
|
||||
<span class="line"><span style="--shiki-light:#032F62;--shiki-dark:#9ECBFF;"> {</span></span>
|
||||
<span class="line"><span style="--shiki-light:#032F62;--shiki-dark:#9ECBFF;"> "role": "user",</span></span>
|
||||
<span class="line"><span style="--shiki-light:#032F62;--shiki-dark:#9ECBFF;"> "content": "generate a cat"</span></span>
|
||||
<span class="line"><span style="--shiki-light:#032F62;--shiki-dark:#9ECBFF;"> }</span></span>
|
||||
<span class="line"><span style="--shiki-light:#032F62;--shiki-dark:#9ECBFF;"> ]</span></span>
|
||||
<span class="line"><span style="--shiki-light:#032F62;--shiki-dark:#9ECBFF;"> }'</span></span></code></pre></div><h3 id="响应示例" tabindex="-1">响应示例 <a class="header-anchor" href="#响应示例" aria-label="Permalink to “响应示例”"></a></h3><div class="language-json"><button title="Copy Code" class="copy"></button><span class="lang">json</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:#24292E;--shiki-dark:#E1E4E8;">{</span></span>
|
||||
<span class="line"><span style="--shiki-light:#005CC5;--shiki-dark:#79B8FF;"> "id"</span><span style="--shiki-light:#24292E;--shiki-dark:#E1E4E8;">: </span><span style="--shiki-light:#032F62;--shiki-dark:#9ECBFF;">"chatcmpl-1732374740123"</span><span style="--shiki-light:#24292E;--shiki-dark:#E1E4E8;">,</span></span>
|
||||
<span class="line"><span style="--shiki-light:#005CC5;--shiki-dark:#79B8FF;"> "object"</span><span style="--shiki-light:#24292E;--shiki-dark:#E1E4E8;">: </span><span style="--shiki-light:#032F62;--shiki-dark:#9ECBFF;">"chat.completion"</span><span style="--shiki-light:#24292E;--shiki-dark:#E1E4E8;">,</span></span>
|
||||
<span class="line"><span style="--shiki-light:#005CC5;--shiki-dark:#79B8FF;"> "created"</span><span style="--shiki-light:#24292E;--shiki-dark:#E1E4E8;">: </span><span style="--shiki-light:#005CC5;--shiki-dark:#79B8FF;">1732374740</span><span style="--shiki-light:#24292E;--shiki-dark:#E1E4E8;">,</span></span>
|
||||
<span class="line"><span style="--shiki-light:#005CC5;--shiki-dark:#79B8FF;"> "model"</span><span style="--shiki-light:#24292E;--shiki-dark:#E1E4E8;">: </span><span style="--shiki-light:#032F62;--shiki-dark:#9ECBFF;">"gemini-3-pro-image-preview"</span><span style="--shiki-light:#24292E;--shiki-dark:#E1E4E8;">,</span></span>
|
||||
<span class="line"><span style="--shiki-light:#005CC5;--shiki-dark:#79B8FF;"> "choices"</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;"> "index"</span><span style="--shiki-light:#24292E;--shiki-dark:#E1E4E8;">: </span><span style="--shiki-light:#005CC5;--shiki-dark:#79B8FF;">0</span><span style="--shiki-light:#24292E;--shiki-dark:#E1E4E8;">,</span></span>
|
||||
<span class="line"><span style="--shiki-light:#005CC5;--shiki-dark:#79B8FF;"> "message"</span><span style="--shiki-light:#24292E;--shiki-dark:#E1E4E8;">: {</span></span>
|
||||
<span class="line"><span style="--shiki-light:#005CC5;--shiki-dark:#79B8FF;"> "role"</span><span style="--shiki-light:#24292E;--shiki-dark:#E1E4E8;">: </span><span style="--shiki-light:#032F62;--shiki-dark:#9ECBFF;">"assistant"</span><span style="--shiki-light:#24292E;--shiki-dark:#E1E4E8;">,</span></span>
|
||||
<span class="line"><span style="--shiki-light:#005CC5;--shiki-dark:#79B8FF;"> "content"</span><span style="--shiki-light:#24292E;--shiki-dark:#E1E4E8;">: </span><span style="--shiki-light:#032F62;--shiki-dark:#9ECBFF;">""</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;"> "finish_reason"</span><span style="--shiki-light:#24292E;--shiki-dark:#E1E4E8;">: </span><span style="--shiki-light:#032F62;--shiki-dark:#9ECBFF;">"stop"</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:#24292E;--shiki-dark:#E1E4E8;">}</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><p>流式模式包含心跳保活机制,可以避免长时间生成导致的连接超时。</p></div><h3 id="请求示例-1" tabindex="-1">请求示例 <a class="header-anchor" href="#请求示例-1" aria-label="Permalink to “请求示例”"></a></h3><div class="language-bash"><button title="Copy Code" class="copy"></button><span class="lang">bash</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:#6F42C1;--shiki-dark:#B392F0;">curl</span><span style="--shiki-light:#005CC5;--shiki-dark:#79B8FF;"> -X</span><span style="--shiki-light:#032F62;--shiki-dark:#9ECBFF;"> POST</span><span style="--shiki-light:#032F62;--shiki-dark:#9ECBFF;"> http://localhost:3000/v1/chat/completions</span><span style="--shiki-light:#005CC5;--shiki-dark:#79B8FF;"> \\</span></span>
|
||||
<span class="line"><span style="--shiki-light:#005CC5;--shiki-dark:#79B8FF;"> -H</span><span style="--shiki-light:#032F62;--shiki-dark:#9ECBFF;"> "Content-Type: application/json"</span><span style="--shiki-light:#005CC5;--shiki-dark:#79B8FF;"> \\</span></span>
|
||||
<span class="line"><span style="--shiki-light:#005CC5;--shiki-dark:#79B8FF;"> -H</span><span style="--shiki-light:#032F62;--shiki-dark:#9ECBFF;"> "Authorization: Bearer sk-your-key"</span><span style="--shiki-light:#005CC5;--shiki-dark:#79B8FF;"> \\</span></span>
|
||||
<span class="line"><span style="--shiki-light:#005CC5;--shiki-dark:#79B8FF;"> -d</span><span style="--shiki-light:#032F62;--shiki-dark:#9ECBFF;"> '{</span></span>
|
||||
<span class="line"><span style="--shiki-light:#032F62;--shiki-dark:#9ECBFF;"> "model": "gemini-3-pro-image-preview",</span></span>
|
||||
<span class="line"><span style="--shiki-light:#032F62;--shiki-dark:#9ECBFF;"> "stream": true,</span></span>
|
||||
<span class="line"><span style="--shiki-light:#032F62;--shiki-dark:#9ECBFF;"> "messages": [</span></span>
|
||||
<span class="line"><span style="--shiki-light:#032F62;--shiki-dark:#9ECBFF;"> {</span></span>
|
||||
<span class="line"><span style="--shiki-light:#032F62;--shiki-dark:#9ECBFF;"> "role": "user",</span></span>
|
||||
<span class="line"><span style="--shiki-light:#032F62;--shiki-dark:#9ECBFF;"> "content": "generate a cat"</span></span>
|
||||
<span class="line"><span style="--shiki-light:#032F62;--shiki-dark:#9ECBFF;"> }</span></span>
|
||||
<span class="line"><span style="--shiki-light:#032F62;--shiki-dark:#9ECBFF;"> ]</span></span>
|
||||
<span class="line"><span style="--shiki-light:#032F62;--shiki-dark:#9ECBFF;"> }'</span></span></code></pre></div><h3 id="响应示例-1" tabindex="-1">响应示例 <a class="header-anchor" href="#响应示例-1" aria-label="Permalink to “响应示例”"></a></h3><div class="language-"><button title="Copy Code" class="copy"></button><span class="lang"></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>data: {"id":"chatcmpl-123","object":"chat.completion.chunk","created":1732374740,"model":"gemini-3-pro-image-preview","choices":[{"index":0,"delta":{"role":"assistant","content":""},"finish_reason":null}]}</span></span>
|
||||
<span class="line"><span></span></span>
|
||||
<span class="line"><span>: keep-alive</span></span>
|
||||
<span class="line"><span></span></span>
|
||||
<span class="line"><span>: keep-alive</span></span>
|
||||
<span class="line"><span></span></span>
|
||||
<span class="line"><span>data: {"id":"chatcmpl-123","object":"chat.completion.chunk","created":1732374740,"model":"gemini-3-pro-image-preview","choices":[{"index":0,"delta":{"content":""},"finish_reason":"stop"}]}</span></span>
|
||||
<span class="line"><span></span></span>
|
||||
<span class="line"><span>data: [DONE]</span></span></code></pre></div><h2 id="错误处理" tabindex="-1">错误处理 <a class="header-anchor" href="#错误处理" aria-label="Permalink to “错误处理”"></a></h2><h3 id="队列已满-429" tabindex="-1">队列已满 (429) <a class="header-anchor" href="#队列已满-429" aria-label="Permalink to “队列已满 (429)”"></a></h3><div class="language-json"><button title="Copy Code" class="copy"></button><span class="lang">json</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:#24292E;--shiki-dark:#E1E4E8;">{</span></span>
|
||||
<span class="line"><span style="--shiki-light:#005CC5;--shiki-dark:#79B8FF;"> "error"</span><span style="--shiki-light:#24292E;--shiki-dark:#E1E4E8;">: {</span></span>
|
||||
<span class="line"><span style="--shiki-light:#005CC5;--shiki-dark:#79B8FF;"> "message"</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:#005CC5;--shiki-dark:#79B8FF;"> "type"</span><span style="--shiki-light:#24292E;--shiki-dark:#E1E4E8;">: </span><span style="--shiki-light:#032F62;--shiki-dark:#9ECBFF;">"rate_limit_exceeded"</span><span style="--shiki-light:#24292E;--shiki-dark:#E1E4E8;">,</span></span>
|
||||
<span class="line"><span style="--shiki-light:#005CC5;--shiki-dark:#79B8FF;"> "code"</span><span style="--shiki-light:#24292E;--shiki-dark:#E1E4E8;">: </span><span style="--shiki-light:#032F62;--shiki-dark:#9ECBFF;">"QUEUE_FULL"</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><div class="tip custom-block"><p class="custom-block-title">解决方案</p><p>启用流式模式 (<code>stream: true</code>) 可以无限排队,避免 429 错误。</p></div><h3 id="模型不支持-400" tabindex="-1">模型不支持 (400) <a class="header-anchor" href="#模型不支持-400" aria-label="Permalink to “模型不支持 (400)”"></a></h3><div class="language-json"><button title="Copy Code" class="copy"></button><span class="lang">json</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:#24292E;--shiki-dark:#E1E4E8;">{</span></span>
|
||||
<span class="line"><span style="--shiki-light:#005CC5;--shiki-dark:#79B8FF;"> "error"</span><span style="--shiki-light:#24292E;--shiki-dark:#E1E4E8;">: {</span></span>
|
||||
<span class="line"><span style="--shiki-light:#005CC5;--shiki-dark:#79B8FF;"> "message"</span><span style="--shiki-light:#24292E;--shiki-dark:#E1E4E8;">: </span><span style="--shiki-light:#032F62;--shiki-dark:#9ECBFF;">"没有 Worker 支持模型: invalid-model"</span><span style="--shiki-light:#24292E;--shiki-dark:#E1E4E8;">,</span></span>
|
||||
<span class="line"><span style="--shiki-light:#005CC5;--shiki-dark:#79B8FF;"> "type"</span><span style="--shiki-light:#24292E;--shiki-dark:#E1E4E8;">: </span><span style="--shiki-light:#032F62;--shiki-dark:#9ECBFF;">"invalid_request_error"</span><span style="--shiki-light:#24292E;--shiki-dark:#E1E4E8;">,</span></span>
|
||||
<span class="line"><span style="--shiki-light:#005CC5;--shiki-dark:#79B8FF;"> "code"</span><span style="--shiki-light:#24292E;--shiki-dark:#E1E4E8;">: </span><span style="--shiki-light:#032F62;--shiki-dark:#9ECBFF;">"MODEL_NOT_FOUND"</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>`,29)])])}const g=i(l,[["render",h]]);export{E as __pageData,g as default};
|
||||
@@ -0,0 +1 @@
|
||||
import{_ as i,c as a,o as t,ah as n}from"./chunks/framework.BJEpWshW.js";const E=JSON.parse('{"title":"Chat Completions","description":"","frontmatter":{},"headers":[],"relativePath":"api/chat.md","filePath":"api/chat.md"}'),l={name:"api/chat.md"};function h(e,s,p,k,o,d){return t(),a("div",null,[...s[0]||(s[0]=[n("",29)])])}const g=i(l,[["render",h]]);export{E as __pageData,g as default};
|
||||
@@ -0,0 +1,27 @@
|
||||
import{_ as i,c as a,o as t,ah as n}from"./chunks/framework.BJEpWshW.js";const E=JSON.parse('{"title":"Cookies API","description":"","frontmatter":{},"headers":[],"relativePath":"api/cookies.md","filePath":"api/cookies.md"}'),h={name:"api/cookies.md"};function l(k,s,e,p,r,o){return t(),a("div",null,[...s[0]||(s[0]=[n(`<h1 id="cookies-api" tabindex="-1">Cookies API <a class="header-anchor" href="#cookies-api" aria-label="Permalink to “Cookies API”"></a></h1><p>获取浏览器实例的 Cookie,可用于其他工具。</p><h2 id="端点" tabindex="-1">端点 <a class="header-anchor" href="#端点" aria-label="Permalink to “端点”"></a></h2><div class="language-"><button title="Copy Code" class="copy"></button><span class="lang"></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>GET /v1/cookies</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>name</code></td><td>string</td><td>❌</td><td>浏览器实例名称</td></tr><tr><td><code>domain</code></td><td>string</td><td>❌</td><td>过滤指定域名的 Cookie</td></tr></tbody></table><h2 id="请求示例" tabindex="-1">请求示例 <a class="header-anchor" href="#请求示例" aria-label="Permalink to “请求示例”"></a></h2><h3 id="获取所有-cookie" tabindex="-1">获取所有 Cookie <a class="header-anchor" href="#获取所有-cookie" aria-label="Permalink to “获取所有 Cookie”"></a></h3><div class="language-bash"><button title="Copy Code" class="copy"></button><span class="lang">bash</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:#6F42C1;--shiki-dark:#B392F0;">curl</span><span style="--shiki-light:#005CC5;--shiki-dark:#79B8FF;"> -X</span><span style="--shiki-light:#032F62;--shiki-dark:#9ECBFF;"> GET</span><span style="--shiki-light:#032F62;--shiki-dark:#9ECBFF;"> http://localhost:3000/v1/cookies</span><span style="--shiki-light:#005CC5;--shiki-dark:#79B8FF;"> \\</span></span>
|
||||
<span class="line"><span style="--shiki-light:#005CC5;--shiki-dark:#79B8FF;"> -H</span><span style="--shiki-light:#032F62;--shiki-dark:#9ECBFF;"> "Authorization: Bearer sk-your-key"</span></span></code></pre></div><h3 id="指定实例和域名" tabindex="-1">指定实例和域名 <a class="header-anchor" href="#指定实例和域名" aria-label="Permalink to “指定实例和域名”"></a></h3><div class="language-bash"><button title="Copy Code" class="copy"></button><span class="lang">bash</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:#6F42C1;--shiki-dark:#B392F0;">curl</span><span style="--shiki-light:#005CC5;--shiki-dark:#79B8FF;"> -X</span><span style="--shiki-light:#032F62;--shiki-dark:#9ECBFF;"> GET</span><span style="--shiki-light:#032F62;--shiki-dark:#9ECBFF;"> "http://localhost:3000/v1/cookies?name=browser_default&domain=lmarena.ai"</span><span style="--shiki-light:#005CC5;--shiki-dark:#79B8FF;"> \\</span></span>
|
||||
<span class="line"><span style="--shiki-light:#005CC5;--shiki-dark:#79B8FF;"> -H</span><span style="--shiki-light:#032F62;--shiki-dark:#9ECBFF;"> "Authorization: Bearer sk-your-key"</span></span></code></pre></div><h2 id="响应格式" tabindex="-1">响应格式 <a class="header-anchor" href="#响应格式" aria-label="Permalink to “响应格式”"></a></h2><div class="language-json"><button title="Copy Code" class="copy"></button><span class="lang">json</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:#24292E;--shiki-dark:#E1E4E8;">{</span></span>
|
||||
<span class="line"><span style="--shiki-light:#005CC5;--shiki-dark:#79B8FF;"> "instance"</span><span style="--shiki-light:#24292E;--shiki-dark:#E1E4E8;">: </span><span style="--shiki-light:#032F62;--shiki-dark:#9ECBFF;">"browser_default"</span><span style="--shiki-light:#24292E;--shiki-dark:#E1E4E8;">,</span></span>
|
||||
<span class="line"><span style="--shiki-light:#005CC5;--shiki-dark:#79B8FF;"> "cookies"</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;"> "name"</span><span style="--shiki-light:#24292E;--shiki-dark:#E1E4E8;">: </span><span style="--shiki-light:#032F62;--shiki-dark:#9ECBFF;">"_GRECAPTCHA"</span><span style="--shiki-light:#24292E;--shiki-dark:#E1E4E8;">,</span></span>
|
||||
<span class="line"><span style="--shiki-light:#005CC5;--shiki-dark:#79B8FF;"> "value"</span><span style="--shiki-light:#24292E;--shiki-dark:#E1E4E8;">: </span><span style="--shiki-light:#032F62;--shiki-dark:#9ECBFF;">"09ADxxxxxx"</span><span style="--shiki-light:#24292E;--shiki-dark:#E1E4E8;">,</span></span>
|
||||
<span class="line"><span style="--shiki-light:#005CC5;--shiki-dark:#79B8FF;"> "domain"</span><span style="--shiki-light:#24292E;--shiki-dark:#E1E4E8;">: </span><span style="--shiki-light:#032F62;--shiki-dark:#9ECBFF;">"www.google.com"</span><span style="--shiki-light:#24292E;--shiki-dark:#E1E4E8;">,</span></span>
|
||||
<span class="line"><span style="--shiki-light:#005CC5;--shiki-dark:#79B8FF;"> "path"</span><span style="--shiki-light:#24292E;--shiki-dark:#E1E4E8;">: </span><span style="--shiki-light:#032F62;--shiki-dark:#9ECBFF;">"/recaptcha"</span><span style="--shiki-light:#24292E;--shiki-dark:#E1E4E8;">,</span></span>
|
||||
<span class="line"><span style="--shiki-light:#005CC5;--shiki-dark:#79B8FF;"> "expires"</span><span style="--shiki-light:#24292E;--shiki-dark:#E1E4E8;">: </span><span style="--shiki-light:#005CC5;--shiki-dark:#79B8FF;">1780000000</span><span style="--shiki-light:#24292E;--shiki-dark:#E1E4E8;">,</span></span>
|
||||
<span class="line"><span style="--shiki-light:#005CC5;--shiki-dark:#79B8FF;"> "httpOnly"</span><span style="--shiki-light:#24292E;--shiki-dark:#E1E4E8;">: </span><span style="--shiki-light:#005CC5;--shiki-dark:#79B8FF;">true</span><span style="--shiki-light:#24292E;--shiki-dark:#E1E4E8;">,</span></span>
|
||||
<span class="line"><span style="--shiki-light:#005CC5;--shiki-dark:#79B8FF;"> "secure"</span><span style="--shiki-light:#24292E;--shiki-dark:#E1E4E8;">: </span><span style="--shiki-light:#005CC5;--shiki-dark:#79B8FF;">true</span><span style="--shiki-light:#24292E;--shiki-dark:#E1E4E8;">,</span></span>
|
||||
<span class="line"><span style="--shiki-light:#005CC5;--shiki-dark:#79B8FF;"> "sameSite"</span><span style="--shiki-light:#24292E;--shiki-dark:#E1E4E8;">: </span><span style="--shiki-light:#032F62;--shiki-dark:#9ECBFF;">"None"</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;"> "name"</span><span style="--shiki-light:#24292E;--shiki-dark:#E1E4E8;">: </span><span style="--shiki-light:#032F62;--shiki-dark:#9ECBFF;">"OTZ"</span><span style="--shiki-light:#24292E;--shiki-dark:#E1E4E8;">,</span></span>
|
||||
<span class="line"><span style="--shiki-light:#005CC5;--shiki-dark:#79B8FF;"> "value"</span><span style="--shiki-light:#24292E;--shiki-dark:#E1E4E8;">: </span><span style="--shiki-light:#032F62;--shiki-dark:#9ECBFF;">"8888888_24_24__24_"</span><span style="--shiki-light:#24292E;--shiki-dark:#E1E4E8;">,</span></span>
|
||||
<span class="line"><span style="--shiki-light:#005CC5;--shiki-dark:#79B8FF;"> "domain"</span><span style="--shiki-light:#24292E;--shiki-dark:#E1E4E8;">: </span><span style="--shiki-light:#032F62;--shiki-dark:#9ECBFF;">"accounts.google.com"</span><span style="--shiki-light:#24292E;--shiki-dark:#E1E4E8;">,</span></span>
|
||||
<span class="line"><span style="--shiki-light:#005CC5;--shiki-dark:#79B8FF;"> "path"</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:#005CC5;--shiki-dark:#79B8FF;"> "expires"</span><span style="--shiki-light:#24292E;--shiki-dark:#E1E4E8;">: </span><span style="--shiki-light:#005CC5;--shiki-dark:#79B8FF;">1760000000</span><span style="--shiki-light:#24292E;--shiki-dark:#E1E4E8;">,</span></span>
|
||||
<span class="line"><span style="--shiki-light:#005CC5;--shiki-dark:#79B8FF;"> "httpOnly"</span><span style="--shiki-light:#24292E;--shiki-dark:#E1E4E8;">: </span><span style="--shiki-light:#005CC5;--shiki-dark:#79B8FF;">false</span><span style="--shiki-light:#24292E;--shiki-dark:#E1E4E8;">,</span></span>
|
||||
<span class="line"><span style="--shiki-light:#005CC5;--shiki-dark:#79B8FF;"> "secure"</span><span style="--shiki-light:#24292E;--shiki-dark:#E1E4E8;">: </span><span style="--shiki-light:#005CC5;--shiki-dark:#79B8FF;">true</span><span style="--shiki-light:#24292E;--shiki-dark:#E1E4E8;">,</span></span>
|
||||
<span class="line"><span style="--shiki-light:#005CC5;--shiki-dark:#79B8FF;"> "sameSite"</span><span style="--shiki-light:#24292E;--shiki-dark:#E1E4E8;">: </span><span style="--shiki-light:#032F62;--shiki-dark:#9ECBFF;">"None"</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:#24292E;--shiki-dark:#E1E4E8;">}</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>将 Cookie 导出给其他自动化工具使用</li><li>利用本项目的自动续登功能保持 Cookie 新鲜</li><li>调试登录状态问题</li></ul></div>`,15)])])}const g=i(h,[["render",l]]);export{E as __pageData,g as default};
|
||||
@@ -0,0 +1 @@
|
||||
import{_ as i,c as a,o as t,ah as n}from"./chunks/framework.BJEpWshW.js";const E=JSON.parse('{"title":"Cookies API","description":"","frontmatter":{},"headers":[],"relativePath":"api/cookies.md","filePath":"api/cookies.md"}'),h={name:"api/cookies.md"};function l(k,s,e,p,r,o){return t(),a("div",null,[...s[0]||(s[0]=[n("",15)])])}const g=i(h,[["render",l]]);export{E as __pageData,g as default};
|
||||
@@ -0,0 +1,25 @@
|
||||
import{_ as i,c as a,o as n,ah as t}from"./chunks/framework.BJEpWshW.js";const E=JSON.parse('{"title":"Models API","description":"","frontmatter":{},"headers":[],"relativePath":"api/models.md","filePath":"api/models.md"}'),e={name:"api/models.md"};function l(h,s,p,k,d,r){return n(),a("div",null,[...s[0]||(s[0]=[t(`<h1 id="models-api" tabindex="-1">Models API <a class="header-anchor" href="#models-api" aria-label="Permalink to “Models API”"></a></h1><p>获取当前可用的模型列表。</p><h2 id="端点" tabindex="-1">端点 <a class="header-anchor" href="#端点" aria-label="Permalink to “端点”"></a></h2><div class="language-"><button title="Copy Code" class="copy"></button><span class="lang"></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>GET /v1/models</span></span></code></pre></div><h2 id="请求示例" tabindex="-1">请求示例 <a class="header-anchor" href="#请求示例" aria-label="Permalink to “请求示例”"></a></h2><div class="language-bash"><button title="Copy Code" class="copy"></button><span class="lang">bash</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:#6F42C1;--shiki-dark:#B392F0;">curl</span><span style="--shiki-light:#005CC5;--shiki-dark:#79B8FF;"> -X</span><span style="--shiki-light:#032F62;--shiki-dark:#9ECBFF;"> GET</span><span style="--shiki-light:#032F62;--shiki-dark:#9ECBFF;"> http://localhost:3000/v1/models</span><span style="--shiki-light:#005CC5;--shiki-dark:#79B8FF;"> \\</span></span>
|
||||
<span class="line"><span style="--shiki-light:#005CC5;--shiki-dark:#79B8FF;"> -H</span><span style="--shiki-light:#032F62;--shiki-dark:#9ECBFF;"> "Authorization: Bearer sk-your-key"</span></span></code></pre></div><h2 id="响应格式" tabindex="-1">响应格式 <a class="header-anchor" href="#响应格式" aria-label="Permalink to “响应格式”"></a></h2><div class="language-json"><button title="Copy Code" class="copy"></button><span class="lang">json</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:#24292E;--shiki-dark:#E1E4E8;">{</span></span>
|
||||
<span class="line"><span style="--shiki-light:#005CC5;--shiki-dark:#79B8FF;"> "object"</span><span style="--shiki-light:#24292E;--shiki-dark:#E1E4E8;">: </span><span style="--shiki-light:#032F62;--shiki-dark:#9ECBFF;">"list"</span><span style="--shiki-light:#24292E;--shiki-dark:#E1E4E8;">,</span></span>
|
||||
<span class="line"><span style="--shiki-light:#005CC5;--shiki-dark:#79B8FF;"> "data"</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;"> "id"</span><span style="--shiki-light:#24292E;--shiki-dark:#E1E4E8;">: </span><span style="--shiki-light:#032F62;--shiki-dark:#9ECBFF;">"gemini-3-pro-image-preview"</span><span style="--shiki-light:#24292E;--shiki-dark:#E1E4E8;">,</span></span>
|
||||
<span class="line"><span style="--shiki-light:#005CC5;--shiki-dark:#79B8FF;"> "object"</span><span style="--shiki-light:#24292E;--shiki-dark:#E1E4E8;">: </span><span style="--shiki-light:#032F62;--shiki-dark:#9ECBFF;">"model"</span><span style="--shiki-light:#24292E;--shiki-dark:#E1E4E8;">,</span></span>
|
||||
<span class="line"><span style="--shiki-light:#005CC5;--shiki-dark:#79B8FF;"> "created"</span><span style="--shiki-light:#24292E;--shiki-dark:#E1E4E8;">: </span><span style="--shiki-light:#005CC5;--shiki-dark:#79B8FF;">1732456789</span><span style="--shiki-light:#24292E;--shiki-dark:#E1E4E8;">,</span></span>
|
||||
<span class="line"><span style="--shiki-light:#005CC5;--shiki-dark:#79B8FF;"> "owned_by"</span><span style="--shiki-light:#24292E;--shiki-dark:#E1E4E8;">: </span><span style="--shiki-light:#032F62;--shiki-dark:#9ECBFF;">"internal_server"</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;"> "id"</span><span style="--shiki-light:#24292E;--shiki-dark:#E1E4E8;">: </span><span style="--shiki-light:#032F62;--shiki-dark:#9ECBFF;">"lmarena/gemini-3-pro-image-preview"</span><span style="--shiki-light:#24292E;--shiki-dark:#E1E4E8;">,</span></span>
|
||||
<span class="line"><span style="--shiki-light:#005CC5;--shiki-dark:#79B8FF;"> "object"</span><span style="--shiki-light:#24292E;--shiki-dark:#E1E4E8;">: </span><span style="--shiki-light:#032F62;--shiki-dark:#9ECBFF;">"model"</span><span style="--shiki-light:#24292E;--shiki-dark:#E1E4E8;">,</span></span>
|
||||
<span class="line"><span style="--shiki-light:#005CC5;--shiki-dark:#79B8FF;"> "created"</span><span style="--shiki-light:#24292E;--shiki-dark:#E1E4E8;">: </span><span style="--shiki-light:#005CC5;--shiki-dark:#79B8FF;">1732456789</span><span style="--shiki-light:#24292E;--shiki-dark:#E1E4E8;">,</span></span>
|
||||
<span class="line"><span style="--shiki-light:#005CC5;--shiki-dark:#79B8FF;"> "owned_by"</span><span style="--shiki-light:#24292E;--shiki-dark:#E1E4E8;">: </span><span style="--shiki-light:#032F62;--shiki-dark:#9ECBFF;">"lmarena"</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;"> "id"</span><span style="--shiki-light:#24292E;--shiki-dark:#E1E4E8;">: </span><span style="--shiki-light:#032F62;--shiki-dark:#9ECBFF;">"seedream-4-high-res-fal"</span><span style="--shiki-light:#24292E;--shiki-dark:#E1E4E8;">,</span></span>
|
||||
<span class="line"><span style="--shiki-light:#005CC5;--shiki-dark:#79B8FF;"> "object"</span><span style="--shiki-light:#24292E;--shiki-dark:#E1E4E8;">: </span><span style="--shiki-light:#032F62;--shiki-dark:#9ECBFF;">"model"</span><span style="--shiki-light:#24292E;--shiki-dark:#E1E4E8;">,</span></span>
|
||||
<span class="line"><span style="--shiki-light:#005CC5;--shiki-dark:#79B8FF;"> "created"</span><span style="--shiki-light:#24292E;--shiki-dark:#E1E4E8;">: </span><span style="--shiki-light:#005CC5;--shiki-dark:#79B8FF;">1732456789</span><span style="--shiki-light:#24292E;--shiki-dark:#E1E4E8;">,</span></span>
|
||||
<span class="line"><span style="--shiki-light:#005CC5;--shiki-dark:#79B8FF;"> "owned_by"</span><span style="--shiki-light:#24292E;--shiki-dark:#E1E4E8;">: </span><span style="--shiki-light:#032F62;--shiki-dark:#9ECBFF;">"internal_server"</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:#24292E;--shiki-dark:#E1E4E8;">}</span></span></code></pre></div><h2 id="模型命名规则" tabindex="-1">模型命名规则 <a class="header-anchor" href="#模型命名规则" aria-label="Permalink to “模型命名规则”"></a></h2><h3 id="简写形式" tabindex="-1">简写形式 <a class="header-anchor" href="#简写形式" aria-label="Permalink to “简写形式”"></a></h3><p>直接使用模型 ID:</p><div class="language-"><button title="Copy Code" class="copy"></button><span class="lang"></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>gemini-3-pro-image-preview</span></span></code></pre></div><p>系统会自动匹配到支持该模型的 Worker。</p><h3 id="指定后端形式" tabindex="-1">指定后端形式 <a class="header-anchor" href="#指定后端形式" aria-label="Permalink to “指定后端形式”"></a></h3><p>使用 <code>backend/model</code> 格式:</p><div class="language-"><button title="Copy Code" class="copy"></button><span class="lang"></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>lmarena/gemini-3-pro-image-preview</span></span>
|
||||
<span class="line"><span>gemini_biz/gemini-3-pro-image-preview</span></span></code></pre></div><p>强制使用指定后端处理请求。</p><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><code>image</code></td><td>图片生成模型</td></tr><tr><td><code>text</code></td><td>文本生成模型</td></tr></tbody></table><div class="info custom-block"><p class="custom-block-title">说明</p><p>返回的模型列表取决于当前配置的 Worker 和适配器类型。</p></div>`,20)])])}const g=i(e,[["render",l]]);export{E as __pageData,g as default};
|
||||
@@ -0,0 +1 @@
|
||||
import{_ as i,c as a,o as n,ah as t}from"./chunks/framework.BJEpWshW.js";const E=JSON.parse('{"title":"Models API","description":"","frontmatter":{},"headers":[],"relativePath":"api/models.md","filePath":"api/models.md"}'),e={name:"api/models.md"};function l(h,s,p,k,d,r){return n(),a("div",null,[...s[0]||(s[0]=[t("",20)])])}const g=i(e,[["render",l]]);export{E as __pageData,g as default};
|
||||
@@ -0,0 +1,14 @@
|
||||
import{_ as a,c as s,o as i,ah as e}from"./chunks/framework.BJEpWshW.js";const k=JSON.parse('{"title":"API 概览","description":"","frontmatter":{},"headers":[],"relativePath":"api/overview.md","filePath":"api/overview.md"}'),d={name:"api/overview.md"};function n(l,t,h,o,r,p){return i(),s("div",null,[...t[0]||(t[0]=[e(`<h1 id="api-概览" tabindex="-1">API 概览 <a class="header-anchor" href="#api-概览" aria-label="Permalink to “API 概览”"></a></h1><p>WebAI2API 提供兼容 OpenAI 格式的 RESTful API。</p><h2 id="基础信息" tabindex="-1">基础信息 <a class="header-anchor" href="#基础信息" aria-label="Permalink to “基础信息”"></a></h2><ul><li><strong>Base URL</strong>: <code>http://localhost:3000</code></li><li><strong>认证方式</strong>: Bearer Token</li></ul><h3 id="请求头" tabindex="-1">请求头 <a class="header-anchor" href="#请求头" aria-label="Permalink to “请求头”"></a></h3><div class="language-http"><button title="Copy Code" class="copy"></button><span class="lang">http</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;">Authorization</span><span style="--shiki-light:#D73A49;--shiki-dark:#F97583;">:</span><span style="--shiki-light:#032F62;--shiki-dark:#9ECBFF;"> Bearer sk-your-secret-key</span></span>
|
||||
<span class="line"><span style="--shiki-light:#22863A;--shiki-dark:#85E89D;">Content-Type</span><span style="--shiki-light:#D73A49;--shiki-dark:#F97583;">:</span><span style="--shiki-light:#032F62;--shiki-dark:#9ECBFF;"> application/json</span></span></code></pre></div><h2 id="api-端点列表" tabindex="-1">API 端点列表 <a class="header-anchor" href="#api-端点列表" aria-label="Permalink to “API 端点列表”"></a></h2><h3 id="openai-兼容接口" tabindex="-1">OpenAI 兼容接口 <a class="header-anchor" href="#openai-兼容接口" aria-label="Permalink to “OpenAI 兼容接口”"></a></h3><table tabindex="0"><thead><tr><th>方法</th><th>端点</th><th>说明</th></tr></thead><tbody><tr><td>POST</td><td><code>/v1/chat/completions</code></td><td>对话生成</td></tr><tr><td>GET</td><td><code>/v1/models</code></td><td>获取模型列表</td></tr><tr><td>GET</td><td><code>/v1/cookies</code></td><td>获取 Cookie</td></tr></tbody></table><h3 id="管理接口" tabindex="-1">管理接口 <a class="header-anchor" href="#管理接口" aria-label="Permalink to “管理接口”"></a></h3><table tabindex="0"><thead><tr><th>方法</th><th>端点</th><th>说明</th></tr></thead><tbody><tr><td>GET</td><td><code>/admin/status</code></td><td>服务状态</td></tr><tr><td>GET</td><td><code>/admin/stats</code></td><td>统计信息</td></tr><tr><td>GET</td><td><code>/admin/queue</code></td><td>队列状态</td></tr><tr><td>POST</td><td><code>/admin/restart</code></td><td>重启服务</td></tr><tr><td>POST</td><td><code>/admin/stop</code></td><td>停止服务</td></tr><tr><td>GET</td><td><code>/admin/vnc/status</code></td><td>VNC 状态</td></tr><tr><td>POST</td><td><code>/admin/cache/clear</code></td><td>清理缓存</td></tr></tbody></table><h2 id="错误响应" tabindex="-1">错误响应 <a class="header-anchor" href="#错误响应" aria-label="Permalink to “错误响应”"></a></h2><p>所有 API 错误返回统一格式:</p><div class="language-json"><button title="Copy Code" class="copy"></button><span class="lang">json</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:#24292E;--shiki-dark:#E1E4E8;">{</span></span>
|
||||
<span class="line"><span style="--shiki-light:#005CC5;--shiki-dark:#79B8FF;"> "error"</span><span style="--shiki-light:#24292E;--shiki-dark:#E1E4E8;">: {</span></span>
|
||||
<span class="line"><span style="--shiki-light:#005CC5;--shiki-dark:#79B8FF;"> "message"</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:#005CC5;--shiki-dark:#79B8FF;"> "type"</span><span style="--shiki-light:#24292E;--shiki-dark:#E1E4E8;">: </span><span style="--shiki-light:#032F62;--shiki-dark:#9ECBFF;">"error_type"</span><span style="--shiki-light:#24292E;--shiki-dark:#E1E4E8;">,</span></span>
|
||||
<span class="line"><span style="--shiki-light:#005CC5;--shiki-dark:#79B8FF;"> "code"</span><span style="--shiki-light:#24292E;--shiki-dark:#E1E4E8;">: </span><span style="--shiki-light:#032F62;--shiki-dark:#9ECBFF;">"ERROR_CODE"</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><h3 id="常见错误码" tabindex="-1">常见错误码 <a class="header-anchor" href="#常见错误码" aria-label="Permalink to “常见错误码”"></a></h3><table tabindex="0"><thead><tr><th>HTTP 状态码</th><th>错误类型</th><th>说明</th></tr></thead><tbody><tr><td>401</td><td><code>unauthorized</code></td><td>认证失败</td></tr><tr><td>400</td><td><code>invalid_request</code></td><td>请求参数错误</td></tr><tr><td>404</td><td><code>not_found</code></td><td>资源不存在</td></tr><tr><td>429</td><td><code>rate_limit</code></td><td>请求过多</td></tr><tr><td>500</td><td><code>internal_error</code></td><td>服务器内部错误</td></tr><tr><td>503</td><td><code>service_unavailable</code></td><td>服务不可用</td></tr></tbody></table><h2 id="流式响应" tabindex="-1">流式响应 <a class="header-anchor" href="#流式响应" aria-label="Permalink to “流式响应”"></a></h2><p>对于 <code>stream: true</code> 的请求,响应使用 Server-Sent Events (SSE) 格式:</p><div class="language-"><button title="Copy Code" class="copy"></button><span class="lang"></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>data: {"id":"...","object":"chat.completion.chunk",...}</span></span>
|
||||
<span class="line"><span></span></span>
|
||||
<span class="line"><span>: keep-alive</span></span>
|
||||
<span class="line"><span></span></span>
|
||||
<span class="line"><span>data: {"id":"...","object":"chat.completion.chunk",...}</span></span>
|
||||
<span class="line"><span></span></span>
|
||||
<span class="line"><span>data: [DONE]</span></span></code></pre></div><div class="tip custom-block"><p class="custom-block-title">心跳保活</p><p>流式请求会自动发送心跳包防止连接超时,格式取决于配置的 <code>keepalive.mode</code>。</p></div><h2 id="相关文档" tabindex="-1">相关文档 <a class="header-anchor" href="#相关文档" aria-label="Permalink to “相关文档”"></a></h2><ul><li><a href="/api/chat.html">Chat Completions</a> - 对话生成接口详解</li><li><a href="/api/models.html">Models</a> - 模型列表接口</li><li><a href="/api/cookies.html">Cookies</a> - Cookie 获取接口</li></ul>`,22)])])}const u=a(d,[["render",n]]);export{k as __pageData,u as default};
|
||||
@@ -0,0 +1 @@
|
||||
import{_ as a,c as s,o as i,ah as e}from"./chunks/framework.BJEpWshW.js";const k=JSON.parse('{"title":"API 概览","description":"","frontmatter":{},"headers":[],"relativePath":"api/overview.md","filePath":"api/overview.md"}'),d={name:"api/overview.md"};function n(l,t,h,o,r,p){return i(),s("div",null,[...t[0]||(t[0]=[e("",22)])])}const u=a(d,[["render",n]]);export{k as __pageData,u as default};
|
||||
+1
@@ -0,0 +1 @@
|
||||
import{t as p}from"./chunks/theme.f90DuY8d.js";import{C as o,a3 as i,a4 as u,a5 as c,a6 as l,a7 as f,a8 as d,a9 as m,aa as h,ab as g,ac as A,d as y,u as C,p as v,y as P,ad as b,ae as w,af as E,ag as R}from"./chunks/framework.BJEpWshW.js";function r(e){if(e.extends){const a=r(e.extends);return{...a,...e,async enhanceApp(t){a.enhanceApp&&await a.enhanceApp(t),e.enhanceApp&&await e.enhanceApp(t)}}}return e}const n=r(p),S=y({name:"VitePressApp",setup(){const{site:e,lang:a,dir:t}=C();return v(()=>{P(()=>{document.documentElement.lang=a.value,document.documentElement.dir=t.value})}),e.value.router.prefetchLinks&&b(),w(),E(),n.setup&&n.setup(),()=>R(n.Layout)}});async function T(){globalThis.__VITEPRESS__=!0;const e=L(),a=D();a.provide(u,e);const t=c(e.route);return a.provide(l,t),a.component("Content",f),a.component("ClientOnly",d),Object.defineProperties(a.config.globalProperties,{$frontmatter:{get(){return t.frontmatter.value}},$params:{get(){return t.page.value.params}}}),n.enhanceApp&&await n.enhanceApp({app:a,router:e,siteData:m}),{app:a,router:e,data:t}}function D(){return A(S)}function L(){let e=o;return h(a=>{let t=g(a),s=null;return t&&(e&&(t=t.replace(/\.js$/,".lean.js")),s=import(t)),o&&(e=!1),s},n.NotFound)}o&&T().then(({app:e,router:a,data:t})=>{a.go(location.href,{initialLoad:!0}).then(()=>{i(a.route,t.site),e.mount("#app")})});export{T as createApp};
|
||||
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
@@ -0,0 +1,52 @@
|
||||
import{_ as i,c as a,o as n,ah as t}from"./chunks/framework.BJEpWshW.js";const g=JSON.parse('{"title":"实例配置","description":"","frontmatter":{},"headers":[],"relativePath":"config/instances.md","filePath":"config/instances.md"}'),h={name:"config/instances.md"};function l(e,s,k,p,r,d){return n(),a("div",null,[...s[0]||(s[0]=[t(`<h1 id="实例配置" tabindex="-1">实例配置 <a class="header-anchor" href="#实例配置" aria-label="Permalink to “实例配置”"></a></h1><p>实例 (Instance) 和工作者 (Worker) 是 WebAI2API 的核心配置概念。</p><h2 id="概念说明" tabindex="-1">概念说明 <a class="header-anchor" href="#概念说明" aria-label="Permalink to “概念说明”"></a></h2><h3 id="instance-浏览器实例" tabindex="-1">Instance (浏览器实例) <a class="header-anchor" href="#instance-浏览器实例" aria-label="Permalink to “Instance (浏览器实例)”"></a></h3><p>一个 Instance 代表一个独立的浏览器进程,具有:</p><ul><li>独立的用户数据目录</li><li>独立的 Cookie 和登录状态</li><li>可选的专属代理配置</li></ul><h3 id="worker-工作者" tabindex="-1">Worker (工作者) <a class="header-anchor" href="#worker-工作者" aria-label="Permalink to “Worker (工作者)”"></a></h3><p>Worker 是 Instance 内的一个标签页,负责与特定平台交互。同一 Instance 下的多个 Worker:</p><ul><li>共享浏览器数据和登录状态</li><li>共享代理配置</li><li>可以是不同的适配器类型</li></ul><h2 id="配置结构" tabindex="-1">配置结构 <a class="header-anchor" href="#配置结构" aria-label="Permalink to “配置结构”"></a></h2><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;">"browser_default"</span><span style="--shiki-light:#6A737D;--shiki-dark:#6A737D;"> # 实例 ID</span></span>
|
||||
<span class="line"><span style="--shiki-light:#22863A;--shiki-dark:#85E89D;"> userDataMark</span><span style="--shiki-light:#24292E;--shiki-dark:#E1E4E8;">: </span><span style="--shiki-light:#032F62;--shiki-dark:#9ECBFF;">"01"</span><span style="--shiki-light:#6A737D;--shiki-dark:#6A737D;"> # 数据目录标识 (可选)</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 style="--shiki-light:#6A737D;--shiki-dark:#6A737D;"># 实例级代理 (可选)</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:#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;">1080</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 style="--shiki-light:#6A737D;--shiki-dark:#6A737D;"># Worker 列表</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;">"worker1"</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>
|
||||
<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;">"worker2"</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;">zai_is</span></span></code></pre></div><h2 id="instance-配置项" tabindex="-1">Instance 配置项 <a class="header-anchor" href="#instance-配置项" aria-label="Permalink to “Instance 配置项”"></a></h2><table tabindex="0"><thead><tr><th>配置项</th><th>类型</th><th>必填</th><th>说明</th></tr></thead><tbody><tr><td><code>name</code></td><td>string</td><td>✅</td><td>实例唯一标识,用于日志和 Cookie 获取</td></tr><tr><td><code>userDataMark</code></td><td>string</td><td>❌</td><td>数据目录标识,留空使用默认目录</td></tr><tr><td><code>proxy</code></td><td>object</td><td>❌</td><td>实例级代理配置,参见<a href="/config/proxy.html">代理设置</a></td></tr><tr><td><code>workers</code></td><td>array</td><td>✅</td><td>Worker 配置列表</td></tr></tbody></table><h3 id="数据目录" tabindex="-1">数据目录 <a class="header-anchor" href="#数据目录" aria-label="Permalink to “数据目录”"></a></h3><ul><li>默认位置: <code>data/camoufoxUserData</code></li><li>设置 <code>userDataMark</code> 后: <code>data/camoufoxUserData_{mark}</code></li></ul><h2 id="worker-配置项" tabindex="-1">Worker 配置项 <a class="header-anchor" href="#worker-配置项" aria-label="Permalink to “Worker 配置项”"></a></h2><table tabindex="0"><thead><tr><th>配置项</th><th>类型</th><th>必填</th><th>说明</th></tr></thead><tbody><tr><td><code>name</code></td><td>string</td><td>✅</td><td>Worker 唯一标识(全局唯一)</td></tr><tr><td><code>type</code></td><td>string</td><td>✅</td><td>适配器类型</td></tr><tr><td><code>mergeTypes</code></td><td>array</td><td>❌</td><td>聚合模式的适配器列表 (type=merge 时必填)</td></tr><tr><td><code>mergeMonitor</code></td><td>string</td><td>❌</td><td>空闲时监控的后端 (可选)</td></tr></tbody></table><h3 id="适配器类型" tabindex="-1">适配器类型 <a class="header-anchor" href="#适配器类型" aria-label="Permalink to “适配器类型”"></a></h3><table tabindex="0"><thead><tr><th>类型</th><th>说明</th></tr></thead><tbody><tr><td><code>lmarena</code></td><td>LMArena 图片生成</td></tr><tr><td><code>lmarena_text</code></td><td>LMArena 文本生成</td></tr><tr><td><code>gemini_biz</code></td><td>Gemini Business 图片生成</td></tr><tr><td><code>gemini_biz_text</code></td><td>Gemini Business 文本生成</td></tr><tr><td><code>gemini</code></td><td>Google Gemini</td></tr><tr><td><code>zai_is</code></td><td>zAI 图片生成</td></tr><tr><td><code>nanobananafree_ai</code></td><td>Nano Banana Free</td></tr><tr><td><code>merge</code></td><td>聚合模式(单标签多后端)</td></tr></tbody></table><h2 id="聚合模式-merge" tabindex="-1">聚合模式 (Merge) <a class="header-anchor" href="#聚合模式-merge" aria-label="Permalink to “聚合模式 (Merge)”"></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;">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;">"merged_worker"</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;">merge</span></span>
|
||||
<span class="line"><span style="--shiki-light:#22863A;--shiki-dark:#85E89D;"> mergeTypes</span><span style="--shiki-light:#24292E;--shiki-dark:#E1E4E8;">: [</span><span style="--shiki-light:#032F62;--shiki-dark:#9ECBFF;">gemini_biz</span><span style="--shiki-light:#24292E;--shiki-dark:#E1E4E8;">, </span><span style="--shiki-light:#032F62;--shiki-dark:#9ECBFF;">lmarena</span><span style="--shiki-light:#24292E;--shiki-dark:#E1E4E8;">, </span><span style="--shiki-light:#032F62;--shiki-dark:#9ECBFF;">zai_is</span><span style="--shiki-light:#24292E;--shiki-dark:#E1E4E8;">]</span></span>
|
||||
<span class="line"><span style="--shiki-light:#22863A;--shiki-dark:#85E89D;"> mergeMonitor</span><span style="--shiki-light:#24292E;--shiki-dark:#E1E4E8;">: </span><span style="--shiki-light:#032F62;--shiki-dark:#9ECBFF;">gemini_biz</span><span style="--shiki-light:#6A737D;--shiki-dark:#6A737D;"> # 空闲时挂机监控的后端</span></span></code></pre></div><div class="tip custom-block"><p class="custom-block-title">聚合模式优势</p><ul><li>节省浏览器资源</li><li>自动故障转移</li><li>统一登录状态</li></ul></div><h2 id="配置示例" tabindex="-1">配置示例 <a class="header-anchor" href="#配置示例" aria-label="Permalink to “配置示例”"></a></h2><h3 id="单实例单-worker" tabindex="-1">单实例单 Worker <a class="header-anchor" href="#单实例单-worker" aria-label="Permalink to “单实例单 Worker”"></a></h3><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;">"default"</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;">"worker1"</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><h3 id="多实例隔离" tabindex="-1">多实例隔离 <a class="header-anchor" href="#多实例隔离" aria-label="Permalink to “多实例隔离”"></a></h3><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:#6A737D;--shiki-dark:#6A737D;"> # 实例 1: 美国代理</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;">"browser_us"</span></span>
|
||||
<span class="line"><span style="--shiki-light:#22863A;--shiki-dark:#85E89D;"> userDataMark</span><span style="--shiki-light:#24292E;--shiki-dark:#E1E4E8;">: </span><span style="--shiki-light:#032F62;--shiki-dark:#9ECBFF;">"us"</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;"> 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;">"us_worker"</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>
|
||||
<span class="line"></span>
|
||||
<span class="line"><span style="--shiki-light:#6A737D;--shiki-dark:#6A737D;"> # 实例 2: 日本代理</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;">"browser_jp"</span></span>
|
||||
<span class="line"><span style="--shiki-light:#22863A;--shiki-dark:#85E89D;"> userDataMark</span><span style="--shiki-light:#24292E;--shiki-dark:#E1E4E8;">: </span><span style="--shiki-light:#032F62;--shiki-dark:#9ECBFF;">"jp"</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;">jp-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;"> 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;">"jp_worker"</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><h3 id="聚合模式" tabindex="-1">聚合模式 <a class="header-anchor" href="#聚合模式" aria-label="Permalink to “聚合模式”"></a></h3><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;">"browser_merged"</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;">"all_in_one"</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;">merge</span></span>
|
||||
<span class="line"><span style="--shiki-light:#22863A;--shiki-dark:#85E89D;"> mergeTypes</span><span style="--shiki-light:#24292E;--shiki-dark:#E1E4E8;">: [</span><span style="--shiki-light:#032F62;--shiki-dark:#9ECBFF;">gemini_biz</span><span style="--shiki-light:#24292E;--shiki-dark:#E1E4E8;">, </span><span style="--shiki-light:#032F62;--shiki-dark:#9ECBFF;">lmarena</span><span style="--shiki-light:#24292E;--shiki-dark:#E1E4E8;">, </span><span style="--shiki-light:#032F62;--shiki-dark:#9ECBFF;">zai_is</span><span style="--shiki-light:#24292E;--shiki-dark:#E1E4E8;">]</span></span>
|
||||
<span class="line"><span style="--shiki-light:#22863A;--shiki-dark:#85E89D;"> mergeMonitor</span><span style="--shiki-light:#24292E;--shiki-dark:#E1E4E8;">: </span><span style="--shiki-light:#032F62;--shiki-dark:#9ECBFF;">gemini_biz</span></span></code></pre></div>`,30)])])}const o=i(h,[["render",l]]);export{g as __pageData,o as default};
|
||||
@@ -0,0 +1 @@
|
||||
import{_ as i,c as a,o as n,ah as t}from"./chunks/framework.BJEpWshW.js";const g=JSON.parse('{"title":"实例配置","description":"","frontmatter":{},"headers":[],"relativePath":"config/instances.md","filePath":"config/instances.md"}'),h={name:"config/instances.md"};function l(e,s,k,p,r,d){return n(),a("div",null,[...s[0]||(s[0]=[t("",30)])])}const o=i(h,[["render",l]]);export{g as __pageData,o as default};
|
||||
@@ -0,0 +1,37 @@
|
||||
import{_ as i,c as a,o as t,ah as n}from"./chunks/framework.BJEpWshW.js";const E=JSON.parse('{"title":"配置文件概览、","description":"","frontmatter":{},"headers":[],"relativePath":"config/overview.md","filePath":"config/overview.md"}'),e={name:"config/overview.md"};function l(h,s,d,p,k,r){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 使用 YAML 格式的配置文件 <code>config.yaml</code> 进行配置。</p><div class="warning custom-block"><p class="custom-block-title">注意</p><p>项目的配置问价已可以完全使用 WebUI 进行配置,若您不了解 YAML 文件,请直接略过该板块访问 WebUI 修改配置!</p></div><h2 id="配置文件结构" tabindex="-1">配置文件结构 <a class="header-anchor" href="#配置文件结构" aria-label="Permalink to “配置文件结构”"></a></h2><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:#6A737D;--shiki-dark:#6A737D;"># 日志等级</span></span>
|
||||
<span class="line"><span style="--shiki-light:#22863A;--shiki-dark:#85E89D;">logLevel</span><span style="--shiki-light:#24292E;--shiki-dark:#E1E4E8;">: </span><span style="--shiki-light:#032F62;--shiki-dark:#9ECBFF;">info</span></span>
|
||||
<span class="line"></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;">server</span><span style="--shiki-light:#24292E;--shiki-dark:#E1E4E8;">:</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;">3000</span></span>
|
||||
<span class="line"><span style="--shiki-light:#22863A;--shiki-dark:#85E89D;"> auth</span><span style="--shiki-light:#24292E;--shiki-dark:#E1E4E8;">: </span><span style="--shiki-light:#032F62;--shiki-dark:#9ECBFF;">sk-your-key</span></span>
|
||||
<span class="line"><span style="--shiki-light:#22863A;--shiki-dark:#85E89D;"> keepalive</span><span style="--shiki-light:#24292E;--shiki-dark:#E1E4E8;">:</span></span>
|
||||
<span class="line"><span style="--shiki-light:#22863A;--shiki-dark:#85E89D;"> mode</span><span style="--shiki-light:#24292E;--shiki-dark:#E1E4E8;">: </span><span style="--shiki-light:#032F62;--shiki-dark:#9ECBFF;">"comment"</span></span>
|
||||
<span class="line"></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;">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;"> strategy</span><span style="--shiki-light:#24292E;--shiki-dark:#E1E4E8;">: </span><span style="--shiki-light:#032F62;--shiki-dark:#9ECBFF;">least_busy</span></span>
|
||||
<span class="line"><span style="--shiki-light:#22863A;--shiki-dark:#85E89D;"> failover</span><span style="--shiki-light:#24292E;--shiki-dark:#E1E4E8;">:</span></span>
|
||||
<span class="line"><span style="--shiki-light:#22863A;--shiki-dark:#85E89D;"> enabled</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;"> maxRetries</span><span style="--shiki-light:#24292E;--shiki-dark:#E1E4E8;">: </span><span style="--shiki-light:#005CC5;--shiki-dark:#79B8FF;">2</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;">"browser_default"</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;">"default"</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>
|
||||
<span class="line"><span style="--shiki-light:#22863A;--shiki-dark:#85E89D;"> adapter</span><span style="--shiki-light:#24292E;--shiki-dark:#E1E4E8;">:</span></span>
|
||||
<span class="line"><span style="--shiki-light:#22863A;--shiki-dark:#85E89D;"> gemini_biz</span><span style="--shiki-light:#24292E;--shiki-dark:#E1E4E8;">:</span></span>
|
||||
<span class="line"><span style="--shiki-light:#22863A;--shiki-dark:#85E89D;"> entryUrl</span><span style="--shiki-light:#24292E;--shiki-dark:#E1E4E8;">: </span><span style="--shiki-light:#032F62;--shiki-dark:#9ECBFF;">""</span></span>
|
||||
<span class="line"></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;">queue</span><span style="--shiki-light:#24292E;--shiki-dark:#E1E4E8;">:</span></span>
|
||||
<span class="line"><span style="--shiki-light:#22863A;--shiki-dark:#85E89D;"> queueBuffer</span><span style="--shiki-light:#24292E;--shiki-dark:#E1E4E8;">: </span><span style="--shiki-light:#005CC5;--shiki-dark:#79B8FF;">2</span></span>
|
||||
<span class="line"><span style="--shiki-light:#22863A;--shiki-dark:#85E89D;"> imageLimit</span><span style="--shiki-light:#24292E;--shiki-dark:#E1E4E8;">: </span><span style="--shiki-light:#005CC5;--shiki-dark:#79B8FF;">5</span></span>
|
||||
<span class="line"></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;">browser</span><span style="--shiki-light:#24292E;--shiki-dark:#E1E4E8;">:</span></span>
|
||||
<span class="line"><span style="--shiki-light:#22863A;--shiki-dark:#85E89D;"> path</span><span style="--shiki-light:#24292E;--shiki-dark:#E1E4E8;">: </span><span style="--shiki-light:#032F62;--shiki-dark:#9ECBFF;">""</span></span>
|
||||
<span class="line"><span style="--shiki-light:#22863A;--shiki-dark:#85E89D;"> headless</span><span style="--shiki-light:#24292E;--shiki-dark:#E1E4E8;">: </span><span style="--shiki-light:#005CC5;--shiki-dark:#79B8FF;">false</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></code></pre></div><h2 id="配置项说明" tabindex="-1">配置项说明 <a class="header-anchor" href="#配置项说明" aria-label="Permalink to “配置项说明”"></a></h2><h3 id="日志配置" tabindex="-1">日志配置 <a class="header-anchor" href="#日志配置" aria-label="Permalink to “日志配置”"></a></h3><table tabindex="0"><thead><tr><th>配置项</th><th>类型</th><th>默认值</th><th>说明</th></tr></thead><tbody><tr><td><code>logLevel</code></td><td>string</td><td><code>info</code></td><td>日志等级:<code>debug</code>、<code>info</code>、<code>warn</code>、<code>error</code></td></tr></tbody></table><h3 id="服务器配置-server" tabindex="-1">服务器配置 (server) <a class="header-anchor" href="#服务器配置-server" aria-label="Permalink to “服务器配置 (server)”"></a></h3><table tabindex="0"><thead><tr><th>配置项</th><th>类型</th><th>默认值</th><th>说明</th></tr></thead><tbody><tr><td><code>port</code></td><td>number</td><td><code>3000</code></td><td>HTTP 服务监听端口</td></tr><tr><td><code>auth</code></td><td>string</td><td>-</td><td>API 鉴权 Token (Bearer Token)</td></tr><tr><td><code>keepalive.mode</code></td><td>string</td><td><code>comment</code></td><td>心跳模式:<code>comment</code> 或 <code>content</code></td></tr></tbody></table><div class="tip custom-block"><p class="custom-block-title">心跳模式说明</p><ul><li><strong>comment</strong>: 发送 <code>:keepalive</code> 注释,不污染数据(推荐)</li><li><strong>content</strong>: 发送空 delta,用于必须收到 JSON 才重置超时的客户端</li></ul></div><h3 id="队列配置-queue" tabindex="-1">队列配置 (queue) <a class="header-anchor" href="#队列配置-queue" aria-label="Permalink to “队列配置 (queue)”"></a></h3><table tabindex="0"><thead><tr><th>配置项</th><th>类型</th><th>默认值</th><th>说明</th></tr></thead><tbody><tr><td><code>queueBuffer</code></td><td>number</td><td><code>2</code></td><td>非流式请求的额外排队数,0 表示不限制</td></tr><tr><td><code>imageLimit</code></td><td>number</td><td><code>5</code></td><td>单次请求最大图片数量 (最大 10)</td></tr></tbody></table><h3 id="浏览器配置-browser" tabindex="-1">浏览器配置 (browser) <a class="header-anchor" href="#浏览器配置-browser" aria-label="Permalink to “浏览器配置 (browser)”"></a></h3><table tabindex="0"><thead><tr><th>配置项</th><th>类型</th><th>默认值</th><th>说明</th></tr></thead><tbody><tr><td><code>path</code></td><td>string</td><td><code>""</code></td><td>Camoufox 可执行文件路径,留空使用默认</td></tr><tr><td><code>headless</code></td><td>boolean</td><td><code>false</code></td><td>是否启用无头模式</td></tr><tr><td><code>proxy</code></td><td>object</td><td>-</td><td>全局代理配置</td></tr></tbody></table><h2 id="相关文档" tabindex="-1">相关文档 <a class="header-anchor" href="#相关文档" aria-label="Permalink to “相关文档”"></a></h2><ul><li><a href="/config/instances.html">实例配置</a> - 浏览器实例和 Worker 详细配置</li><li><a href="/config/proxy.html">代理设置</a> - 代理配置详解</li></ul>`,17)])])}const c=i(e,[["render",l]]);export{E as __pageData,c as default};
|
||||
@@ -0,0 +1 @@
|
||||
import{_ as i,c as a,o as t,ah as n}from"./chunks/framework.BJEpWshW.js";const E=JSON.parse('{"title":"配置文件概览、","description":"","frontmatter":{},"headers":[],"relativePath":"config/overview.md","filePath":"config/overview.md"}'),e={name:"config/overview.md"};function l(h,s,d,p,k,r){return t(),a("div",null,[...s[0]||(s[0]=[n("",17)])])}const c=i(e,[["render",l]]);export{E as __pageData,c as default};
|
||||
@@ -0,0 +1,28 @@
|
||||
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;">"browser_us"</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;">"us_worker"</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;">"browser_direct"</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;">"direct_worker"</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};
|
||||
@@ -0,0 +1 @@
|
||||
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("",18)])])}const g=i(l,[["render",h]]);export{o as __pageData,g as default};
|
||||
@@ -0,0 +1,26 @@
|
||||
import{_ as i,c as a,o as n,ah as h}from"./chunks/framework.BJEpWshW.js";const o=JSON.parse('{"title":"快速部署","description":"","frontmatter":{},"headers":[],"relativePath":"guide/deployment.md","filePath":"guide/deployment.md"}'),l={name:"guide/deployment.md"};function e(t,s,k,p,r,d){return n(),a("div",null,[...s[0]||(s[0]=[h(`<h1 id="快速部署" tabindex="-1">快速部署 <a class="header-anchor" href="#快速部署" aria-label="Permalink to “快速部署”"></a></h1><p>本项目支持 <strong>手动部署(推荐)</strong> 和 <strong>Docker 容器化部署</strong> 两种方式。</p><h2 id="手动部署" tabindex="-1">手动部署 <a class="header-anchor" href="#手动部署" aria-label="Permalink to “手动部署”"></a></h2><h3 id="_1-克隆项目" tabindex="-1">1. 克隆项目 <a class="header-anchor" href="#_1-克隆项目" aria-label="Permalink to “1. 克隆项目”"></a></h3><div class="language-bash"><button title="Copy Code" class="copy"></button><span class="lang">bash</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:#6F42C1;--shiki-dark:#B392F0;">git</span><span style="--shiki-light:#032F62;--shiki-dark:#9ECBFF;"> clone</span><span style="--shiki-light:#032F62;--shiki-dark:#9ECBFF;"> https://github.com/foxhui/WebAI2API.git</span></span>
|
||||
<span class="line"><span style="--shiki-light:#005CC5;--shiki-dark:#79B8FF;">cd</span><span style="--shiki-light:#032F62;--shiki-dark:#9ECBFF;"> WebAI2API</span></span></code></pre></div><h3 id="_2-复制配置文件" tabindex="-1">2. 复制配置文件 <a class="header-anchor" href="#_2-复制配置文件" aria-label="Permalink to “2. 复制配置文件”"></a></h3><div class="language-bash"><button title="Copy Code" class="copy"></button><span class="lang">bash</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:#6F42C1;--shiki-dark:#B392F0;">cp</span><span style="--shiki-light:#032F62;--shiki-dark:#9ECBFF;"> config.example.yaml</span><span style="--shiki-light:#032F62;--shiki-dark:#9ECBFF;"> config.yaml</span></span></code></pre></div><h3 id="_3-安装依赖" tabindex="-1">3. 安装依赖 <a class="header-anchor" href="#_3-安装依赖" aria-label="Permalink to “3. 安装依赖”"></a></h3><div class="language-bash"><button title="Copy Code" class="copy"></button><span class="lang">bash</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:#6A737D;--shiki-dark:#6A737D;"># 安装 Node.js 依赖</span></span>
|
||||
<span class="line"><span style="--shiki-light:#6F42C1;--shiki-dark:#B392F0;">pnpm</span><span style="--shiki-light:#032F62;--shiki-dark:#9ECBFF;"> install</span></span>
|
||||
<span class="line"></span>
|
||||
<span class="line"><span style="--shiki-light:#6A737D;--shiki-dark:#6A737D;"># 初始化预编译依赖</span></span>
|
||||
<span class="line"><span style="--shiki-light:#6F42C1;--shiki-dark:#B392F0;">npm</span><span style="--shiki-light:#032F62;--shiki-dark:#9ECBFF;"> run</span><span style="--shiki-light:#032F62;--shiki-dark:#9ECBFF;"> init</span></span></code></pre></div><div class="warning custom-block"><p class="custom-block-title">注意</p><p><code>npm run init</code> 需要从 GitHub 下载文件,请确保网络畅通。</p></div><h3 id="_4-编辑配置" tabindex="-1">4. 编辑配置 <a class="header-anchor" href="#_4-编辑配置" aria-label="Permalink to “4. 编辑配置”"></a></h3><p>编辑 <code>config.yaml</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;">server</span><span style="--shiki-light:#24292E;--shiki-dark:#E1E4E8;">:</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;">3000</span></span>
|
||||
<span class="line"><span style="--shiki-light:#22863A;--shiki-dark:#85E89D;"> auth</span><span style="--shiki-light:#24292E;--shiki-dark:#E1E4E8;">: </span><span style="--shiki-light:#032F62;--shiki-dark:#9ECBFF;">sk-your-secret-key</span><span style="--shiki-light:#6A737D;--shiki-dark:#6A737D;"> # 修改为你的密钥</span></span></code></pre></div><h3 id="_5-启动服务" tabindex="-1">5. 启动服务 <a class="header-anchor" href="#_5-启动服务" aria-label="Permalink to “5. 启动服务”"></a></h3><div class="language-bash"><button title="Copy Code" class="copy"></button><span class="lang">bash</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:#6A737D;--shiki-dark:#6A737D;"># 标准运行</span></span>
|
||||
<span class="line"><span style="--shiki-light:#6F42C1;--shiki-dark:#B392F0;">npm</span><span style="--shiki-light:#032F62;--shiki-dark:#9ECBFF;"> start</span></span>
|
||||
<span class="line"></span>
|
||||
<span class="line"><span style="--shiki-light:#6A737D;--shiki-dark:#6A737D;"># Linux 命令行启动</span></span>
|
||||
<span class="line"><span style="--shiki-light:#6F42C1;--shiki-dark:#B392F0;">npm</span><span style="--shiki-light:#032F62;--shiki-dark:#9ECBFF;"> start</span><span style="--shiki-light:#005CC5;--shiki-dark:#79B8FF;"> --</span><span style="--shiki-light:#005CC5;--shiki-dark:#79B8FF;"> -xvfb</span><span style="--shiki-light:#005CC5;--shiki-dark:#79B8FF;"> -vnc</span></span></code></pre></div><h2 id="docker-部署" tabindex="-1">Docker 部署 <a class="header-anchor" href="#docker-部署" aria-label="Permalink to “Docker 部署”"></a></h2><div class="warning custom-block"><p class="custom-block-title"><strong>特别说明</strong></p><p>登录相关操作可以在 WebUI 的虚拟显示器板块进行,也可通过 RealVNC 等工具连接(需添加映射 VNC 端口,默认非被占用的情况下为 5900)</p></div><h3 id="docker-cli" tabindex="-1">Docker CLI <a class="header-anchor" href="#docker-cli" aria-label="Permalink to “Docker CLI”"></a></h3><div class="language-bash"><button title="Copy Code" class="copy"></button><span class="lang">bash</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:#6F42C1;--shiki-dark:#B392F0;">docker</span><span style="--shiki-light:#032F62;--shiki-dark:#9ECBFF;"> run</span><span style="--shiki-light:#005CC5;--shiki-dark:#79B8FF;"> -d</span><span style="--shiki-light:#005CC5;--shiki-dark:#79B8FF;"> --name</span><span style="--shiki-light:#032F62;--shiki-dark:#9ECBFF;"> webai-2api</span><span style="--shiki-light:#005CC5;--shiki-dark:#79B8FF;"> \\</span></span>
|
||||
<span class="line"><span style="--shiki-light:#005CC5;--shiki-dark:#79B8FF;"> -p</span><span style="--shiki-light:#032F62;--shiki-dark:#9ECBFF;"> 3000:3000</span><span style="--shiki-light:#005CC5;--shiki-dark:#79B8FF;"> \\</span></span>
|
||||
<span class="line"><span style="--shiki-light:#005CC5;--shiki-dark:#79B8FF;"> -v</span><span style="--shiki-light:#032F62;--shiki-dark:#9ECBFF;"> "$(</span><span style="--shiki-light:#005CC5;--shiki-dark:#79B8FF;">pwd</span><span style="--shiki-light:#032F62;--shiki-dark:#9ECBFF;">)/data:/app/data"</span><span style="--shiki-light:#005CC5;--shiki-dark:#79B8FF;"> \\</span></span>
|
||||
<span class="line"><span style="--shiki-light:#005CC5;--shiki-dark:#79B8FF;"> --shm-size=2gb</span><span style="--shiki-light:#005CC5;--shiki-dark:#79B8FF;"> \\</span></span>
|
||||
<span class="line"><span style="--shiki-light:#032F62;--shiki-dark:#9ECBFF;"> foxhui/webai-2api:latest</span></span></code></pre></div><h3 id="docker-compose" tabindex="-1">Docker Compose <a class="header-anchor" href="#docker-compose" aria-label="Permalink to “Docker Compose”"></a></h3><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;">services</span><span style="--shiki-light:#24292E;--shiki-dark:#E1E4E8;">:</span></span>
|
||||
<span class="line"><span style="--shiki-light:#22863A;--shiki-dark:#85E89D;"> webai-2api</span><span style="--shiki-light:#24292E;--shiki-dark:#E1E4E8;">:</span></span>
|
||||
<span class="line"><span style="--shiki-light:#22863A;--shiki-dark:#85E89D;"> image</span><span style="--shiki-light:#24292E;--shiki-dark:#E1E4E8;">: </span><span style="--shiki-light:#032F62;--shiki-dark:#9ECBFF;">foxhui/webai-2api:latest</span></span>
|
||||
<span class="line"><span style="--shiki-light:#22863A;--shiki-dark:#85E89D;"> container_name</span><span style="--shiki-light:#24292E;--shiki-dark:#E1E4E8;">: </span><span style="--shiki-light:#032F62;--shiki-dark:#9ECBFF;">webai-2api</span></span>
|
||||
<span class="line"><span style="--shiki-light:#22863A;--shiki-dark:#85E89D;"> restart</span><span style="--shiki-light:#24292E;--shiki-dark:#E1E4E8;">: </span><span style="--shiki-light:#032F62;--shiki-dark:#9ECBFF;">unless-stopped</span></span>
|
||||
<span class="line"><span style="--shiki-light:#22863A;--shiki-dark:#85E89D;"> ports</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:#032F62;--shiki-dark:#9ECBFF;">"3000:3000"</span></span>
|
||||
<span class="line"><span style="--shiki-light:#22863A;--shiki-dark:#85E89D;"> volumes</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:#032F62;--shiki-dark:#9ECBFF;">./data:/app/data</span></span>
|
||||
<span class="line"><span style="--shiki-light:#22863A;--shiki-dark:#85E89D;"> shm_size</span><span style="--shiki-light:#24292E;--shiki-dark:#E1E4E8;">: </span><span style="--shiki-light:#032F62;--shiki-dark:#9ECBFF;">'2gb'</span></span>
|
||||
<span class="line"><span style="--shiki-light:#22863A;--shiki-dark:#85E89D;"> init</span><span style="--shiki-light:#24292E;--shiki-dark:#E1E4E8;">: </span><span style="--shiki-light:#005CC5;--shiki-dark:#79B8FF;">true</span></span></code></pre></div><p>启动服务:</p><div class="language-bash"><button title="Copy Code" class="copy"></button><span class="lang">bash</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:#6F42C1;--shiki-dark:#B392F0;">docker</span><span style="--shiki-light:#032F62;--shiki-dark:#9ECBFF;"> compose</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><h2 id="验证安装" tabindex="-1">验证安装 <a class="header-anchor" href="#验证安装" aria-label="Permalink to “验证安装”"></a></h2><p>服务启动后,访问以下地址验证:</p><ul><li><strong>Web 管理界面</strong>: <a href="http://localhost:3000" target="_blank" rel="noreferrer">http://localhost:3000</a></li><li><strong>API 接口测试</strong>: <a href="http://localhost:3000/v1/chat/completions" target="_blank" rel="noreferrer">http://localhost:3000/v1/chat/completions</a></li></ul><h2 id="下一步" tabindex="-1">下一步 <a class="header-anchor" href="#下一步" aria-label="Permalink to “下一步”"></a></h2><p>部署完成后,请阅读 <a href="/guide/first-use.html">首次使用</a> 完成登录初始化。</p>`,28)])])}const c=i(l,[["render",e]]);export{o as __pageData,c as default};
|
||||
@@ -0,0 +1 @@
|
||||
import{_ as i,c as a,o as n,ah as h}from"./chunks/framework.BJEpWshW.js";const o=JSON.parse('{"title":"快速部署","description":"","frontmatter":{},"headers":[],"relativePath":"guide/deployment.md","filePath":"guide/deployment.md"}'),l={name:"guide/deployment.md"};function e(t,s,k,p,r,d){return n(),a("div",null,[...s[0]||(s[0]=[h("",28)])])}const c=i(l,[["render",e]]);export{o as __pageData,c as default};
|
||||
@@ -0,0 +1,8 @@
|
||||
import{_ as s,c as a,o as l,ah as e}from"./chunks/framework.BJEpWshW.js";const c=JSON.parse('{"title":"首次使用","description":"","frontmatter":{},"headers":[],"relativePath":"guide/first-use.md","filePath":"guide/first-use.md"}'),t={name:"guide/first-use.md"};function n(h,i,r,k,p,o){return l(),a("div",null,[...i[0]||(i[0]=[e(`<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><h3 id="启动登录模式" tabindex="-1">启动登录模式 <a class="header-anchor" href="#启动登录模式" aria-label="Permalink to “启动登录模式”"></a></h3><p>登录模式会强制关闭无头模式</p><div class="language-bash"><button title="Copy Code" class="copy"></button><span class="lang">bash</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:#6A737D;--shiki-dark:#6A737D;"># 启动第一个 Worker 进行登录</span></span>
|
||||
<span class="line"><span style="--shiki-light:#6F42C1;--shiki-dark:#B392F0;">npm</span><span style="--shiki-light:#032F62;--shiki-dark:#9ECBFF;"> start</span><span style="--shiki-light:#005CC5;--shiki-dark:#79B8FF;"> --</span><span style="--shiki-light:#005CC5;--shiki-dark:#79B8FF;"> -login</span></span>
|
||||
<span class="line"></span>
|
||||
<span class="line"><span style="--shiki-light:#6A737D;--shiki-dark:#6A737D;"># 启动指定 Worker 进行登录</span></span>
|
||||
<span class="line"><span style="--shiki-light:#6F42C1;--shiki-dark:#B392F0;">npm</span><span style="--shiki-light:#032F62;--shiki-dark:#9ECBFF;"> start</span><span style="--shiki-light:#005CC5;--shiki-dark:#79B8FF;"> --</span><span style="--shiki-light:#005CC5;--shiki-dark:#79B8FF;"> -login=workerName</span></span></code></pre></div><h3 id="linux-用户特殊说明" tabindex="-1">Linux 用户特殊说明 <a class="header-anchor" href="#linux-用户特殊说明" aria-label="Permalink to “Linux 用户特殊说明”"></a></h3><p>Linux 服务器用户可以使用 Xvfb + VNC 方式:</p><div class="language-bash"><button title="Copy Code" class="copy"></button><span class="lang">bash</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:#6F42C1;--shiki-dark:#B392F0;">npm</span><span style="--shiki-light:#032F62;--shiki-dark:#9ECBFF;"> start</span><span style="--shiki-light:#005CC5;--shiki-dark:#79B8FF;"> --</span><span style="--shiki-light:#005CC5;--shiki-dark:#79B8FF;"> -xvfb</span><span style="--shiki-light:#005CC5;--shiki-dark:#79B8FF;"> -vnc</span></span></code></pre></div><p>然后通过 VNC 客户端连接 <code>:5900</code> 端口进行操作(也可使用 WebUI 中的虚拟显示器板块)</p><h2 id="初始化步骤" tabindex="-1">初始化步骤 <a class="header-anchor" href="#初始化步骤" aria-label="Permalink to “初始化步骤”"></a></h2><ol><li><p><strong>登录账号</strong></p><ul><li>Linux 用户使用 <code>npm start -- -xvfb -vnc</code> 启动程序,然后使用 WebUI 或者第三方工具连接 VNC</li><li>在打开的浏览器中登录相应平台的账号</li><li>例如:Google 账号用于 Gemini,GitHub 账号用于 LMArena</li></ul></li><li><p><strong>完成验证</strong></p><ul><li>在输入框发送任意消息</li><li>触发并完成 CloudFlare/reCAPTCHA 验证</li><li>同意服务条款</li></ul></li><li><p><strong>验证成功</strong></p><ul><li>确认可以正常发送消息和接收回复</li><li>关闭浏览器或按 <code>Ctrl+C</code> 退出登录模式</li></ul></li></ol><div class="tip custom-block"><p class="custom-block-title">运行建议</p><ul><li>初始化完成后可使用无头模式运行,为降低风控风险,<strong>强烈建议长期保持非无头模式运行</strong>。</li><li><strong>WebUI 和 VNC 传输过程均未加密,若在公网环境运行请走 SSH 隧道或者使用 Caddy/Nginx 为 WebUI 添加 HTTPS 连接</strong><div class="language-bash"><button title="Copy Code" class="copy"></button><span class="lang">bash</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:#6A737D;--shiki-dark:#6A737D;"># SSH隧道方法:在本地终端运行,将服务器 5900 端口映射到本地</span></span>
|
||||
<span class="line"><span style="--shiki-light:#6F42C1;--shiki-dark:#B392F0;">ssh</span><span style="--shiki-light:#005CC5;--shiki-dark:#79B8FF;"> -L</span><span style="--shiki-light:#032F62;--shiki-dark:#9ECBFF;"> 5900:127.0.0.1:5900</span><span style="--shiki-light:#032F62;--shiki-dark:#9ECBFF;"> root@服务器IP</span></span></code></pre></div></li></ul></div><h2 id="多-worker-登录" tabindex="-1">多 Worker 登录 <a class="header-anchor" href="#多-worker-登录" aria-label="Permalink to “多 Worker 登录”"></a></h2><p>如果配置了多个 Worker,需要分别为每个 Worker 完成登录:</p><div class="language-bash"><button title="Copy Code" class="copy"></button><span class="lang">bash</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:#6A737D;--shiki-dark:#6A737D;"># 依次登录各个 Worker</span></span>
|
||||
<span class="line"><span style="--shiki-light:#6F42C1;--shiki-dark:#B392F0;">npm</span><span style="--shiki-light:#032F62;--shiki-dark:#9ECBFF;"> start</span><span style="--shiki-light:#005CC5;--shiki-dark:#79B8FF;"> --</span><span style="--shiki-light:#005CC5;--shiki-dark:#79B8FF;"> -login=worker1</span></span>
|
||||
<span class="line"><span style="--shiki-light:#6F42C1;--shiki-dark:#B392F0;">npm</span><span style="--shiki-light:#032F62;--shiki-dark:#9ECBFF;"> start</span><span style="--shiki-light:#005CC5;--shiki-dark:#79B8FF;"> --</span><span style="--shiki-light:#005CC5;--shiki-dark:#79B8FF;"> -login=worker2</span></span></code></pre></div><div class="info custom-block"><p class="custom-block-title">共享登录状态</p><p>同一 Instance(浏览器实例)下的多个 Worker 共享登录状态。如果使用 Google OAuth 等统一登录方式,只需登录一次即可。</p></div><h2 id="webui-登录模式" tabindex="-1">WebUI 登录模式 <a class="header-anchor" href="#webui-登录模式" aria-label="Permalink to “WebUI 登录模式”"></a></h2><p>服务运行后,也可以通过 WebUI 切换到登录模式:</p><ol><li>访问 <a href="http://localhost:3000" target="_blank" rel="noreferrer">http://localhost:3000</a></li><li>进入「系统管理」页面</li><li>点击「重启」按钮的下拉箭头</li><li>选择「登录模式重启」或指定 Worker 登录</li></ol><h2 id="下一步" tabindex="-1">下一步 <a class="header-anchor" href="#下一步" aria-label="Permalink to “下一步”"></a></h2><p>登录完成后,请阅读以下内容:</p><ul><li><a href="/config/overview.html">配置文件</a> - 了解完整配置选项</li><li><a href="/api/overview.html">API 参考</a> - 开始使用 API</li></ul>`,23)])])}const g=s(t,[["render",n]]);export{c as __pageData,g as default};
|
||||
@@ -0,0 +1 @@
|
||||
import{_ as s,c as a,o as l,ah as e}from"./chunks/framework.BJEpWshW.js";const c=JSON.parse('{"title":"首次使用","description":"","frontmatter":{},"headers":[],"relativePath":"guide/first-use.md","filePath":"guide/first-use.md"}'),t={name:"guide/first-use.md"};function n(h,i,r,k,p,o){return l(),a("div",null,[...i[0]||(i[0]=[e("",23)])])}const g=s(t,[["render",n]]);export{c as __pageData,g as default};
|
||||
@@ -0,0 +1 @@
|
||||
import{_ as e,c as r,o as a,ah as n}from"./chunks/framework.BJEpWshW.js";const f=JSON.parse('{"title":"WebAI2API","description":"","frontmatter":{},"headers":[],"relativePath":"guide/introduction.md","filePath":"guide/introduction.md"}'),l={name:"guide/introduction.md"};function s(i,t,o,d,g,c){return a(),r("div",null,[...t[0]||(t[0]=[n('<h1 id="webai2api" tabindex="-1">WebAI2API <a class="header-anchor" href="#webai2api" aria-label="Permalink to “WebAI2API”"></a></h1><p><img src="https://github.com/user-attachments/assets/296a518e-c42b-4e39-8ff6-9b4381ed4f6e" alt="Image"></p><h2 id="📝-项目简介" tabindex="-1">📝 项目简介 <a class="header-anchor" href="#📝-项目简介" aria-label="Permalink to “📝 项目简介”"></a></h2><p><strong>WebAI2API</strong> 是一个基于 <strong>Camoufox (Playwright)</strong> 的网页版 AI 服务转通用 API 的工具。通过模拟人类操作与 LMArena、Gemini 等网站交互,提供兼容 <strong>OpenAI 格式</strong> 的接口服务,同时支持 <strong>多窗口并发</strong> 与 <strong>多账号管理</strong>(浏览器实例数据隔离)。</p><h3 id="📋-当前支持列表" tabindex="-1">📋 当前支持列表 <a class="header-anchor" href="#📋-当前支持列表" aria-label="Permalink to “📋 当前支持列表”"></a></h3><table tabindex="0"><thead><tr><th style="text-align:left;">网站名称</th><th style="text-align:center;">文本支持</th><th style="text-align:center;">图片支持</th></tr></thead><tbody><tr><td style="text-align:left;"><a href="https://lmarena.ai/" target="_blank" rel="noreferrer"><strong>LMArena</strong></a></td><td style="text-align:center;">✅</td><td style="text-align:center;">✅</td></tr><tr><td style="text-align:left;"><a href="https://business.gemini.google/" target="_blank" rel="noreferrer"><strong>Gemini Enterprise Business</strong></a></td><td style="text-align:center;">✅</td><td style="text-align:center;">✅</td></tr><tr><td style="text-align:left;"><a href="https://nanobananafree.ai/" target="_blank" rel="noreferrer"><strong>Nano Banana Free</strong></a></td><td style="text-align:center;">❌</td><td style="text-align:center;">✅</td></tr><tr><td style="text-align:left;"><a href="https://zai.is/" target="_blank" rel="noreferrer"><strong>zAI</strong></a></td><td style="text-align:center;">❌</td><td style="text-align:center;">✅</td></tr><tr><td style="text-align:left;"><a href="https://gemini.google.com/" target="_blank" rel="noreferrer"><strong>Google Gemini</strong></a></td><td style="text-align:center;">❌</td><td style="text-align:center;">✅</td></tr></tbody></table><blockquote><p>未来可能会支持更多网站...</p></blockquote>',7)])])}const b=e(l,[["render",s]]);export{f as __pageData,b as default};
|
||||
@@ -0,0 +1 @@
|
||||
import{_ as e,c as r,o as a,ah as n}from"./chunks/framework.BJEpWshW.js";const f=JSON.parse('{"title":"WebAI2API","description":"","frontmatter":{},"headers":[],"relativePath":"guide/introduction.md","filePath":"guide/introduction.md"}'),l={name:"guide/introduction.md"};function s(i,t,o,d,g,c){return a(),r("div",null,[...t[0]||(t[0]=[n("",7)])])}const b=e(l,[["render",s]]);export{f as __pageData,b as default};
|
||||
@@ -0,0 +1,14 @@
|
||||
import{_ as i,c as a,o as t,ah as e}from"./chunks/framework.BJEpWshW.js";const g=JSON.parse('{"title":"环境要求","description":"","frontmatter":{},"headers":[],"relativePath":"guide/requirements.md","filePath":"guide/requirements.md"}'),l={name:"guide/requirements.md"};function n(h,s,r,d,p,k){return t(),a("div",null,[...s[0]||(s[0]=[e(`<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><h3 id="操作系统" tabindex="-1">操作系统 <a class="header-anchor" href="#操作系统" aria-label="Permalink to “操作系统”"></a></h3><ul><li><strong>Windows</strong>: Windows 10/11 或 Windows Server 2016+</li><li><strong>Linux</strong>: Ubuntu 18.04+, Debian 10+, CentOS 7+ 或其他主流发行版</li><li><strong>macOS</strong>: macOS 10.15 (Catalina) 或更高版本</li></ul><h3 id="硬件配置" tabindex="-1">硬件配置 <a class="header-anchor" href="#硬件配置" aria-label="Permalink to “硬件配置”"></a></h3><table tabindex="0"><thead><tr><th style="text-align:left;">资源</th><th style="text-align:left;">最低配置</th><th style="text-align:left;">推荐配置(单实例)</th><th style="text-align:left;">推荐配置(多实例)</th></tr></thead><tbody><tr><td style="text-align:left;"><strong>CPU</strong></td><td style="text-align:left;">1 核</td><td style="text-align:left;">2 核及以上</td><td style="text-align:left;">2 核及以上</td></tr><tr><td style="text-align:left;"><strong>内存</strong></td><td style="text-align:left;">1 GB</td><td style="text-align:left;">2 GB 及以上</td><td style="text-align:left;">4 GB 及以上</td></tr><tr><td style="text-align:left;"><strong>磁盘</strong></td><td style="text-align:left;">2 GB 可用空间</td><td style="text-align:left;">5 GB 及以上</td><td style="text-align:left;">7 GB 及以上</td></tr></tbody></table><div class="tip custom-block"><p class="custom-block-title">实测环境表现</p><ul><li><strong>Oracle 免费机</strong> (1C1G, Debian 12):资源紧张,比较卡顿,仅供尝鲜或轻度使用</li><li><strong>阿里云轻量云</strong> (2C2G, Debian 11):运行流畅,项目开发测试所用机型</li></ul></div><h2 id="软件依赖" tabindex="-1">软件依赖 <a class="header-anchor" href="#软件依赖" aria-label="Permalink to “软件依赖”"></a></h2><h3 id="node-js" tabindex="-1">Node.js <a class="header-anchor" href="#node-js" aria-label="Permalink to “Node.js”"></a></h3><ul><li><strong>版本要求</strong>: v20.0.0 或更高版本 (ABI 115+)</li><li><strong>包管理器</strong>: pnpm (推荐) 或 npm</li></ul><div class="language-bash"><button title="Copy Code" class="copy"></button><span class="lang">bash</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:#6A737D;--shiki-dark:#6A737D;"># 检查 Node.js 版本</span></span>
|
||||
<span class="line"><span style="--shiki-light:#6F42C1;--shiki-dark:#B392F0;">node</span><span style="--shiki-light:#005CC5;--shiki-dark:#79B8FF;"> --version</span></span>
|
||||
<span class="line"></span>
|
||||
<span class="line"><span style="--shiki-light:#6A737D;--shiki-dark:#6A737D;"># 安装 pnpm (如未安装)</span></span>
|
||||
<span class="line"><span style="--shiki-light:#6F42C1;--shiki-dark:#B392F0;">npm</span><span style="--shiki-light:#032F62;--shiki-dark:#9ECBFF;"> install</span><span style="--shiki-light:#005CC5;--shiki-dark:#79B8FF;"> -g</span><span style="--shiki-light:#032F62;--shiki-dark:#9ECBFF;"> pnpm</span></span></code></pre></div><h3 id="camoufox" tabindex="-1">Camoufox <a class="header-anchor" href="#camoufox" aria-label="Permalink to “Camoufox”"></a></h3><p>Camoufox 是本项目的核心依赖,会在安装过程中自动下载。</p><div class="warning custom-block"><p class="custom-block-title">网络要求</p><p>安装过程需要从 GitHub 下载 Camoufox 等预编译依赖,请确保网络能够正常访问 GitHub。</p></div><h2 id="docker-环境-可选" tabindex="-1">Docker 环境 (可选) <a class="header-anchor" href="#docker-环境-可选" aria-label="Permalink to “Docker 环境 (可选)”"></a></h2><p>如果选择 Docker 部署方式,需要安装:</p><ul><li><strong>Docker</strong>: 20.10.0 或更高版本</li><li><strong>Docker Compose</strong>: 2.0.0 或更高版本 (可选)</li></ul><div class="language-bash"><button title="Copy Code" class="copy"></button><span class="lang">bash</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:#6A737D;--shiki-dark:#6A737D;"># 检查 Docker 版本</span></span>
|
||||
<span class="line"><span style="--shiki-light:#6F42C1;--shiki-dark:#B392F0;">docker</span><span style="--shiki-light:#005CC5;--shiki-dark:#79B8FF;"> --version</span></span>
|
||||
<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:#032F62;--shiki-dark:#9ECBFF;"> version</span></span></code></pre></div><h2 id="linux-特殊依赖" tabindex="-1">Linux 特殊依赖 <a class="header-anchor" href="#linux-特殊依赖" aria-label="Permalink to “Linux 特殊依赖”"></a></h2><p>在 Linux 环境下运行非无头模式时,可能需要额外安装:</p><div class="language-bash"><button title="Copy Code" class="copy"></button><span class="lang">bash</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:#6A737D;--shiki-dark:#6A737D;"># Ubuntu/Debian</span></span>
|
||||
<span class="line"><span style="--shiki-light:#6F42C1;--shiki-dark:#B392F0;">sudo</span><span style="--shiki-light:#032F62;--shiki-dark:#9ECBFF;"> apt-get</span><span style="--shiki-light:#032F62;--shiki-dark:#9ECBFF;"> install</span><span style="--shiki-light:#032F62;--shiki-dark:#9ECBFF;"> xvfb</span><span style="--shiki-light:#032F62;--shiki-dark:#9ECBFF;"> x11vnc</span></span>
|
||||
<span class="line"></span>
|
||||
<span class="line"><span style="--shiki-light:#6A737D;--shiki-dark:#6A737D;"># CentOS/RHEL</span></span>
|
||||
<span class="line"><span style="--shiki-light:#6F42C1;--shiki-dark:#B392F0;">sudo</span><span style="--shiki-light:#032F62;--shiki-dark:#9ECBFF;"> yum</span><span style="--shiki-light:#032F62;--shiki-dark:#9ECBFF;"> install</span><span style="--shiki-light:#032F62;--shiki-dark:#9ECBFF;"> xorg-x11-server-Xvfb</span><span style="--shiki-light:#032F62;--shiki-dark:#9ECBFF;"> x11vnc</span></span>
|
||||
<span class="line"></span>
|
||||
<span class="line"><span style="--shiki-light:#6A737D;--shiki-dark:#6A737D;"># Arch Linux</span></span>
|
||||
<span class="line"><span style="--shiki-light:#6F42C1;--shiki-dark:#B392F0;">sudo</span><span style="--shiki-light:#032F62;--shiki-dark:#9ECBFF;"> pacman</span><span style="--shiki-light:#005CC5;--shiki-dark:#79B8FF;"> -S</span><span style="--shiki-light:#032F62;--shiki-dark:#9ECBFF;"> xorg-server-xvfb</span><span style="--shiki-light:#032F62;--shiki-dark:#9ECBFF;"> x11vnc</span></span></code></pre></div><h2 id="下一步" tabindex="-1">下一步 <a class="header-anchor" href="#下一步" aria-label="Permalink to “下一步”"></a></h2><p>环境准备就绪后,请继续阅读 <a href="/guide/deployment.html">快速部署</a> 开始安装。</p>`,24)])])}const c=i(l,[["render",n]]);export{g as __pageData,c as default};
|
||||
@@ -0,0 +1 @@
|
||||
import{_ as i,c as a,o as t,ah as e}from"./chunks/framework.BJEpWshW.js";const g=JSON.parse('{"title":"环境要求","description":"","frontmatter":{},"headers":[],"relativePath":"guide/requirements.md","filePath":"guide/requirements.md"}'),l={name:"guide/requirements.md"};function n(h,s,r,d,p,k){return t(),a("div",null,[...s[0]||(s[0]=[e("",24)])])}const c=i(l,[["render",n]]);export{g as __pageData,c as default};
|
||||
+1
@@ -0,0 +1 @@
|
||||
import{_ as e,c as t,o as i}from"./chunks/framework.BJEpWshW.js";const p=JSON.parse('{"title":"","description":"","frontmatter":{"layout":"home","hero":{"name":"WebAI2API","text":"网页版 AI 服务转 OpenAI 兼容 API","tagline":"基于 Camoufox (Playwright),模拟人类操作与 LMArena、Gemini 等网站交互","actions":[{"theme":"brand","text":"快速开始","link":"/guide/deployment"},{"theme":"alt","text":"项目介绍","link":"/guide/introduction"},{"theme":"alt","text":"GitHub","link":"https://github.com/foxhui/WebAI2API"}],"image":{"src":"/favicon.png"}},"features":[{"icon":"🤖","title":"拟人交互","details":"模拟人类打字与鼠标轨迹,通过特征伪装规避自动化检测"},{"icon":"🔄","title":"接口兼容","details":"提供标准 OpenAI 格式接口,支持流式响应与心跳保活"},{"icon":"🚀","title":"并发隔离","details":"支持多窗口并发执行,实现多账号浏览器实例级数据隔离"},{"icon":"🛡️","title":"稳定防护","details":"内置任务队列、负载均衡、故障转移、错误重试"}]},"headers":[],"relativePath":"index.md","filePath":"index.md"}'),n={name:"index.md"};function a(o,r,c,l,s,d){return i(),t("div")}const h=e(n,[["render",a]]);export{p as __pageData,h as default};
|
||||
@@ -0,0 +1 @@
|
||||
import{_ as e,c as t,o as i}from"./chunks/framework.BJEpWshW.js";const p=JSON.parse('{"title":"","description":"","frontmatter":{"layout":"home","hero":{"name":"WebAI2API","text":"网页版 AI 服务转 OpenAI 兼容 API","tagline":"基于 Camoufox (Playwright),模拟人类操作与 LMArena、Gemini 等网站交互","actions":[{"theme":"brand","text":"快速开始","link":"/guide/deployment"},{"theme":"alt","text":"项目介绍","link":"/guide/introduction"},{"theme":"alt","text":"GitHub","link":"https://github.com/foxhui/WebAI2API"}],"image":{"src":"/favicon.png"}},"features":[{"icon":"🤖","title":"拟人交互","details":"模拟人类打字与鼠标轨迹,通过特征伪装规避自动化检测"},{"icon":"🔄","title":"接口兼容","details":"提供标准 OpenAI 格式接口,支持流式响应与心跳保活"},{"icon":"🚀","title":"并发隔离","details":"支持多窗口并发执行,实现多账号浏览器实例级数据隔离"},{"icon":"🛡️","title":"稳定防护","details":"内置任务队列、负载均衡、故障转移、错误重试"}]},"headers":[],"relativePath":"index.md","filePath":"index.md"}'),n={name:"index.md"};function a(o,r,c,l,s,d){return i(),t("div")}const h=e(n,[["render",a]]);export{p as __pageData,h as default};
|
||||
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
+1
File diff suppressed because one or more lines are too long
+77
File diff suppressed because one or more lines are too long
Vendored
+62
File diff suppressed because one or more lines are too long
Vendored
+53
File diff suppressed because one or more lines are too long
Vendored
BIN
Binary file not shown.
|
After Width: | Height: | Size: 69 KiB |
+51
File diff suppressed because one or more lines are too long
Vendored
+33
File diff suppressed because one or more lines are too long
+26
File diff suppressed because one or more lines are too long
+39
File diff suppressed because one or more lines are too long
Vendored
+1
@@ -0,0 +1 @@
|
||||
{"admin_linux.md":"C4pirr1w","admin_troubleshooting.md":"BdBPvYAx","admin_webui.md":"C6OfyL7c","api_chat.md":"CVfvhFz2","api_cookies.md":"BngFs3oo","api_models.md":"BmD2H_2d","api_overview.md":"BJJapNOd","config_instances.md":"CvnejDKP","config_overview.md":"-rOn3l_p","config_proxy.md":"B7kjsU6e","guide_deployment.md":"Browh70b","guide_first-use.md":"C0Hv5lBx","guide_introduction.md":"D7_DJb6Y","guide_requirements.md":"ettCHBZs","index.md":"C3b48Ls9"}
|
||||
Vendored
+26
File diff suppressed because one or more lines are too long
Vendored
+1
@@ -0,0 +1 @@
|
||||
.vpi-social-github{--icon:url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' width='24' height='24'%3E%3Cpath fill='black' d='M12 .297c-6.63 0-12 5.373-12 12c0 5.303 3.438 9.8 8.205 11.385c.6.113.82-.258.82-.577c0-.285-.01-1.04-.015-2.04c-3.338.724-4.042-1.61-4.042-1.61C4.422 18.07 3.633 17.7 3.633 17.7c-1.087-.744.084-.729.084-.729c1.205.084 1.838 1.236 1.838 1.236c1.07 1.835 2.809 1.305 3.495.998c.108-.776.417-1.305.76-1.605c-2.665-.3-5.466-1.332-5.466-5.93c0-1.31.465-2.38 1.235-3.22c-.135-.303-.54-1.523.105-3.176c0 0 1.005-.322 3.3 1.23c.96-.267 1.98-.399 3-.405c1.02.006 2.04.138 3 .405c2.28-1.552 3.285-1.23 3.285-1.23c.645 1.653.24 2.873.12 3.176c.765.84 1.23 1.91 1.23 3.22c0 4.61-2.805 5.625-5.475 5.92c.42.36.81 1.096.81 2.22c0 1.606-.015 2.896-.015 3.286c0 .315.21.69.825.57C20.565 22.092 24 17.592 24 12.297c0-6.627-5.373-12-12-12'/%3E%3C/svg%3E")}
|
||||
+11
-16
@@ -53,39 +53,34 @@ npm start -- -xvfb -vnc
|
||||
|
||||
## Docker 部署
|
||||
|
||||
::: warning 首次运行说明
|
||||
首次运行需通过 VNC 客户端连接 `localhost:5900` 完成网页登录验证。
|
||||
::: warning **特别说明**
|
||||
登录相关操作可以在 WebUI 的虚拟显示器板块进行,也可通过 RealVNC 等工具连接(需添加映射 VNC 端口,默认非被占用的情况下为 5900)
|
||||
:::
|
||||
|
||||
### Docker CLI
|
||||
|
||||
```bash
|
||||
docker run -d --name webai2api \
|
||||
-p 3000:3000 -p 5900:5900 \
|
||||
docker run -d --name webai-2api \
|
||||
-p 3000:3000 \
|
||||
-v "$(pwd)/data:/app/data" \
|
||||
-v "$(pwd)/config.yaml:/app/config.yaml" \
|
||||
-e LOGIN_MODE=true \
|
||||
--shm-size=2gb \
|
||||
foxhui/lmarena-imagen-automator:latest
|
||||
foxhui/webai-2api:latest
|
||||
```
|
||||
|
||||
### Docker Compose
|
||||
|
||||
```yaml
|
||||
version: '3.8'
|
||||
services:
|
||||
webai2api:
|
||||
image: foxhui/lmarena-imagen-automator:latest
|
||||
webai-2api:
|
||||
image: foxhui/webai-2api:latest
|
||||
container_name: webai-2api
|
||||
restart: unless-stopped
|
||||
ports:
|
||||
- "3000:3000"
|
||||
- "5900:5900"
|
||||
volumes:
|
||||
- ./data:/app/data
|
||||
- ./config.yaml:/app/config.yaml
|
||||
environment:
|
||||
- LOGIN_MODE=true
|
||||
shm_size: 2gb
|
||||
restart: unless-stopped
|
||||
shm_size: '2gb'
|
||||
init: true
|
||||
```
|
||||
|
||||
启动服务:
|
||||
|
||||
@@ -6,6 +6,8 @@
|
||||
|
||||
### 启动登录模式
|
||||
|
||||
登录模式会强制关闭无头模式
|
||||
|
||||
```bash
|
||||
# 启动第一个 Worker 进行登录
|
||||
npm start -- -login
|
||||
@@ -27,6 +29,7 @@ npm start -- -xvfb -vnc
|
||||
## 初始化步骤
|
||||
|
||||
1. **登录账号**
|
||||
- Linux 用户使用 `npm start -- -xvfb -vnc` 启动程序,然后使用 WebUI 或者第三方工具连接 VNC
|
||||
- 在打开的浏览器中登录相应平台的账号
|
||||
- 例如:Google 账号用于 Gemini,GitHub 账号用于 LMArena
|
||||
|
||||
@@ -39,16 +42,14 @@ npm start -- -xvfb -vnc
|
||||
- 确认可以正常发送消息和接收回复
|
||||
- 关闭浏览器或按 `Ctrl+C` 退出登录模式
|
||||
|
||||
## 切换到标准模式
|
||||
|
||||
初始化完成后,使用标准命令启动服务:
|
||||
|
||||
```bash
|
||||
npm start
|
||||
```
|
||||
|
||||
::: tip 运行建议
|
||||
为降低风控风险,**强烈建议长期保持非无头模式运行**。
|
||||
- 初始化完成后可使用无头模式运行,为降低风控风险,**强烈建议长期保持非无头模式运行**。
|
||||
- **WebUI 和 VNC 传输过程均未加密,若在公网环境运行请走 SSH 隧道或者使用 Caddy/Nginx 为 WebUI 添加 HTTPS 连接**
|
||||
```bash
|
||||
# SSH隧道方法:在本地终端运行,将服务器 5900 端口映射到本地
|
||||
ssh -L 5900:127.0.0.1:5900 root@服务器IP
|
||||
```
|
||||
:::
|
||||
|
||||
## 多 Worker 登录
|
||||
|
||||
@@ -0,0 +1,18 @@
|
||||
# WebAI2API
|
||||

|
||||
|
||||
## 📝 项目简介
|
||||
|
||||
**WebAI2API** 是一个基于 **Camoufox (Playwright)** 的网页版 AI 服务转通用 API 的工具。通过模拟人类操作与 LMArena、Gemini 等网站交互,提供兼容 **OpenAI 格式** 的接口服务,同时支持 **多窗口并发** 与 **多账号管理**(浏览器实例数据隔离)。
|
||||
|
||||
### 📋 当前支持列表
|
||||
|
||||
| 网站名称 | 文本支持 | 图片支持 |
|
||||
| :--- | :---: | :---: |
|
||||
| [**LMArena**](https://lmarena.ai/) | ✅ | ✅ |
|
||||
| [**Gemini Enterprise Business**](https://business.gemini.google/) | ✅ | ✅ |
|
||||
| [**Nano Banana Free**](https://nanobananafree.ai/) | ❌ | ✅ |
|
||||
| [**zAI**](https://zai.is/) | ❌ | ✅ |
|
||||
| [**Google Gemini**](https://gemini.google.com/) | ❌ | ✅ |
|
||||
|
||||
> 未来可能会支持更多网站...
|
||||
@@ -9,6 +9,9 @@ hero:
|
||||
- theme: brand
|
||||
text: 快速开始
|
||||
link: /guide/deployment
|
||||
- theme: alt
|
||||
text: 项目介绍
|
||||
link: /guide/introduction
|
||||
- theme: alt
|
||||
text: GitHub
|
||||
link: https://github.com/foxhui/WebAI2API
|
||||
|
||||
Reference in New Issue
Block a user