Commit Graph
6218 Commits
Author SHA1 Message Date
CaIon 50e5377ea5 fix(topup): settle recharge orders atomically 2026-08-11 22:03:47 +08:00
CaIon d7992672a6 fix(oauth): avoid overwriting user state when binding 2026-08-11 22:03:45 +08:00
zhibisora 3d5dc36f1d fix: 修复 Gemini 风格 /v1/models 列表请求 (#6199)
* fix: support Gemini model listing on v1 route

* test: cover Gemini query key model listing
2026-08-11 14:49:20 +08:00
Wodandmultica-agent ffeb1b24ef fix(web): refresh Turnstile token after login attempt (#6764)
Co-authored-by: multica-agent <github@multica.ai>
2026-08-11 13:55:01 +08:00
Seefs 4eaeefbdf5 fix: mobile sidebar (#6760)
* fix: mobile sidebar

* fix(web): prevent iOS sidebar taps from being swallowed
2026-08-11 13:50:39 +08:00
Seefs bb234ff418 refactor(responses): remove compact model suffix handling (#6770) 2026-08-11 13:42:32 +08:00
Uzuki Shion 253a74dd1b fix(relay): preserve presence/frequency penalty in Responses conversion (#6654) 2026-08-11 13:40:13 +08:00
Seefs 9c97e78ace fix(web): require confirmation before rotating access token (#6749) 2026-08-10 13:12:59 +08:00
Seefs 4cf9107f04 feat(billing): highlight matched conditional multipliers in logs (#6561)
* feat(billing): highlight matched conditional multipliers in usage logs

* fix(billing): make request rule tracing stable and type-safe
2026-08-10 12:50:27 +08:00
Seefs d49160f0e5 fix: backend length validation (#5548) 2026-08-10 12:50:08 +08:00
Seefs 8ad159a3bb fix(ollama): preserve reasoning and tool-call context (#6605) 2026-08-10 12:49:26 +08:00
Seefs 85feb7a345 feat(relay): expose user and group context to parameter overrides (#6534) 2026-08-10 12:49:06 +08:00
Seefs eab18a8357 fix: record reasoning effort consistently in usage logs (#6641) 2026-08-10 12:48:14 +08:00
Seefs 7dd1000a19 perf(web): debounce server and large-list searches (#6727) 2026-08-10 12:47:55 +08:00
Seefs 5d3423bec1 feat(channels): add auto-disable-only channel test mode (#6728) 2026-08-10 12:47:44 +08:00
Seefs 823e26304a fix(channels): classify Qwen TTS models correctly (#6711) 2026-08-08 14:31:29 +08:00
ENCHIGO 2399de97da fix(ali): stop injecting top_p into requests that omit it (#6674) 2026-08-08 13:54:00 +08:00
CaIon 5c3abffe85 CI: enhance release synchronization workflow with optional file syncing 2026-08-07 17:40:31 +08:00
lihu-001 e926e5cace fix: 修复兑换码额度精度损失 (#6685)
* fix: 修复兑换码额度精度损失(#6680)

* fix(redemption): guard update data integrity
2026-08-07 17:06:32 +08:00
CaIon 1da23d6b33 feat(rate-limit): add user critical rate limit middleware for access token and aff transfer routes 2026-08-07 16:01:22 +08:00
Seefs b941253aea fix: test Claude/Gemini endpoints with native request format (#6698) 2026-08-07 13:35:46 +08:00
Seefs c9bc038649 feat(channels): refine fetched model categorization (#6632)
* feat(channels): refine fetched model categorization

* fix: channel category

* fix: hy3 category
2026-08-07 13:34:56 +08:00
RedwindA 0cd9dc85e3 Merge commit from fork 2026-08-06 17:53:55 +08:00
CaIon ea4f021012 refactor(relay): move replay metadata onto request bodies 2026-08-06 17:33:10 +08:00
LucasandClaude Fable 5 d6b5ce99de fix(relay): set Request.GetBody so the HTTP/2 transport can transparently retry after an upstream stream reset (#6249)
* fix(relay): set Request.GetBody so the HTTP/2 transport can transparently retry after an upstream stream reset

The outbound request body is a type-erased io.Reader over BodyStorage, so
net/http cannot derive Request.GetBody (it only does so for *bytes.Reader,
*bytes.Buffer and *strings.Reader). With GetBody nil, the HTTP/2 transport
cannot transparently retry a request once the body has been written and the
upstream resets the stream with a retryable error (REFUSED_STREAM, or a
connection-level GOAWAY); the relay request then fails with:

    http2: Transport: cannot retry err [...] after Request.Body was written;
    define Request.GetBody to avoid this error

This affects every relay path that goes through DoApiRequest (chat, claude,
gemini, responses, embedding, image, rerank).

BodyStorage (memory and disk) already implements io.Seeker, so replay support
only needed wiring:

- NewOutboundJSONBody additionally returns a getBody that rewinds the storage
  and hands out a fresh non-closing reader. The transport only calls GetBody
  after the previous attempt's body has been abandoned, so the rewind cannot
  race an in-flight read.
- RelayInfo carries it in the new UpstreamRequestGetBody field, set alongside
  UpstreamRequestBodySize by the handlers that build storage-backed bodies.
- applyUpstreamGetBody (symmetric with applyUpstreamContentLength) wires it
  into DoApiRequest/DoFormRequest/DoTaskApiRequest, only when req.GetBody is
  still nil.

Also remove the hand-rolled GetBody override in DoTaskApiRequest: it returned
the same already-consumed reader, so any transport-level replay would have
silently sent an empty body, and it clobbered the correct snapshot-based
GetBody that net/http derives from the *bytes.Reader bodies the task adaptors
pass in. For non-replayable bodies GetBody now stays nil, so a retry fails
loudly instead of corrupting the request.

Covered by unit tests plus an end-to-end raw-frame HTTP/2 test that resets
the first stream with REFUSED_STREAM after the body is written and asserts
the transport transparently retries with the complete body.

Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>

* fix(relay): hand out independent readers from GetBody (address review)

Per the http.Request.GetBody contract ("returns a new copy of Body"),
each call must yield a reader with its own cursor. The previous
implementation rewound and reused the shared BodyStorage, so two
consecutive GetBody readers would interfere with each other, and a
replay could disturb the primary body's offset under extreme transport
timing (e.g. attempt N's body write not yet fully abandoned when the
transport builds attempt N+1).

Instead of snapshotting the payload (an extra copy), add
BodyStorage.NewReader, which returns an independent zero-copy reader:

- memory mode: a fresh bytes.Reader over the same immutable backing
  array;
- disk mode: a separate file descriptor over the cache file, so the
  transport closing a replayed body only closes that descriptor.

NewOutboundJSONBody's getBody now simply hands out storage.NewReader,
and once the handler releases the storage, GetBody fails with
ErrStorageClosed instead of replaying stale data.

Tests: interleaved reads across two replay readers and the primary
body each observe exactly their own byte stream, for both the memory
and the disk-backed storage; the existing GetBody and HTTP/2 retry
suites still pass (h2 e2e tests flake-free with -count=20).

Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>

* fix(relay): bind replayable metadata on pass-through requests

* fix(relay): reset upstream body metadata between channels

* test(relay): cover replay across retries and channel attempts

* fix(relay): stop following upstream redirects

---------

Co-authored-by: Claude Fable 5 <noreply@anthropic.com>
2026-08-06 15:56:38 +08:00
Calcium-Ion 0ab0202060 Feat/auto group (#6590)
* feat(token): support custom auto group order

* feat(keys): enhance auto group presentation

* fix(keys): rework Auto flow border and compact inherited order

The Auto group highlight previously tinted the whole control surface
with a gradient and animated only a 1px top sweep, which read as a
background color rather than a flowing border. Replace it with a
border-only effect: an aria-hidden, pointer-events-none overlay whose
conic gradient is masked down to a thin ring hugging the rounded
perimeter, so the highlight travels around all four edges and corners
every 3.2s. The interior stays neutral with a restrained static
primary border and glow; prefers-reduced-motion hides the moving
layer while keeping the static emphasis.

The inherited global Auto order also rendered as spacious two-line
rows with circular sequence markers, wasting drawer space. Render it
as a compact wrapping strip of one-line chips (index, name, ratio
badge) with descriptions kept accessible via title and sr-only text,
scrolling only past a much smaller max height.

Custom add/remove/reorder editing, empty-array inheritance semantics,
and the submit payload are unchanged.

* fix(keys): preserve Auto inheritance and unify effects

* refactor(keys): temporarily disable AutoGroupBadge in api-key-group-cell
2026-08-01 23:19:01 +08:00
Calcium-Ion bd585d78ef fix(aws): cancel Bedrock requests on client disconnect (#6589)
* fix(aws): cancel Bedrock requests on client disconnect

* fix(billing): log effective usage billing path
2026-08-01 22:39:54 +08:00
Calcium-Ion cfaba1dd67 fix(billing): harden tiered retry group-switch billing (#6570)
Follow-up to #6518 (issue #6480) addressing three review findings:

- Document and lock in arrears semantics for the wallet Reserve top-up:
  when an auto-group retry lands on a more expensive group, the full
  reservation delta is deducted unconditionally (balance may go
  negative), mirroring settlement, so the logged pre-consumed quota
  always reconciles with the actual balance movement. Genuine DB
  errors still fail the attempt with update_data_error. Subscription
  funding keeps its insufficient-quota behavior: subscriptions enforce
  a hard used<=total cap and do not support arrears.
- PriceData.FreeModel is cleared when a retry switches from a free
  group to a paid one, keeping it consistent with the billing session
  created at that point.
- getChannel refreshes GroupRatioInfo only after channel selection
  succeeds, and the retry loop records the channel in use_channel
  before PrepareTieredBillingForSelectedGroup can fail.
2026-08-01 09:35:51 +08:00
吴天一 df43f80153 fix(billing): settle tiered retries with final group (#6518) 2026-07-31 19:16:46 +08:00
Seefs 9724ef1b24 feat: deepseek responses api (#6562) 2026-07-31 15:23:13 +08:00
feitianbubu aa7d0d39a4 style: use text-sm for public header nav links to match other nav components (#6557) 2026-07-31 14:54:23 +08:00
Neimar Avila e78e1db1e4 fix(oauth): stop treating a foreign window.opener as a bind flow (#6425)
* fix(oauth): stop treating a foreign window.opener as a bind flow

The /oauth/:provider callback decided between an account bind and a plain
login with `window.opener ? 'bind' : 'login'`. Any tab opened from an
external link (target="_blank", Slack, mail clients, another site) carries
a live opener, and that opener survives the cross-origin round trip to the
identity provider. Such a login callback was therefore misread as a bind:
it posted a handshake to a window that speaks no such protocol, showed the
"binding your account" screen, and hung until the 30s deadline fired with
"OAuth binding timed out" — while the backend was never called at all.

Reproduced against a real Keycloak round trip: a tab opened via window.open
still reports window.opener !== null on the callback, so mode resolved to
'bind' for an ordinary OIDC login.

A bind now requires positive proof: the popup we open for it is same-origin
(about:blank) before being sent to the provider, so we stamp its own
sessionStorage. The stamp rides through the provider round trip and is
scoped to that popup alone, so a login tab can never carry it. Ambiguity
resolves to 'login', which is the recoverable direction.

Affects every provider sharing this callback (OIDC, GitHub, Discord,
LinuxDO, custom).

* fix(oauth): harden bind popup detection
2026-07-31 14:53:59 +08:00
Seefs 8461e5339d fix(relay): preserve multipart image edits for New API channels (#6559) 2026-07-31 13:46:13 +08:00
Seefs 84834eee85 feat(logs): expose stream status to log owners (#6558) 2026-07-31 13:29:07 +08:00
Seefs 0f9f668c60 feat: support zstd request decompression (#6545) 2026-07-31 11:17:55 +08:00
Scott 66ee6b8f98 fix: preserve Qwen thinking_budget passthrough (#5836)
* fix: preserve qwen thinking budget

* test: address qwen thinking budget review comments

* chore: remove unreachable adaptor code

* test: cover zero Qwen thinking budgets
2026-07-29 17:45:14 +08:00
June Chi cb4c8c02f8 feat(oidc): 支持自定义 OIDC 登录显示名称 (#6012)
* docs: add design spec for OIDC custom display name

Mirrors the existing Custom OAuth Provider name pattern so admins can
show a meaningful label instead of the hardcoded "OIDC" on the login
page and in related copy.

* feat(oidc): add configurable display name with OIDC fallback

* feat(oidc): use configured display name in provider name and status API

* feat(oidc): add display name field to default-theme OIDC settings

Claude-Session: https://claude.ai/code/session_01FDkWJqigJi9yE3HG5pjZP5

* feat(oidc): show configured display name on default-theme login button

* feat(oidc): add display name field to classic-theme OIDC settings

* feat(oidc): show configured display name on classic-theme login button

* fix(oidc): trim whitespace before applying display name fallback

* chore: remove internal design doc from PR

Design/planning docs are working artifacts for this session and
shouldn't be submitted to the upstream project.

* fix(oidc): lead with example in classic-theme display name placeholder

Reorders the combined placeholder to show the example first, then
the fallback note, matching the Custom OAuth Provider Name field's
placeholder convention (example-only) that this feature mirrors.

* fix(i18n): improve Russian grammar in OIDC display-name placeholder translation

Leads each clause with its condition/subject and adds the missing
verb, per PR review feedback.

* test(web): remove redundant OIDC harness tests
2026-07-29 16:27:15 +08:00
CaIon c27d1ef651 Update .gitattributes 2026-07-29 13:45:10 +08:00
CaIon afe16c64cd feat: add README.md for RelayKit module with capabilities and usage examples 2026-07-28 15:24:37 +08:00
CaIon 1db6ae1957 feat: enhance CI workflow to include vetting for Go modules 2026-07-28 15:09:49 +08:00
CaIon 8e2bfe278b refactor: remove mutex from CustomEvent and update TCP connection handling in tests 2026-07-28 15:09:49 +08:00
feitianbubu c3db41407d fix: 慢查询/错误 SQL 日志参数化 (#6493)
* fix: parameterize slow/error SQL logs to avoid leaking credentials

* fix: validate SQL_SLOW_THRESHOLD_MS range

* fix: sanitize database driver error messages in SQL logs

* refactor: sanitize at gorm log writer seam to keep caller attribution
2026-07-27 22:21:31 +08:00
CaIon f01c13b086 feat: add CI workflow for backend and frontend build, typecheck, and test 2026-07-27 22:07:09 +08:00
CaIon 2cf3c8d71e docs: update AGENTS.md 2026-07-27 21:41:31 +08:00
CaIon e99a9bd86f feat: add per-channel HTTP transport controls 2026-07-27 21:41:13 +08:00
CaIon b27b2b1d6f fix(web): detect iPad login sessions correctly 2026-07-27 21:19:42 +08:00
CaIon a043eef559 feat: implement Gemini to OpenAI chat stream conversion with state management and terminal handling 2026-07-27 20:17:20 +08:00
CaIon f3ab2cff36 feat: enhance GitCode release workflow to handle bootstrap and matrix assets 2026-07-27 18:24:43 +08:00
CaIon 6d57d250f8 feat: enhance GitCode release workflow with bootstrap asset and asset matrix 2026-07-27 18:20:01 +08:00
CaIon 2ec6171faa fix: replace ASCII apostrophes in release notes to prevent script breakage 2026-07-27 17:17:01 +08:00