Commit Graph

782 Commits

Author SHA1 Message Date
Calcium-Ion
9c079d04a8 Merge pull request #1487 from seefs001/feature/2fa
feat: implement two-factor authentication (2FA) support with user login and settings integration
2025-08-04 19:54:31 +08:00
CaIon
12b4e80d4b feat: add status filtering and bulk enable/disable functionality in multi-key management 2025-08-04 19:51:58 +08:00
CaIon
8357b15fec feat: enhance multi-key management with pagination and statistics 2025-08-04 17:15:32 +08:00
CaIon
ecdd9d1ccb feat: add multi-key management 2025-08-04 16:52:31 +08:00
Seefs
398ae7156b refactor: improve error handling and database transactions in 2FA model methods 2025-08-03 10:49:55 +08:00
Seefs
d85eeabf11 fix: coderabbit review 2025-08-03 10:41:00 +08:00
Seefs
c784a70277 feat: implement two-factor authentication (2FA) support with user login and settings integration 2025-08-02 14:53:28 +08:00
Calcium-Ion
e6c87907d5 Merge pull request #1486 from nekohy/fix-get-google-models
fix: correct Gemini channel model retrieval logic
2025-08-02 14:52:22 +08:00
Nekohy
71e9290142 fix: correct Gemini channel model retrieval logic 2025-08-02 14:19:32 +08:00
CaIon
6abbd036f8 feat: add recordErrorLog option to NewAPIError for conditional error logging 2025-08-02 11:07:50 +08:00
CaIon
ef0db0f914 feat: implement key mode for multi-key channels with append/replace options 2025-08-02 10:57:03 +08:00
CaIon
953f1bdc3c feat: add admin info to error logging with multi-key support 2025-08-01 18:19:28 +08:00
Seefs
f995e31d04 Revert "feat: add Claude Code channel support with OAuth integration" 2025-07-31 22:08:16 +08:00
Seefs
345fbdf3d2 Merge branch 'alpha' into feature/claude-code
# Conflicts:
#	web/src/components/table/channels/modals/EditChannelModal.jsx
2025-07-31 21:19:43 +08:00
CaIon
196bafff03 fix: 修复被禁用的渠道无法测试的问题 2025-07-31 10:56:51 +08:00
Xyfacai
1f5ef24ecd feat: 显式指定 error 跳过重试 2025-07-30 22:35:31 +08:00
CaIon
f7b284ad73 feat: 错误内容脱敏 2025-07-30 19:08:35 +08:00
CaIon
95d46d1dfc fix: auto ban 2025-07-29 23:08:16 +08:00
Seefs
bca78beb1b feat: add claude code channel 2025-07-26 18:06:46 +08:00
Calcium-Ion
a4356727e9 Merge pull request #1437 from Raymondxox/fix
判断兑换码名称长度,改为按字符长度计算
2025-07-26 14:04:02 +08:00
Raymond
df647e7b42 判断兑换码名称长度,改为按字符长度计算 2025-07-25 22:40:12 +08:00
feitianbubu
352da66bd1 feat: add vidu video channel 2025-07-24 10:14:25 +08:00
CaIon
ae0461692c feat: support ollama claude format 2025-07-23 20:01:03 +08:00
CaIon
756a8c50d6 fix: improve error messages for channel retrieval failures in distributor and relay 2025-07-23 16:32:52 +08:00
feitianbubu
7bc9192f3f chore: opt video channel and platform 2025-07-22 20:14:24 +08:00
feitianbubu
fcc006ecd3 feat: channel kling support New API 2025-07-21 21:38:53 +08:00
IcedTangerine
952b679ca3 Merge pull request #1352 from wzxjohn/feature/simple_stripe
Add stripe support and fix wrong top up loading state
2025-07-18 22:00:52 +08:00
Calcium-Ion
c36c920b34 Merge pull request #1349 from feitianbubu/pr/fix-kling-image-mode-name
fix: KlingText2VideoRequest image and model_name
2025-07-18 20:47:10 +08:00
t0ng7u
15f65bb558 🌐 feat: add configurable USD exchange-rate support across backend & frontend
Backend
- setting/payment.go: introduce default `USDExchangeRate` (7.3)
- model/option.go:
  • inject `USDExchangeRate` into `InitOptionMap`
  • persist & sync value in `updateOptionMap`
- controller/misc.go: expose `usd_exchange_rate` via `/api/status`

Frontend
- OperationSetting.js & SettingsGeneral.js:
  • extend state/inputs with `USDExchangeRate`
  • add form field “美元汇率 (non-top-up rate, pricing only)”
- ModelPricing.js already consumes `status.usd_exchange_rate`; no change needed

API
- Administrators can update the rate via `PUT /api/option` (key: `USDExchangeRate`)
- All clients receive the latest rate through `GET /api/status`

