Commit Graph
408 Commits
Author SHA1 Message Date
t0ng7u 1d578b73ce 🖼️ chore: format code file 2025-08-10 12:11:31 +08:00
Calcium-Ion f942361f7b Merge pull request #1496 from Bliod-Cook/feat-linuxdo-minumum-trust-level
feat: allow admin to restrict the minimum linuxdo trust level to register
2025-08-10 10:27:40 +08:00
CaIon f6c7828160 feat: implement moonshot adaptor for request handling and response processing 2025-08-08 17:28:21 +08:00
CaIon daa7a13505 feat: 完善格式抓换,修复gemini渠道和openai渠道在claude code中使用的问题 2025-08-08 16:45:37 +08:00
t0ng7u 8fba0017c7 ✨ feat(pricing+endpoints+ui): wire custom endpoint mapping end‑to‑end and overhaul visual JSON editor
Backend (Go)
- Include custom endpoints in each model’s SupportedEndpointTypes by parsing Model.Endpoints (JSON) and appending keys alongside native endpoint types.
- Build a global supportedEndpointMap map[string]EndpointInfo{path, method} by:
  - Seeding with native defaults.
  - Overriding/adding from models.endpoints (accepts string path → default POST, or {path, method}).
- Expose supported_endpoint at the top level of /api/pricing (vendors-like), removing per-model duplication.
- Fix default path for EndpointTypeOpenAIResponse to /v1/responses.
- Keep concurrency/caching for pricing retrieval intact.

Frontend (React)
- Fetch supported_endpoint in useModelPricingData and propagate to PricingPage → ModelDetailSideSheet → ModelEndpoints.
- ModelEndpoints
  - Resolve path+method via endpointMap; replace {model} with actual model name.
  - Fix mobile visibility; always show path and HTTP method.
- JSONEditor
  - Wrap with Form.Slot to inherit form layout; simplify visual styles.
  - Use Tabs for “Visual” / “Manual” modes.
  - Unify editors: key-value editor now supports nested JSON:
    - “+” to convert a primitive into an object and add nested fields.
    - Add “Convert to value” for two‑way toggle back from object.
    - Stable key rename without reordering rows; new rows append at bottom.
    - Use Row/Col grid for clean alignment; region editor uses Form.Slot + grid.
- Editing flows
  - EditModelModal / EditPrefillGroupModal use JSONEditor (editorType='object') for endpoint mappings.
  - PrefillGroupManagement renders endpoint group items by JSON keys.

Data expectations / compatibility
- models.endpoints should be a JSON object mapping endpoint type → string path or {path, method}. Strings default to POST.
- No schema changes; existing TEXT field continues to store JSON.

QA
- /api/pricing now returns custom endpoint types and global supported_endpoint.
- UI shows both native and custom endpoints; paths/methods render on mobile; nested editing works and preserves order.
2025-08-08 02:34:15 +08:00
Bliod-Cook 3feeca627c feat: allow admin to restrict the minimum linuxdo trust level to register 2025-08-04 17:19:38 +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
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 e3d3e697d3 fix: WriteContentType panic 2025-07-30 20:31:51 +08:00
CaIon f7b284ad73 feat: 错误内容脱敏 2025-07-30 19:08:35 +08:00
Seefs bca78beb1b feat: add claude code channel 2025-07-26 18:06:46 +08:00
feitianbubu 3538cefe68 fix: page query param is p 2025-07-21 15:39:16 +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 5541026b86 Merge pull request #1190 from feitianbubu/fix-nil-request-id
fix: default request ID to 'SYSTEM' for background tasks
2025-07-18 20:48:15 +08:00
Calcium-Ion 514fea65c4 Merge pull request #1363 from feitianbubu/pr/add-jimeng-image
feat: 增加即梦生图功能
2025-07-18 20:45:49 +08:00
wzxjohn fb9b5d31e8 Merge branch 'alpha' into feature/simple_stripe 2025-07-16 10:39:11 +08:00
Xyfacai 456475d593 refactor: format api page query and err result 2025-07-14 22:03:22 +08:00
feitianbubu aa8d112c58 feat: add jimeng image 2025-07-13 13:36:33 +08:00
wzxjohn 8cc747ef22 fix: for AI review problems 2025-07-10 20:55:43 +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
Xiangyuan-liu 7b29f429ee refactor: log params and channel params
refactor: log params and channel params
2025-07-07 14:26:37 +08:00
CaIon 9546a47f2b ✨ feat(tokens): add cherryConfig support for URL generation and base64 encoding 2025-07-06 20:56:09 +08:00
CaIon f0f277dc2a 🔧 refactor(auth, channel, context): improve context setup and validation for multi-key channels 2025-07-06 12:37:56 +08:00
CaIon 30fb349d91 ✨ feat(endpoint types): add support for image generation models in endpoint type handling 2025-07-05 14:14:40 +08:00
CaIon 6ac7878863 🔧 refactor(endpoint types): comment out unused endpoint types in constants 2025-07-04 15:53:46 +08:00
t0ng7u bf577b8937 🔌 feat(api): extend endpoint type support & expose in pricing UI
* backend
  - constant/endpoint_type.go
    • Add EndpointTypeMidjourney, EndpointTypeSuno, EndpointTypeKling, EndpointTypeJimeng.
  - common/endpoint_type.go
    • Map Midjourney / MidjourneyPlus, SunoAPI, Kling, Jimeng channel types to the new endpoint types.

