chore: remove useless classnames (#7795)

* chore: remove useless classnames

* fix: respect filterIncludeUser
This commit is contained in:
one 2025-07-07 01:46:11 +08:00 committed by GitHub
parent 40519b48c5
commit 2c5bb5b699
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
2 changed files with 12 additions and 27 deletions

View File

@ -57,28 +57,19 @@ const Chat: FC<Props> = (props) => {
const contentSearchFilter: NodeFilter = { const contentSearchFilter: NodeFilter = {
acceptNode(node) { acceptNode(node) {
if (node.parentNode) { const container = node.parentElement?.closest('.message-content-container')
let parentNode: HTMLElement | null = node.parentNode as HTMLElement if (!container) return NodeFilter.FILTER_REJECT
while (parentNode?.parentNode) {
if (parentNode.classList.contains('MessageFooter')) {
return NodeFilter.FILTER_REJECT
}
if (filterIncludeUser) { const message = container.closest('.message')
if (parentNode?.classList.contains('message-content-container')) { if (!message) return NodeFilter.FILTER_REJECT
return NodeFilter.FILTER_ACCEPT
} if (filterIncludeUser) {
} else { return NodeFilter.FILTER_ACCEPT
if (parentNode?.classList.contains('message-content-container-assistant')) {
return NodeFilter.FILTER_ACCEPT
}
}
parentNode = parentNode.parentNode as HTMLElement
}
return NodeFilter.FILTER_REJECT
} else {
return NodeFilter.FILTER_REJECT
} }
if (message.classList.contains('message-assistant')) {
return NodeFilter.FILTER_ACCEPT
}
return NodeFilter.FILTER_REJECT
} }
} }

View File

@ -156,13 +156,7 @@ const MessageItem: FC<Props> = ({
{!isEditing && ( {!isEditing && (
<> <>
<MessageContentContainer <MessageContentContainer
className={ className="message-content-container"
message.role === 'user'
? 'message-content-container message-content-container-user'
: message.role === 'assistant'
? 'message-content-container message-content-container-assistant'
: 'message-content-container'
}
style={{ style={{
fontFamily: messageFont === 'serif' ? 'var(--font-family-serif)' : 'var(--font-family)', fontFamily: messageFont === 'serif' ? 'var(--font-family-serif)' : 'var(--font-family)',
fontSize, fontSize,