Wesley Liddick
ad6c328135
Merge pull request #1575 from shuanbao0/fix/cursor-responses-body-compat
...
fix(gateway): 兼容 Cursor /v1/chat/completions 的 Responses API body
2026-04-13 22:02:44 +08:00
Wesley Liddick
7d80b5ad28
Merge pull request #1610 from touwaeriol/fix/alipay-wxpay-type-mapping
...
fix(payment): register Alipay/Wxpay providers for base payment types
2026-04-13 21:44:19 +08:00
sakurawztlt
a1e299a355
fix: Anthropic 非流式路径在上游终态事件 output 为空时从 delta 事件重建响应内容
...
b2e379cf 引入的 BufferedResponseAccumulator 已修复了 chat_completions
非流式路径和 responses OAuth 非流式路径,但遗漏了 Anthropic /v1/messages
非流式路径 (handleAnthropicBufferedStreamingResponse)。
当客户端请求 stream=false 且模型开启思考时,上游 response.completed
终态事件的 output 字段可能为空,实际 message 内容通过
response.output_text.delta 增量事件下发。旧代码只读终态事件的 Response,
导致客户端收到的 content 字段为空 ([{"type":"text"}])。
本 commit 将 b2e379cf 的相同修复模式镜像到 Anthropic 路径:在 SSE 扫描
过程中用 BufferedResponseAccumulator 累积 delta 内容,终态 output 为空
时通过 SupplementResponseOutput 补充重建。
同时修复 handleAnthropicBufferedStreamingResponse 遗漏 response.done
事件类型的问题,与 chat completions 路径保持一致,避免上游发送
response.done 时 handler 认不出终态事件、最终返回 502 的潜在问题。
BufferedResponseAccumulator 已在 chatcompletions_responses_test.go 有
完整单元测试覆盖(TextOnly/ToolCalls/Reasoning/Mixed/SupplementEmpty/
NoSupplementWhenOutputExists/EmptyDeltas/IgnoresNonFunctionCallItems),
本次复用相同累加器无需新增测试。
2026-04-13 18:51:49 +08:00
erio
f498eb8fde
fix(payment): fix Alipay/Wxpay direct provider type mapping and enable cross-provider load balancing
...
Two issues fixed:
1. Alipay.SupportedTypes() returned ["alipay_direct"] and Wxpay returned
["wxpay_direct"], but the frontend sends payment_type="alipay"/"wxpay".
The registry lookup failed with "payment method (alipay) is not
configured". Fix: return the base types ["alipay"]/["wxpay"].
2. When multiple providers support the same payment type (e.g. EasyPay
and Alipay direct both handle "alipay"), only the last-registered
provider's instances were reachable — the registry mapped one type to
one provider key, and SelectInstance queried by that single key.
Fix: bypass the registry in invokeProvider and let SelectInstance
query across all providers when providerKey is empty. The selected
instance's own ProviderKey (now included in InstanceSelection) is
used to create the correct provider, enabling true cross-provider
load balancing.
Closes #1592
2026-04-13 14:07:12 +08:00
github-actions[bot]
ad64190bec
chore: sync VERSION to 0.1.111 [skip ci]
2026-04-12 10:17:16 +00:00
bot
cb016ad861
fix: handle Anthropic credit balance exhausted (400) as account error
...
When an Anthropic API key's credit balance is depleted, the upstream
returns HTTP 400 with message containing "credit balance". Previously,
the 400 handler only checked for "organization has been disabled",
so credit-exhausted accounts kept being scheduled — every request
returned the same error.
Treat this case identically to 402 (Payment Required): call
handleAuthError → SetError to stop scheduling the account until
an admin manually recovers it after topping up credits.
Closes #1586
2026-04-12 13:30:15 +08:00
shuanbao0
422e25c99f
fix(gateway): 剥离 Cursor raw body 透传路径中 Codex 不支持的 Responses API 参数
...
在前一个 commit 的 isResponsesShape 短路路径基础上,补充对 Cursor 云端
带过来的、Codex 上游统一不支持的顶层 Responses API 参数的剥离:
- prompt_cache_retention
- safety_identifier
- metadata
- stream_options
根因补充:这条 raw-body 透传路径为了保留 Cursor 的 input 数组整体结构,
不再经过 ChatCompletionsRequest 的反序列化过滤,所以这些 Go 结构体里
没有对应字段的参数会被原样发到上游,上游返回:
Unsupported parameter: <field>
常规 Chat Completions 转换路径天然通过 ChatCompletionsRequest 丢弃未知字段,
不受影响;此处仅在 isResponsesShape 分支内用 sjson.DeleteBytes 显式过滤,
作用域最小。剥离列表与 openai_gateway_service.go:2034 的
unsupportedFields 语义对齐。
另外在 applyCodexOAuthTransform 的 OAuth 兜底 strip 列表里同步追加
prompt_cache_retention,作为对该函数所有其他 OAuth 调用点的 defense
in depth(当前只有 Cursor 路径的短路已在前面剥过,但保留这一层更稳)。
测试:
- TestCursorMixedShape_StripsUnsupportedFields — 验证所有 4 个字段都被剥
- TestApplyCodexOAuthTransform_StripsPromptCacheRetention — OAuth 兜底路径
Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com >
2026-04-11 22:48:45 +08:00
shuanbao0
b7edc3ed82
fix(gateway): 兼容 Cursor /v1/chat/completions 的 Responses API body
...
Cursor 云端 (User-Agent: Go-http-client/2.0) 发往 /v1/chat/completions 的
body 使用 Responses API 格式:
{"model":"gpt-5.4","input":[{"role":"system","content":"..."}],"stream":true}
原代码用 ChatCompletionsRequest 反序列化,该结构体没有 Input 字段,
Cursor 的 input 数组被静默丢弃,ChatCompletionsToResponses 转换后产出
input: null,Codex 上游以 "Invalid type for 'input': expected a string,
but got an object" 拒绝请求(上游 typeof null === 'object')。
修复:在 ForwardAsChatCompletions 里用 gjson 检测 body shape,当 input
存在且 messages 缺失时,跳过 Chat→Responses 转换,用 sjson 仅改写 model
字段后原样透传 body。billing 所需的 ServiceTier 和 Reasoning.Effort 通过
gjson 从 raw body 提取,下游 codex OAuth transform 路径保持不变。
测试:新增 openai_cursor_warmup_pipeline_test.go,覆盖 5 个 shape 检测
用例(正向/标准请求不误伤/两字段共存/空 body/JSON 回读)。
Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com >
2026-04-11 20:22:18 +08:00
erio
fa833f7684
Merge remote-tracking branch 'upstream/main' into feat/payment-system-v2
...
# Conflicts:
# frontend/src/api/admin/settings.ts
# frontend/src/stores/app.ts
# frontend/src/types/index.ts
# frontend/src/views/admin/SettingsView.vue
2026-04-11 18:25:06 +08:00
erio
d67ecf893d
chore: remove all sora dead code and fork-specific sora_client_enabled
...
Upstream removed sora feature (090_drop_sora.sql) but left i18n keys
and wire.go references. Clean up:
- Remove entire sora i18n block from en.ts and zh.ts (~190 lines)
- Remove sora nav key and unused 'data' settings tab key
- Remove sora_client_enabled from settings (fork-specific)
- Remove SoraMediaCleanupService from wire.go
2026-04-11 18:15:24 +08:00
erio
7515590324
feat(payment): add H5/mobile payment support
...
Backend:
- Parse EasyPay `payurl2` field, prefer H5 link on mobile
- Add `device=mobile` to EasyPay submit.php (popup) mode
- Expand isMobile detection keywords (add ipad/ipod)
Frontend:
- Add `isMobileDevice()` utility (userAgentData + UA regex)
- Mobile + pay_url: direct redirect instead of QR/popup
- Popup blocked fallback: auto-redirect when window.open fails
- Stripe WeChat Pay: dynamic client param (mobile_web vs web)
2026-04-11 13:16:35 +08:00
erio
e3a000e0d4
refactor(payment): code standards fixes and regression repairs
...
Backend:
- Split payment_order.go (546→314 lines) into payment_order_lifecycle.go
- Replace magic strings with constants in factory, easypay, webhook handler
- Add rate limit/validity unit constants in payment_order_lifecycle, payment_service
- Fix critical regression: add PaymentEnabled to GetPublicSettings response
- Add missing migration 099_fix_migrated_purchase_menu_label_icon.sql
Frontend:
- Fix StripePopupView.vue: replace `as any` with typed interface, use extractApiErrorMessage
- Fix AdminOrderTable.vue: replace hardcoded column labels with i18n t() calls
- Fix SubscriptionsView.vue: replace hardcoded Today/Tomorrow with i18n
- Extract duplicate statusBadgeClass/canRefund/formatOrderDateTime to orderUtils.ts
- Add missing i18n keys: common.today, common.tomorrow, payment.orders.orderType/actions
- Remove dead PurchaseSubscriptionView.vue (replaced by PaymentView)
2026-04-11 13:16:35 +08:00
erio
e1547d7835
fix(payment): resolve PR audit issues
...
- Add payment navigation to AppSidebar (user orders + admin payment menu group with collapse)
- Add 5 missing nav i18n keys (myOrders, orderManagement, paymentDashboard, paymentConfig, paymentPlans)
- Renumber payment migrations 090-100 → 092-102 to avoid conflict with upstream 090/091
- Remove non-payment sora_client_enabled change, restore upstream purchase_subscription fields
- Remove extra 'data' from SettingsTab type union
2026-04-11 13:16:35 +08:00
erio
63d1860dc0
feat(payment): add complete payment system with multi-provider support
...
Add a full payment and subscription system supporting EasyPay (Alipay/WeChat),
Stripe, and direct Alipay/WeChat Pay providers with multi-instance load balancing.
2026-04-11 13:16:35 +08:00
IanShaw027
f480e57344
fix: align table defaults and preserve sidebar svg colors
2026-04-10 18:27:53 +08:00
IanShaw027
7dc7ff22d2
fix: preserve messages dispatch config in repository hydration
2026-04-10 18:13:18 +08:00
IanShaw027
67a05dfccd
fix: honor table defaults and preserve dispatch mappings
2026-04-10 17:55:37 +08:00
IanShaw027
1312405966
fix(settings): 补齐公开设置中的表格分页字段返回
2026-04-10 09:18:48 +08:00
IanShaw027
269c7a065c
fix(test): restore integration expectations
2026-04-09 22:08:42 +08:00
IanShaw027
b6946e78a2
fix(lint): restore repository sort helpers
2026-04-09 21:49:10 +08:00
IanShaw027
2b70d1d332
merge upstream main into fix/bug-cleanup-main
2026-04-09 21:35:48 +08:00
IanShaw027
b37afd68ec
fix(lint): format setting service
2026-04-09 21:31:48 +08:00
Wesley Liddick
00c08c574e
Merge pull request #1539 from warksu/fix/loadfactor-not-synced-to-scheduler-cache
...
fix: 同步 LoadFactor 到调度快照缓存
2026-04-09 21:15:40 +08:00
Wesley Liddick
bbc79796dc
Merge pull request #1529 from IanShaw027/feat/group-messages-dispatch-redo
...
feat: 为openai分组增加messages调度模型映射并支持instructions模板注入
2026-04-09 21:14:38 +08:00
Wesley Liddick
760cc7d6be
Merge pull request #1481 from alfadb/fix/increase-error-log-body-limit
...
fix(ops): 将错误日志请求体存储限制从 10KB 提升至 256KB
2026-04-09 21:14:13 +08:00
Wesley Liddick
9a72025afb
Merge pull request #1523 from octo-patch/fix/issue-1519-home-content-csp-frame-src
...
fix: include home_content URL in CSP frame-src origins
2026-04-09 21:13:46 +08:00
Wesley Liddick
74302f60ab
Merge pull request #1010 from Glorhop/pr/oidc-login
...
feat(auth): support OIDC login and prefer IdP real email on sign-in
2026-04-09 21:13:22 +08:00
IanShaw027
62962c05f1
fix(lint): 修复 CI 中的 ineffassign 和 unused 代码告警,修正 group 排序集成测试兼容性
2026-04-09 19:25:08 +08:00
swark2006
118ff85fbf
fix: 同步 LoadFactor 到调度快照缓存
...
LoadFactor 字段在构建调度快照缓存时缺失,导致调度算法
EffectiveLoadFactor() 无法使用配置的负载因子,回退到 Concurrency。
这会影响账号的负载率计算,进而影响调度优先级。
修复:在 buildSchedulerMetadataAccount 中添加 LoadFactor 字段。
2026-04-09 18:50:11 +08:00
IanShaw027
5f8e60a1b7
feat(table): 表格排序与搜索改为后端处理
2026-04-09 18:14:28 +08:00
IanShaw027
66e15a54a4
fix(export): 导出逻辑与当前筛选条件对齐
2026-04-09 18:14:28 +08:00
IanShaw027
ad80606a44
feat(settings): 增加全局表格分页配置,支持自定义
2026-04-09 18:14:28 +08:00
alfadb
6401dd7cc7
fix(ops): increase error log request body limit from 10KB to 256KB
...
10KB is too aggressive for modern LLM API requests where conversation
context routinely exceeds 1MB. This causes error logs to contain only
a minimal placeholder, making it impossible to debug upstream failures.
256KB retains enough context for effective debugging while the existing
multi-pass trimming logic handles larger payloads gracefully.
Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com >
2026-04-09 17:49:02 +08:00
IanShaw027
7d008bd5b6
fix(test): 修正 admin service 分组测试平台字段赋值
2026-04-09 12:42:37 +08:00
IanShaw027
66ff2def8c
fix(test): 补充 admin service 分组测试字符串指针辅助函数
2026-04-09 12:39:05 +08:00
IanShaw027
4de4823a65
feat(openai): 支持messages模型映射与instructions模板注入
2026-04-09 12:29:49 +08:00
IanShaw027
23c4d592f8
feat(group): 增加messages调度模型映射配置
2026-04-09 12:29:28 +08:00
Glorhop
311f06745a
chore: clean up deprecated Sora settings after rebase
2026-04-09 03:06:53 +00:00
Glorhop
8e1a7bdfff
fix: fixed an issue where OIDC login consistently used a synthetic email address
2026-04-09 02:20:51 +00:00
ruiqurm
02a66a01c3
feat: support OIDC login.
2026-04-09 02:20:51 +00:00
octo-patch
ce833d91ce
fix: include home_content URL in CSP frame-src origins ( fixes #1519 )
2026-04-09 09:47:27 +08:00
ius
265687b56d
fix: 优化调度快照缓存以避免 Redis 大 MGET
2026-04-08 10:39:15 -07:00
github-actions[bot]
0d69c0cd64
chore: sync VERSION to 0.1.110 [skip ci]
2026-04-08 08:41:32 +00:00
shaw
b982076e52
fix: resolve errcheck lint and add missing enable_cch_signing to test
...
- Suppress errcheck for xxhash Digest.Write (never returns error)
- Add enable_cch_signing field to settings API contract test
2026-04-08 16:23:02 +08:00
shaw
7060596a30
fix: bump Go from 1.26.1 to 1.26.2 to resolve 6 stdlib CVEs
...
Fixes GO-2026-4947, GO-2026-4946, GO-2026-4870, GO-2026-4869,
GO-2026-4866, GO-2026-4865 in crypto/x509, crypto/tls, archive/tar,
and html/template.
2026-04-08 16:17:15 +08:00
shaw
e51c9e50b5
feat: sync billing header cc_version with User-Agent and add opt-in CCH signing
...
- Sync cc_version in x-anthropic-billing-header with the fingerprint
User-Agent version, preserving the message-derived suffix
- Implement xxHash64-based CCH signing to replace the cch=00000
placeholder with a computed hash
- Add admin toggle (enable_cch_signing) under gateway forwarding settings,
disabled by default
2026-04-08 16:11:19 +08:00
Wesley Liddick
5088e91566
Merge pull request #1417 from YanzheL/fix/openai-empty-base64-image-payloads
...
fix: sanitize empty base64 image payloads for OpenAI requests
2026-04-08 14:20:38 +08:00
Wesley Liddick
276f499c82
Merge pull request #1418 from YanzheL/fix/1161-gemini-google-search-grounding
...
fix(gemini): preserve google search grounding tools
2026-04-08 14:19:57 +08:00
Wesley Liddick
5c203ce6c6
Merge pull request #1428 from YanzheL/fix/openai-gateway-content-session-hash-fallback
...
fix(gateway): add content-based session hash fallback for non-Codex clients
2026-04-08 14:17:49 +08:00
Wesley Liddick
47cd1c5286
Merge pull request #1467 from touwaeriol/refactor/channel-service-cleanup
...
refactor(channel): split long functions, extract shared validation, move billing validation to service
2026-04-08 14:16:28 +08:00