This closes the end-to-end flow for displaying model prices in both USD and CNY based on a configurable exchange rate.
2025-07-17 23:04:45 +08:00
CaIon
b161d6831f fix: 修复playground优先级失效 2025-07-17 22:26:38 +08:00
CaIon
9a239d9e13 refactor: initialize channel cache after channel operations to ensure data consistency 2025-07-17 20:04:26 +08:00
CaIon
6f81f2d143 fix: 修复vertex渠道编辑密钥功能失效 2025-07-17 19:29:28 +08:00
Calcium-Ion
2911b9cd04 Merge pull request #1368 from RedwindA/fix/embedding-test
fix: 修复Gemini渠道的向量模型测试
2025-07-17 19:16:10 +08:00
feitianbubu
a100baf57f fix: playground chat 2025-07-16 23:47:59 +08:00
wzxjohn
fb9b5d31e8 Merge branch 'alpha' into feature/simple_stripe 2025-07-16 10:39:11 +08:00
t0ng7u
06ad5e3f8c 🐛 fix: multi-key channel sync and Vertex-AI key-upload edge cases
Backend
1. controller/channel.go
   • Always hydrate `ChannelInfo` from DB in `UpdateChannel`, keeping `IsMultiKey` true so `MultiKeySize` is recalculated.

2. model/channel.go
   • getKeys(): accept both newline-separated keys and JSON array (`[ {...}, {...} ]`).
   • Update(): reuse new parser-logic to recalc `MultiKeySize`; prune stale indices in `MultiKeyStatusList`.

Frontend
1. pages/Channel/EditChannel.js
   • `handleVertexUploadChange`
     – Reset `vertexErroredNames` on every change so the “ignored files” prompt always re-appears.
     – In single-key mode keep only the last file; in batch mode keep all valid files.
     – Parse files, display “以下文件解析失败,已忽略:…”.
   • Batch-toggle checkbox
     – When switching from batch→single while multiple files are present, show a confirm dialog and retain only the first file (synchronises state, form and local caches).
   • On opening the “new channel” side-sheet, clear `vertexErroredNames` to restore error prompts.

Result
• “已启用 x/x” count updates immediately after editing multi-key channels.
• Vertex-AI key upload works intuitively: proper error feedback, no duplicated files, and safe down-switch from batch to single mode.
2025-07-15 12:02:04 +08:00
Xyfacai
456475d593 refactor: format api page query and err result 2025-07-14 22:03:22 +08:00
t0ng7u
a36ce199ba feat: implement backend channel duplication & streamline frontend copy flow
Add a dedicated backend endpoint to clone an existing channel (including its key) and
replace all previous front-end cloning logic with a single API call.

Backend
• controller/channel.go
  – add CopyChannel: safely clone a channel, reset balance/usage, append name suffix,
    preserve key, create abilities, return new ID.
  – supports optional query params: `suffix`, `reset_balance`.
• router/api-router.go
  – register POST /api/channel/copy/:id (secured by AdminAuth).
• model interaction uses BatchInsertChannels to ensure transactional integrity.

Frontend
• ChannelsTable.js
  – simplify copySelectedChannel: call /api/channel/copy/{id} and refresh list.
  – remove complex field-manipulation & key-fetching logic.
  – improved error handling.

Security & stability
• All cloning done server-side; sensitive key never exposed to client.
• Route inherits existing admin middleware.
• Graceful JSON responses with detailed error messages.
2025-07-14 21:54:53 +08:00
RedwindA
93b6f1066b 🎨 feat(channel-test): Enhance request conversion for Embedding models and update input type 2025-07-14 16:59:48 +08:00
CaIon
20607b0b5c feat(logs): add multi-key support in LogsTable and enhance log info generation 2025-07-12 15:14:55 +08:00
CaIon
50b76f4466 feat(channel): improve channel cache handling and add error checks for disabled channels 2025-07-12 14:20:59 +08:00
CaIon
23e4e25e9a feat(channel): implement thread-safe polling 2025-07-12 11:17:08 +08:00
CaIon
85efea3fb8 feat(channel): implement multi-key mode handling and improve channel update logic 2025-07-11 21:12:17 +08:00
wzxjohn
8cc747ef22 fix: for AI review problems 2025-07-10 20:55:43 +08:00
wzxjohn
e8ae980104 feat: add stripe topup page 2025-07-10 20:28:29 +08:00
CaIon
cd8c23c0ab feat(channel): enhance channel status management 2025-07-10 17:49:53 +08:00
wzxjohn
7443129e18 feat: add stripe pay api support 2025-07-10 16:29:38 +08:00
CaIon
cb16bf552e Merge branch 'alpha' into refactor_error
# Conflicts:
#	controller/channel.go
#	middleware/distributor.go
#	model/channel.go
#	model/user.go
#	model/user_cache.go
#	relay/common/relay_info.go
2025-07-10 15:11:55 +08:00
CaIon
98952198bb refactor: Introduce standardized API error
This commit refactors the application's error handling mechanism by introducing a new standardized error type, `types.NewAPIError`. It also renames common JSON utility functions for better clarity.

Previously, internal error handling was tightly coupled to the `dto.OpenAIError` format. This change decouples the internal logic from the external API representation.

Key changes:
- A new `types.NewAPIError` struct is introduced to serve as a canonical internal representation for all API errors.
- All relay adapters (OpenAI, Claude, Gemini, etc.) are updated to return `*types.NewAPIError`.
- Controllers now convert the internal `NewAPIError` to the client-facing `OpenAIError` format at the API boundary, ensuring backward compatibility.
- Channel auto-disable/enable logic is updated to use the new standardized error type.
- JSON utility functions are renamed to align with Go's standard library conventions (e.g., `UnmarshalJson` -> `Unmarshal`, `EncodeJson` -> `Marshal`).
2025-07-10 15:02:40 +08:00
CaIon
338e914a60 🔧 refactor(channel): add validation for CHANNEL_TEST_FREQUENCY in automatic tests 2025-07-10 11:31:07 +08:00