Skip to content

💄 style: Optimized model list & search#9397

Closed
sxjeru wants to merge 24 commits into
lobehub:mainfrom
sxjeru:9.24
Closed

💄 style: Optimized model list & search#9397
sxjeru wants to merge 24 commits into
lobehub:mainfrom
sxjeru:9.24

Conversation

@sxjeru

@sxjeru sxjeru commented Sep 24, 2025

Copy link
Copy Markdown
Contributor

🧹 chore(SearchResult): remove debug log for filtered models

💻 变更类型 | Change Type

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

🔀 变更说明 | Description of Change

  • 搜索结果更换为虚拟列表,将卡顿转化为更能接受的列表空白加载(为每次键入自动搜索做准备)
  • 每次输入时自动搜索,类似搜索提供商效果(是否需要?空白加载在 1s 内)
  • 进一步可将初始模型列表也更换为虚拟列表
  • 上下滚动时可能存在抖动(暂无解决方案)
  • 模型搜索框,当点击外部使其失焦时,自动执行一次搜索,使操作人性化。
  • 更换其他提供商时,复原搜索框状态

进一步可以考虑当输入内容大于 n 个字符,每次输入自动执行搜索。需权衡搜索的卡顿问题。

📝 补充信息 | Additional Information

Summary by Sourcery

Optimize the search input component by managing its value in local state, firing searches on blur when the value changes, and cleaning up debug logs.

Enhancements:

  • Make the search input a controlled component synced to prop value
  • Trigger searches automatically on input blur when the text has changed while preserving manual search triggers
  • Retain manual search via Enter key or search icon

Chores:

  • Remove console.log debug statement from SearchResult

🧹 chore(SearchResult): remove debug log for filtered models
@vercel

vercel Bot commented Sep 24, 2025

Copy link
Copy Markdown

@sxjeru is attempting to deploy a commit to the LobeHub OSS Team on Vercel.

A member of the Team first needs to authorize it.

@sourcery-ai

sourcery-ai Bot commented Sep 24, 2025

Copy link
Copy Markdown
Contributor

Reviewer's Guide

Converted the search input to a controlled component with local state and onBlur-triggered searches for a more user-friendly behavior, and cleaned up a leftover debug log in the search results.

File-Level Changes

Change Details Files
Convert search input to controlled component with local state
  • Introduced text state and useEffect to sync with value prop
  • Replaced defaultValue with controlled value prop
  • Updated onChange to only update local state
  • Added onBlur handler to trigger search when focus is lost
  • Enhanced onSearch to sync state and propagate the search
src/app/[variants]/(main)/settings/provider/features/ModelList/ModelTitle/Search.tsx
Remove debug log in search results
  • Deleted console.log call for filteredModels
src/app/[variants]/(main)/settings/provider/features/ModelList/SearchResult.tsx

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

@dosubot dosubot Bot added the size:S This PR changes 10-29 lines, ignoring generated files. label Sep 24, 2025
@gru-agent

gru-agent Bot commented Sep 24, 2025

Copy link
Copy Markdown
Contributor

TestGru Assignment

Summary

