-
Notifications
You must be signed in to change notification settings - Fork 626
fix: correct provider icon alignment in message list #789
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
Conversation
WalkthroughModelIcon.vue now renders an img as the root element instead of wrapping it in a div. MessageItemAssistant.vue updates ModelIcon usage by moving sizing classes from a standard class attribute to the custom-class prop. No prop or control-flow changes. Changes
Estimated code review effort🎯 2 (Simple) | ⏱️ ~10 minutes Poem
Tip 🔌 Remote MCP (Model Context Protocol) integration is now available!Pro plan users can now connect to remote MCP servers from the Integrations page. Connect with popular remote MCPs such as Notion and Linear to add more context to your reviews and chats. ✨ Finishing Touches🧪 Generate unit tests
Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out. 🪧 TipsChatThere are 3 ways to chat with CodeRabbit:
SupportNeed help? Create a ticket on our support page for assistance with any issues or questions. CodeRabbit Commands (Invoked using PR/Issue comments)Type Other keywords and placeholders
CodeRabbit Configuration File (
|
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.
Actionable comments posted: 1
📜 Review details
Configuration used: CodeRabbit UI
Review profile: CHILL
Plan: Pro
💡 Knowledge Base configuration:
- MCP integration is disabled by default for public repositories
- Jira integration is disabled by default for public repositories
- Linear integration is disabled by default for public repositories
You can enable these sources in your CodeRabbit configuration.
📒 Files selected for processing (2)
src/renderer/src/components/icons/ModelIcon.vue(1 hunks)src/renderer/src/components/message/MessageItemAssistant.vue(1 hunks)
🧰 Additional context used
📓 Path-based instructions (9)
**/*.{ts,tsx,js,jsx,vue}
📄 CodeRabbit inference engine (CLAUDE.md)
Use English for logs and comments
Files:
src/renderer/src/components/icons/ModelIcon.vuesrc/renderer/src/components/message/MessageItemAssistant.vue
src/renderer/src/**/*.vue
📄 CodeRabbit inference engine (CLAUDE.md)
src/renderer/src/**/*.vue: Use Composition API for all Vue 3 components
Use Tailwind CSS with scoped styles for styling
Organize components by feature in src/renderer/src/
Follow existing component patterns in src/renderer/src/ when creating new UI components
Use Composition API with proper TypeScript typing for new UI components
Implement responsive design with Tailwind CSS for new UI components
Add proper error handling and loading states for new UI componentsUse scoped styles to prevent CSS conflicts between components
Files:
src/renderer/src/components/icons/ModelIcon.vuesrc/renderer/src/components/message/MessageItemAssistant.vue
src/renderer/src/**/*.{ts,tsx,vue}
📄 CodeRabbit inference engine (CLAUDE.md)
src/renderer/src/**/*.{ts,tsx,vue}: Use Pinia for frontend state management
Renderer to Main: Use usePresenter.ts composable for direct presenter method calls
Files:
src/renderer/src/components/icons/ModelIcon.vuesrc/renderer/src/components/message/MessageItemAssistant.vue
src/renderer/src/**/*
📄 CodeRabbit inference engine (.cursor/rules/i18n.mdc)
src/renderer/src/**/*: All user-facing strings must use i18n keys (avoid hardcoded user-visible text in code)
Use the 'vue-i18n' framework for all internationalization in the renderer
Ensure all user-visible text in the renderer uses the translation system
Files:
src/renderer/src/components/icons/ModelIcon.vuesrc/renderer/src/components/message/MessageItemAssistant.vue
src/renderer/**/*.{vue,ts,js,tsx,jsx}
📄 CodeRabbit inference engine (.cursor/rules/project-structure.mdc)
渲染进程代码放在
src/renderer
Files:
src/renderer/src/components/icons/ModelIcon.vuesrc/renderer/src/components/message/MessageItemAssistant.vue
src/renderer/src/**/*.{vue,ts,tsx,js,jsx}
📄 CodeRabbit inference engine (.cursor/rules/vue-best-practices.mdc)
src/renderer/src/**/*.{vue,ts,tsx,js,jsx}: Use the Composition API for better code organization and reusability
Implement proper state management with Pinia
Utilize Vue Router for navigation and route management
Leverage Vue's built-in reactivity system for efficient data handling
Files:
src/renderer/src/components/icons/ModelIcon.vuesrc/renderer/src/components/message/MessageItemAssistant.vue
src/renderer/**/*.{ts,tsx,vue}
📄 CodeRabbit inference engine (.cursor/rules/vue-shadcn.mdc)
src/renderer/**/*.{ts,tsx,vue}: Use descriptive variable names with auxiliary verbs (e.g., isLoading, hasError).
Use TypeScript for all code; prefer types over interfaces.
Avoid enums; use const objects instead.
Use arrow functions for methods and computed properties.
Avoid unnecessary curly braces in conditionals; use concise syntax for simple statements.
Files:
src/renderer/src/components/icons/ModelIcon.vuesrc/renderer/src/components/message/MessageItemAssistant.vue
src/renderer/**/*.{vue,ts}
📄 CodeRabbit inference engine (.cursor/rules/vue-shadcn.mdc)
Implement lazy loading for routes and components.
Files:
src/renderer/src/components/icons/ModelIcon.vuesrc/renderer/src/components/message/MessageItemAssistant.vue
src/renderer/**/*.{ts,vue}
📄 CodeRabbit inference engine (.cursor/rules/vue-shadcn.mdc)
src/renderer/**/*.{ts,vue}: Use useFetch and useAsyncData for data fetching.
Implement SEO best practices using Nuxt's useHead and useSeoMeta.
Files:
src/renderer/src/components/icons/ModelIcon.vuesrc/renderer/src/components/message/MessageItemAssistant.vue
🧠 Learnings (5)
📓 Common learnings
Learnt from: CR
PR: ThinkInAIXYZ/deepchat#0
File: .cursor/rules/vue-shadcn.mdc:0-0
Timestamp: 2025-07-23T00:45:57.322Z
Learning: Applies to src/renderer/**/*.{vue} : Use Iconify/Vue for icon implementation.
Learnt from: CR
PR: ThinkInAIXYZ/deepchat#0
File: .cursor/rules/vue-shadcn.mdc:0-0
Timestamp: 2025-07-23T00:45:57.322Z
Learning: Applies to src/renderer/**/*.{vue} : Use the Icon component with lucide icons.
Learnt from: CR
PR: ThinkInAIXYZ/deepchat#0
File: .cursor/rules/vue-shadcn.mdc:0-0
Timestamp: 2025-07-23T00:45:57.322Z
Learning: Applies to src/renderer/**/*.{vue} : Prefer "lucide:" icon family as the primary choice.
Learnt from: CR
PR: ThinkInAIXYZ/deepchat#0
File: .cursor/rules/vue-shadcn.mdc:0-0
Timestamp: 2025-07-23T00:45:57.322Z
Learning: Applies to src/renderer/**/*.{vue} : Follow naming pattern: {collection}:{icon-name} for icons.
📚 Learning: 2025-07-23T00:45:57.322Z
Learnt from: CR
PR: ThinkInAIXYZ/deepchat#0
File: .cursor/rules/vue-shadcn.mdc:0-0
Timestamp: 2025-07-23T00:45:57.322Z
Learning: Applies to src/renderer/**/*.{vue} : Use Iconify/Vue for icon implementation.
Applied to files:
src/renderer/src/components/icons/ModelIcon.vuesrc/renderer/src/components/message/MessageItemAssistant.vue
📚 Learning: 2025-07-23T00:45:57.322Z
Learnt from: CR
PR: ThinkInAIXYZ/deepchat#0
File: .cursor/rules/vue-shadcn.mdc:0-0
Timestamp: 2025-07-23T00:45:57.322Z
Learning: Applies to src/renderer/**/*.{vue} : Use the Icon component with lucide icons.
Applied to files:
src/renderer/src/components/icons/ModelIcon.vue
📚 Learning: 2025-07-23T00:45:57.322Z
Learnt from: CR
PR: ThinkInAIXYZ/deepchat#0
File: .cursor/rules/vue-shadcn.mdc:0-0
Timestamp: 2025-07-23T00:45:57.322Z
Learning: Applies to src/renderer/**/*.{vue} : Import Icon component from Iconify/Vue.
Applied to files:
src/renderer/src/components/icons/ModelIcon.vue
📚 Learning: 2025-07-23T00:45:57.322Z
Learnt from: CR
PR: ThinkInAIXYZ/deepchat#0
File: .cursor/rules/vue-shadcn.mdc:0-0
Timestamp: 2025-07-23T00:45:57.322Z
Learning: Applies to src/renderer/**/*.{vue} : For cases where lucide icons don't meet requirements, use other Iconify collections as fallback.
Applied to files:
src/renderer/src/components/icons/ModelIcon.vue
⏰ Context from checks skipped due to timeout of 90000ms. You can increase the timeout in your CodeRabbit configuration to a maximum of 15 minutes (900000ms). (1)
- GitHub Check: build-check (x64)
🔇 Additional comments (2)
src/renderer/src/components/icons/ModelIcon.vue (1)
177-181: Verify absence of parent-passedaltonModelIconI ran a global search for
<ModelIcon>withaltor:altacross all.vuefiles insrc/rendererand found no matches. Please manually verify that no parent component is passing analtprop toModelIcon. If any instances are discovered:
- Remove the parent-passed
altattribute so it doesn’t collide with the internal binding.- Retain the internal
:alt="iconKey"on the<img>root.- For decorative icons (e.g. purely decorative provider logos), consider setting
alt=""and addingaria-hidden="true".Once confirmed (or adjusted), this will prevent duplicate/conflicting
altattributes and ensure a11y correctness.src/renderer/src/components/message/MessageItemAssistant.vue (1)
9-14: Remove redundant :alt on ModelIcon to prevent conflicts and incorrect semanticsModelIcon now binds :alt internally. Passing :alt="currentMessage.role" from here produces conflicting alt intent and “assistant” is not the correct description for a provider logo. Remove it and let the icon component handle alt.
[ suggest_optional_refactor ]Apply this diff:
<ModelIcon :model-id="currentMessage.model_provider" custom-class="w-3 h-3" :is-dark="themeStore.isDark" - :alt="currentMessage.role" />Optional follow-up:
- If you want explicit control, add an alt prop to ModelIcon that accepts a localized provider label and use something like t('chat.providerIconAlt', { provider: currentMessage.model_provider }).
After applying, please re-check the visual alignment in the message list. If it still appears off by 1px on certain DPRs, consider adding 'block' to custom-class to eliminate any inline-image baseline quirks:
- custom-class="w-3 h-3" + custom-class="block w-3 h-3"
| <img | ||
| :src="icons[iconKey]" | ||
| :alt="iconKey" | ||
| :class="[customClass, { invert }, invert ? 'opacity-50' : '']" | ||
| /> |
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.
Fix undefined binding: use props.customClass in template
customClass is a prop on props. Referencing it bare in the template resolves to an undefined binding and drops the intended size classes, which likely re-introduces the alignment issue you’re fixing.
Apply this diff:
- <img
- :src="icons[iconKey]"
- :alt="iconKey"
- :class="[customClass, { invert }, invert ? 'opacity-50' : '']"
- />
+ <img
+ :src="icons[iconKey]"
+ :alt="iconKey"
+ loading="lazy"
+ decoding="async"
+ draggable="false"
+ :class="[props.customClass, { invert }, invert ? 'opacity-50' : '']"
+ />📝 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. Thoroughly test & benchmark the code to ensure it meets the requirements.
| <img | |
| :src="icons[iconKey]" | |
| :alt="iconKey" | |
| :class="[customClass, { invert }, invert ? 'opacity-50' : '']" | |
| /> | |
| <img | |
| :src="icons[iconKey]" | |
| :alt="iconKey" | |
| loading="lazy" | |
| decoding="async" | |
| draggable="false" | |
| :class="[props.customClass, { invert }, invert ? 'opacity-50' : '']" | |
| /> |
🤖 Prompt for AI Agents
In src/renderer/src/components/icons/ModelIcon.vue around lines 177-181 the
template references customClass directly which is undefined in this component
scope; change the binding to use props.customClass instead (i.e.,
:class="[props.customClass, { invert }, invert ? 'opacity-50' : '']") so the
passed-in size/alignment classes are applied correctly.
correct provider icon alignment in message list
old:

now:

Summary by CodeRabbit