Skip to content
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

🐛 fix: fix avatar missing on client DB mode #2645

Merged
merged 4 commits into from
May 24, 2024
Merged

🐛 fix: fix avatar missing on client DB mode #2645

merged 4 commits into from
May 24, 2024

Conversation

arvinxx
Copy link
Contributor

@arvinxx arvinxx commented May 24, 2024

💻 变更类型 | Change Type

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

🔀 变更说明 | Description of Change

修正 Client DB 模式下 avatar 没法正常显示的问题

📝 补充信息 | Additional Information

Summary by CodeRabbit

  • New Features
    • User avatars are now conditionally updated, enhancing the personalization of user profiles.

Copy link

vercel bot commented May 24, 2024

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

Name Status Preview Comments Updated (UTC)
lobe-chat-community ✅ Ready (Inspect) Visit Preview 💬 Add feedback May 24, 2024 11:54am

@lobehubbot
Copy link
Member

👍 @arvinxx

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

Copy link

coderabbitai bot commented May 24, 2024

Warning

Rate Limit Exceeded

@arvinxx has exceeded the limit for the number of commits or files that can be reviewed per hour. Please wait 14 minutes and 56 seconds before requesting another review.

How to resolve this issue?

After the wait time has elapsed, a review can be triggered using the @coderabbitai review command as a PR comment. Alternatively, push new commits to this PR.

We recommend that you space out your commits to avoid hitting the rate limit.

How do rate limits work?

CodeRabbit enforces hourly rate limits for each developer per organization.
Our paid plans have higher rate limits than the trial, open-source and free plans. In all cases, we re-allow further reviews after a brief timeout.
Please see our FAQ for further information.

Commits Files that changed from the base of the PR and between deb5b24 and 8aeb45f.

Walkthrough

The recent changes in the codebase focus on enhancing the user state management by incorporating avatar data. Specifically, the LobeUser type from @/types/user is now imported, and the state creation logic in action.ts has been modified to conditionally include avatar information in the user object.

Changes

Files Change Summary
src/store/user/slices/common/action.ts - Added LobeUser import from @/types/user.
- Updated state creation to conditionally include avatar data.

🌟 In code's embrace, where users grow,
🌟 A rabbit's joy begins to show.
🌟 With avatars now in the mix,
🌟 Our state evolves with clever tricks.
🌟 Hoppity hop, the changes flow,
🌟 In every byte, new life will glow.
🌟 🐇✨


Thank you for using CodeRabbit. We offer it for free to the OSS community and would appreciate your support in helping us grow. If you find it useful, would you consider giving us a shout-out on your favorite social media?

Share
Tips

Chat

There are 3 ways to chat with CodeRabbit:

  • Review comments: Directly reply to a review comment made by CodeRabbit. Example:
    • I pushed a fix in commit <commit_id>.
    • Generate unit testing code for this file.
    • Open a follow-up GitHub issue for this discussion.
  • Files and specific lines of code (under the "Files changed" tab): Tag @coderabbitai in a new review comment at the desired location with your query. Examples:
    • @coderabbitai generate unit testing code for this file.
    • @coderabbitai modularize this function.
  • PR comments: Tag @coderabbitai in a new PR comment to ask questions about the PR branch. For the best results, please provide a very specific query, as very limited context is provided in this mode. Examples:
    • @coderabbitai generate interesting stats about this repository and render them as a table.
    • @coderabbitai show all the console.log statements in this repository.
    • @coderabbitai read src/utils.ts and generate unit testing code.
    • @coderabbitai read the files in the src/scheduler package and generate a class diagram using mermaid and a README in the markdown format.

Note: Be mindful of the bot's finite context window. It's strongly recommended to break down tasks such as reading entire modules into smaller chunks. For a focused discussion, use review comments to chat about specific files and their changes, instead of using the PR comments.

CodeRabbit Commands (invoked as PR comments)

  • @coderabbitai pause to pause the reviews on a PR.
  • @coderabbitai resume to resume the paused reviews.
  • @coderabbitai review to trigger a review. This is useful when automatic reviews are disabled for the repository.
  • @coderabbitai resolve resolve all the CodeRabbit review comments.
  • @coderabbitai help to get help.

Additionally, you can add @coderabbitai ignore anywhere in the PR description to prevent this PR from being reviewed.

CodeRabbit Configration File (.coderabbit.yaml)

  • You can programmatically configure CodeRabbit by adding a .coderabbit.yaml file to the root of your repository.
  • Please see the configuration documentation for more information.
  • If your editor has YAML language server enabled, you can add the path at the top of this file to enable auto-completion and validation: # yaml-language-server: $schema=https://coderabbit.ai/integrations/schema.v2.json

Documentation and Community

  • Visit our Documentation for detailed information on how to use CodeRabbit.
  • Join our Discord Community to get help, request features, and share feedback.
  • Follow us on X/Twitter for updates and announcements.

Copy link

codecov bot commented May 24, 2024

Codecov Report

Attention: Patch coverage is 88.88889% with 1 line in your changes missing coverage. Please review.

Project coverage is 93.67%. Comparing base (69600da) to head (8aeb45f).
Report is 1090 commits behind head on main.

