Skip to content

解锁deepseek补全倍率;允许deepseek渠道获取模型#1913

Merged
seefs001 merged 1 commit into
QuantumNous:mainfrom
RedwindA:fix/deepseek-ratio
Sep 29, 2025
Merged

解锁deepseek补全倍率;允许deepseek渠道获取模型#1913
seefs001 merged 1 commit into
QuantumNous:mainfrom
RedwindA:fix/deepseek-ratio

Conversation

@RedwindA
Copy link
Copy Markdown
Contributor

@RedwindA RedwindA commented Sep 29, 2025

PR 类型

  • Bug 修复
  • 新功能
  • 文档更新
  • 其他

PR 是否包含破坏性更新?

PR 描述

  • 由于deepseek官方价格更新,现解除硬编码的补全倍率;
  • 补充了之前遗漏的deepseek渠道白名单

Summary by CodeRabbit

  • New Features

    • Enabled fetching upstream models for an additional channel type, expanding compatibility when editing channels.
  • Refactor

    • Updated model ratio handling: specific models (e.g., deepseek-chat and deepseek-reasoner) no longer use a hardcoded ratio and now follow standard/default or configured ratios, aligning behavior with other models.

@coderabbitai
Copy link
Copy Markdown
Contributor

coderabbitai Bot commented Sep 29, 2025

Walkthrough

Two changes: removed hardcoded model ratio handling for specific model names in Go, and added numeric type 43 to the set of fetchable channel types in a React modal.

Changes

Cohort / File(s) Summary
Model ratio resolution
setting/ratio_setting/model_ratio.go
Removed lowercase name derivation and special-case ratios for "deepseek-chat" and "deepseek-reasoner"; these models now follow the general ratio determination path.
UI fetchable types expansion
web/src/components/table/channels/modals/EditChannelModal.jsx
Added type 43 to MODEL_FETCHABLE_TYPES, enabling upstream model fetching for this additional channel type.

Sequence Diagram(s)

sequenceDiagram
  autonumber
  actor Caller
  participant Ratio as getHardcodedCompletionModelRatio
  participant Config as Config/Defaults

  Caller->>Ratio: Request ratio for model name
  alt General cases (incl. deepseek-*)
    Ratio->>Config: Resolve via configured/default ratios
    Config-->>Ratio: Ratio value
  end
  Ratio-->>Caller: Return ratio
  note over Ratio: Special-case short-circuit for deepseek-* removed
Loading
sequenceDiagram
  autonumber
  actor User
  participant Modal as EditChannelModal
  participant Types as MODEL_FETCHABLE_TYPES
  participant API as Upstream Models API

  User->>Modal: Open edit channel (type X)
  Modal->>Types: Check if type ∈ set
  alt Type included (e.g., 43)
    Modal->>API: Fetch upstream models
    API-->>Modal: Models list
    Modal-->>User: Populate selector
  else Type not included
    Modal-->>User: Skip fetching
  end
Loading

Estimated code review effort

🎯 2 (Simple) | ⏱️ ~10 minutes

Poem

A twitch of whiskers, code hops by,
Ratios freed from special tie.
Type forty-three joins the crew—hooray!
Modals fetch without delay.
In burrows deep, our tests will sing,
Thump, thump—ship this spring! 🐇✨

Pre-merge checks and finishing touches

❌ Failed checks (1 warning)
Check name Status Explanation Resolution
Docstring Coverage ⚠️ Warning Docstring coverage is 0.00% which is insufficient. The required threshold is 80.00%. You can run @coderabbitai generate docstrings to improve docstring coverage.
✅ Passed checks (2 passed)
Check name Status Explanation
Description Check ✅ Passed Check skipped - CodeRabbit’s high-level summary is enabled.
Title Check ✅ Passed The title clearly and concisely summarizes the two primary changes in the PR—removing the hard-coded completion multiplier for Deepseek and enabling the Deepseek channel to fetch models—without extraneous details or vague wording.
✨ Finishing touches
  • 📝 Generate Docstrings
🧪 Generate unit tests
  • Create PR with unit tests
  • Post copyable unit tests in a comment

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

Comment @coderabbitai help to get the list of available commands and usage tips.

Copy link
Copy Markdown
Contributor

@coderabbitai coderabbitai Bot left a comment

Choose a reason for hiding this comment

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

Actionable comments posted: 0

🧹 Nitpick comments (1)
web/src/components/table/channels/modals/EditChannelModal.jsx (1)

106-106: Optional: annotate magic number for maintainability

Add a brief comment to label 43 as DeepSeek to aid future readers.

   42,
   105,
   48,
-  43,
+  43, // DeepSeek
 ]
📜 Review details

Configuration used: CodeRabbit UI

Review profile: CHILL

Plan: Pro

📥 Commits

Reviewing files that changed from the base of the PR and between c7a5237 and ca0eaa7.

📒 Files selected for processing (2)
  • setting/ratio_setting/model_ratio.go (0 hunks)
  • web/src/components/table/channels/modals/EditChannelModal.jsx (1 hunks)
💤 Files with no reviewable changes (1)
  • setting/ratio_setting/model_ratio.go
🧰 Additional context used
🧠 Learnings (2)
📚 Learning: 2025-08-27T02:15:25.448Z
Learnt from: AAEE86
PR: QuantumNous/new-api#1658
File: web/src/components/table/channels/modals/EditChannelModal.jsx:555-569
Timestamp: 2025-08-27T02:15:25.448Z
Learning: In EditChannelModal.jsx, the applyModelMapping function transforms the models list by replacing original model names (mapping values) with display names (mapping keys). The database stores this transformed list containing mapped keys. On channel load, data.models contains these mapped display names, making the initialization filter if (data.models.includes(key)) correct.

Applied to files:

  • web/src/components/table/channels/modals/EditChannelModal.jsx
📚 Learning: 2025-08-27T02:15:25.448Z
Learnt from: AAEE86
PR: QuantumNous/new-api#1658
File: web/src/components/table/channels/modals/EditChannelModal.jsx:555-569
Timestamp: 2025-08-27T02:15:25.448Z
Learning: In EditChannelModal.jsx, the database stores mapped keys (display names) in the models field after applying model mapping transformations. When loading a channel, data.models contains the mapped keys, not the original model names. The filtering logic if (data.models.includes(key)) in the initialization is correct.

Applied to files:

  • web/src/components/table/channels/modals/EditChannelModal.jsx
🔇 Additional comments (1)
web/src/components/table/channels/modals/EditChannelModal.jsx (1)

88-107: Approve addition of DeepSeek (type 43) to MODEL_FETCHABLE_TYPES
All UI constants, helpers, routing, and backend adaptors already include type 43, so upstream model fetching works end-to-end.

@seefs001 seefs001 merged commit 9f989fc into QuantumNous:main Sep 29, 2025
1 check passed
@coderabbitai coderabbitai Bot mentioned this pull request Sep 29, 2025
x22x22 pushed a commit to x22x22/new-api that referenced this pull request Apr 24, 2026
解锁deepseek补全倍率;允许deepseek渠道获取模型
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.

2 participants