* frontend
  - ModelPricing.js
    • Add “Supported Endpoint Type” column.
    • Implement renderSupportedEndpoints with `stringToColor` for consistent tag colors.

These changes allow `/api/pricing` and model lists to return accurate
`supported_endpoint_types` covering all non-OpenAI providers and display
them clearly in the UI.

No breaking changes.
2025-07-04 03:15:34 +08:00
CaIon 7e298f8ad1 ✨ feat: refactor environment variable initialization and introduce new constant types for API and context keys 2025-07-03 13:10:25 +08:00
CaIon 389a4c3e4c Merge branch 'main' into alpha 2025-07-01 13:15:47 +08:00
CaIon eb265a55e1 ✨ feat: enhance environment configuration and resource initialization 2025-07-01 13:13:30 +08:00
CaIon 6b9237f868 🐛 fix: refactor JSON unmarshalling across multiple handlers to use UnmarshalJson and UnmarshalJsonStr for consistency
This update replaces instances of DecodeJson and DecodeJsonStr with UnmarshalJson and UnmarshalJsonStr in various relay handlers, enhancing code consistency and clarity in JSON processing. The changes improve maintainability and align with recent refactoring efforts in the codebase.
2025-06-28 00:02:07 +08:00
CaIon 1f4cf07b63 🐛 fix: refactor response body handling in multiple relay handlers to utilize IOCopyBytesGracefully 2025-06-27 23:35:56 +08:00
CaIon 9c08d8cf20 ✨ feat: introduce IOCopyBytesGracefully function for streamlined response body handling
This update adds the IOCopyBytesGracefully function to the common package, which simplifies the process of copying response bodies in the OpenAI handlers. It enhances error handling and ensures proper resource management by encapsulating the logic for setting headers and writing response data. The OpenAI handlers have been refactored to utilize this new function, improving code clarity and maintainability.
2025-06-27 22:36:12 +08:00
CaIon 3002659f47 ✨ feat: add CloseResponseBodyGracefully function to handle HTTP response body closure 2025-06-27 21:37:13 +08:00
skynono 05ea0dd54f feat: add video channel jimeng 2025-06-27 17:08:20 +08:00
Xiangyuan-liu 76da067d40 feat: 优化分页组件 2025-06-25 18:42:19 +08:00
Calcium-Ion 03468e05e4 Merge pull request #1267 from t0ng7u/feature/upstream-ratio-sync
🔄 feat(ratio-sync): introduce upstream ratio synchronisation feature #1220
2025-06-20 16:22:00 +08:00
skynono 8a79de333a feat: add video channel kling 2025-06-19 11:53:42 +08:00
Apple\Apple 7975cdf3bf 🚀 feat(ratio-sync): major refactor & UX overhaul for Upstream Ratio Sync 2025-06-19 08:57:34 +08:00
CaIon 51757b83e1 Merge branch 'alpha' 2025-06-17 14:49:13 +08:00
chenjm b33d808bc1 fix(audio): :bugs: fix webm audio strconv.ParseFloat: parsing "N/A" 2025-06-17 10:04:36 +08:00
chenjm 4559f5b2d3 fix(audio): :bugs: fix webm audio strconv.ParseFloat: parsing "N/A" 2025-06-17 09:21:56 +08:00
RedwindA a7d87475af 🔧 fix(redis): only set expiration if greater than 0 in RedisHSetObj 2025-06-17 02:37:19 +08:00
CaIon b9b4b24961 fix: Resolving conflicts caused by mixing multiple databases 2025-06-14 17:51:05 +08:00
skynono b887db474e fix: default request ID to 'SYSTEM' for background tasks 2025-06-09 22:13:21 +08:00
RedwindA eff9ce117f refactor: rename RedisHDelObj to RedisDelKey and update references 2025-06-05 21:17:57 +08:00
RedwindA 191f521926 fix: change RedisHDelObj to use Del instead of HDel 2025-06-05 20:42:56 +08:00