Files with missing lines Patch % Lines
src/store/user/slices/common/action.ts 85.71% 1 Missing ⚠️
Additional details and impacted files
@@            Coverage Diff             @@
##             main    #2645      +/-   ##
==========================================
- Coverage   93.68%   93.67%   -0.01%     
==========================================
  Files         349      349              
  Lines       20408    20407       -1     
  Branches     2443     2452       +9     
==========================================
- Hits        19119    19117       -2     
- Misses       1289     1290       +1     

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

Copy link

@coderabbitai coderabbitai bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Actionable comments posted: 1

Review Details

Configuration used: CodeRabbit UI
Review profile: CHILL

Commits Files that changed from the base of the PR and between 69600da and deb5b24.
Files selected for processing (1)
  • src/store/user/slices/common/action.ts (3 hunks)
Additional Context Used
Biome (4)
src/store/user/slices/common/action.ts (4)

73-73: Avoid redundant double-negation.


1-1: Some named imports are only used as types.


1-2: All these imports are only used as types.


10-11: All these imports are only used as types.

Additional comments not posted (1)
src/store/user/slices/common/action.ts (1)

Line range hint 91-107: The conditional logic for updating the avatar in the user object looks correct and aligns with the PR's objective to fix avatar display issues.

@@ -8,7 +8,7 @@
import type { UserStore } from '@/store/user';
import type { GlobalServerConfig } from '@/types/serverConfig';
import type { GlobalSettings } from '@/types/settings';
import { UserInitializationState } from '@/types/user';
import { LobeUser, UserInitializationState } from '@/types/user';
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Consider using import type for imports that are only used as types to clarify their usage and potentially optimize bundling.

- import { LobeUser, UserInitializationState } from '@/types/user';
+ import type { LobeUser, UserInitializationState } from '@/types/user';

Committable suggestion

‼️ IMPORTANT
Carefully review the code before committing. Ensure that it accurately replaces the highlighted code, contains no missing lines, and has no issues with indentation.

Suggested change
import { LobeUser, UserInitializationState } from '@/types/user';
import type { LobeUser, UserInitializationState } from '@/types/user';

@arvinxx arvinxx changed the title 🐛 fix: fix avatar missing 🐛 fix: fix avatar missing on client DB mode May 24, 2024
@arvinxx arvinxx merged commit 12726c2 into main May 24, 2024
8 of 10 checks passed
@arvinxx arvinxx deleted the fix/avatar branch May 24, 2024 15:51
@lobehubbot
Copy link
Member

❤️ Great PR @arvinxx ❤️

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.
项目的成长离不开用户反馈和贡献,感谢您的贡献! 如果您对 LobeHub 开发者社区感兴趣,请加入我们的 discord,然后私信 @arvinxx@canisminor1990。他们会邀请您加入我们的私密开发者频道。我们将会讨论关于 Lobe Chat 的开发,分享和讨论全球范围内的 AI 消息。

github-actions bot pushed a commit that referenced this pull request May 24, 2024
### [Version&nbsp;0.161.15](v0.161.14...v0.161.15)
<sup>Released on **2024-05-24**</sup>

#### 🐛 Bug Fixes

- **misc**: Fix avatar missing on client DB mode.

<br/>

<details>
<summary><kbd>Improvements and Fixes</kbd></summary>

#### What's fixed

* **misc**: Fix avatar missing on client DB mode, closes [#2645](#2645) ([12726c2](12726c2))

</details>

<div align="right">

[![](https://img.shields.io/badge/-BACK_TO_TOP-151515?style=flat-square)](#readme-top)

</div>
@lobehubbot
Copy link
Member

🎉 This PR is included in version 0.161.15 🎉

The release is available on:

Your semantic-release bot 📦🚀

github-actions bot pushed a commit to bentwnghk/lobe-chat that referenced this pull request May 24, 2024
### [Version&nbsp;1.41.8](v1.41.7...v1.41.8)
<sup>Released on **2024-05-24**</sup>

#### 🐛 Bug Fixes

- **misc**: Fix avatar missing on client DB mode.

<br/>

<details>
<summary><kbd>Improvements and Fixes</kbd></summary>

#### What's fixed

* **misc**: Fix avatar missing on client DB mode, closes [lobehub#2645](https://github.com/bentwnghk/lobe-chat/issues/2645) ([12726c2](12726c2))

</details>

<div align="right">

[![](https://img.shields.io/badge/-BACK_TO_TOP-151515?style=flat-square)](#readme-top)

</div>
ipoly pushed a commit to ipoly/lobe-chat that referenced this pull request Jul 29, 2024
* 🐛 fix: fix avatar missing

* 🐛 fix: fix user avatar

* ♻️ refactor: refactor to remove deprecated userId and avatar field

* ✅ test: improve test
ipoly pushed a commit to ipoly/lobe-chat that referenced this pull request Jul 29, 2024
### [Version&nbsp;0.161.15](lobehub/lobe-chat@v0.161.14...v0.161.15)
<sup>Released on **2024-05-24**</sup>

#### 🐛 Bug Fixes

- **misc**: Fix avatar missing on client DB mode.

<br/>

<details>
<summary><kbd>Improvements and Fixes</kbd></summary>

#### What's fixed

* **misc**: Fix avatar missing on client DB mode, closes [lobehub#2645](lobehub#2645) ([12726c2](lobehub@12726c2))

</details>

<div align="right">

[![](https://img.shields.io/badge/-BACK_TO_TOP-151515?style=flat-square)](#readme-top)

</div>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants