Skip to content

feat: added "流畅阅读" (FluentRead) as a new chat provider option. - #1541

Merged
Calcium-Ion merged 5 commits into
alphafrom
fluent-read
Aug 10, 2025
Merged

Calcium-Ion merged 5 commits into
alphafrom
fluent-read

Conversation

@Calcium-Ion

@Calcium-Ion Calcium-Ion commented Aug 9, 2025 •

Copy link
Copy Markdown
Member

Summary by CodeRabbit

  • New Features

    • Added "FluentRead(流畅阅读)" as a new chat provider option.
  • Improvements

    • Updated notification messages and button labels to reference "FluentRead(流畅阅读)" for clarity.
    • Enhanced notification logic for model selection and suppression options.
  • Bug Fixes

    • Improved chat list handling to exclude entries linked to "fluent" providers and empty chats from the sidebar.

@coderabbitai

coderabbitai Bot commented Aug 9, 2025 •

Copy link
Copy Markdown
Contributor

Walkthrough

A new chat provider entry "流畅阅读" ("fluentread") was added to the global chat list. The frontend sidebar now filters out chat entries whose links start with "fluent", preventing their display. The token notification UI was updated to reference "FluentRead(流畅阅读)", adjust button logic, and refine suppression and model selection behaviors.

Changes

Cohort / File(s) Change Summary
Backend Chat Provider Addition
setting/chat.go
Added a new chat provider entry named "流畅阅读" ("fluentread") to the global Chats slice, inserted between existing entries. No other logic was changed.
Sidebar Chat Filtering
web/src/components/layout/SiderBar.js
Modified chat item processing to filter out chats with links starting with "fluent", and to skip entries without valid text, preventing their display in the sidebar.
Token Notification UI Updates
web/src/components/table/tokens/index.jsx
Updated the notification to reference "FluentRead(流畅阅读)", changed button labels, refined suppression logic, adjusted model selection messaging, and conditionally rendered the "Do not remind again" button.

Sequence Diagram(s)

sequenceDiagram
    participant User
    participant Sidebar
    participant LocalStorage

    User->>Sidebar: Load sidebar
    Sidebar->>LocalStorage: Get chats array
    loop For each chat in chats
        Sidebar->>Sidebar: Check if link starts with "fluent"
        alt Link starts with "fluent"
            Sidebar->>Sidebar: Skip chat
        else Link does not start with "fluent"
            Sidebar->>Sidebar: Add chat to sidebar
        end
    end
Loading
sequenceDiagram
    participant User
    participant TokensPage
    participant LocalStorage

    User->>TokensPage: Trigger openFluentNotification
    TokensPage->>TokensPage: Check if modelOptions is empty
    alt modelOptions is empty
        TokensPage->>TokensPage: Call loadModels()
    end
    TokensPage->>LocalStorage: Check SUPPRESS_KEY
    alt Key is provided
        TokensPage->>TokensPage: Show "请选择模型。" message
        TokensPage->>TokensPage: Hide "Do not remind again" button
    else
        TokensPage->>TokensPage: Show original message
        TokensPage->>TokensPage: Show "Do not remind again" button
    end
    User->>TokensPage: Click "一键填充到 FluentRead" or "Do not remind again"
Loading

Estimated code review effort

🎯 2 (Simple) | ⏱️ ~8 minutes

Poem

In the warren of code, a new chat appears,
"FluentRead" hops in, greeted with cheers!
Sidebar now filters, keeping things neat,
While tokens toast changes with a shiny new treat.
With every hop and every tweak,
Our rabbit hearts are fluent—never meek!
🐇✨

Note

🔌 MCP (Model Context Protocol) integration is now available in Early Access!

Pro users can now connect to remote MCP servers under the Integrations page to get reviews and chat conversations that understand additional development context.


📜 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 a47fc5a and fd2ff2a.

📒 Files selected for processing (1)
  • web/src/components/layout/SiderBar.js (1 hunks)
🚧 Files skipped from review as they are similar to previous changes (1)
  • web/src/components/layout/SiderBar.js
✨ Finishing Touches
  • 📝 Generate Docstrings
🧪 Generate unit tests
  • Create PR with unit tests
  • Post copyable unit tests in a comment
  • Commit unit tests in branch fluent-read

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.

❤️ Share
🪧 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.
  • 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.

Support

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

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 generate unit tests to generate unit tests for 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 changed the title feat: add FluentRead support in chat configuration feat: added "流畅阅读" (FluentRead) as a new chat provider option. Aug 9, 2025

@coderabbitai coderabbitai Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Actionable comments posted: 1

🧹 Nitpick comments (4)
setting/chat.go (2)

15-17: Align display name with UI copy for consistency.

Frontend uses “FluentRead(流畅阅读)”. Consider matching it here to keep UX consistent across surfaces.

