Skip to content

feat: conditionally set Gemini ThinkingBudget based on MaxOutputTokens - #1278

Merged
Calcium-Ion merged 25 commits into
mainfrom
alpha
Jun 21, 2025
Merged

feat: conditionally set Gemini ThinkingBudget based on MaxOutputTokens#1278
Calcium-Ion merged 25 commits into
mainfrom
alpha

Conversation

@Calcium-Ion

@Calcium-Ion Calcium-Ion commented Jun 21, 2025

Copy link
Copy Markdown
Member

Summary by CodeRabbit

  • New Features

    • Added persistent unread announcement tracking and notification badge in the header, with a new shine animation for unread notifications.
    • Enhanced notice modal with tabbed views for system announcements and in-app notifications, including unread highlighting and timeline display.
    • Introduced new settings sections for Chats, Drawing, and Payment, each with dedicated management components and improved settings navigation with icons.
    • Added a Data Dashboard settings section for managing data export options.
  • Improvements

    • Sorted announcements by newest first in dashboard settings.
    • Updated visual style of settings tabs to use card layout and icons for better navigation.
    • Refined Gemini model settings and ratio logic for more accurate configuration.
    • Improved localization and updated English translations for new and existing features.
  • Removals

    • Removed drawing, data dashboard, and chat settings from the operation settings section.
    • Eliminated server address and payment configuration from system settings.
    • Removed deprecated chat link warning and reset model ratio feature.
  • Bug Fixes

    • Fixed display order of announcements and ensured accurate unread count.
  • Style

    • Added new shine animation for unread notifications and adjusted component margins for improved layout.
  • Chores

    • Cleaned up unused imports and internal code for better maintainability.

PeterDaveHello and others added 25 commits April 29, 2025 22:54
- Add translation "Expose ratio API" for Chinese text "暴露倍率接口"
- Update English locale file (en.json) with new translation entry
- Change message from "已与上游倍率完全一致,无需同步" to "未找到差异化倍率,无需同步"
- Update English translation to "No differential ratio found, no synchronization is required"
- Improve user experience clarity for upstream ratio synchronization status
- Add icons to each settings tab to enhance visual recognition
- Import necessary Lucide React icons (Settings, Calculator, Gauge, Shapes, etc.)
- Create consistent tab styling with icons aligned next to text
- Reorder tabs to place "Other Settings" as the last option
- Improve overall settings page UI with better visual hierarchy
- Create new ChatsSetting component for managing chat configurations
- Add "Chat Settings" tab with MessageSquare icon in settings page
- Remove chat settings section from OperationSetting component
- Update import path to use Chat directory structure
- Create a new DrawingSetting component for managing drawing-related configurations
- Add a dedicated "Drawing Settings" tab with Palette icon in the settings page
- Remove drawing settings section from the OperationSetting component
- Update import path to use Drawing directory instead of Operation directory
- Improve UI organization by separating drawing settings from general operations
…ection

This commit relocates the DataDashboard settings component from the Operation section to the Dashboard section for better logical organization. The changes include:

- Remove DataDashboard import and component from OperationSetting.js
- Add DataDashboard component to DashboardSetting.js
- Update import path from Operation to Dashboard directory
- Add DataExport related state management in DashboardSetting

This restructuring improves the application's information architecture by grouping related dashboard visualization settings together.
Restructure payment settings into a separate tab for better organization and user experience. The changes include:

1. Create dedicated Payment components in the Setting directory structure
2. Move payment-related settings from SystemSetting to PaymentSetting
3. Add proper i18n support with useTranslation hook
4. Split payment settings into GeneralPayment and PaymentGateway components
5. Fix internationalization issues in placeholder text
6. Update navigation with CreditCard icon for payment tab

This refactoring improves code maintainability by following the established project pattern of having specialized setting components in their own directories.
feat(model-ratio): add default ratios for new Gemini models and refine flash model handling
feat: allow for a lower percentage of the thinkingBudget
refactor: optimize Dockerfile apk usage
…lance

