lobe-chat icon indicating copy to clipboard operation
lobe-chat copied to clipboard

bug好多,历史对话切换一下,就没了,反应也贼慢[Bug]

Open 1137882300 opened this issue 11 months ago • 21 comments

💻 系统环境

Windows

📦 部署环境

Official Preview

🌐 浏览器

Chrome

🐛 问题描述

同样的open key,在其他套壳里。就可以回到当前日期,在这里就不行!!!

🚦 期望结果

反应要快,历史对话要保留,同样的问题,同样的key,在其他地方套壳里就能正常回答。

📷 复现步骤

No response

📝 补充信息

No response

1137882300 avatar Mar 11 '24 08:03 1137882300

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


💻 System environment

Windows

📦 Deployment environment

Official Preview

🌐 Browser

Chrome

🐛 Problem description

The same open key, in other shells. You can go back to the current date, which is not possible here! ! !

🚦 Expected results

The response must be fast, the historical dialogue must be retained, and the same question and the same key can be answered normally in a shell elsewhere.

📷 Steps to reproduce

No response

📝 Supplementary information

No response

lobehubbot avatar Mar 11 '24 08:03 lobehubbot

👀 @1137882300

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。我们会尽快调查此事,并尽快回复您。 请确保您已经提供了尽可能多的背景信息。

lobehubbot avatar Mar 11 '24 08:03 lobehubbot

历史对话切换一下,就没了

看看右侧: https://chat-docs.lobehub.com/zh/usage/agents/concepts

在其他套壳里。就可以回到当前日期,在这里就不行!!!

请描述清楚你的问题,我看不懂你在说什么。

arvinxx avatar Mar 11 '24 08:03 arvinxx

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


Switch the historical dialogue and it will be gone.

Take a look at the right side: https://chat-docs.lobehub.com/en/usage/agents/concepts

In other shells. You can go back to the current date, which is not possible here! ! !

Please describe your problem clearly, I don't understand what you are talking about.

lobehubbot avatar Mar 11 '24 08:03 lobehubbot

+1,性能贼差,建议好好优化下。

devyujie avatar Mar 12 '24 02:03 devyujie

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


+1, the performance is terrible, it is recommended to optimize it.

lobehubbot avatar Mar 12 '24 02:03 lobehubbot

@devyujie 请给出你觉得性能差的地方?

arvinxx avatar Mar 12 '24 02:03 arvinxx

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


@devyujie Please tell me where you think the performance is poor?

lobehubbot avatar Mar 12 '24 02:03 lobehubbot

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


@devyujie Please give us where you think the performance is poor?

I think this is indeed the case. During use, it is indeed slower at times. For example, it takes a while to reflect from the discovery cutter session. It may be that there is indeed a place where rendering affects performance.

lobehubbot avatar Mar 13 '24 13:03 lobehubbot

@devyujie 请给出你觉得性能差的地方?

我认为确实如此,在使用过程中,确实有时候比较慢,比如从发现tab切换回会话要等一会,可能确实是哪里有渲染影响性能的地方。

s7monk avatar Mar 13 '24 13:03 s7monk

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


@devyujie Please give us where you think the performance is poor?

I think this is indeed the case. During use, it is sometimes slow. For example, it takes a while to switch back to the session from the discovery tab. It may be that there is indeed a rendering that affects performance.

lobehubbot avatar Mar 13 '24 13:03 lobehubbot

界面切换慢应该是网络问题,本地部署的话响应速度是OK的,不过能优化就最好了。或者给一个加载动画,显示目前正在加载

慢得明显的是插件窗口,打开关闭时的动画非常不流畅

BrandonStudio avatar Mar 14 '24 07:03 BrandonStudio

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


Slow interface switching should be a network problem. If deployed locally, the response speed is OK, but it would be best if it could be optimized. Or give a loading animation to show that it is currently loading.

What is obviously slow is the plug-in window. The animation when opening and closing is very unsmooth.

lobehubbot avatar Mar 14 '24 07:03 lobehubbot

慢得明显的是插件窗口,打开关闭时的动画非常不流畅

这个有计划优化,我自己也发现了

或者给一个加载动画,显示目前正在加载

我回头看看有没有方法搞

arvinxx avatar Mar 14 '24 07:03 arvinxx

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


What is obviously slow is the plug-in window. The animation when opening and closing is very unsmooth.

This is planned and optimized, I also discovered it myself

Or give a loading animation to show that it is currently loading

I'll look back and see if there's a way to do it

lobehubbot avatar Mar 14 '24 07:03 lobehubbot

慢得明显的是插件窗口,打开关闭时的动画非常不流畅

这个有计划优化,我自己也发现了

或者给一个加载动画,显示目前正在加载

我回头看看有没有方法搞

要么做一个带动效的骨架屏吧,本地部署的嗷嗷快,如果走外网切换话题确实有点慢了

MapleEve avatar Mar 18 '24 17:03 MapleEve

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


What is obviously slow is the plug-in window. The animation when opening and closing is very unsmooth.

