mirror of
https://github.com/CherryHQ/cherry-studio.git
synced 2025-12-27 04:31:27 +08:00
chore: remove useless classnames (#7795)
* chore: remove useless classnames * fix: respect filterIncludeUser
This commit is contained in:
parent
40519b48c5
commit
2c5bb5b699
@ -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
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@ -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,
|
||||
|
||||
Loading…
Reference in New Issue
Block a user