feat: add moonshot(kimi) update balance
…l, and shine animation

• HeaderBar
  - Added dynamic unread badge; click now opens NoticeModal on “System Announcements” tab
  - Passes `defaultTab` and `unreadKeys` props to NoticeModal for contextual behaviour

• NoticeModal
  - Introduced Tabs inside the modal title with Lucide icons (Bell, Megaphone)
  - Displays in-app notice (markdown) and system announcements separately
  - Highlights unread announcements with “shine” text animation
  - Accepts new props `defaultTab`, `unreadKeys` to control initial tab and highlight logic

• CSS (index.css)
  - Implemented `sweep-shine` keyframes and `.shine-text` utility for left-to-right glow
  - Added dark-mode variant for better contrast
  - Ensured cross-browser support with standard `background-clip`

Overall, users now see an unread counter, are directed to new announcements automatically, and benefit from an eye-catching glow effect that works in both light and dark themes.
Add reverse-chronological sorting for the announcements list so that the newest
items appear first in the dashboard.

No API changes; this only affects front-end display and user notifications.
@coderabbitai

coderabbitai Bot commented Jun 21, 2025

Copy link
Copy Markdown
Contributor

Caution

Review failed

The pull request is closed.

Walkthrough

This update introduces new settings sections and components for chat, drawing, and payment management in the web application's settings interface, along with enhanced notification handling and visual improvements. It also refines backend logic for model ratios, channel billing, and Gemini pricing, while removing deprecated or redundant settings and updating localization strings and styles for improved usability and clarity.

Changes

File(s) Change Summary
Dockerfile Streamlined Alpine package installation by combining apk upgrade and apk add with --no-cache, removing explicit apk update.
controller/channel-billing.go Added Moonshot channel balance update logic and integrated it into the channel balance updater.
relay/channel/gemini/relay-gemini.go Refined ThinkingBudget assignment logic in Gemini relay; removed unused variable.
setting/operation_setting/tools.go Added Gemini 2.5 flash audio price constants and improved model prefix matching in audio price function.
setting/ratio_setting/model_ratio.go Added new model ratios, normalized gizmo model names, and refined ratio logic for Gemini 2.5 flash variants.
web/src/components/layout/HeaderBar.js Added unread system announcement tracking, bell icon badge, and modal logic for marking announcements as read.
web/src/components/layout/NoticeModal.js Added tabbed modal for in-app vs. system announcements, unread highlighting, and timeline view.
web/src/components/settings/ChatsSetting.js New component for managing chat-related settings, fetching options from API.
web/src/components/settings/DashboardSetting.js Added Data Dashboard settings section with new state fields and card.
web/src/components/settings/DrawingSetting.js New component for drawing-related settings, fetching and parsing options from API.
web/src/components/settings/OperationSetting.js Removed drawing, data dashboard, and chat settings from operation settings UI and state.
web/src/components/settings/PaymentSetting.js New component for payment-related settings, including fetching, parsing, and updating payment options.
web/src/components/settings/RateLimitSetting.js Removed unused imports; reformatted data loop.
web/src/components/settings/RatioSetting.js Changed tabs from 'line' to 'card' style.
web/src/components/settings/SystemSetting.js Removed all server address and payment configuration logic and UI.
web/src/i18n/locales/en.json Updated and added localization strings, especially for payment and settings UI.
web/src/index.css Added shine animation styles for unread notification highlighting.
web/src/pages/Setting/Chat/SettingsChats.js Removed unused imports and reset function; updated section and banner text.
web/src/pages/Setting/Dashboard/SettingsAnnouncements.js Ensured announcements are sorted by publish date in descending order for pagination.
web/src/pages/Setting/Model/SettingGeminiModel.js Lowered minimum value for Gemini thinking budget percentage and updated description.
web/src/pages/Setting/Operation/SettingsGeneral.js Removed deprecated chat link warning banner.
web/src/pages/Setting/Payment/SettingsGeneralPayment.js New component for updating general payment server address.
web/src/pages/Setting/Payment/SettingsPaymentGateway.js New component for managing payment gateway settings with validation and update logic.
web/src/pages/Setting/Ratio/ModelRationNotSetEditor.js
web/src/pages/Setting/Ratio/ModelSettingsVisualEditor.js
Added top margin to button/search containers.
web/src/pages/Setting/Ratio/UpstreamRatioSync.js Updated success message for ratio synchronization.
web/src/pages/Setting/index.js Added icons to all settings tabs; introduced new tabs for chat, drawing, and payment settings; reordered tabs and changed style to 'card'.

