Conversation
…ENS/CUSTOM)
Replace the legacy boolean “DisplayInCurrencyEnabled” with an injected, type-safe
configuration `general_setting.quota_display_type`, and wire it through the
backend and frontend.
Backend
- Add `QuotaDisplayType` to `operation_setting.GeneralSetting` with injected
registration via `config.GlobalConfig.Register("general_setting", ...)`.
Helpers: `IsCurrencyDisplay()`, `IsCNYDisplay()`, `GetQuotaDisplayType()`.
- Expose `quota_display_type` in `/api/status` and keep legacy
`display_in_currency` for backward compatibility.
- Logger: update `LogQuota` and `FormatQuota` to support USD/CNY/TOKENS. When
CNY is selected, convert using `operation_setting.USDExchangeRate`.
- Controllers:
- `billing`: compute subscription/usage amounts based on the selected type
(USD: divide by `QuotaPerUnit`; CNY: USD→CNY; TOKENS: keep raw tokens).
- `topup` / `topup_stripe`: treat inputs as “amount” for USD/CNY and as
token-count for TOKENS; adjust min topup and pay money accordingly.
- `misc`: include `quota_display_type` in status payload.
- Compatibility: in `model/option.UpdateOption`, map updates to
`DisplayInCurrencyEnabled` → `general_setting.quota_display_type`
(true→USD, false→TOKENS). Keep exporting the legacy key in `OptionMap`.
Frontend
- Settings: replace the “display in currency” switch with a Select
(`general_setting.quota_display_type`) offering USD / CNY / Tokens.
Provide fallback mapping from legacy `DisplayInCurrencyEnabled`.
- Persist `quota_display_type` to localStorage (keep `display_in_currency`
for legacy components).
- Rendering helpers: base all quota/price rendering on `quota_display_type`;
use `usd_exchange_rate` for CNY symbol/values.
- Pricing page: default view currency follows site display type (USD/CNY),
while TOKENS mode still allows per-view currency toggling when needed.
Notes
- No database migrations required.
- Legacy clients remain functional via compatibility fields.
# Conflicts: # web/src/components/settings/personal/cards/AccountManagement.jsx # web/src/components/table/channels/modals/EditChannelModal.jsx # web/src/hooks/channels/useChannelsData.jsx # web/src/hooks/common/useSidebar.js # web/src/i18n/locales/fr.json # web/src/pages/Setting/Operation/SettingsGeneral.jsx
feat: Allow FIM chat requests without messages
…improved serialization #1961
refactor: simplify unsupported test channel types
…mproved issue reporting #1960
…for enhanced feature proposal submissions
…for improved feature proposal submissions
💱 feat(settings): introduce site-wide quota display type
…ts based on user settings
…isplay logic in RechargeCard and render functions
feat: support openAI sdk retrieve videos
- replace infinite sleep loop with time.Ticker to avoid goroutine leaks - add immediate initial test execution before ticker starts - implement frequency change detection and ticker recreation - ensure proper ticker cleanup when loop exits or feature disabled
fix(channel): handle dynamic frequency updates
支持可灵使用openai sdk生成视频
feat: sora 增加参数校验与计费
…seconds, and size
…for multi-platform builds
|
Caution Review failedThe pull request is closed. WalkthroughIntroduces Electron desktop app (code and CI), consolidates release workflows, adds OpenAI-compatible video endpoints and Sora task adaptor, implements quota display types (USD/CNY/TOKENS/CUSTOM), adds legal settings with user-facing pages, extends pricing logic (default price map, OtherRatios), enhances top-up flows and admin ops, updates HTTP client redirect safety, and adjusts multiple adapters (Gemini, Perplexity, Anthropic). Changes
Sequence Diagram(s)sequenceDiagram
autonumber
actor User
participant App as Electron App
participant Bin as Backend Binary (new-api)
participant UI as Renderer (Web)
participant API as Local HTTP API
User->>App: Launch
App->>Bin: Spawn backend (PORT=3000, SQLITE_PATH,…)
App->>API: Health checks (retry)
alt Backend ready
App->>UI: Create window/tray, load http://127.0.0.1:3000
else Crash/Errors
App->>User: Show error dialog (analyzed logs, actions)
end
User->>UI: Interact
UI->>API: Requests (local)
sequenceDiagram
autonumber
actor Client
participant GW as Gateway (/v1/videos)
participant Task as Task Subsystem
participant Chan as Channel Adaptor (Sora/Kling/…)
participant Up as Upstream Provider
Client->>GW: POST /v1/videos (submit)
GW->>Task: Validate & create task
Task->>Chan: BuildRequest & DoRequest
Chan->>Up: Submit job
Up-->>Chan: Task accepted (id)
Chan-->>Task: Response (task_id, data)
Task-->>Client: 202 Accepted (task_id)
Client->>GW: GET /v1/videos/:task_id
GW->>Task: Fetch status/data
alt OpenAI video path
Task->>Chan: ConvertToOpenAIVideo
Chan-->>GW: OpenAIVideo JSON
GW-->>Client: 200 OpenAIVideo
else Default
GW-->>Client: 200 Task JSON
end
Client->>GW: GET /v1/videos/:task_id/content
GW->>Up: Proxy GET content with Authorization
Up-->>GW: Stream video
GW-->>Client: Stream with headers (cacheable)
sequenceDiagram
autonumber
participant FE as Frontend
participant API as Backend API
participant Settings as Operation/System Settings
FE->>API: GET /api/status
API->>Settings: GetQuotaDisplayType, currency symbol/rate
Settings-->>API: DisplayType (USD/CNY/TOKENS/CUSTOM)
API-->>FE: Status (quota_display_type, symbols, flags)
FE->>API: Billing/Usage requests
API->>Settings: Resolve display mode
API-->>FE: Amounts formatted per mode
Estimated code review effort🎯 5 (Critical) | ⏱️ ~120+ minutes Possibly related PRs
Suggested reviewers
Poem
✨ Finishing touches
🧪 Generate unit tests (beta)
📜 Recent review detailsConfiguration used: CodeRabbit UI Review profile: CHILL Plan: Pro ⛔ Files ignored due to path filters (6)
📒 Files selected for processing (107)
⛔ Files not processed due to max files limit (24)
Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out. Comment |
Summary by CodeRabbit
New Features
Improvements
Documentation
Chores