5646 Commits

Author SHA1 Message Date
Calcium-Ion
ec8f3dceaa
Merge pull request #4412 from xyfacai/fix/image-n
fix(image): only price image model use N ratio
2026-04-24 14:01:56 +08:00
Xyfacai
69ba18d392 fix(image): only price image model use N ratio 2026-04-24 01:24:14 +08:00
Calcium-Ion
65b1654732
Merge pull request #4409 from QuantumNous/nightly
feat: support for tiered billing expressions in the billing system
2026-04-24 00:34:52 +08:00
CaIon
eab478bdc8
fix: miscellaneous quick fixes from CodeRabbit review
- log_info_generate.go: add nil guard in InjectTieredBillingInfo
- billing_expr_request.go: merge headers instead of replacing
- go.mod: remove incorrect // indirect on expr-lang/expr
- ToolPriceSettings.jsx: add null check in syncToVisual
- tool_billing.go: fix PricePer1K for image_generation (per-call, not per-1K)
- utils.jsx: add minute() to time condition regex
- useUsageLogsData.jsx: pass displayMode to renderTieredModelPrice
- AGENTS.md, CLAUDE.md: fix Rule 6/7 ordering
- relay-gemini.go: add TEXT modality case in CandidatesTokensDetails
2026-04-24 00:34:06 +08:00
CaIon
3e5f2ee1d6
fix(billing): correct tiered billing settlement and edge cases
- quota.go: add missing SettleBilling call in PostWssConsumeQuota
- text_quota.go: gate InjectTieredBillingInfo on tieredBillingApplied bool
  instead of tieredResult != nil, so fallback billing still logs metadata
- price.go: remove quotaBeforeGroup == 0 from freeModel condition to avoid
  bypassing settlement for output-only expressions
- tiered_settle.go: split cc/cc1h subtraction using UsageSemantic to
  distinguish OpenAI vs Claude cache creation token formats
- pricing.go: only set BillingMode when a non-empty expression exists
- useModelPricingEditorState.js: only write billing_mode when
  finalBillingExpr is non-empty
2026-04-24 00:33:54 +08:00
CaIon
8eeae00737
fix: resolve runtime crashes in render.jsx and TieredPricingEditor.jsx
- render.jsx: change const destructuring of completionRatio/audioRatio to
  use raw names with ?? 0 defaults, preventing "Assignment to constant
  variable" errors in renderModelPrice, renderAudioModelPrice, and
  renderClaudeModelPrice
- TieredPricingEditor.jsx: add missing MATCH_GTE import, remove misleading
  alias help text, preserve conditions for single-tier configs
2026-04-24 00:33:41 +08:00
CaIon
6bde1a9c8d
Merge origin/main into nightly
Resolve conflicts:
- .gitignore: keep nightly additions (.test, skills-lock.json)
- relay/helper/price.go: keep both billingexpr and model imports
- en.json / zh-CN.json: keep nightly's superset of i18n entries
- service/billing_session.go: add missing 3rd arg to DecreaseUserQuota
- en.json / zh-CN.json: deduplicate 129+320 duplicate i18n keys
2026-04-23 21:37:03 +08:00
Calcium-Ion
55b7e485c1
Merge pull request #4162 from yyhhyyyyyy/fix/tiered-text-tool-surcharge
fix(billing): preserve text tool surcharges in tiered settlement
2026-04-23 19:01:13 +08:00
CaIon
5c4ed5be99
fix(billing): use tieredQuota fallback in composeTieredTextQuota error path
Remove the intermediate branch that recomputed quota from
EstimatedQuotaBeforeGroup when tieredResult is nil. This discarded the
FinalPreConsumedQuota fallback that TryTieredSettle already selected.
Now the error path simply adds tool surcharges to the passed-in
tieredQuota, preserving the existing fallback semantics.