Sequence Diagram(s)

sequenceDiagram
    participant User
    participant HeaderBar
    participant NoticeModal
    participant localStorage

    User->>HeaderBar: Clicks bell icon
    HeaderBar->>NoticeModal: Opens with unreadKeys, defaultTab
    NoticeModal->>User: Shows announcements (tabs: inApp/system)
    User->>NoticeModal: Closes modal
    NoticeModal->>HeaderBar: Triggers handleNoticeClose
    HeaderBar->>localStorage: Marks all announcements as read
    HeaderBar->>HeaderBar: Updates unreadCount
Loading
sequenceDiagram
    participant User
    participant SettingsPage
    participant ChatsSetting
    participant DrawingSetting
    participant PaymentSetting

    User->>SettingsPage: Navigates to Settings
    SettingsPage->>ChatsSetting: Renders tab (if root)
    SettingsPage->>DrawingSetting: Renders tab (if root)
    SettingsPage->>PaymentSetting: Renders tab (if root)
    ChatsSetting->>API: Fetches chat options
    DrawingSetting->>API: Fetches drawing options
    PaymentSetting->>API: Fetches payment options
Loading

Possibly related PRs

  • QuantumNous/new-api#1247: Refactors and centralizes thinking budget clamping logic in the same function and file as the changes made to CovertGemini2OpenAI in this PR.

Poem

A rabbit hopped through settings new,
With tabs and icons, quite a view!
Announcements now will shine and blink,
While payments, chats, and drawings sync.
Ratios, prices, all aligned—
In every corner, polish you'll find.
🐇✨ Settings spring, so well designed!


📜 Recent review details

Configuration used: CodeRabbit UI
Review profile: CHILL
Plan: Pro

📥 Commits

Reviewing files that changed from the base of the PR and between 59574dc and 6bb5521.

📒 Files selected for processing (27)
  • Dockerfile (1 hunks)
  • controller/channel-billing.go (3 hunks)
  • relay/channel/gemini/relay-gemini.go (1 hunks)
  • setting/operation_setting/tools.go (2 hunks)
  • setting/ratio_setting/model_ratio.go (4 hunks)
  • web/src/components/layout/HeaderBar.js (6 hunks)
  • web/src/components/layout/NoticeModal.js (4 hunks)
  • web/src/components/settings/ChatsSetting.js (1 hunks)
  • web/src/components/settings/DashboardSetting.js (4 hunks)
  • web/src/components/settings/DrawingSetting.js (1 hunks)
  • web/src/components/settings/OperationSetting.js (0 hunks)
  • web/src/components/settings/PaymentSetting.js (1 hunks)
  • web/src/components/settings/RateLimitSetting.js (2 hunks)
  • web/src/components/settings/RatioSetting.js (1 hunks)
  • web/src/components/settings/SystemSetting.js (0 hunks)
  • web/src/i18n/locales/en.json (3 hunks)
  • web/src/index.css (1 hunks)
  • web/src/pages/Setting/Chat/SettingsChats.js (1 hunks)
  • web/src/pages/Setting/Dashboard/SettingsAnnouncements.js (1 hunks)
  • web/src/pages/Setting/Model/SettingGeminiModel.js (1 hunks)
  • web/src/pages/Setting/Operation/SettingsGeneral.js (0 hunks)
  • web/src/pages/Setting/Payment/SettingsGeneralPayment.js (1 hunks)
  • web/src/pages/Setting/Payment/SettingsPaymentGateway.js (1 hunks)
  • web/src/pages/Setting/Ratio/ModelRationNotSetEditor.js (1 hunks)
  • web/src/pages/Setting/Ratio/ModelSettingsVisualEditor.js (1 hunks)
  • web/src/pages/Setting/Ratio/UpstreamRatioSync.js (1 hunks)
  • web/src/pages/Setting/index.js (4 hunks)
