From ffab957acc95ee2aa28aecc10b929735b1b05a65 Mon Sep 17 00:00:00 2001 From: Jeff Gu Date: Thu, 9 Apr 2026 13:14:49 +0800 Subject: [PATCH] =?UTF-8?q?feat(docs):=20=E6=9B=B4=E6=96=B0=E6=96=87?= =?UTF-8?q?=E6=A1=A3=E4=BB=A5=E5=8F=8D=E6=98=A0=20AI=20=E6=9C=8D=E5=8A=A1?= =?UTF-8?q?=E5=95=86=E7=9A=84=E6=9B=B4=E6=94=B9=E5=92=8C=E6=96=B0=E7=89=B9?= =?UTF-8?q?=E6=80=A7=20feat(layout):=20=E6=B7=BB=E5=8A=A0=E6=B8=90?= =?UTF-8?q?=E5=8F=98=E8=83=8C=E6=99=AF=E6=A0=B7=E5=BC=8F=E4=BB=A5=E6=8F=90?= =?UTF-8?q?=E5=8D=87=E8=A7=86=E8=A7=89=E6=95=88=E6=9E=9C=20feat(dashboard)?= =?UTF-8?q?:=20=E4=BC=98=E5=8C=96=E6=A0=B8=E5=BF=83=E7=89=B9=E6=80=A7?= =?UTF-8?q?=E6=8F=8F=E8=BF=B0=EF=BC=8C=E5=A2=9E=E5=BC=BA=E7=94=A8=E6=88=B7?= =?UTF-8?q?=E4=BD=93=E9=AA=8C=20fix(pricing):=20=E4=BF=AE=E5=A4=8D?= =?UTF-8?q?=E5=AE=9A=E4=BB=B7=E9=A1=B5=E9=9D=A2=E7=9A=84=E6=A0=B7=E5=BC=8F?= =?UTF-8?q?=E9=97=AE=E9=A2=98=EF=BC=8C=E6=8F=90=E5=8D=87=E5=8F=AF=E8=AF=BB?= =?UTF-8?q?=E6=80=A7=20fix(tokens):=20=E8=B0=83=E6=95=B4=E4=BB=A4=E7=89=8C?= =?UTF-8?q?=E9=A1=B5=E9=9D=A2=E7=9A=84=E5=8D=A1=E7=89=87=E6=A0=B7=E5=BC=8F?= =?UTF-8?q?=EF=BC=8C=E7=A1=AE=E4=BF=9D=E4=B8=80=E8=87=B4=E6=80=A7?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- README.md | 21 ++- frontend/src/components/layout/AppLayout.tsx | 2 +- frontend/src/pages/Channels.tsx | 6 +- frontend/src/pages/Dashboard.tsx | 163 ++++++++++--------- frontend/src/pages/Pricing.tsx | 2 +- frontend/src/pages/Tokens.tsx | 2 +- 6 files changed, 101 insertions(+), 95 deletions(-) diff --git a/README.md b/README.md index a3c69ac..791fad9 100644 --- a/README.md +++ b/README.md @@ -4,14 +4,13 @@ ## ✨ 特性 -- 🚀 **基于 Cloudflare Workers**:无服务器架构,全球边缘部署 -- 🔐 **多渠道支持**:支持 OpenAI、Azure OpenAI、Claude、OpenAI Responses、Azure OpenAI Responses -- 🎫 **Token 管理**:完整的 API Token 生成、管理和配额控制 -- 📊 **使用量统计**:实时统计 API 使用量和费用 +- 🚀 **基于 Cloudflare Workers**:全球分布式网络、极低延、高性能 +- 🔐 **多渠道**:支持 OpenAI、Azure OpenAI、Claude 等多种 AI 服务商 +- 🎫 **负载均衡**:支持多KEY/渠道间分配请求,自动重试+自动轮换,确保高可用性 +- 📊 **用量统计**:Analytics Engine 实时统计,精确成本核算与日志回溯 - 💰 **定价管理**:灵活的模型定价配置 - 🎨 **Web 管理界面**:直观的 Web 界面进行配置管理 - 🧪 **API 测试工具**:内置 API 测试功能,支持实时调试 -- 📚 **OpenAPI 文档**:自动生成的 API 文档 ## 🏗️ 系统架构 @@ -26,7 +25,7 @@ flowchart LR D[(Cloudflare D1
Database)] end - subgraph Providers["AI 服务提供商"] + subgraph Providers["AI 服务商"] C1[Azure OpenAI] C2[OpenAI] end @@ -49,13 +48,13 @@ one-api-workers/ │ │ ├── pricing_api.ts # 定价管理 API │ │ ├── db_api.ts # 数据库初始化 API │ │ └── index.ts # 管理接口路由 -│ ├── providers/ # AI 服务提供商 +│ ├── providers/ # AI 服务商 │ │ ├── azure-openai-proxy.ts # Azure OpenAI 代理 │ │ ├── openai-proxy.ts # OpenAI 代理 │ │ ├── claude-proxy.ts # Claude 代理 │ │ ├── openai-responses-proxy.ts # OpenAI Responses 代理 │ │ ├── azure-openai-responses-proxy.ts # Azure Responses 代理 -│ │ └── index.ts # 提供商路由 +│ │ └── index.ts # 渠道路由 │ ├── db/ # 数据库相关 │ ├── model/ # 数据模型 │ ├── constants.ts # 常量定义 @@ -273,7 +272,7 @@ curl https://your-domain.com/v1/responses \ 访问 `https://your-domain.com` 即可使用 Web 管理界面,功能包括: -- **🔗 渠道管理**:添加、编辑、删除 AI 服务提供商渠道(支持 OpenAI、Azure OpenAI、Claude、OpenAI Responses、Azure Responses) +- **🔗 渠道管理**:添加、编辑、删除 AI 服务商(支持 OpenAI、Azure OpenAI、Claude、OpenAI Responses、Azure Responses) - **🔑 API Token 管理**:生成、管理和监控 API Token 使用情况 - **💰 定价配置**:灵活配置不同模型的定价策略 - **🧪 API 测试工具**:内置 API 测试界面,支持实时调试和错误排查 @@ -289,7 +288,7 @@ curl https://your-domain.com/v1/responses \ #### 渠道配置 -目前支持以下 AI 服务提供商: +目前支持以下 AI 服务商: **OpenAI 配置** @@ -368,7 +367,7 @@ curl https://your-domain.com/v1/responses \ **配置字段说明**: - `name`: 渠道显示名称 -- `type`: 服务提供商类型(`openai`、`azure-openai`、`claude`、`openai-responses`、`azure-openai-responses`) +- `type`: 服务商类型(`openai`、`azure-openai`、`claude`、`openai-responses`、`azure-openai-responses`) - `endpoint`: API 端点地址 - `api_key`: API 密钥 - `api_version`: API 版本(Azure OpenAI / Claude 可用;Azure Responses v1 请留空) diff --git a/frontend/src/components/layout/AppLayout.tsx b/frontend/src/components/layout/AppLayout.tsx index e555b12..2b3211a 100644 --- a/frontend/src/components/layout/AppLayout.tsx +++ b/frontend/src/components/layout/AppLayout.tsx @@ -83,7 +83,7 @@ export function AppLayout({ children }: AppLayoutProps) { )} -
+
{children}
diff --git a/frontend/src/pages/Channels.tsx b/frontend/src/pages/Channels.tsx index 14d85ce..c4cb004 100644 --- a/frontend/src/pages/Channels.tsx +++ b/frontend/src/pages/Channels.tsx @@ -566,7 +566,7 @@ export function Channels() { return ( - - +
+
+
+
+ + Unified AI Gateway +
+

+ + One API on Workers + +

+

+ 基于 Cloudflare Workers
分布式、高性能、低延迟的 AI 统一网关 +

+
+ + {/* */}
@@ -89,24 +91,24 @@ export function Dashboard() {
{/* Features Grid */}
-
-
-

核心特性

-
-
{features.map((feature) => ( - + -
+
-
+

{feature.title}

-

- {feature.description} -

+

{feature.description}

@@ -115,18 +117,20 @@ export function Dashboard() {
{/* Quick Start */} - - -
+ + +

快速开始

四步完成配置,开始使用统一接口

-
+
{steps.map((step) => ( -
+
- + {step.num}
@@ -143,10 +147,13 @@ export function Dashboard() { {/* Supported Providers */}
-

支持的服务提供商

+

支持的服务端点

- {['OpenAI', 'Azure OpenAI', 'Claude', 'OpenAI Responses'].map((name) => ( -
+ {["OpenAI", "Azure OpenAI", "Claude", "OpenAI Responses"].map((name) => ( +
{name}
@@ -155,5 +162,5 @@ export function Dashboard() {
- ) + ); } diff --git a/frontend/src/pages/Pricing.tsx b/frontend/src/pages/Pricing.tsx index 8457093..c6abfa2 100644 --- a/frontend/src/pages/Pricing.tsx +++ b/frontend/src/pages/Pricing.tsx @@ -216,7 +216,7 @@ export function Pricing() {
) : pricingRows.length === 0 ? ( -
+
diff --git a/frontend/src/pages/Tokens.tsx b/frontend/src/pages/Tokens.tsx index 0c5fefe..c06d018 100644 --- a/frontend/src/pages/Tokens.tsx +++ b/frontend/src/pages/Tokens.tsx @@ -273,7 +273,7 @@ export function Tokens() {
) : !data || data.length === 0 ? ( - +