Also removes unrelated mise.toml and adds a test covering the error
fallback with a pre-consumed quota that differs from the estimate.
2026-04-23 18:59:48 +08:00
Calcium-Ion
11f8d42d66
Merge pull request #4401 from XiaoAI1024/codex/legacy-token-key-compat
Relax token key column length for legacy migration compatibility
2026-04-23 13:32:45 +08:00
XiaoAI1024
49474520ec
Protect external token migration tests 2026-04-23 13:29:00 +08:00
XiaoAI1024
0feb6f2c3c
Add cross-database token migration tests 2026-04-23 13:29:00 +08:00
XiaoAI1024
81ddf6e722
Add legacy token migration test 2026-04-23 13:29:00 +08:00
XiaoAI1024
2431efc01f
Support longer legacy token keys 2026-04-23 13:29:00 +08:00
Calcium-Ion
01c2e909a0
Merge pull request #4399 from QuantumNous/dependabot/npm_and_yarn/electron/xmldom/xmldom-0.8.13
chore(deps-dev): bump @xmldom/xmldom from 0.8.12 to 0.8.13 in /electron
2026-04-23 12:43:28 +08:00
Calcium-Ion
e2e479c11d
Merge pull request #4397 from QuantumNous/dependabot/go_modules/github.com/jackc/pgx/v5-5.9.2
chore(deps): bump github.com/jackc/pgx/v5 from 5.9.0 to 5.9.2
2026-04-23 12:43:16 +08:00
dependabot[bot]
346de02683
chore(deps-dev): bump @xmldom/xmldom from 0.8.12 to 0.8.13 in /electron
Bumps [@xmldom/xmldom](https://github.com/xmldom/xmldom) from 0.8.12 to 0.8.13.
- [Release notes](https://github.com/xmldom/xmldom/releases)
- [Changelog](https://github.com/xmldom/xmldom/blob/master/CHANGELOG.md)
- [Commits](https://github.com/xmldom/xmldom/compare/0.8.12...0.8.13)

---
updated-dependencies:
- dependency-name: "@xmldom/xmldom"
  dependency-version: 0.8.13
  dependency-type: indirect
...

Signed-off-by: dependabot[bot] <support@github.com>
2026-04-23 02:02:02 +00:00
dependabot[bot]
6c69d60fbb
chore(deps): bump github.com/jackc/pgx/v5 from 5.9.0 to 5.9.2
Bumps [github.com/jackc/pgx/v5](https://github.com/jackc/pgx) from 5.9.0 to 5.9.2.
- [Changelog](https://github.com/jackc/pgx/blob/master/CHANGELOG.md)
- [Commits](https://github.com/jackc/pgx/compare/v5.9.0...v5.9.2)

---
updated-dependencies:
- dependency-name: github.com/jackc/pgx/v5
  dependency-version: 5.9.2
  dependency-type: indirect
...

Signed-off-by: dependabot[bot] <support@github.com>
2026-04-23 00:44:49 +00:00
Calcium-Ion
3afa439b5c
Merge pull request #4372 from feitianbubu/pr/723d3fea3a4c9092187f745fa8ac4a5e9ef1dc35
增加令牌最后使用时间
2026-04-23 00:34:31 +08:00
Calcium-Ion
2d4bdd297b
Show user ID in admin topup bills (#4349) 2026-04-23 00:33:38 +08:00
Seefs
1d83b5472a
fix: require proper verification for passkey changes (#4393)
Some checks failed
Publish Docker image (Multi Registries, native amd64+arm64) / Build & push (amd64) [native] (push) Has been cancelled
Publish Docker image (Multi Registries, native amd64+arm64) / Build & push (arm64) [native] (push) Has been cancelled
Publish Docker image (Multi Registries, native amd64+arm64) / Create multi-arch manifests (Docker Hub) (push) Has been cancelled
Build Electron App / build (windows-latest) (push) Has been cancelled
Build Electron App / release (push) Has been cancelled
Release (Linux, macOS, Windows) / Linux Release (push) Has been cancelled
Release (Linux, macOS, Windows) / macOS Release (push) Has been cancelled
Release (Linux, macOS, Windows) / Windows Release (push) Has been cancelled
v0.12.15
2026-04-22 22:55:06 +08:00
Seefs
e729b22197
fix: refresh codex credentials for auto-disabled channels (#4324) 2026-04-22 22:54:52 +08:00
Seefs
5f67d2a28b
fix: use stream for codex auto test (#4325) 2026-04-22 22:54:41 +08:00
Seefs
d586a567e4
chore: refine codex usage modal layout (#4386)
* chore: refine codex usage modal layout

* fix: polish codex usage modal responsiveness
2026-04-22 22:54:28 +08:00
gaoren002
6afaa58d28
fix(topup): import missing Tag in recharge card (#4388) 2026-04-22 22:22:09 +08:00
feitianbubu
b60bc94f9c
feat: show last used time column in tokens table 2026-04-21 17:20:26 +08:00
uskyu
600ae85998
Show user ID in admin topup bills 2026-04-20 00:14:19 +08:00
Seefs
f995a868e4
Merge pull request #4089 from seefs001/feature/waffo-pay
rafactor: payment
2026-04-18 14:22:54 +08:00
Seefs
5b9dcf1bda
Merge pull request #4311 from KoellM/fix-gemini-3-toolconfig
fix(gemini): add IncludeServerSideToolInvocations field to ToolConfig
2026-04-18 01:13:48 +08:00
CaIon
d75a046791
chore(docker-compose): set default redis password
Enable Redis requirepass in the compose template and embed the matching
credential in REDIS_CONN_STRING, aligning with the existing PostgreSQL
default password pattern so out-of-the-box deployments are not left with
an unauthenticated Redis instance.
2026-04-18 00:56:07 +08:00
CaIon
209645e26b
feat(topup-log): add NODE_NAME env var for audit logs
Introduce NODE_NAME environment variable to identify node identity in top-up
audit logs, improving readability over auto-detected container internal IPs
in Docker/K8s deployments. Surface node_name in admin expanded log rows and
add it as a commented example to docker-compose.yml.
2026-04-18 00:51:04 +08:00
CaIon
6ff8c7ab03
fix(topup-log): keep row expandable and warn admins on legacy logs
Some checks failed
Publish Docker image (Multi Registries, native amd64+arm64) / Build & push (amd64) [native] (push) Has been cancelled
Publish Docker image (Multi Registries, native amd64+arm64) / Build & push (arm64) [native] (push) Has been cancelled
Publish Docker image (Multi Registries, native amd64+arm64) / Create multi-arch manifests (Docker Hub) (push) Has been cancelled
Build Electron App / build (windows-latest) (push) Has been cancelled
Build Electron App / release (push) Has been cancelled
Release (Linux, macOS, Windows) / Linux Release (push) Has been cancelled
Release (Linux, macOS, Windows) / macOS Release (push) Has been cancelled
Release (Linux, macOS, Windows) / Windows Release (push) Has been cancelled
Top-up logs written by pre-upgrade instances have no admin_info, which
made the expanded row empty and the row un-expandable. For admins, always
emit an entry: either the audit fields from admin_info when present, or a
warning prompting the operator to upgrade the instance so audit fields
(server IP, callback IP, payment method, system version) are recorded.
v0.12.14
2026-04-18 00:36:05 +08:00
CaIon
c31343ac76
fix(log): hide admin identity in user-visible management logs
Admin username/ID was embedded directly into the log Content for
quota changes and forced 2FA disable, leaking the operator's
identity to the target user via their own usage log page.

Move operator info into Other.admin_info so formatUserLogs strips
it for non-admin viewers, and render it in the expand panel only
for admins as "操作管理员".

Closes #4301
2026-04-18 00:16:52 +08:00
CaIon
b2e62a44ee
fix(topup): harden top-up search against DoS and cap user queries to 30 days
Some checks failed
Publish Docker image (Multi Registries, native amd64+arm64) / Build & push (amd64) [native] (push) Has been cancelled
Publish Docker image (Multi Registries, native amd64+arm64) / Build & push (arm64) [native] (push) Has been cancelled
Publish Docker image (Multi Registries, native amd64+arm64) / Create multi-arch manifests (Docker Hub) (push) Has been cancelled
Build Electron App / build (windows-latest) (push) Has been cancelled
Build Electron App / release (push) Has been cancelled
Release (Linux, macOS, Windows) / Linux Release (push) Has been cancelled
Release (Linux, macOS, Windows) / macOS Release (push) Has been cancelled
Release (Linux, macOS, Windows) / Windows Release (push) Has been cancelled
Apply the same LIKE sanitization used for token search to SearchUserTopUps
and SearchAllTopUps (reject %%, cap % count, require >=2 stripped chars,
use ESCAPE '!') and bound COUNT with a 10000-row hard limit to avoid
unbounded full-table scans.

Also restrict user-facing list and search (GetUserTopUps, SearchUserTopUps)
to records within the last 30 days via create_time. Admin endpoints
(GetAllTopUps, SearchAllTopUps) remain unrestricted.
v0.12.13
2026-04-18 00:01:03 +08:00
CaIon
9253426223
fix(user): invalidate user and token caches when disabling user
When an admin disables/deletes/promotes/demotes a user via ManageUser,
explicitly evict the user cache and all of the user's token caches from
Redis. This prevents a disabled user from continuing to make successful
API requests until the user cache TTL expires, and ensures subsequent
requests reload fresh status from the database.
2026-04-17 23:58:45 +08:00
CaIon
209d90e861
feat(topup): add admin-only audit info to top-up logs
Thread caller IP from webhook/admin controllers through model recharge
functions and record a new RecordTopupLog entry with admin_info (server
IP, caller IP, order payment method, callback payment method, system
version). Frontend shows these fields in the expanded log row and the
IP column for admins on top-up logs, while non-admins continue to see
admin_info stripped by formatUserLogs.
2026-04-17 23:51:30 +08:00
CaIon
e2807c5f95
feat: enhance SSRF protection 2026-04-17 23:46:28 +08:00
KoellM
45cc95a25c
fix(gemini): add IncludeServerSideToolInvocations field to ToolConfig 2026-04-17 20:39:47 +08:00
Calcium-Ion
283474020d
chore(deps): bump github.com/jackc/pgx/v5 from 5.7.1 to 5.9.0 (#4294)
Some checks failed
Publish Docker image (Multi Registries, native amd64+arm64) / Build & push (amd64) [native] (push) Has been cancelled
Publish Docker image (Multi Registries, native amd64+arm64) / Build & push (arm64) [native] (push) Has been cancelled
Publish Docker image (Multi Registries, native amd64+arm64) / Create multi-arch manifests (Docker Hub) (push) Has been cancelled
Build Electron App / build (windows-latest) (push) Has been cancelled
Build Electron App / release (push) Has been cancelled
Release (Linux, macOS, Windows) / Linux Release (push) Has been cancelled
Release (Linux, macOS, Windows) / macOS Release (push) Has been cancelled
Release (Linux, macOS, Windows) / Windows Release (push) Has been cancelled
Bumps [github.com/jackc/pgx/v5](https://github.com/jackc/pgx) from 5.7.1 to 5.9.0.
- [Changelog](https://github.com/jackc/pgx/blob/master/CHANGELOG.md)
- [Commits](https://github.com/jackc/pgx/compare/v5.7.1...v5.9.0)

---
updated-dependencies:
- dependency-name: github.com/jackc/pgx/v5
  dependency-version: 5.9.0
  dependency-type: indirect
...

Signed-off-by: dependabot[bot] <support@github.com>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
v0.12.12
2026-04-17 13:53:20 +08:00
papersnake
47d7bca268
feat: support claude-opus-4-7 (#4293)
* feat: support claude-opus-4-7

* feat: summarized display for opus 4.7
2026-04-17 13:52:34 +08:00
dependabot[bot]
dd57eeb514
chore(deps): bump github.com/jackc/pgx/v5 from 5.7.1 to 5.9.0
Bumps [github.com/jackc/pgx/v5](https://github.com/jackc/pgx) from 5.7.1 to 5.9.0.
- [Changelog](https://github.com/jackc/pgx/blob/master/CHANGELOG.md)
- [Commits](https://github.com/jackc/pgx/compare/v5.7.1...v5.9.0)

---
updated-dependencies:
- dependency-name: github.com/jackc/pgx/v5
  dependency-version: 5.9.0
  dependency-type: indirect
...

Signed-off-by: dependabot[bot] <support@github.com>
2026-04-16 22:45:12 +00:00
CaIon
22e509c1ef
refactor: simplify ShouldDisableChannel function by removing unused parameters and commented-out code 2026-04-16 20:56:44 +08:00
CaIon
3cad6b9d7f
fix(claude): improve handling of empty string content in OpenAI to Claude message conversion
Some checks failed
Publish Docker image (Multi Registries, native amd64+arm64) / Build & push (amd64) [native] (push) Has been cancelled
Publish Docker image (Multi Registries, native amd64+arm64) / Build & push (arm64) [native] (push) Has been cancelled
Publish Docker image (Multi Registries, native amd64+arm64) / Create multi-arch manifests (Docker Hub) (push) Has been cancelled
Build Electron App / build (windows-latest) (push) Has been cancelled
Build Electron App / release (push) Has been cancelled
Release (Linux, macOS, Windows) / Linux Release (push) Has been cancelled
Release (Linux, macOS, Windows) / macOS Release (push) Has been cancelled
Release (Linux, macOS, Windows) / Windows Release (push) Has been cancelled
v0.12.11
2026-04-16 17:44:38 +08:00
CaIon
8aaec8b1cc
feat: add PaymentMethod field to TopUp model and enhance payment method validation in topup controllers 2026-04-15 21:17:49 +08:00
CaIon
b2a40d3381
feat: enhance Stripe webhook handling for async payment events
Some checks failed
Publish Docker image (Multi Registries, native amd64+arm64) / Build & push (amd64) [native] (push) Has been cancelled
Publish Docker image (Multi Registries, native amd64+arm64) / Build & push (arm64) [native] (push) Has been cancelled
Publish Docker image (Multi Registries, native amd64+arm64) / Create multi-arch manifests (Docker Hub) (push) Has been cancelled
Build Electron App / build (windows-latest) (push) Has been cancelled
Build Electron App / release (push) Has been cancelled
Release (Linux, macOS, Windows) / Linux Release (push) Has been cancelled
Release (Linux, macOS, Windows) / macOS Release (push) Has been cancelled
Release (Linux, macOS, Windows) / Windows Release (push) Has been cancelled
v0.12.10
2026-04-15 20:56:55 +08:00
Calcium-Ion
bf130c5cde
feat: include admin username in quota adjustment logs (#4216) 2026-04-15 20:56:34 +08:00
Seefs
f7adf02eb4
feat(claude): add cache_control and speed passthrough controls (#4247) 2026-04-15 20:55:01 +08:00
wans10
d0c2d2c6fb
fix(channel): 修复多密钥管理弹窗索引显示,将索引值调整为从1开始 (#4231) 2026-04-15 20:53:58 +08:00
power
ee7cedd577
fix: use json.RawMessage for Instructions field in OpenAIResponsesResponse (#4260)
The Instructions field in OpenAIResponsesResponse was defined as string,
but upstream providers may return null or non-string JSON values for this
field. This causes json.Unmarshal to fail, resulting in HTTP 500 on
/v1/responses endpoint.

Other fields in the same struct (Status, ToolChoice, Truncation, etc.)
already use json.RawMessage. The request-side DTO (openai_request.go)
also defines Instructions as json.RawMessage. This fix aligns the
response-side with both patterns.

Co-authored-by: 40005415C\Administrator <linbin@envicool.com>
Co-authored-by: Claude Opus 4.6 <noreply@anthropic.com>
2026-04-15 20:51:10 +08:00
CaIon
8c8661d0d7
refactor: clean up unused imports and commented-out code in channel.go 2026-04-13 16:39:12 +08:00