✨ Finishing Touches
  • 📝 Generate Docstrings

🪧 Tips

Chat

There are 3 ways to chat with CodeRabbit:

  • Review comments: Directly reply to a review comment made by CodeRabbit. Example:
    • I pushed a fix in commit <commit_id>, please review it.
    • Explain this complex logic.
    • Open a follow-up GitHub issue for this discussion.
  • Files and specific lines of code (under the "Files changed" tab): Tag @coderabbitai in a new review comment at the desired location with your query. Examples:
    • @coderabbitai explain this code block.
    • @coderabbitai modularize this function.
  • PR comments: Tag @coderabbitai in a new PR comment to ask questions about the PR branch. For the best results, please provide a very specific query, as very limited context is provided in this mode. Examples:
    • @coderabbitai gather interesting stats about this repository and render them as a table. Additionally, render a pie chart showing the language distribution in the codebase.
    • @coderabbitai read src/utils.ts and explain its main purpose.
    • @coderabbitai read the files in the src/scheduler package and generate a class diagram using mermaid and a README in the markdown format.
    • @coderabbitai help me debug CodeRabbit configuration file.

Support

Need help? Create a ticket on our support page for assistance with any issues or questions.

Note: Be mindful of the bot's finite context window. It's strongly recommended to break down tasks such as reading entire modules into smaller chunks. For a focused discussion, use review comments to chat about specific files and their changes, instead of using the PR comments.

CodeRabbit Commands (Invoked using PR comments)

  • @coderabbitai pause to pause the reviews on a PR.
  • @coderabbitai resume to resume the paused reviews.
  • @coderabbitai review to trigger an incremental review. This is useful when automatic reviews are disabled for the repository.
  • @coderabbitai full review to do a full review from scratch and review all the files again.
  • @coderabbitai summary to regenerate the summary of the PR.
  • @coderabbitai generate docstrings to generate docstrings for this PR.
  • @coderabbitai generate sequence diagram to generate a sequence diagram of the changes in this PR.
  • @coderabbitai resolve resolve all the CodeRabbit review comments.
  • @coderabbitai configuration to show the current CodeRabbit configuration for the repository.
  • @coderabbitai help to get help.

Other keywords and placeholders

  • Add @coderabbitai ignore anywhere in the PR description to prevent this PR from being reviewed.
  • Add @coderabbitai summary to generate the high-level summary at a specific location in the PR description.
  • Add @coderabbitai anywhere in the PR title to generate the title automatically.

CodeRabbit Configuration File (.coderabbit.yaml)

  • You can programmatically configure CodeRabbit by adding a .coderabbit.yaml file to the root of your repository.
  • Please see the configuration documentation for more information.
  • If your editor has YAML language server enabled, you can add the path at the top of this file to enable auto-completion and validation: # yaml-language-server: $schema=https://coderabbit.ai/integrations/schema.v2.json

Documentation and Community

  • Visit our Documentation for detailed information on how to use CodeRabbit.
  • Join our Discord Community to get help, request features, and share feedback.
  • Follow us on X/Twitter for updates and announcements.

@Calcium-Ion
Calcium-Ion merged commit cf4700a into main Jun 21, 2025
@coderabbitai coderabbitai Bot mentioned this pull request Jun 22, 2025
@coderabbitai coderabbitai Bot mentioned this pull request Jul 28, 2025
@coderabbitai coderabbitai Bot mentioned this pull request Mar 22, 2026
x22x22 pushed a commit to x22x22/new-api that referenced this pull request Apr 24, 2026
feat: conditionally set Gemini ThinkingBudget based on MaxOutputTokens
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

5 participants