lobehub / lobe-chat

🤯 Lobe Chat - an open-source, modern-design AI chat framework. Supports Multi AI Providers( OpenAI / Claude 3 / Gemini / Ollama / Azure / DeepSeek), Knowledge Base (file upload / knowledge management / RAG ), Multi-Modals (Vision/TTS) and plugin system. One-click FREE deployment of your private ChatGPT/ Claude application.
https://chat-preview.lobehub.com
Other
44.38k stars 9.95k forks source link

[Bug] 设置页面切换 Language Model Tab 异常卡顿 #3937

Open ZeekoZhu opened 1 month ago

ZeekoZhu commented 1 month ago

📦 部署环境

Official Preview

📌 软件版本

v1.16.12

💻 系统环境

Other Linux

🌐 浏览器

Other

🐛 问题描述

通过左上角打开全局设置后,切换到 Language Model Tab,UI 需要 1 ~ 2 秒才能更新

📷 复现步骤

No response

🚦 期望结果

通过左上角打开全局设置后,切换到 Language Model Tab,UI 在 0.5 秒内完成更新

📝 补充信息

profiler 截图 image

network 截图 image

lobehubbot commented 1 month ago

Bot detected the issue body's language is not English, translate it automatically. 👯👭🏻🧑‍🤝‍🧑👫🧑🏿‍🤝‍🧑🏻👩🏾‍🤝‍👨🏿👬🏿


📦 Deployment environment

Official Preview

📌 Software version

v1.16.12

💻 System environment

Other Linux

🌐 Browser

Other

🐛 Problem description

After opening the global settings through the upper left corner, switch to the Language Model Tab. The UI will take 1 ~ 2 seconds to update.

📷 Steps to reproduce

No response

🚦 Expected results

After opening the global settings through the upper left corner, switch to the Language Model Tab, and the UI will be updated within 0.5 seconds.

📝 Supplementary information

profiler screenshot image

network screenshot image

lobehubbot commented 1 month ago

👀 @ZeekoZhu

Thank you for raising an issue. We will investigate into the matter and get back to you as soon as possible. Please make sure you have given us as much context as possible.\ 非常感谢您提交 issue。我们会尽快调查此事,并尽快回复您。 请确保您已经提供了尽可能多的背景信息。

dosubot[bot] commented 1 month ago

@ZeekoZhu 你好!我是Dosu,一个可以帮助你解决 bug、回答问题,并成为贡献者的机器人。我会在等待人类维护者的过程中帮助你。

I found a similar unsolved discussion regarding performance issues when deploying on Vercel, which might be related to the problem you're experiencing [1].

Potential Causes and Solutions

  1. State Management Bottlenecks:

    • The state management for the global settings UI is handled using selectors, which might cause redundant calculations or unnecessary re-renders if not optimized properly [2].
  2. Memoization Techniques:

    • Ensure that memoization techniques like React.memo and useMemo are used effectively to prevent unnecessary re-renders. The ModelSwitchPanel and ModelSelect components already use these techniques, but you might want to review their implementation for any missed optimizations [3][4].
  3. Lazy Loading and Asynchronous Data Fetching:

    • Implement lazy loading and asynchronous data fetching for the Language Model Tab to improve performance. This can help in reducing the initial load time and make the UI more responsive.
  4. Performance Reports:

    • Review the Lighthouse performance reports for the global settings UI to identify specific areas for optimization. You can find the reports for both desktop and mobile versions here and here [5].
  5. Network Requests:

    • Analyze the network requests to ensure that they are optimized and not causing delays. The provided network screenshot shows multiple fetch requests; consider batching these requests or using caching mechanisms to reduce load times.

By addressing these potential bottlenecks, you should be able to improve the performance of the Language Model Tab and achieve the desired UI update time of under 0.5 seconds.

To continue talking to Dosu, mention @dosu.

Matinal111 commented 1 month ago

确实,近期更新的几个版本在语言模型选项这里变卡顿了

lobehubbot commented 1 month ago

Bot detected the issue body's language is not English, translate it automatically. 👯👭🏻🧑‍🤝‍🧑👫🧑🏿‍🤝‍🧑🏻👩🏾‍🤝‍👨🏿👬🏿


Indeed, several recently updated versions have become stuck in the language model options.