feat: use llm icon for exporter#6196
Conversation
|
@Eric-2369 is attempting to deploy a commit to the NextChat Team on Vercel. A member of the Team first needs to authorize it. |
WalkthroughThis update removes the separate ExportAvatar function from the exporter file and integrates its logic directly into the ImagePreviewer component. The ImagePreviewer now performs conditional checks to render avatars using the Avatar component based on the message role. Additionally, the chat information subtitle has been updated to include a new GitHub repository link. The changes simplify the code by consolidating avatar rendering into one component, reducing redundancy. Changes
Sequence Diagram(s)sequenceDiagram
participant U as User
participant IP as ImagePreviewer
participant A as Avatar
U->>IP: Send message event
IP->>IP: Check message role
alt User Message
IP->>A: Render user avatar
else Bot Message
IP->>A: Render bot avatar
end
A-->>IP: Return rendered avatar
IP-->>U: Display message with avatar
Poem
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? 🪧 TipsChatThere are 3 ways to chat with CodeRabbit:
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 using PR comments)
Other keywords and placeholders
CodeRabbit Configuration File (
|
There was a problem hiding this comment.
Actionable comments posted: 0
🧹 Nitpick comments (2)
app/components/exporter.tsx (2)
529-529: Add protocol prefix to GitHub URL.Consider adding the 'https://' prefix to make the URL clickable in more contexts.
- github.com/ChatGPTNextWeb/NextChat + https://github.com/ChatGPTNextWeb/NextChat
566-572: Extract avatar rendering logic into a reusable component.The avatar rendering logic is duplicated from the chat info section. Consider extracting it into a separate component to improve maintainability.
+const MessageAvatar = ({ role, config, mask }) => { + if (role === "user") { + return <Avatar avatar={config.avatar} />; + } + return mask.avatar === DEFAULT_MASK_AVATAR ? ( + <Avatar model={mask.modelConfig.model} /> + ) : ( + <Avatar avatar={mask.avatar} /> + ); +}; <div className={styles["avatar"]}> - {m.role === "user" ? ( - <Avatar avatar={config.avatar} /> - ) : mask.avatar === DEFAULT_MASK_AVATAR ? ( - <Avatar model={m.model} /> - ) : ( - <Avatar avatar={mask.avatar} /> - )} + <MessageAvatar role={m.role} config={config} mask={mask} /> </div>
📜 Review details
Configuration used: CodeRabbit UI
Review profile: CHILL
Plan: Pro
📒 Files selected for processing (1)
app/components/exporter.tsx(2 hunks)
🔇 Additional comments (1)
app/components/exporter.tsx (1)
532-538: LGTM! Clean implementation of avatar rendering.The conditional rendering logic effectively handles both default model icons and custom avatars.
💻 变更类型 | Change Type
🔀 变更说明 | Description of Change
为 exporter 中 ImagePreviewer 模块添加了显示更多 llm icons 的支持
移除了无用的 ExportAvatar
更新了导出图片中的项目地址
📝 补充信息 | Additional Information
Summary by CodeRabbit