Link CommitId Status Reason
Detail 6538d1b 🚫 Skipped No files need to be tested {"src/app/[variants]/(main)/settings/provider/features/ModelList/ModelTitle/Search.tsx":"File path does not match include patterns.","src/app/[variants]/(main)/settings/provider/features/ModelList/SearchResult.tsx":"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

@lobehubbot

Copy link
Copy Markdown
Member

👍 @sxjeru

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.
非常感谢您提出拉取请求并为我们的社区做出贡献,请确保您已经遵循了我们的贡献指南,我们会尽快审查它。
如果您遇到任何问题,请随时与我们联系。

@dosubot dosubot Bot added the 💄 Design Design and style issues label Sep 24, 2025

@sourcery-ai sourcery-ai 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.

Hey there - I've reviewed your changes and they look great!


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

codecov Bot commented Sep 24, 2025

Copy link
Copy Markdown

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ Project coverage is 80.65%. Comparing base (62097e6) to head (f49fafc).

Additional details and impacted files
@@            Coverage Diff            @@
##             next    #9397     +/-   ##
=========================================
  Coverage   80.65%   80.65%             
=========================================
  Files         970      970             
  Lines       65922    65922             
  Branches     8705    10141   +1436     
=========================================
  Hits        53171    53171             
  Misses      12751    12751             
Flag Coverage Δ
app 73.00% <100.00%> (ø)
database 98.43% <ø> (ø)
packages/agent-runtime 98.08% <ø> (ø)
packages/context-engine 91.61% <ø> (ø)
packages/conversation-flow 98.05% <ø> (ø)
packages/electron-server-ipc 93.76% <ø> (ø)
packages/file-loaders 92.21% <ø> (ø)
packages/model-bank 100.00% <ø> (ø)
packages/model-runtime 91.66% <100.00%> (ø)
packages/prompts 79.17% <ø> (ø)
packages/python-interpreter 96.50% <ø> (ø)
packages/utils 95.31% <ø> (ø)
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% <ø> (ø)
Services 54.54% <ø> (ø)
Server 75.29% <ø> (ø)
Libs 38.40% <ø> (ø)
Utils 83.36% <ø> (ø)
🚀 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.

@dosubot dosubot Bot added size:M This PR changes 30-99 lines, ignoring generated files. and removed size:S This PR changes 10-29 lines, ignoring generated files. labels Sep 25, 2025
@sxjeru sxjeru changed the title 💄 style: Optimized search input 💄 style: Optimized model list & search Sep 25, 2025
@dosubot dosubot Bot added size:L This PR changes 100-499 lines, ignoring generated files. and removed size:M This PR changes 30-99 lines, ignoring generated files. labels Sep 25, 2025
@dosubot dosubot Bot added size:XXL This PR changes 1000+ lines, ignoring generated files. and removed size:L This PR changes 100-499 lines, ignoring generated files. labels Sep 28, 2025
@arvinxx

arvinxx commented Nov 6, 2025

Copy link
Copy Markdown
Member

@sxjeru Need to rebase now


This comment was translated by Claude.

Original Content @sxjeru 得 rebase 下了

@dosubot dosubot Bot added size:XL This PR changes 500-999 lines, ignoring generated files. and removed size:XXL This PR changes 1000+ lines, ignoring generated files. labels Nov 6, 2025
@dosubot dosubot Bot added size:XXL This PR changes 1000+ lines, ignoring generated files. and removed size:XL This PR changes 500-999 lines, ignoring generated files. labels Nov 14, 2025
@sxjeru sxjeru force-pushed the 9.24 branch 2 times, most recently from 8201750 to 243745a Compare November 20, 2025 11:26
@dosubot dosubot Bot added size:XL This PR changes 500-999 lines, ignoring generated files. size:XXL This PR changes 1000+ lines, ignoring generated files. and removed size:XXL This PR changes 1000+ lines, ignoring generated files. size:XL This PR changes 500-999 lines, ignoring generated files. labels Nov 20, 2025
@dosubot dosubot Bot added size:XL This PR changes 500-999 lines, ignoring generated files. and removed size:XXL This PR changes 1000+ lines, ignoring generated files. labels Nov 20, 2025
Copilot AI review requested due to automatic review settings December 4, 2025 05:12

Copilot AI 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.

Pull request overview

This PR optimizes the model list and search functionality by introducing virtual scrolling and improving search UX. The changes address performance issues with large model lists by converting to a virtual list implementation using react-virtuoso, and enhance the search experience by triggering searches on blur in addition to explicit user actions.

Key changes:

  • Implemented virtual scrolling for both search results and disabled model lists to improve rendering performance
  • Made search input a controlled component that triggers searches on blur when the value changes, in addition to manual triggers
  • Removed debug console.log statement from SearchResult component

Reviewed changes

Copilot reviewed 18 out of 19 changed files in this pull request and generated 2 comments.

Show a summary per file
File Description
src/app/[variants]/(main)/settings/provider/features/ModelList/SearchResult.tsx Replaced manual filtering with inline logic, removed debug log, integrated virtual list (react-virtuoso) for search results
src/app/[variants]/(main)/settings/provider/features/ModelList/DisabledModels.tsx Added virtual list implementation for disabled models
src/app/[variants]/(main)/settings/provider/features/ModelList/useModelListVirtualConfig.ts New hook providing device-specific virtual list configuration (item heights, viewport calculations)
src/app/[variants]/(main)/settings/provider/features/ModelList/ModelTitle/Search.tsx Converted to controlled component with local state, added blur handler to trigger search when value changes
src/app/[variants]/(main)/settings/provider/features/ModelList/ModelTitle/index.tsx Added key prop to Search components to reset state when provider changes
src/app/[variants]/(main)/settings/provider/features/ModelList/index.tsx Added useEffect to clear search keyword when switching providers
src/app/[variants]/(main)/settings/provider/features/ModelList/ModelItem.tsx Added useEffect to sync local checked state with enabled prop for proper state updates
src/server/routers/lambda/config/index.test.ts Updated test to use deepseek-r1 instead of llama-3.1-8b model
src/server/routers/lambda/config/__snapshots__/index.test.ts.snap Updated snapshot to match new test model
src/locales/default/modelProvider.ts Fixed spacing in Chinese translation (added space after "发布于")
src/config/modelProviders/nvidia.ts Updated provider name from "Nvidia" to "Nvidia NIM"
src/config/modelProviders/google.ts Removed outdated comment reference
packages/model-runtime/src/utils/modelParse.ts Added 'robotics' keyword to Google model parsing configuration for function call, reasoning, and video capabilities
packages/model-bank/src/aiModels/google.ts Added new Gemini models (Latest variants, Preview versions, Robotics-ER), removed deprecated models (1.5 Flash/Pro 002, 1.5 Flash 8B, LearnLM)
packages/model-bank/src/aiModels/vertexai.ts Removed deprecated Gemini 1.5 Flash 002 and Pro 002 models
packages/model-bank/src/aiModels/openrouter.ts Removed deprecated/free models, updated Auto Router description
packages/model-bank/src/aiModels/ollama.ts Added Kimi K2 model with reasoning and function call capabilities
packages/model-bank/src/aiModels/higress.ts Removed deprecated Gemini 1.0 and 1.5 model variants
packages/model-bank/src/aiModels/vercelaigateway.ts Updated cache read pricing for several models

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

Comment thread packages/model-bank/src/aiModels/google.ts Outdated
Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>
@arvinxx

arvinxx commented Feb 4, 2026

Copy link
Copy Markdown
Member

@sxjeru This PR probably needs to be redone 🥵


This comment was translated by Claude.

Original Content @sxjeru 这个 PR 估计得重新搞了🥵

@arvinxx arvinxx closed this Feb 4, 2026
@gru-agent

gru-agent Bot commented Feb 4, 2026

Copy link
Copy Markdown
Contributor

⏳ Processing in progress

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:XL This PR changes 500-999 lines, ignoring generated files.

Projects

None yet

4 participants