Commit Graph
100 Commits
Author SHA1 Message Date
CaIon 0d5995eb63 fix(auth): allow read-only access for non-disabled tokens 2026-07-05 13:35:10 +08:00
CaIon 5fc35e28a2 fix(user): harden account email and password handling
- normalize emails (trim + lowercase) and enforce uniqueness across
  registration, OAuth auto-registration, and email binding
- serialize concurrent writers on the same normalized email within a
  transaction to avoid duplicate accounts
- resolve password reset to a single matching account and reject
  ambiguous or absent matches
- require an existing password before self-service password change and
  reject login for accounts without a usable password
2026-07-05 13:15:41 +08:00
CaIon bed4a3f916 fix(user): trim whitespace from username and validate input 2026-07-04 16:56:37 +08:00
CaIon 12603a7765 fix(redemption): add status filtering and cleanup action 2026-07-04 16:15:47 +08:00
CaIon 86021d8ed2 Refine default web UI and backend sync handling 2026-07-04 14:57:53 +08:00
CaIon 55858f353c feat: add manual Docker image publishing workflow 2026-07-03 16:54:52 +08:00
Calcium-Ion dfc0d6324b Merge commit from fork
* Harden user setting cache updates

* Fix user update test isolation
2026-07-03 15:25:33 +08:00
CaIon bfddc5fea0 fix: omit access_token from user queries 2026-07-03 15:15:16 +08:00
CaIon 8874d1929f Make quota logging synchronous and delay startup log 2026-07-02 21:58:41 +08:00
CaIon bff701b0cd docs: update AGENTS.md 2026-07-02 21:53:53 +08:00
CaIon 12fc010060 Bump Electron lockfile dependencies 2026-06-30 14:06:48 +08:00
CaIon 43591fba77 feat: improve advanced custom route editor 2026-06-29 12:45:30 +08:00
CaIon 25f998595d feat: refine channel management UI 2026-06-28 16:36:32 +08:00
CaIon 1d166532fe fix: update section titles and improve layout in channel components 2026-06-28 15:21:45 +08:00
Calcium-Ion 2d5a041639 feat: support Responses to Chat (#5787)
* fix(openai): harden Chat-to-Responses compatibility

Add a shared Responses-to-Chat stream state machine and use it from the OpenAI relay path. Preserve assistant text alongside tool calls, bind tool argument deltas by output_index, map incomplete finish reasons, support reasoning/custom tool events, and buffer upstream SSE for non-stream Chat clients.

Add deterministic service tests and relay SSE tests for the conversion path.

Related to #5745.

* refactor: rename openaicompat to relayconvert for improved clarity

* feat(gemini): support responses request conversion

* feat: add responses to chat conversion support

* fix: harden responses chat conversion edge cases
2026-06-28 14:25:47 +08:00
Calcium-Ion 3a506f50f0 fix(openai): harden Chat-to-Responses compatibility (#5772)
Add a shared Responses-to-Chat stream state machine and use it from the OpenAI relay path. Preserve assistant text alongside tool calls, bind tool argument deltas by output_index, map incomplete finish reasons, support reasoning/custom tool events, and buffer upstream SSE for non-stream Chat clients.

Add deterministic service tests and relay SSE tests for the conversion path.

Related to #5745.
2026-06-27 19:16:56 +08:00
CaIon 626dadb556 fix(web): secure rich content rendering 2026-06-27 17:44:52 +08:00
CaIon df44a75d53 fix: adapt ClickHouse log LIKE filters 2026-06-27 17:03:25 +08:00
Calcium-Ion 4aee5f7d5a feat: better admin permissions (#5755)
* feat: add casbin admin permissions

* feat: improve audit logging to associate logs with actual operators and target users

* feat: enhance admin permissions and UI interactions for sensitive actions

* Refactor authz RBAC and tighten channel permissions

* Split channel authz field policy

* Address channel authz review findings
2026-06-27 17:01:59 +08:00
CaIon 6c35e1ef26 chore: update i18n skill 2026-06-27 12:42:54 +08:00
CaIon b191f47375 fix: use neutral drawing task labels 2026-06-24 22:15:29 +08:00
CaIon 69b0f0b56f feat: add date-fns and date-fns-tz paths to build configuration 2026-06-24 20:56:01 +08:00
CaIon 48da37a3df feat: add date-fns and date-fns-tz dependencies 2026-06-24 20:51:58 +08:00
CaIon ad35ab1d9a feat: enhance i18n-translate skill 2026-06-24 20:46:30 +08:00
CaIon 5814ca90c3 fix: add token limit save label translations 2026-06-24 20:45:48 +08:00
CaIon d2dcbc3137 feat: add channel async polling delay toggle
Fixes #5717
Fixes #4244
2026-06-24 20:40:10 +08:00
Calcium-Ion 2cbdfa0398 feat: add system instance info panel (#5716)
* feat: add system instance reporting

* feat: show system instance resources

* fix: update translations for heartbeat messages in Russian and Vietnamese
2026-06-24 19:16:56 +08:00
Calcium-Ion 5377192293 feat: add system task runner (#5680) 2026-06-24 17:16:21 +08:00
CaIon acb52d0f78 chore(deps): update clickhouse-go and orb dependencies 2026-06-24 16:20:02 +08:00
CaIon 72b3f34576 chore: update agent skills and project config
- add vercel-react-best-practices skill (SKILL.md + full-guide.md)
- slim CLAUDE.md to import shared AGENTS.md conventions
- promote go-ntlmssp to a direct dependency in go.mod
2026-06-24 13:52:51 +08:00
CaIon cf6ae6fdeb fix: preserve SMTP PLAIN auth TLS guard 2026-06-24 12:50:54 +08:00
CaIon 9fc9c8f1e3 chore: avoid duplicate shadcn skill exposure 2026-06-23 13:53:52 +08:00
CaIon f8cfbfa4df refactor(log): remove legacy log deletion endpoint and associated types 2026-06-22 19:40:04 +08:00
CaIon f84b7d591f refactor(log): simplify ClickHouse log deletion and add unit tests
Replace the per-batch ClickHouse mutation loop with a single
ALTER TABLE ... DELETE, since ClickHouse DELETE is a heavy mutation
that rewrites data parts and per-batch mutations are pathologically
slow. Add deterministic unit tests covering ClickHouse DSN handling,
main-database rejection, TTL DDL generation, log ordering, request_id
backfill, and display id assignment.
2026-06-22 19:32:32 +08:00
CaIon a162163b48 feat: add persistent system task log cleanup progress 2026-06-22 19:16:53 +08:00
Calcium-Ion 6dc4030fdf feat: support ClickHouse log database (#5663)
* feat: support ClickHouse log database

* feat(log): optimize log deletion process for ClickHouse
2026-06-22 18:41:26 +08:00
CaIon e5694748c7 chore(web): use tsgo for type checking 2026-06-22 13:38:43 +08:00
CaIon 44e0e68689 feat: add channel test env toggle 2026-06-22 12:45:45 +08:00
CaIon 5e86644649 feat(dashboard): add sensitive data toggle to flow chart
Add an eye toggle in the flow section header that masks sensitive node
labels (users, tokens, nodes, groups, channels) in the Sankey while keeping
model names visible. Masking only rewrites display text; nodes stay distinct
via their key so graph structure, links, and highlighting are unaffected.
2026-06-20 22:09:04 +08:00
CaIon 8ad83bf62f feat(dashboard): interactive sankey highlighting and persistent filters
- Highlight full paths through a clicked node or link in the flow Sankey,
  dimming unrelated nodes/links instead of removing them
- Disable VChart built-in emphasis to avoid crash, use custom highlight sets
- Initialize models filter dialog from currently applied filters so manual
  time ranges are not overridden by preferences; auto-pick granularity by range
- Lift user charts time range/granularity/limit to dashboard as controlled state
2026-06-20 22:09:03 +08:00
CaIon 061948011c feat: limit dashboard flow nodes 2026-06-20 22:09:03 +08:00
CaIon f9e508bdae perf(channels): optimize card view layout and reduce re-renders
- Show 3-column card grid from xl breakpoint instead of 2xl
- Cap inline priority/weight width to avoid huge values stretching cards
- Collapse right-column grid to content-sized columns, removing wasted space
- Memoize channel columns, context value, upstream-update result, and ChannelCard
  to avoid rebuilding/re-rendering all cards on unrelated state changes
2026-06-20 16:06:06 +08:00
CaIon cb841850b7 fix: update channel icon 2026-06-20 14:06:53 +08:00
CaIon 91ab664c53 feat: add routing reliability management 2026-06-20 13:55:50 +08:00
CaIon 2c2d92116f refactor: simplify model list 2026-06-20 12:16:42 +08:00
CaIon 0229dc2057 refactor: refine toolbar controls and model drawer 2026-06-19 20:17:45 +08:00
CaIon 9100e15e4e feat: add channel sensitive info toggle 2026-06-19 20:09:18 +08:00
CaIon 4206d7fd58 feat(data-table): enhance mobile card view handling and improve layout logic 2026-06-19 19:58:20 +08:00
CaIon 50b8f2a272 refactor: update styling and improve code readability across multiple components 2026-06-19 19:29:00 +08:00
CaIon a0de4b560e refactor(channels): restructure channel card into left/right columns
Group #id/name and balance on the left and priority/weight plus
response/last-tested on the right. Simplify field labels by dropping
the CJK-unfriendly uppercase/letter-spacing, left-align the right
column, and shorten the "Last Tested" zh label.
2026-06-19 18:30:13 +08:00
CaIon 0467d54014 chore: update frontend branding copy 2026-06-19 18:14:40 +08:00
CaIon 29c3dcb927 feat(table): support card layout 2026-06-19 17:43:13 +08:00
CaIon 68585568d6 feat(data-table): add reusable card/table view toggle
Add an opt-in card view to the shared data-table stack (DataTablePage),
toggled via a segmented control in the toolbar with per-table localStorage
persistence. Cards render generically from column meta by default, with an
optional renderCard slot. Defaults to table-only so existing pages are
unchanged.

Wire it into the channels page with a bespoke ChannelCard that reuses every
column's cell renderer, preserving all table information and interactions
(selection, inline priority/weight, balance refresh, status, actions, tag
expand).
2026-06-19 17:43:11 +08:00
CaIon 6bd69f3edf feat(ui): enhance endpoint selection and date picker 2026-06-19 15:10:50 +08:00
CaIon 0c806db996 refactor(theme): update color classes 2026-06-19 14:53:44 +08:00
CaIon 490395b2f8 feat(performance): enhanced metrics display 2026-06-19 14:27:16 +08:00
CaIon 6ad5dbb641 fix(main): prevent refetching on window focus to optimize performance 2026-06-19 12:45:20 +08:00
CaIon f7dae5cbe6 fix(drawing): update timestamp formatting to include milliseconds 2026-06-18 21:38:55 +08:00
CaIon f4575fe664 feat(format): add locales support to number formatting 2026-06-18 21:30:05 +08:00
CaIon cfc9bbcdbf feat(logs): improve layout 2026-06-18 21:29:55 +08:00
CaIon 55b00fcf09 feat(advanced-custom): remove fallback option and enhance path matching for advanced custom routes 2026-06-18 20:29:24 +08:00
CaIon 21d4d18dfc feat(rankings): remove 'all' period option from rankings and related components 2026-06-18 17:56:45 +08:00
CaIon 50784c10ee feat(api): change subscription product options and catalog endpoints to use GET method 2026-06-18 17:15:05 +08:00
CaIon b8f5ba4a31 feat(overview): update setup guide expansion logic 2026-06-18 16:59:12 +08:00
CaIon fd557064d3 feat(subscription): add descriptions for plan purchase amounts in multiple languages 2026-06-18 16:53:57 +08:00
CaIon f6c260437c feat(subscription): add support for wallet overflow and downgrade group functionality in subscription plans 2026-06-18 16:44:12 +08:00
CaIon 4e8b5e9b13 feat(data-table): add column visibility storage functionality for API keys, channels, and usage logs 2026-06-18 16:03:06 +08:00
CaIon 1aa77e6698 fix(ui): enforce HTTPS for backend-provided image URLs and improve URL validation 2026-06-18 14:56:44 +08:00
CaIon 06f9dec95b feat(recharge): enhance payment method buttons with minimum top-up information 2026-06-18 14:40:06 +08:00
CaIon 1414569b63 feat(stat): enhance log stat cards with compact number formatting and improved layout 2026-06-18 12:13:53 +08:00
CaIon df013946d7 feat(performance): add compact formatting for latency and throughput metrics 2026-06-18 12:03:11 +08:00
CaIon 208d86e96e feat(performance): add recent success rates to model summary and enhance metrics retrieval 2026-06-18 12:00:03 +08:00
CaIon a37ce3d6b5 fix: clarify channel test results 2026-06-18 11:59:17 +08:00
CaIon a95655a245 feat(performance): implement success rate grading and enhance UI representation 2026-06-17 22:28:36 +08:00
CaIon 3cc2b1bea4 feat(channel-test-dialog): add functionality to delete failed models and copy selected models 2026-06-17 21:31:20 +08:00
CaIon 122a730a77 feat(layout): improve settings form layout and enhance textarea overflow handling 2026-06-17 21:16:50 +08:00
CaIon 21636fc1b5 feat(performance): enhance uptime calculations and chart data handling 2026-06-17 21:10:54 +08:00
CaIon 2154fce094 feat(payment): enhance payment method configuration with icons and improve UI interactions 2026-06-17 20:47:24 +08:00
CaIon 3b345cfd27 chore: remove legacy OAuth controllers 2026-06-17 16:13:29 +08:00
CaIon 1ac0f5807a feat(audit): add authentication method tracking in audit logs 2026-06-13 16:12:22 +08:00
Calcium-Ion d0c4305a16 feat(audit): add localized security audit logs (#5462) 2026-06-12 23:40:40 +08:00
CaIon 59a93cf5c7 fix(openai): align image streaming relay governance
Route OpenAI image streaming through shared stream handling, split image/realtime/usage helpers for maintainability, and include the related image request and rate limit updates.
2026-06-10 17:47:37 +08:00
CaIon 1588027084 feat: add subscription balance redemption toggle (#3071) 2026-05-29 12:54:00 +08:00
CaIon 5b86ce0d70 fix: optimize batch update process 2026-05-27 13:23:05 +08:00
CaIon 74985fa877 fix: keep token log filters exact 2026-05-26 21:17:25 +08:00
CaIon dc245ae764 fix(web): improve channel and usage log UI
Fixes #5121
2026-05-26 20:28:28 +08:00
CaIon f8add4ca49 feat(theme): add simple-large preset, xl scale and clean up channel badge dots
Implement the Simple Large-font theme preset and xl font scale options to enhance interface accessibility. Remove status indicator dots from channel badges in logs to keep the table layout visual and clean.
2026-05-26 18:35:51 +08:00
CaIon 5bc4c74813 🎨 fix(logs): tune usage table typography
Set usage log tables to a balanced 13px default and keep log badges aligned with the active theme font.
2026-05-26 12:41:00 +08:00
CaIon f223db9330 🎨 fix(charts): improve dark mode chart readability
Ensure VChart labels and grid lines use theme-aware colors, and remove oversized rounded corners from ranking bar charts.
2026-05-26 12:30:13 +08:00
CaIon 9e283ab10b 🎨 fix(logs): remove hardcoded font-mono to support global theme font inheritance
- Remove explicit 'font-mono' and custom size classes from model and token
  badges in usage logs.
- Allow model name and token badges to naturally inherit the active theme's
  font family (Sans or Serif) and text size from the parent container.
- Restore visual consistency and proportion across all table badge components.
2026-05-26 12:23:52 +08:00
CaIon a8b7c92e5f 🎨 fix(logs): restore timing background badges and optimize model/token spacing
- Re-introduce the custom translucent background color and thin border scheme
  for timing and duration badges in common, drawing, and task logs.
- Remove strict max-width constraints on model badges to ensure complete
  names (with version suffixes) are always visible and wrap gracefully.
- Adjust spacing on model and token badges (h-6 height, larger gaps, and
  proper padding) to prevent crowded elements and restore a balanced,
  high-quality look in the log tables.
2026-05-26 12:03:43 +08:00
CaIon 6b6c9904ac feat(subscription): support balance purchases
Refs #3071.
2026-05-26 12:03:02 +08:00
CaIon 1011934987 🎨 fix(theme): default theme font preset falls back to Sans instead of Serif
Adjust PRESET_DEFAULT_FONT so that the shipped 'default' preset falls back to the humanist 'sans' (Public Sans) out-of-the-box instead of forcing the editorial 'serif' (Lora). Keeps the 'anthropic' preset on 'serif' as intended.
2026-05-26 11:29:38 +08:00
CaIon bc8110ce36 🎨 refactor(badge): restore status-badge sizes and classic color scheme
- Restore StatusBadge sizes to h-5/text-xs (sm, md) and h-6/text-xs (lg).
- Restore classic textColorMap coloring and status indicator dot.
- Embed channel type icon directly inside StatusBadge as custom children.
- Re-align status badge colors: danger for manual disabled, warning for auto disabled.
2026-05-26 11:23:18 +08:00
CaIon 51ca897cf4 refactor(home): redesign hero section to dual-column layout with compliant copywriting
Redesigns the hero section into a balanced horizontal dual-column layout:
- Left Column: Features title, clean legal-compliant descriptions, CTA buttons with BookOpen Docs link, and enlarged supported apps buttons (Cherry Studio and CC Switch with lobe icons)
- Right Column: Smoothly integrates the terminal API demo with top horizontal alignment
- i18n: Configures compliance translations for en, zh, fr, ja, ru, and vi locales
2026-05-25 23:11:05 +08:00
CaIon fddf54ccc5 perf: reduce heap residency for large base64 relay requests
Three layered optimizations targeting Gemini-style 5MB base64 payloads where
RSS could balloon to tens of GB under concurrent load:

1. Byte-based param override (relay/common/override.go)
   - Switch legacy/operations hot paths from common.Marshal round-trips and
     map[string]any conversions to gjson/sjson on []byte directly.
   - Avoids cloning 5MB strings during each Set/Delete operation.

2. strings.Builder for Gemini response markdown (relay/channel/gemini/relay-gemini.go)
   - Replace string concatenation + strings.Join when assembling
     "![image](data:...;base64,DATA)" content for inline image responses.
   - Pre-allocates capacity from inline_data byte sizes.

3. Outbound BodyStorage + streaming Decoder (this commit's core)
   - New relay/common/outbound_body.go helper wraps marshaled upstream bodies
     in common.BodyStorage, allowing disk-cache mode to offload jsonData to
     a temp file while waiting for upstream TTFB. The original []byte can
     then be GC'd, removing ~5MB/req of heap residency during the longest
     window of a request.
   - All 7 relay handlers (gemini/claude/responses/embedding/image/compatible/
     rerank) plus chat_completions_via_responses adopt the helper with
     defer closer.Close() and explicit jsonData = nil.
   - relay/common/relay_info.go: new UpstreamRequestBodySize so
     relay/channel/api_request.go can populate req.ContentLength (lost when
     body becomes a type-erased io.Reader).
   - common/gin.go UnmarshalBodyReusable: when storage is disk-backed and
     content-type is JSON, decode via DecodeJson(storage) instead of
     storage.Bytes()+Unmarshal, removing one transient 5MB copy per request.
     memory mode and form/multipart paths unchanged.
2026-05-22 19:08:38 +08:00
CaIon b9bc6f0e21 Revert "fix: correct usage logs filtering (#4883)"
This reverts commit 554defe4f4.
2026-05-22 16:19:54 +08:00
Calcium-Ion 146dd77b83 fix(keys): call submit handler directly to avoid stale form linkage (#4858) (#4967)
Users reported that the API key edit drawer's "Save changes" button
becomes unresponsive after the drawer has been open / idle for a
while: no loading state, no request, no error. Reopening the drawer
restores it because a fresh DOM is created.

The button lived in `SheetFooter` (a portaled Base UI Sheet) and was
linked to the form via the HTML `form='api-key-form'` attribute. Once
the portal/DOM relationship goes stale, the click no longer triggers
the form's submit event, hence the silent failure.

Defensive fix: drop the cross-DOM `form` linkage and call
`form.handleSubmit(onSubmit)` directly via `onClick`. The native
submit path (Enter key, original `<form onSubmit>`) is preserved.

Closes #4858
2026-05-19 16:40:11 +08:00
Calcium-Ion 5e88f97ac1 fix(data-table): make faceted filter popover width adaptive (#4905) (#4966)
The faceted filter popover used a fixed width of 200px, which clipped
long option labels (e.g. user-defined channel group names) and forced
the truncated text to be unreadable without leaving a way to see the
full value.

- Switch PopoverContent from `w-[200px]` to
  `min-w-[200px] max-w-[360px]` so short option lists keep their
  current footprint while long labels can expand up to 360px before
  the existing truncate kicks in.
- Add `title={t(option.label)}` on the truncated label span so users
  can still hover to see the full text on extreme cases.

Closes #4905
2026-05-19 16:39:57 +08:00
Calcium-Ion 0cd9a3a068 fix(auth): use aff_code field name in registration payload (#4945) (#4965)
The new UI's sign-up form sent the invite code under key `aff`, but
the backend `Register` controller binds it to `User.AffCode` whose
JSON tag is `aff_code` (see model/user.go). Result: every invited
sign-up landed with `inviter_id = 0`, breaking the affiliate flow.

Rename only the request payload field so it matches the backend
contract. URL query parameter (`/sign-up?aff=...`), localStorage key
and OAuth state continue to use `aff` and are unchanged.

Closes #4945
2026-05-19 16:39:42 +08:00