Skip to content

Conversation

@bbbugg
Copy link
Contributor

@bbbugg bbbugg commented Nov 2, 2025

💻 Change Type

  • ✨ feat
  • 🐛 fix
  • ♻️ refactor
  • 💄 style
  • 👷 build
  • ⚡️ perf
  • ✅ test
  • 📝 docs
  • 🔨 chore

🔗 Related Issue

🔀 Description of Change

给未开启的模型新增按字母排序、按发布时间排序功能。
给未开启的模型服务商新增按字母排序功能。
排序方式保存在浏览器缓存。

🧪 How to Test

  • Tested locally
  • Added/updated tests
  • No tests needed

📸 Screenshots / Videos

模型服务商列表
image image image
模型列表
image image

📝 Additional Information

Summary by Sourcery

Add alphabetical sorting toggle for disabled models and providers with tooltip support.

Enhancements:

  • Implement default and alphabetical sorting for disabled AI models
  • Implement default and alphabetical sorting for disabled AI providers
  • Add toggle button with AZ icon and tooltip to switch between sort orders

Documentation:

  • Add localization entries for sort toggle tooltips in modelProvider locale file

@vercel
Copy link

vercel bot commented Nov 2, 2025

@bbbugg is attempting to deploy a commit to the LobeHub Community Team on Vercel.

A member of the Team first needs to authorize it.

@dosubot dosubot bot added the size:L This PR changes 100-499 lines, ignoring generated files. label Nov 2, 2025
@sourcery-ai
Copy link
Contributor

sourcery-ai bot commented Nov 2, 2025

Reviewer's Guide

Adds alphabetical and default sorting toggles with tooltip support for disabled models and model providers, updating UI components and localization entries to enhance discoverability.

Entity relationship diagram for updated localization entries