-    {
-        "流畅阅读": "fluentread",
-    },
+    {
+        "FluentRead(流畅阅读)": "fluentread",
+    },

8-30: Consider replacing []map[string]string with a typed struct for maintainability.

Using a slice of single-entry maps is error-prone (unordered keys, harder to validate). A struct clarifies intent and enables validation.

Example:

type ChatProvider struct {
    Name string `json:"name"`
    URL  string `json:"url"`
}

var Chats = []ChatProvider{
    {Name: "Cherry Studio", URL: "cherrystudio://providers/api-keys?v=1&data={cherryConfig}"},
    {Name: "FluentRead(流畅阅读)", URL: "fluentread"},
    // ...
}
web/src/components/table/tokens/index.jsx (2)

91-95: Gate model preloading to avoid unnecessary network calls when suppressed or container missing.

Currently, models are preloaded before suppression and container checks, causing background API calls even when the notice won’t show. Optional optimization: check suppression and container first, then preload.

   const SUPPRESS_KEY = 'fluent_notify_suppressed';
-  if (modelOptions.length === 0) {
-    // fire-and-forget; a later effect will refresh the notice content
-    loadModels()
-  }
-  if (!key && localStorage.getItem(SUPPRESS_KEY) === '1') return;
+  if (!key && localStorage.getItem(SUPPRESS_KEY) === '1') return;
   const container = document.getElementById('fluent-new-api-container');
-  if (!container) {
-    Toast.warning(t('未检测到 FluentRead(流畅阅读),请确认扩展已启用'));
-    return;
-  }
+  if (!container) {
+    Toast.warning(t('未检测到 FluentRead(流畅阅读),请确认扩展已启用'));
+    return;
+  }
+  if (modelOptions.length === 0) {
+    // fire-and-forget; a later effect will refresh the notice content
+    loadModels();
+  }

150-198: Unify copy: replace “Fluent” with “FluentRead(流畅阅读)” in handler messages.

Two strings still reference the old name.

-      Toast.error(t('未检测到 Fluent 容器'));
+      Toast.error(t('未检测到 FluentRead(流畅阅读)'));
@@
-    Toast.success(t('已发送到 Fluent'));
+    Toast.success(t('已发送到 FluentRead(流畅阅读)'));
📜 Review details

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

📥 Commits

Reviewing files that changed from the base of the PR and between 72ffe61 and 8639699.

📒 Files selected for processing (2)
  • setting/chat.go (1 hunks)
  • web/src/components/table/tokens/index.jsx (2 hunks)
🔇 Additional comments (6)
web/src/components/table/tokens/index.jsx (6)

98-99: LGTM: updated container-missing warning copy.

Message now matches the new provider name.


105-105: LGTM: updated notification title.

Consistent naming with “FluentRead(流畅阅读)”.


109-112: LGTM: simplified conditional content.

Clearer guidance when a key is already provided.


127-127: LGTM: primary action label updated.

Matches provider naming.


129-137: LGTM: conditionally render “不再提醒” only when no key is provided.

Prevents hiding prompts in key-specific flows; correct onClick side effects.


218-224: Confirm duplicate prevention with Semi UI Notification

We’ve verified that in Semi UI v2.45.0 and later, calling Notification.open with the same id updates the existing notification rather than stacking a new one ([semi.design/feedback/notification][1]). Your useEffect will therefore refresh the open notice as intended—no duplicates will appear.

• Ensure your openFluentNotification implementation consistently passes the same id when reopening the notice.

Citations:
[1] https://semi.design/zh-CN/feedback/notification?utm_source=openai

Comment thread setting/chat.go Resolved

@coderabbitai coderabbitai Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Actionable comments posted: 2

📜 Review details

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

📥 Commits

Reviewing files that changed from the base of the PR and between 8639699 and a47fc5a.

📒 Files selected for processing (2)
  • dto/openai_request.go (1 hunks)
  • web/src/components/layout/SiderBar.js (1 hunks)

Comment thread dto/openai_request.go Resolved
Comment thread web/src/components/layout/SiderBar.js Resolved
@Calcium-Ion
Calcium-Ion merged commit d6b03d4 into alpha Aug 10, 2025
@Calcium-Ion
Calcium-Ion deleted the fluent-read branch October 11, 2025 03:06
x22x22 pushed a commit to x22x22/new-api that referenced this pull request Apr 24, 2026
feat: added "流畅阅读" (FluentRead) as a new chat provider option.
@coderabbitai coderabbitai Bot mentioned this pull request May 7, 2026
9 of 11 tasks
salem-2007 added a commit to salem-2007/new-api that referenced this pull request Sep 10, 2026
feat: added "流畅阅读" (FluentRead) as a new chat provider option.
junjundesk pushed a commit to junjundesk/new-api that referenced this pull request Oct 3, 2026
feat: added "流畅阅读" (FluentRead) as a new chat provider option.
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.

1 participant