- 11 Mar, 2026 7 commits
-
-
John Doe authored
Add a system-wide "Backend Mode" that disables user self-registration and self-service while keeping admin panel and API gateway fully functional. When enabled, only admin can log in; all user-facing routes return 403. Backend: - New setting key `backend_mode_enabled` with atomic cached reads (60s TTL) - BackendModeUserGuard middleware blocks non-admin authenticated routes - BackendModeAuthGuard middleware blocks registration/password-reset auth routes - Login/Login2FA/RefreshToken handlers reject non-admin when enabled - TokenPairWithUser struct for role-aware token refresh - 20 unit tests (middleware + service layer) Frontend: - Router guards redirect unauthenticated users to /login - Admin toggle in Settings page - Login page hides register link and footer in backend mode - 9 unit tests for router guard logic - i18n support (en/zh) 27 files changed, 833 insertions(+), 17 deletions(-) Co-Authored-By:Claude Opus 4.6 <noreply@anthropic.com>
-
shaw authored
将 /v1/chat/completions 端点从 ResponseWriter 劫持模式重构为独立的 类型安全转换路径,与 Anthropic Messages 端点架构对齐: - 在 apicompat 包新增 Chat Completions 完整类型定义和双向转换器 - 新增 ForwardAsChatCompletions service 方法,走 Responses API 上游 - Handler 改为独立的账号选择/failover 循环,不再劫持 Responses handler - 提取 handleCompatErrorResponse 为 Chat Completions 和 Messages 共用 - 删除旧的 forwardChatCompletions 直传路径及相关死代码
-
Wesley Liddick authored
feat: 添加 OpenAI Chat Completions 兼容端点(基于 #648,修复编译错误和运行时 panic)
-
Wesley Liddick authored
fix: 补充缺失的组级和账户级运维告警指标
-
7976723 authored
1. 修复 WriteFilteredHeaders API 不兼容(2处): 将 s.cfg.Security.ResponseHeaders 改为 s.responseHeaderFilter, 因为 main 分支已将函数签名改为接受 *responseheaders.CompiledHeaderFilter 2. 修复 writer 生命周期导致的 nil pointer panic: ChatCompletions handler 替换了 c.Writer 但未恢复,导致 OpsErrorLogger 中间件的 defer 释放 opsCaptureWriter 后, Logger 中间件调用 c.Writer.Status() 触发空指针解引用。 通过保存并恢复 originalWriter 修复。 3. 为 chatCompletionsResponseWriter 添加防御性 Status() 和 Written() 方法,包含 nil 安全检查 4. 恢复 gateway.go 中被误删的 net/http import
-
7976723 authored
基于 @yulate 在 PR #648 (commit 0bb6a392) 的工作,解决了与最新 main 分支的合并冲突。 原始功能(@yulate): - 添加 /v1/chat/completions 和 /chat/completions 兼容端点 - 将 Chat Completions 请求转换为 Responses API 格式并转换回来 - 添加 API Key 直连转发支持 - 包含单元测试 Co-authored-by:yulate <yulate@users.noreply.github.com>
-
Wesley Liddick authored
fix(openai): convert string input to array for Codex OAuth responses endpoint (fix #919)
-
- 10 Mar, 2026 12 commits
-
-
rickylin047 authored
The ChatGPT backend-api codex/responses endpoint requires `input` to be an array, but the OpenAI Responses API spec allows it to be a plain string. When a client sends a string input, sub2api now converts it to the expected message array format. Empty/whitespace-only strings become an empty array to avoid triggering a 400 "Input must be a list" error.
-
wucm667 authored
新增以下运维告警指标类型: - group_available_accounts: 组内可用账户数 - group_available_ratio: 组内可用账户比例 - group_rate_limit_ratio: 组内限速账户比例 - account_rate_limited_count: 限速账户数 - account_error_count: 错误账户数 - account_error_ratio: 错误账户比例 - overload_account_count: 过载账户数 包含比例和计数类指标的评估逻辑,并注册新的百分比类指标用于阈值校验。
-
Wesley Liddick authored
feat: 允许管理员为持有有效订阅的用户绑定订阅类型分组
-
shaw authored
-
ischanx authored
-
Wesley Liddick authored
fix: Linux.do OAuth 注册支持邀请码两步流程 (fix #836)
-
Wesley Liddick authored
feat: cleanup stale concurrency slots on startup
-
Wesley Liddick authored
fix: OpenAI临时性400错误支持池模式同账号重试 & HelpTooltip层级修复
-
Wesley Liddick authored
fix: use shared max_line_size config for OpenAI Responses SSE scanner
-
Wesley Liddick authored
fix(frontend): stack quota badges vertically in capacity column
-
Wesley Liddick authored
feat(frontend): pass locale to iframe embedded pages via lang parameter
-
Wesley Liddick authored
feat: OpenAI 账号信息增强 & 批量操作支持
-
- 09 Mar, 2026 21 commits
-
-
kyx236 authored
1. 识别OpenAI "An error occurred while processing your request" 临时性400错误 并触发failover,同时在池模式下标记RetryableOnSameAccount,允许同账号重试 2. ForwardAsAnthropic路径同步支持临时性400错误的识别和同账号重试 3. HelpTooltip组件使用Teleport渲染到body,修复在dialog内被裁切的问题
-
erio authored
Two SSE scanners in openai_gateway_messages.go were hardcoded to 1MB while all other scanners use defaultMaxLineSize (500MB) with config override. This caused Responses API streams to fail on large payloads.
-
ischanx authored
之前管理员无法通过 API 密钥管理将用户绑定到订阅类型分组(直接返回错误)。 现在改为检查用户是否持有该分组的有效订阅,有则允许绑定,无则拒绝。 - admin_service: 新增 userSubRepo 依赖,替换硬拒绝为订阅校验 - admin_service: 区分 ErrSubscriptionNotFound 和内部错误,避免 DB 故障被误报 - wire_gen/api_contract_test: 同步新增参数 - UserApiKeysModal: 管理员分组下拉不再过滤订阅类型分组 Co-Authored-By:Claude Opus 4.6 <noreply@anthropic.com>
-
QTom authored
- 提取 refreshSingleAccount 私有方法复用单账号刷新逻辑 - 新增 BatchClearError handler (POST /admin/accounts/batch-clear-error) - 新增 BatchRefresh handler (POST /admin/accounts/batch-refresh) - 前端 AccountBulkActionsBar 添加批量重置状态/刷新令牌按钮 - AccountsView 添加 handler 支持 partial success 反馈 - i18n 中英文补充批量操作相关翻译
-
QTom authored
提取 DecodeIDToken(跳过过期校验)供导入场景使用, ParseIDToken 复用它并保留原有过期检查行为。 导入 OpenAI/Sora OAuth 账号时自动补充缺失的 email、 plan_type、chatgpt_account_id 等字段,不覆盖已有值。
-
QTom authored
OAuth 授权和 token 刷新时从 id_token 的 OpenAI auth claim 中 提取 chatgpt_plan_type(plus/team/pro/free),存入 credentials, 账号管理页面 PlatformTypeBadge 显示订阅类型。
-
erio authored
QuotaBadge components (daily/weekly/total) were wrapped in a horizontal flex container, making them visually inconsistent with other capacity badges (concurrency, window cost, sessions, RPM) which stack vertically. Remove the wrapper so all badges align consistently. Co-Authored-By:Claude Opus 4.6 <noreply@anthropic.com>
-
erio authored
When the service restarts, concurrency slots from the old process remain in Redis, causing phantom occupancy. On startup, scan all concurrency sorted sets and remove members with non-current process prefix, then clear orphaned wait queue counters. Uses Go-side SCAN to discover keys (compatible with Redis client prefix hooks in tests), then passes them to a Lua script for atomic member-level cleanup. Co-Authored-By:Claude Opus 4.6 <noreply@anthropic.com>
-
erio authored
Embedded pages (purchase subscription, custom pages) now receive the current user locale through a `lang` URL parameter, allowing iframe content to match the user's language preference. Co-Authored-By:Claude Opus 4.6 <noreply@anthropic.com>
-
shaw authored
-
shaw authored
-
shaw authored
-
shaw authored
-
Elysia authored
-
shaw authored
-
Wesley Liddick authored
fix(billing): 修复 OpenAI fast 档位计费并补齐展示
-
shaw authored
-
yangjianbo authored
- 打通 service_tier 在 OpenAI HTTP、WS、passthrough 与 usage 记录中的传递 - 修正 priority/flex 计费逻辑,并将 fast 归一化为 priority - 在用户端和管理端补齐服务档位与计费明细展示 - 补齐前后端测试,并修复 WS 限流信号重复持久化导致的全量回归失败 Co-Authored-By:Claude Opus 4.6 <noreply@anthropic.com>
-
shaw authored
-
Wesley Liddick authored
fix(openai): remove misplaced passthrough check from isModelSupportedByAccount
-
Wesley Liddick authored
feat(frontend): 为后台账号管理和 IP 管理增加拖筐选中能力
-