erDiagram
    MODEL_PROVIDER {
      string list_disabled
      string list_enabled
      object list_disabledActions
    }
    DISABLED_ACTIONS {
      string sortAlphabetical
      string sortDefault
      string showMore
    }
    MODEL_PROVIDER ||--o{ DISABLED_ACTIONS : contains
Loading

Class diagram for updated DisabledModels and ProviderList components

classDiagram
    class DisabledModels {
      - showMore: boolean
      - sortType: SortType
      + toggleSortType()
      + getSortTooltip()
      + sortedDisabledModels: Model[]
    }
    class ProviderList {
      - open: boolean
      - sortType: SortType
      + toggleSortType()
      + getSortTooltip()
      + sortedDisabledProviders: Provider[]
    }
    class SortType {
      <<enumeration>>
      Alphabetical
      Default
    }
    DisabledModels --> SortType
    ProviderList --> SortType
Loading

File-Level Changes

Change Details Files
Introduce sorting toggle for disabled models with tooltip in DisabledModels component
  • Add SortType enum and sortType state
  • Compute sortedDisabledModels via useMemo based on sortType
  • Adjust displayModels to use sortedDisabledModels
  • Implement toggleSortType and getSortTooltip helpers
  • Wrap header text in Flexbox and add ActionIcon with Tooltip
src/app/[variants]/(main)/settings/provider/features/ModelList/DisabledModels.tsx
Introduce sorting toggle for disabled model providers with tooltip in ProviderList component
  • Add SortType enum and sortType state
  • Compute sortedDisabledProviders via useMemo based on sortType
  • Implement toggleSortType and getSortTooltip helpers
  • Wrap disabled header in Flexbox and add ActionIcon with Tooltip
  • Render sortedDisabledProviders instead of original list
src/app/[variants]/(main)/settings/provider/ProviderMenu/List.tsx
Extend localization entries with sorting action labels
  • Add 'sortAlphabetical' and 'sortDefault' keys under disabledActions for providerModels
  • Add matching keys under disabledActions for menu list
src/locales/default/modelProvider.ts

Tips and commands

Interacting with Sourcery

  • Trigger a new review: Comment @sourcery-ai review on the pull request.
  • Continue discussions: Reply directly to Sourcery's review comments.
  • Generate a GitHub issue from a review comment: Ask Sourcery to create an
    issue from a review comment by replying to it. You can also reply to a
    review comment with @sourcery-ai issue to create an issue from it.
  • Generate a pull request title: Write @sourcery-ai anywhere in the pull
    request title to generate a title at any time. You can also comment
    @sourcery-ai title on the pull request to (re-)generate the title at any time.
  • Generate a pull request summary: Write @sourcery-ai summary anywhere in
    the pull request body to generate a PR summary at any time exactly where you
    want it. You can also comment @sourcery-ai summary on the pull request to
    (re-)generate the summary at any time.
  • Generate reviewer's guide: Comment @sourcery-ai guide on the pull
    request to (re-)generate the reviewer's guide at any time.
  • Resolve all Sourcery comments: Comment @sourcery-ai resolve on the
    pull request to resolve all Sourcery comments. Useful if you've already
    addressed all the comments and don't want to see them anymore.
  • Dismiss all Sourcery reviews: Comment @sourcery-ai dismiss on the pull
    request to dismiss all existing Sourcery reviews. Especially useful if you
    want to start fresh with a new review - don't forget to comment
    @sourcery-ai review to trigger a new review!

Customizing Your Experience

Access your dashboard to:

  • Enable or disable review features such as the Sourcery-generated pull request
    summary, the reviewer's guide, and others.
  • Change the review language.
  • Add, remove or edit custom review instructions.
  • Adjust other review settings.

Getting Help

@lobehubbot
Copy link
Member

👍 @bbbugg

Thank you for raising your pull request and contributing to our Community
Please make sure you have followed our contributing guidelines. We will review it as soon as possible.
If you encounter any problems, please feel free to connect with us.

@gru-agent
Copy link
Contributor

gru-agent bot commented Nov 2, 2025

TestGru Assignment

Summary

Link CommitId Status Reason
Detail 8c08667 🚫 Skipped No files need to be tested {"src/app/[variants]/(main)/settings/provider/ProviderMenu/List.tsx":"File path does not match include patterns.","src/app/[variants]/(main)/settings/provider/features/ModelList/DisabledModels.tsx":"File path does not match include patterns.","src/locales/default/modelProvider.ts":"File path does not match include patterns."}

History Assignment

Tip

You can @gru-agent and leave your feedback. TestGru will make adjustments based on your input

@dosubot dosubot bot added the 💄 Design Design and style issues label Nov 2, 2025
Copy link
Contributor

@sourcery-ai sourcery-ai bot left a comment

Choose a reason for hiding this comment

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

Hey there - I've reviewed your changes - here's some feedback:

  • Extract SortType and the sorting logic into a shared utility or custom hook to avoid duplicating it in DisabledModels and ProviderList.
  • Unify the i18n keys for the sort tooltips under a consistent namespace so both models and providers use the same translation paths.
  • Since this PR adds new interactive sorting behavior, consider updating the commit/PR type from 'style' to 'feat' to better reflect the feature.
Prompt for AI Agents
Please address the comments from this code review:

## Overall Comments
- Extract SortType and the sorting logic into a shared utility or custom hook to avoid duplicating it in DisabledModels and ProviderList.
- Unify the i18n keys for the sort tooltips under a consistent namespace so both models and providers use the same translation paths.
- Since this PR adds new interactive sorting behavior, consider updating the commit/PR type from 'style' to 'feat' to better reflect the feature.

Sourcery is free for open source - if you like our reviews please consider sharing them ✨
Help me be more useful! Please click 👍 or 👎 on each comment and I'll use the feedback to improve your reviews.

@codecov
Copy link

codecov bot commented Nov 2, 2025

Codecov Report

❌ Patch coverage is 85.71429% with 1 line in your changes missing coverage. Please review.
✅ Project coverage is 81.96%. Comparing base (84148a8) to head (fc09cc8).
⚠️ Report is 10 commits behind head on next.

Additional details and impacted files
@@            Coverage Diff             @@
##             next   #10000      +/-   ##
==========================================
+ Coverage   81.90%   81.96%   +0.05%     
==========================================
  Files         879      881       +2     
  Lines       56224    56754     +530     
  Branches     7692     7507     -185     
==========================================
+ Hits        46051    46517     +466     
- Misses      10173    10237      +64     
Flag Coverage Δ
app 74.89% <85.71%> (+0.23%) ⬆️
database 98.03% <ø> (-0.33%) ⬇️
packages/agent-runtime 98.37% <ø> (ø)
packages/context-engine 93.79% <ø> (ø)
packages/electron-server-ipc 93.76% <ø> (ø)
packages/file-loaders 92.21% <ø> (ø)
packages/model-bank 100.00% <ø> (ø)
packages/model-runtime 92.19% <ø> (ø)
packages/prompts 77.29% <ø> (ø)
packages/python-interpreter 96.50% <ø> (ø)
packages/utils 94.29% <ø> (ø)
packages/web-crawler 96.81% <ø> (ø)

Flags with carried forward coverage won't be shown. Click here to find out more.

Components Coverage Δ
Store 73.16% <85.71%> (+0.03%) ⬆️
Services 54.82% <ø> (-0.54%) ⬇️
Server 78.68% <ø> (+0.35%) ⬆️
Libs 36.77% <ø> (+0.10%) ⬆️
Utils 83.03% <ø> (ø)
🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.
  • 📦 JS Bundle Analysis: Save yourself from yourself by tracking and limiting bundle sizes in JS merges.

@arvinxx
Copy link
Member

arvinxx commented Nov 2, 2025

image

I suggest making it similar to this. There might be other sorting modes in the future.


This comment was translated by Claude.

Original Content image

建议做成类似这样的,未来说不定还有别的排序模式

@arvinxx
Copy link
Member

arvinxx commented Nov 4, 2025

The data from localStorage needs to be read in systemStatus. You can check the related implementation in globalStore for reference.


This comment was translated by Claude.

Original Content localStorage 的数据需要放到 systemStatus 这个里读取。可以看下 globalStore 的这块相关实现

) as SortType) || SortType.Default,
);

useEffect(() => {
Copy link
Member

Choose a reason for hiding this comment

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

const sortType = useGlobalStore(systemStatusSelectors.disabledModelProvidersSortType)

不需要再包一层 useState 和 useEffect

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

💄 Design Design and style issues size:L This PR changes 100-499 lines, ignoring generated files.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants