- 17 Apr, 2026 11 commits
-
-
-
refactor: extract ReadUpstreamResponseBody to deduplicate upstream response read + too-large error handling Consolidates 9 call sites of resolveUpstreamResponseReadLimit + readUpstreamResponseBodyLimited + ErrUpstreamResponseBodyTooLarge error handling into a single ReadUpstreamResponseBody function with TooLargeWriter callback for API-format-specific error responses (Anthropic, OpenAI, countTokens).
-
Each retry in the SetOutboxWatermark loop now gets its own 5s context. Previously a shared context could already be expired when the second or third attempt ran, making the retries pointless. Co-Authored-By:Claude Sonnet 4.6 (1M context) <noreply@anthropic.com>
-
Fixes #1691 - pollOutbox() reused a 10s context for SetOutboxWatermark after event processing could take much longer, causing "outbox watermark write failed: context deadline exceeded". The watermark never advanced so the same 200 events were reprocessed every poll cycle, spiking CPU. Now uses an independent 5s context with up to 3 retries (200ms apart). - When multiple Codex accounts sharing the same 21-22 groups are all rate-limited in quick succession, each account_changed event triggered redundant bucket rebuild attempts for the same groups. Introduce batchSeenKey{groupID, platform} and thread a seen map through the handler chain; rebuildBucketsForPlatform skips (group, platform) pairs already rebuilt within the same poll batch (~80% fewer rebuild calls in the 5-accounts-same-groups scenario). Co-Authored-By:Claude Sonnet 4.6 (1M context) <noreply@anthropic.com>
-
-
-
- 16 Apr, 2026 1 commit
-
-
陈曦 authored
-
- 15 Apr, 2026 13 commits
-
-
github-actions[bot] authored
-
Wesley Liddick authored
修复 OpenAI 账号限流回流误判:7d 窗口可用时不因 5h 窗口为 0 回写 429
-
Wesley Liddick authored
feat(usage): add account cost display to admin dashboard and usage pages
-
Wesley Liddick authored
fix(ui): allow closing test dialog during active SSE stream
-
Wesley Liddick authored
feat(payment): balance recharge multiplier and fee rate
-
erio authored
-
erio authored
- Cost cell: change gray "A $xxx" to orange "成本 $xxx" with i18n - Remove standalone account_cost column from column settings (redundant)
-
erio authored
- UserBreakdownItem: add AccountCost field + SQL aggregation - UserBreakdownSubTable: add orange account cost column - Admin usage table: add account_cost column (after cost, default visible) - Column settings: add account_cost toggle option
-
Wesley Liddick authored
-
erio authored
-
erio authored
- Fix mock for GetModelStatsWithFilters: add account_cost column - Add assertion: GetStatsWithFilters always returns TotalAccountCost - New test: GetModelStatsAccountCostColumn verifies scan of AccountCost - New test: GetGroupStatsAccountCostColumn verifies scan of AccountCost - New test: GetStatsWithFiltersAlwaysReturnsAccountCost (no AccountID filter) - Integration test: add TotalAccountCost/TodayAccountCost assertions - Fix gofmt alignment in usage_log_types.go
-
erio authored
- Add account_cost column to dashboard aggregation tables (migration 107) - DashboardStats: add TotalAccountCost/TodayAccountCost fields - ModelStat/GroupStat: add AccountCost field with SQL aggregation - GetStatsWithFilters: always return TotalAccountCost (remove accountID filter) - Dashboard Token cards: show user(green)/cost(orange)/standard(gray) - Usage stats card: show account cost and standard below main value - Model/Group distribution tables: add orange cost column
-
erio authored
Replace dead EventSource variable with AbortController to enable cancelling fetch streams. Remove close-button disable during connecting status so users can dismiss the dialog at any time.
-
- 14 Apr, 2026 15 commits
-
-
erio authored
-
erio authored
Product name (e.g. "快代码科技工作室 100 元") should show the user's original recharge amount (limitAmount), not the fee-inclusive pay amount. The gateway receives payAmount separately for actual charging.
-
erio authored
-
erio authored
- Fix gofmt alignment in setting_handler.go, settings.go, payment_config_service.go - Add payment_balance_recharge_multiplier and payment_recharge_fee_rate to API contract test expected JSON
-
erio authored
- Show base amount (充值金额) as first line - Show fee amount with percentage when fee_rate > 0 - Show pay_amount (实付金额) in bold primary color - Show credited amount (到账金额) when different from pay_amount - Compute baseAmount and feeAmount from backend order data
-
erio authored
Backend: - Validate recharge_fee_rate: 0 ≤ rate ≤ 100, max 2 decimal places Frontend settings: - Add % suffix icon to fee rate input - Enforce max=100, min=0, step=0.01 with 2 decimal precision
-
erio authored
Backend: - Use cfg.RechargeFeeRate in order creation instead of hardcoded 0 - Remove dead getFeeRate stub method - All amounts computed server-side: order_amount, pay_amount, fee_rate Frontend - PaymentView: - Read recharge_fee_rate from checkout-info API (not per-method) - Show fee breakdown only when fee_rate > 0 - Show credited amount only when multiplier ≠ 1 Frontend - Order display (user + admin): - Fix fee_rate * 100 bug (fee_rate is already a percentage) - OrderTable: show pay_amount as primary, fee/credited as sub-lines - AdminOrderDetail: full breakdown (base/fee/paid/credited) - AdminRefundDialog: label "到账金额" for clarity - PaymentResultView: show pay_amount with fee info Types + i18n: - Add recharge_fee_rate to CheckoutInfoResponse - Add fee_rate to CreateOrderResult - Add translations: creditedAmount, fee, baseAmount, includedInPayAmount
-
erio authored
- Add recharge_fee_rate system setting (percentage fee on top of recharge amount) - Full backend chain: config constant, PaymentConfig struct, update validation, read/write persistence, DTO, handler GET/PUT responses - Frontend: settings input with preview, i18n (zh/en), API types - Fix provider card toggle layout: labels above switches to save width - Fix Chinese translation: "EasyPay" → "易支付" in provider description
-
erio authored
- Add balance_recharge_multiplier system setting (e.g. 1.2 = charge 100 get 120) - Separate order_amount (credited balance) from pay_amount (actual payment) - Refund calculates gateway amount proportionally from pay_amount - Frontend shows both amounts in order details, payment status, refund dialog - Admin settings UI for configuring recharge multiplier
-
Wesley Liddick authored
fix(sidebar): prevent version dropdown clipping in expanded brand
-
Wesley Liddick authored
feat: web search emulation, balance/quota notify, account stats pricing, per-provider refund control, Stripe fix / Web 搜索模拟、余额配额通知、渠道统计计费、按服务商退款控制、Stripe 修复
-
erio authored
- Refactor OpenAI Messages() routing: pre-compute dispatch model using resolveOpenAIMessagesDispatchMappedModel + NormalizeOpenAICompatRequestedModel instead of try-fail-retry pattern with gin context passing - Remove openai_messages_fallback_model context anti-pattern - Use effectiveMappedModel directly for forward default mapped model - Add 3 subscription group tests covering all branch paths: _Blocked (no active subscription → SUBSCRIPTION_REQUIRED), _RequiresRepo (nil repo → SUBSCRIPTION_REPOSITORY_UNAVAILABLE), _AllowsActiveSubscription (valid subscription → success)
-
erio authored
wire_gen.go was calling NewSchedulerCache(redisClient) but wire.go had been updated to register ProvideSchedulerCache(redisClient, config), which reads SnapshotMGetChunkSize and SnapshotWriteChunkSize from config. Without this fix, those config values were silently ignored.
-
erio authored
- Fix flaky WebSocket passthrough test: allow StatusNormalClosure after client close instead of requiring NoError (race condition fix) - Fix ratelimit 401 test: use PlatformOpenAI instead of PlatformGemini for OAuth token cache invalidation scenario (more accurate) - Add usageLoadQueue: Anthropic OAuth/setup-token accounts sharing the same proxy exit are serialized with 1-2s jitter to prevent upstream 429 - AccountUsageCell: add module-level usage cache (5min TTL), unmounted safety guard, and integrate enqueueUsageRequest for throttled fetching
-
erio authored
Replace dialog-based payment with inline state flow (select → paying/stripe). - PaymentStatusPanel replaces QR dialog for scan-to-pay - StripePaymentInline replaces Stripe popup - Subscription confirm as inline card instead of modal - Payment button color follows payment method - Renewal modal with URL parameter navigation (?tab=subscription&group=123) - Mobile auto-redirect for H5 payment - AmountInput uses global min/max instead of per-method - Tab auto-hides during payment - Restore CNY (¥) currency for upstream compatibility
-