This is planned and optimized, I also discovered it myself

Or give a loading animation to show that it is currently loading.

I'll look back and see if there's a way to do it

Or make a skeleton screen with animated effects. Local deployment is super fast, but switching topics over the Internet is a bit slow.

lobehubbot avatar Mar 18 '24 17:03 lobehubbot

我在 #1736 尝试通过重构 layout 的实现来提升页面切换的性能,大家可以测试下看看

arvinxx avatar Mar 26 '24 08:03 arvinxx

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


In #1736, I tried to improve the performance of page switching by reconstructing the implementation of layout. You can test it and see.

lobehubbot avatar Mar 26 '24 08:03 lobehubbot

I think it is much better now

I still look forward a loading animation

BrandonStudio avatar Mar 28 '24 03:03 BrandonStudio

@BrandonStudio I will try

arvinxx avatar Mar 28 '24 03:03 arvinxx

@arvinxx 在/chat页面 -> 扩展插件 -> 插件商店 点击后会有明显的等待时间才会打开弹窗,关闭弹窗也会存在这个问题。在本地开发环境看了一下,打开弹窗时多个(50几个)PluginItem一次性渲染,用JavaScript performance查看发现有一半多的时间都在antd-style的createStyles,这里面竟然又有接近一半的时间在复制theme的属性。 https://github.com/ant-design/antd-style/blob/4187b95fa654e8d4725c69517789e675c6c28a52/src/factories/createStyles/index.ts#L60 打个断点看了一眼theme这个对象,竟然有800多个属性😂,所以只要用了css-in-js创建style每次创建组件(这些操作是在useMemo中完成)这800多属性的theme就会被复制一次,PluginItem这种同时渲染很多组件的场景性能问题就会被放大。就目前看到的情况,这个css-in-js库有可能时拖累整个页面性能问题的帮凶。 最后在production的编译后使用performance获取到的信息和development类似,具体数值有些变化,但复制theme和创建css-in-js创建style会耗费大量的时间。

lee88688 avatar Apr 01 '24 07:04 lee88688

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


@arvinxx On the /chat page -> Extension plug-in -> Plug-in store, there will be an obvious waiting time before the pop-up window opens after clicking. This problem will also exist when closing the pop-up window. I checked it in the local development environment and found that multiple (50+) PluginItems were rendered at once when the pop-up window was opened. I checked with JavaScript performance and found that more than half of the time was spent on createStyles of antd-style, and there was something close to it. Half the time is copying theme attributes. https://github.com/ant-design/antd-style/blob/4187b95fa654e8d4725c69517789e675c6c28a52/src/factories/createStyles/index.ts#L60 I made a breakpoint and took a look at the theme object. It actually has more than 800 attributes. So as long as you use css-in-js to create styles and create components each time (these operations are completed in useMemo), the theme with more than 800 attributes will be will be copied once, and the scene performance problem of PluginItem, which renders many components at the same time, will be amplified. From what we have seen so far, this css-in-js library may be an accomplice in dragging down the performance of the entire page. Finally, the information obtained using performance after compilation in production is similar to that in development. The specific values ​​​​change somewhat, but copying the theme and creating css-in-js to create styles will take a lot of time.

lobehubbot avatar Apr 01 '24 07:04 lobehubbot

✅ @1137882300

This issue is closed, If you have any questions, you can comment and reply.
此问题已经关闭。如果您有任何问题,可以留言并回复。

lobehubbot avatar Apr 02 '24 05:04 lobehubbot

@lee88688 你的分析有点问题,和 antd-style 没啥关系。单纯是列表数据过多,一次性渲染出来比较卡而已。换成虚拟滚动就好了

arvinxx avatar Apr 02 '24 07:04 arvinxx

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


@lee88688 There is something wrong with your analysis, and it has nothing to do with antd-style. It's just that there is too much data in the list, and rendering it all at once is laggy. Just switch to virtual scrolling

lobehubbot avatar Apr 02 '24 07:04 lobehubbot

@arvinxx 此外在关闭弹窗时也会出现延迟,从调试工具看在关闭的时候又重新渲染了这个列表,感觉有点奇怪从上到下都是memo的组件,按道理不应该在关闭的时候出现整个列表的重渲染。

lee88688 avatar Apr 02 '24 09:04 lee88688

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


@arvinxx In addition, there will also be a delay when closing the pop-up window. From the debugging tool, it can be seen that the list is re-rendered when it is closed. It feels a bit strange that they are all memo components from top to bottom. Logically, they should not appear when closing. Re-rendering of the entire list.

lobehubbot avatar Apr 02 '24 09:04 lobehubbot

@BrandonStudio 已优化,可以再试试了

@lee88688 同样关闭慢的问题也解决了

arvinxx avatar Apr 02 '24 17:04 arvinxx

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


@BrandonStudio has been optimized, you can try again

@lee88688 The same problem of slow shutdown has been solved

lobehubbot avatar Apr 02 '24 17:04 lobehubbot