-
-
Notifications
You must be signed in to change notification settings - Fork 11.1k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
♻️ refactor: refactor the drizzle code style #5058
Conversation
The latest updates on your projects. Learn more about Vercel for Git ↗︎
|
Thank you for raising your pull request and contributing to our Community |
9d788a7
to
5e9292a
Compare
Codecov ReportAttention: Patch coverage is
Additional details and impacted files@@ Coverage Diff @@
## main #5058 +/- ##
==========================================
- Coverage 91.95% 91.95% -0.01%
==========================================
Files 548 548
Lines 41423 41398 -25
Branches 2511 2354 -157
==========================================
- Hits 38091 38067 -24
+ Misses 3332 3331 -1
Flags with carried forward coverage won't be shown. Click here to find out more. ☔ View full report in Codecov by Sentry. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
- 依赖导入,优先用
drizzle-orm/expressions
而不是drizzle-orm
原因是 import { xxx } from 'drizzle-orm'
的index是个桶文件,会大大提高编译的耗时(详见 https://vercel.com/blog/how-we-optimized-package-imports-in-next-js );
- 优先使用
toggleKnowledgeBase = async (agentId: string, knowledgeBaseId: string, enabled?: boolean) =>
而不是async toggleKnowledgeBase(agentId: string, knowledgeBaseId: string, enabled?: boolean) {
因为 xxx()
这种写法没有确保闭包,用到 this.
的时候在特定场景下会抛错,很容易踩坑。
比如 useSWR('xxx', userService.abc )
,如果 abc 是一个 function 而不是箭头函数,那么 service 里面的 this 就会挂掉。
5e9292a
to
c690bbc
Compare
❤️ Great PR @canisminor1990 ❤️ The growth of project is inseparable from user feedback and contribution, thanks for your contribution! If you are interesting with the lobehub developer community, please join our discord and then dm @arvinxx or @canisminor1990. They will invite you to our private developer channel. We are talking about the lobe-chat development or sharing ai newsletter around the world. |
### [Version 1.36.32](v1.36.31...v1.36.32) <sup>Released on **2024-12-17**</sup> #### ♻ Code Refactoring - **misc**: Refactor the drizzle code style. <br/> <details> <summary><kbd>Improvements and Fixes</kbd></summary> #### Code refactoring * **misc**: Refactor the drizzle code style, closes [#5058](#5058) ([4057ad3](4057ad3)) </details> <div align="right"> [![](https://img.shields.io/badge/-BACK_TO_TOP-151515?style=flat-square)](#readme-top) </div>
🎉 This PR is included in version 1.36.32 🎉 The release is available on: Your semantic-release bot 📦🚀 |
### [Version 1.78.13](v1.78.12...v1.78.13) <sup>Released on **2024-12-19**</sup> #### ♻ Code Refactoring - **misc**: Refactor the drizzle code style. #### 🐛 Bug Fixes - **misc**: Fix GitHub model fetch, fix pdf preview with capital ext. #### 💄 Styles - **misc**: Improve home page loading for better UX. <br/> <details> <summary><kbd>Improvements and Fixes</kbd></summary> #### Code refactoring * **misc**: Refactor the drizzle code style, closes [lobehub#5058](https://github.com/bentwnghk/lobe-chat/issues/5058) ([4057ad3](4057ad3)) #### What's fixed * **misc**: Fix GitHub model fetch, closes [lobehub#4645](https://github.com/bentwnghk/lobe-chat/issues/4645) ([b69dce3](b69dce3)) * **misc**: Fix pdf preview with capital ext, closes [lobehub#5074](https://github.com/bentwnghk/lobe-chat/issues/5074) ([3f9470f](3f9470f)) #### Styles * **misc**: Improve home page loading for better UX, closes [lobehub#5075](https://github.com/bentwnghk/lobe-chat/issues/5075) ([99026bb](99026bb)) </details> <div align="right"> [![](https://img.shields.io/badge/-BACK_TO_TOP-151515?style=flat-square)](#readme-top) </div>
💻 变更类型 | Change Type
🔀 变更说明 | Description of Change
drizzle-orm/expressions
引用execute()
📝 补充信息 | Additional Information