Commit Graph
60 Commits
Author SHA1 Message Date
Jeff Gu bf12a7d69b change: 更新README mermaid 2026-04-09 15:11:10 +08:00
Jeff Gu c2850aa556 change: 更新README 2026-04-09 14:58:19 +08:00
Jeff Gu 7cee6abcb5 style(ui): 优化组件样式,移除不必要的环形颜色设置 2026-04-09 14:28:31 +08:00
Jeff Gu 280a4fc8c1 style(AppLayout): 调整标签和按钮样式以改善布局
style(Channels): 修改渠道标识文本样式以提升可读性
style(Dashboard): 优化描述文本顺序以增强表达效果
2026-04-09 14:28:22 +08:00
Jeff Gu f83fd8b116 style(App): 统一代码风格,修复格式问题 2026-04-09 13:58:05 +08:00
Jeff Gu ffab957acc feat(docs): 更新文档以反映 AI 服务商的更改和新特性
feat(layout): 添加渐变背景样式以提升视觉效果
feat(dashboard): 优化核心特性描述,增强用户体验
fix(pricing): 修复定价页面的样式问题,提升可读性
fix(tokens): 调整令牌页面的卡片样式,确保一致性
2026-04-09 13:14:49 +08:00
Jeff Gu 31c9788f99 feat(autocomplete): 添加自动完成输入组件及相关逻辑
feat(channel-models): 添加通道模型解析和获取逻辑
feat(api-test): 集成自动完成输入,优化模型选择
feat(pricing): 增加定价页面模型选择的自动完成支持
2026-04-09 12:33:17 +08:00
Jeff Gu 84cc346ebd feat(channel): 添加模型映射和获取模型的 API
- 在 ChannelConfig 中添加 models 字段以支持模型映射
- 新增 ChannelFetchModelsEndpoint 用于获取上游模型列表
- 更新 normalizeChannelConfig 函数以处理新模型结构
- 修改相关的数据库操作以适应新的配置结构
- 引入 buildPrefixedTargetUrl 函数以简化 URL 构建
- 更新 utils 函数以支持模型映射查找
2026-04-09 11:56:38 +08:00
Jeff Gu a2c97959ba feat(channel): 支持多个 API 密钥和自动重试功能
- 更新 ChannelConfig 接口,添加 api_keys、auto_retry 和 auto_rotate 字段
- 修改 Channels 组件以支持新的配置
- 实现 API 请求的重试机制,增强稳定性
2026-04-09 11:17:20 +08:00
Jeff Gu 1ef5502083 feat: 更新项目名称为 One API on Workers 2026-04-09 10:03:02 +08:00
Jeff Gu 6071f18f7a feat(api): 添加前端代理和静态资源处理逻辑
- 增加了对前端开发服务器的代理支持
- 实现了静态资源请求的处理
- 更新了类型定义以支持新环境变量
- 新增了 wrangler.jsonc 配置文件,替换原有的模板文件
2026-04-09 09:39:40 +08:00
Jeff Gu c36e3c1017 feat: 界面&逻辑调整;修复数据库初始化问题 2026-04-08 21:52:33 +08:00
dreamhunter2333 50f0e9e3a3 Use npx for wrangler scripts 2026-03-15 18:54:37 +08:00
dreamhunter2333 466511b399 Add audio playback to API test 2026-03-15 18:40:46 +08:00
dreamhunter2333 a85eb362b2 Upgrade hono to 4.12.8 2026-03-15 18:35:20 +08:00
Dream Hunter 1a90c280e0 Add dedicated audio channel support (#11) 2026-03-15 18:32:50 +08:00
dreamhunter2333andClaude Opus 4.6 f7a1d95ec4 refactor: 消除剩余重复代码,统一 usage 处理和导入风格
- 提取 checkoutResponsesUsageData 到 shared,消除两个 responses proxy 重复
- claude-to-openai 复用 usage-utils 的 normalizeUsage(支持 cached_tokens)
- 删除 utils.ts 默认导出,统一使用命名导入
- channel-resolver JSON.parse 加防御,坏数据跳过不崩溃

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
2026-03-12 20:25:45 +08:00
dreamhunter2333andClaude Opus 4.6 07a597e41a feat: 前端 UI 重构,提升视觉效果和交互体验
- Dashboard: 全新 hero 区域,gradient mesh 背景,stagger 动画特性卡片
- API 测试: 改为左右分栏布局(请求/响应),增加状态指示和复制按钮
- Database: 使用 PageContainer 统一风格,改善结果展示
- 新增 404 页面和 catch-all 路由
- Sidebar: 更紧凑精致,优化折叠/展开交互
- Dialog: backdrop blur 效果,圆角升级
- CSS: 新增 gradient-mesh、grid-pattern、stagger-children 等动画
- 配色系统升级为更鲜艳的靛蓝主色调

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
2026-03-12 18:24:57 +08:00
dreamhunter2333andClaude Opus 4.6 6f99358fb5 refactor: 统一 providers 层,提取共享模块消除重复代码
- 提取 shared/auth.ts、channel-resolver.ts、route-policy.ts、provider-registry.ts
- 提取 shared/openai-stream-utils.ts 和 responses-stream-utils.ts
- 统一 index.ts 为 UnifiedProxyEndpoint(303→55行)
- 各 provider 文件精简约55%,只保留 buildProxyRequest
- 修复 claude-to-openai-proxy.ts 类型错误
- 添加 E2E mock 测试基础设施(mock-upstream + setup + run-e2e)

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
2026-03-12 18:24:30 +08:00
dreamhunter2333 d9dd2d81be Make /v1/models auth optional 2026-02-07 22:15:25 +08:00
dreamhunter2333andClaude Opus 4.5 5b7254f17e fix: 修复 Claude 协议转换中 tool_result 消息导致空 user 消息的问题
当 Claude 消息内容全部为 tool_result 块时,转换后的 OpenAI 消息会缺少 content 字段,
导致后端(如 minimax)返回 400 错误。

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
2026-01-31 15:57:18 +08:00
dreamhunter2333andClaude Opus 4.5 a374078966 fix: 使用转换后的模型名计费
计费时使用 requestBody.model(转换后的实际模型名)而不是原始请求的模型名,
这样定价表只需配置后端实际模型的价格即可。

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
2026-01-31 15:08:53 +08:00
dreamhunter2333andClaude Opus 4.5 c75dade7df feat: 添加 Claude 到 OpenAI 协议转换支持
新增功能:
- 新增 claude-to-openai channel 类型,支持 Claude 协议请求转换为 OpenAI 协议
- 支持流式和非流式响应转换
- 完整的 SSE 事件转换 (message_start, content_block_*, message_delta, message_stop)
- 支持工具调用 (tool_use) 转换

优化:
- 统一在上层完成模型名映射,移除各 provider 重复逻辑
- 添加通配符匹配支持 (如 *claude*, claude-*)
- 简化代码,移除冗余变量

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
2026-01-31 02:15:41 +08:00
dreamhunter2333andClaude Opus 4.5 59149af970 feat: 添加 /v1/models 端点支持
- 新增 ModelsEndpoint 类,返回当前 token 可用的所有模型列表
- 兼容 OpenAI API 格式
- 支持 Authorization 和 x-api-key 两种认证方式

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
2026-01-30 23:32:48 +08:00
dreamhunter2333andClaude Opus 4.5 93d404af5e fix: 回退 chanfana 到 v2,v3 有 breaking changes
chanfana 3.0.0 导致 OpenAPI 端点报错:
TypeError Cannot read properties of undefined (reading 'parent')

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
2026-01-30 22:13:55 +08:00
dreamhunter2333andClaude Opus 4.5 2dd7f89075 fix: 回退 zod 到 v3,v4 有 breaking changes
Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
2026-01-30 21:57:16 +08:00
dreamhunter2333andClaude Opus 4.5 cfe475d587 chore: 更新依赖到最新版本
- chanfana 2.8.3 -> 3.0.0
- hono 4.11.1 -> 4.11.7
- zod 3.25.76 -> 4.3.6
- wrangler 4.56.0 -> 4.61.1

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
2026-01-30 21:56:03 +08:00
dreamhunter2333andClaude Opus 4.5 98522e7678 feat: 添加令牌重置已用额度功能
- 后端新增 POST /api/admin/token/:key/reset 接口
- 前端令牌列表添加重置额度按钮(桌面端和移动端菜单)

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
2026-01-30 21:52:22 +08:00
dreamhunter2333andClaude Opus 4.5 bdb4825cdc feat: 修复 Codex 缓存 token 计费并优化代码结构
- 修复 Codex API 缓存 token 重复计费问题 (input_tokens 包含 cached_tokens)
- 提取共享代码到 src/providers/shared/usage-utils.ts,消除重复
- 前端定价页面增加缓存倍率配置列
- 修复 var 为 const,favicon 改为云图标

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
2026-01-30 21:06:44 +08:00
dreamhunter2333andClaude Opus 4.5 6a648f3fa7 feat: 优化前端 UI 设计和用户体验
- 重构所有 UI 组件,采用现代化设计风格
- 新增 PageContainer 组件统一页面布局
- 优化 Sidebar 支持折叠功能
- 改进 Toast 通知样式和交互
- 统一所有页面的视觉风格和间距
- 提升整体界面的专业性和易用性

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
2026-01-30 14:11:51 +08:00
dreamhunter2333 066437fcb3 Fix duplicate usage tracking for streaming 2026-01-02 01:42:10 +08:00
dreamhunter2333 80a6fedbac Add responses proxies and usage fixes 2025-12-31 11:31:07 +08:00
dreamhunter2333andClaude Opus 4.5 990528da37 fix: 修复 API 响应 body stream 重复读取错误
🤖 Generated with [Claude Code](https://claude.com/claude-code)

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
2025-12-27 11:29:41 +08:00
dreamhunter2333andClaude Opus 4.5 6713f240ba fix: 修复 SPA 路由刷新 404 和认证状态丢失问题
- 移除手动 SPA fallback 逻辑,使用 Cloudflare Assets 原生 SPA 支持
- 修复刷新时认证状态丢失导致跳转首页的问题

🤖 Generated with [Claude Code](https://claude.com/claude-code)

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
2025-12-21 01:39:11 +08:00
dreamhunter2333andClaude Opus 4.5 9bf3a9efb2 fix: 修复 Toast 在浅色模式下背景色问题
- 使用内联 style 直接设置背景色
- 浅色模式使用纯白 #ffffff
- 深色模式使用灰色 #1f2937

🤖 Generated with [Claude Code](https://claude.com/claude-code)

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
2025-12-20 13:32:05 +08:00
dreamhunter2333andClaude Opus 4.5 4572e5fc9e feat: 使用 React + Vite + shadcn/ui 重构前端
- 使用 React 19 + TypeScript + Vite 7 重构整个前端
- 集成 shadcn/ui 组件库和 Tailwind CSS v4
- 使用 TanStack Query 管理服务端状态
- 使用 Zustand 管理客户端状态(认证)
- 使用 React Router v7 实现路由
- 实现浅粉色主题,支持深色模式
- 添加 API 拦截器和全局错误处理
- 优化 Toast 通知样式
- 管理页面按钮右对齐
- Token 显示脱敏处理

🤖 Generated with [Claude Code](https://claude.com/claude-code)

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
2025-12-20 13:24:45 +08:00
dreamhunter2333andClaude Sonnet 4.5 de24d420a4 refactor: 优化 Claude proxy 代码结构和 header 处理
- 简化 stream 条件判断(去掉冗余的 || reqJson.stream)
- 移除不必要的 else(stream 分支已有 return)
- 删除客户端的 x-api-key header 避免冲突
- 精简 header 处理逻辑

🤖 Generated with [Claude Code](https://claude.com/claude-code)

Co-Authored-By: Claude Sonnet 4.5 <noreply@anthropic.com>
2025-12-17 19:04:02 +08:00
dreamhunter2333andClaude Sonnet 4.5 4d4e78fa41 feat: ProxyEndpoint 支持 x-api-key 认证方式
- 支持 OpenAI 格式:Authorization: Bearer xxx
- 支持 Claude 格式:x-api-key: xxx
- 两种认证方式都可以使用
- 客户端可以使用任一格式调用 /v1/messages 和 /v1/chat/completions
- 更新 schema 使两个 header 都为 optional

Claude proxy 完善:
- 删除客户端 Authorization header 避免与上游 API 冲突
- 支持 message_complete 事件(最新格式)
- 保留 message_stop 作为向后兼容

🤖 Generated with [Claude Code](https://claude.com/claude-code)

Co-Authored-By: Claude Sonnet 4.5 <noreply@anthropic.com>
2025-12-17 18:57:08 +08:00
dreamhunter2333andClaude Sonnet 4.5 28efa1367b fix: 修复频道多选和 Claude API streaming 支持
1. 频道多选下拉框修复:
   - 将点击事件改为 checkbox onchange 事件
   - 新增 handleChannelCheckboxChange 函数
   - 避免手动切换导致状态重复切换的问题

2. Claude API 支持完善:
   - 删除客户端的 Authorization header 避免冲突
   - 支持 message_complete 事件(Claude 最新格式)
   - 保留 message_stop 处理作为向后兼容
   - 正确提取 streaming 和 non-streaming 的 token usage

🤖 Generated with [Claude Code](https://claude.com/claude-code)

Co-Authored-By: Claude Sonnet 4.5 <noreply@anthropic.com>
2025-12-17 18:53:23 +08:00
dreamhunter2333andClaude Sonnet 4.5 50b40a18a8 fix: 修复频道多选下拉框选择无效的问题
- 将点击事件从 div 移到 checkbox 的 onchange 事件
- 新增 handleChannelCheckboxChange 函数,正确处理 checkbox 状态
- 避免手动切换 checkbox 导致状态被切换两次的问题
- 现在点击 checkbox 可以正确更新选中状态

🤖 Generated with [Claude Code](https://claude.com/claude-code)

Co-Authored-By: Claude Sonnet 4.5 <noreply@anthropic.com>
2025-12-17 18:48:42 +08:00
dreamhunter2333andClaude Sonnet 4.5 198dc500aa feat: 重构管理界面并添加统一 loading 效果
- 完全重构前端管理界面,采用模块化架构
- 新增独立的 CSS 和 JS 模块(utils, auth, channels, tokens, pricing, api-test, database)
- 实现统一的 loading 遮罩效果,所有 API 请求自动显示加载状态
- 添加现代化多选下拉框组件用于频道选择
- 实现模型部署映射的可视化表格编辑
- 修复页面高度自适应问题,管理页面占满全屏
- 优化侧边栏布局,添加 GitHub 链接和版本号
- 令牌管理页面隐藏敏感 key,添加复制功能
- 管理页面切换时自动重置为列表视图并重新加载数据
- 新增 Claude Proxy 提供商支持
- 统一所有 API 调用的错误处理和 loading 状态管理

🤖 Generated with [Claude Code](https://claude.com/claude-code)

Co-Authored-By: Claude Sonnet 4.5 <noreply@anthropic.com>
2025-12-17 18:41:05 +08:00
dreamhunter2333 e376a8a539 downgrade zod 2025-12-12 20:27:55 +08:00
dreamhunter2333andClaude Opus 4.5 700a50372d docs: 将监控与统计、核心优势、安全性、API文档移入可折叠区域
🤖 Generated with [Claude Code](https://claude.com/claude-code)

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
2025-12-11 13:31:27 +08:00
dreamhunter2333andClaude Opus 4.5 dfc9d084a2 docs: 合并使用指南、管理功能、配置说明到可折叠的二级标题
将使用指南、管理功能、配置说明、Token 配置合并到一个可折叠的"使用与配置"二级标题下,内部改为三级标题

🤖 Generated with [Claude Code](https://claude.com/claude-code)

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
2025-12-11 13:30:24 +08:00
dreamhunter2333andClaude Opus 4.5 9e0da518ea docs: 为可折叠区域添加标题样式
🤖 Generated with [Claude Code](https://claude.com/claude-code)

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
2025-12-11 13:26:56 +08:00
dreamhunter2333andClaude Opus 4.5 5b49dbad6b docs: 优化 README 结构
- 将项目结构移至系统架构后,改为可折叠
- 将使用指南改为可折叠

🤖 Generated with [Claude Code](https://claude.com/claude-code)

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
2025-12-11 13:26:07 +08:00
dreamhunter2333andClaude Opus 4.5 0af96e1639 docs: 将系统架构图改为 Mermaid 格式
🤖 Generated with [Claude Code](https://claude.com/claude-code)

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
2025-12-11 13:23:29 +08:00
dreamhunter2333andClaude Opus 4.5 5656052301 chore: 更新依赖包版本
- chanfana: 2.8.1 -> 2.8.3
- hono: 4.8.2 -> 4.10.8
- zod: 3.25.67 -> 4.1.13
- wrangler: 4.20.5 -> 4.53.0

🤖 Generated with [Claude Code](https://claude.com/claude-code)

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
2025-12-11 13:21:38 +08:00
dreamhunter2333andClaude Opus 4.5 a02ec82a8f feat: 现代化管理面板界面
- 添加 CSS 变量系统支持主题定制
- 改进视觉效果:更柔和的渐变、阴影和圆角
- 添加平滑的动画和过渡效果
- 优化卡片、按钮、表单等组件样式
- 改进响应式设计适配
- 美化滚动条和选择效果

🤖 Generated with [Claude Code](https://claude.com/claude-code)

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
2025-12-11 13:19:33 +08:00
dreamhunter2333 8bffed8a03 优化代理服务流式响应处理和使用量统计
- 修复 processStreamData 异步处理问题,使用 for..of 替代 forEach
- 优化流式响应处理,使用 response.body.tee() 分离客户端和服务端流
- 使用 executionCtx.waitUntil() 确保后台使用量统计不阻塞响应
- 为 Azure OpenAI 代理添加 api_version 条件检查
- 统一两个代理服务的流处理逻辑,提高代码一致性
2025-07-01 03:00:38 +08:00