Skip to content

feat: channel by tag omit key - #2247

Merged
seefs001 merged 1 commit into
QuantumNous:mainfrom
feitianbubu:pr/channel-omit-key
Nov 19, 2025
Merged

feat: channel by tag omit key#2247
seefs001 merged 1 commit into
QuantumNous:mainfrom
feitianbubu:pr/channel-omit-key

Conversation

@feitianbubu

@feitianbubu feitianbubu commented Nov 19, 2025

Copy link
Copy Markdown
Member

优化渠道tag返回

Summary by CodeRabbit

  • Refactor
    • Updated channel retrieval logic to provide more flexible filtering options when searching by tag.

@coderabbitai

coderabbitai Bot commented Nov 19, 2025

Copy link
Copy Markdown
Contributor

Walkthrough

The GetChannelsByTag function signature is updated to include a new selectAll boolean parameter that controls whether the key field is included in database queries. All call sites across controller and model layers are updated to pass this new parameter, with most passing false to maintain existing behavior.

Changes

Cohort / File(s) Summary
Function Signature Update
model/channel.go
GetChannelsByTag signature expanded to include selectAll parameter; conditional logic added to omit key field when selectAll is false
Call Site Updates
controller/channel.go
All invocations of GetChannelsByTag updated to pass the new selectAll argument (false in all instances: GetAllChannels, SearchChannels, GetTagModels)
Internal Call Update
model/channel.go
EditChannelByTag caller updated to pass new parameters (false, false) to GetChannelsByTag

Estimated code review effort

🎯 2 (Simple) | ⏱️ ~8 minutes

  • Straightforward parameter addition with consistent updates across three call sites
  • Conditional field inclusion logic is minimal and easy to verify
  • No error handling or control flow changes

Poem

🐰 A new selectAll hops into play,
Three call sites updated without delay,
The key field now dancing to a parameter's tune,
False keeps it hidden—a simple bassoon! 🎶

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 'feat: channel by tag omit key' directly reflects the main change: adding a selectAll parameter to GetChannelsByTag that controls whether the key field is omitted from the query.
✨ Finishing touches
  • 📝 Generate docstrings
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Post copyable unit tests in a comment

Tip

📝 Customizable high-level summaries are now available in beta!

You can now customize how CodeRabbit generates the high-level summary in your pull requests — including its content, structure, tone, and formatting.

  • Provide your own instructions using the high_level_summary_instructions setting.
  • Format the summary however you like (bullet lists, tables, multi-section layouts, contributor stats, etc.).
  • Use high_level_summary_in_walkthrough to move the summary from the description to the walkthrough section.

Example instruction:

"Divide the high-level summary into five sections:

  1. 📝 Description — Summarize the main change in 50–60 words, explaining what was done.
  2. 📓 References — List relevant issues, discussions, documentation, or related PRs.
  3. 📦 Dependencies & Requirements — Mention any new/updated dependencies, environment variable changes, or configuration updates.
  4. 📊 Contributor Summary — Include a Markdown table showing contributions:
    | Contributor | Lines Added | Lines Removed | Files Changed |
  5. ✔️ Additional Notes — Add any extra reviewer context.
    Keep each section concise (under 200 words) and use bullet or numbered lists for clarity."

Note: This feature is currently in beta for Pro-tier users, and pricing will be announced later.


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.

@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: 0

♻️ Duplicate comments (1)
controller/channel.go (1)

279-285: SearchChannels tag-mode: same GetChannelsByTag usage as GetAllChannels

This call mirrors the GetAllChannels tag-mode behavior: channels are still sorted by idSort, and selectAll=false avoids pulling key into search results, which is desirable for safety/consistency.

🧹 Nitpick comments (1)
model/channel.go (1)

275-287: GetChannelsByTag: behavior matches intent; naming/use of selectAll could be clearer

The new selectAll flag correctly controls whether key is omitted while preserving the existing sort behavior. This aligns with the goal of hiding channel keys on tag-based reads.

If you don’t anticipate a caller that needs the key here, you could simplify by always omitting key (drop selectAll), or alternatively rename the flag to something like includeKey to better reflect its column-level effect. This is purely a readability/naming consideration.

📜 Review details

Configuration used: CodeRabbit UI

Review profile: CHILL

Plan: Pro

📥 Commits

Reviewing files that changed from the base of the PR and between 75fced3 and a7d2450.

📒 Files selected for processing (2)
  • controller/channel.go (3 hunks)
  • model/channel.go (2 hunks)
🧰 Additional context used
🧬 Code graph analysis (2)
controller/channel.go (1)
model/channel.go (1)
  • GetChannelsByTag (275-287)
model/channel.go (1)
model/main.go (1)
  • DB (64-64)
🔇 Additional comments (3)
model/channel.go (1)

730-743: EditChannelByTag now omits key on reload; verify UpdateAbilities does not depend on it

Switching GetChannelsByTag(updatedTag, false, false) to omit key is consistent with avoiding unnecessary key reads. However, this assumes channel.UpdateAbilities(nil) never relies on channel.Key being populated (only on id/tag/models/group/etc.).

Please double-check the implementation of Channel.UpdateAbilities to confirm it doesn’t use Key; otherwise this change could introduce subtle behavior differences when recreating abilities after tag edits.

controller/channel.go (2)

91-113: GetAllChannels tag-mode: now correctly omits key from tag channel listings

Using model.GetChannelsByTag(*tag, idSort, false) ensures tag-mode listings are consistent with the non-tag branch by not loading/exposing key in the returned channels. Bool ordering (tag, idSort, selectAll=false) is correct and preserves previous sort behavior.


1031-1052: GetTagModels: avoids loading keys when only models are needed

Here GetChannelsByTag(tag, false, false) is appropriate: the endpoint only derives a models string and never needs key, so omitting it reduces sensitive data exposure and unnecessary IO while keeping behavior (model selection) unchanged.

@seefs001
seefs001 merged commit f6a5d9e into QuantumNous:main Nov 19, 2025
1 check passed
ennnnny pushed a commit to ennnnny/new-api that referenced this pull request Mar 17, 2026
jiutubaba pushed a commit to jiutubaba/fx-api that referenced this pull request May 17, 2026
…lay-function-call-output

fix: preserve replay tool output continuation
salem-2007 added a commit to salem-2007/new-api that referenced this pull request Sep 10, 2026
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