Deeptrain-Community / chatnio

🚀 Next Generation AI One-Stop Internationalization Solution. 🚀 下一代 AI 一站式 B/C 端解决方案,支持 OpenAI,Midjourney,Claude,讯飞星火,Stable Diffusion,DALL·E,ChatGLM,通义千问,腾讯混元,360 智脑,百川 AI,火山方舟,新必应,Gemini,Moonshot 等模型,支持对话分享,自定义预设,云端同步,模型市场,支持弹性计费和订阅计划模式,支持图片解析,支持联网搜索,支持模型缓存,丰富美观的后台管理与仪表盘数据统计。
https://chatnio.com
Apache License 2.0
2.71k stars 446 forks source link

fix: remove repetitive quota refresh interval #180

Closed eddsi closed 1 month ago

eddsi commented 2 months ago

Description:

Summary

This pull request addresses the issue of unnecessary repetitive quota and subscription refresh intervals in our codebase. By removing the redundant setInterval calls, we optimize performance and reduce potential overhead caused by frequent state updates.

Changes

Impact

Tests

Please review the changes and merge them if everything is in order. Feel free to ask for any further modifications if needed.

描述:

概述

此 Pull Request 解决了我们代码库中不必要的重复配额与订阅刷新间隔问题。通过移除多余的 setInterval 调用,我们优化了性能并减少了因频繁状态更新可能造成的开销。

更改内容

影响

测试

请审查更改,并在一切无误时合并它们。如果需要进行任何进一步的修改,请随时提出。

vercel[bot] commented 2 months ago

The latest updates on your projects. Learn more about Vercel for Git ↗︎

Name Status Preview Comments Updated (UTC)
chatnio ✅ Ready (Inspect) Visit Preview 💬 Add feedback Apr 29, 2024 9:12am
zmh-program commented 1 month ago

非常感谢 PR。此问题减少了轮询请求订阅和点数请求的方案,替换为事件响应,目前因为还有其他地方也使用useSelector引用了quota, subscriptionData的信息,这些引用没有被出发更新请求事件,可能会导致显示错误,需要再增加补丁。等我忙完这段时间之后,改进此 PR 并 merge。

zmh-program commented 1 month ago

bug report: image

It's been reproduced. revert first.