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 = {
acceptNode(node) {
if (node.parentNode) {
let parentNode: HTMLElement | null = node.parentNode as HTMLElement
while (parentNode?.parentNode) {
if (parentNode.classList.contains('MessageFooter')) {
return NodeFilter.FILTER_REJECT
}
const container = node.parentElement?.closest('.message-content-container')
if (!container) return NodeFilter.FILTER_REJECT
if (filterIncludeUser) {
if (parentNode?.classList.contains('message-content-container')) {
return NodeFilter.FILTER_ACCEPT
}
} else {
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
const message = container.closest('.message')
if (!message) return NodeFilter.FILTER_REJECT
if (filterIncludeUser) {
return NodeFilter.FILTER_ACCEPT
}
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 && (
<>
<MessageContentContainer
className={
message.role === 'user'
? 'message-content-container message-content-container-user'
: message.role === 'assistant'
? 'message-content-container message-content-container-assistant'
: 'message-content-container'
}
className="message-content-container"
style={{
fontFamily: messageFont === 'serif' ? 'var(--font-family-serif)' : 'var(--font-family)',
fontSize,