mirror of
https://github.com/CherryHQ/cherry-studio.git
synced 2025-12-24 10:40:07 +08:00
fix: add message processing status check to Message component (#9982)
This commit is contained in:
parent
cb4b26c8a4
commit
ff74e9035d
@ -14,6 +14,7 @@ import { estimateMessageUsage } from '@renderer/services/TokenService'
|
||||
import { Assistant, Topic } from '@renderer/types'
|
||||
import type { Message, MessageBlock } from '@renderer/types/newMessage'
|
||||
import { classNames } from '@renderer/utils'
|
||||
import { isMessageProcessing } from '@renderer/utils/messageUtils/is'
|
||||
import { Divider } from 'antd'
|
||||
import React, { Dispatch, FC, memo, SetStateAction, useCallback, useEffect, useRef } from 'react'
|
||||
import { useTranslation } from 'react-i18next'
|
||||
@ -115,7 +116,8 @@ const MessageItem: FC<Props> = ({
|
||||
|
||||
const isLastMessage = index === 0 || !!isGrouped
|
||||
const isAssistantMessage = message.role === 'assistant'
|
||||
const showMenubar = !hideMenuBar && !isEditing
|
||||
const isProcessing = isMessageProcessing(message)
|
||||
const showMenubar = !hideMenuBar && !isEditing && !isProcessing
|
||||
|
||||
const messageHighlightHandler = useCallback(
|
||||
(highlight: boolean = true) => {
|
||||
|
||||
@ -1,10 +1,12 @@
|
||||
import {
|
||||
AssistantMessageStatus,
|
||||
type CitationMessageBlock,
|
||||
type CodeMessageBlock,
|
||||
type ErrorMessageBlock,
|
||||
type FileMessageBlock,
|
||||
type ImageMessageBlock,
|
||||
type MainTextMessageBlock,
|
||||
Message,
|
||||
type MessageBlock,
|
||||
MessageBlockType,
|
||||
type PlaceholderMessageBlock,
|
||||
@ -147,3 +149,11 @@ export function isCitationBlock(block: MessageBlock): block is CitationMessageBl
|
||||
export function isPlaceholderBlock(block: MessageBlock): block is PlaceholderMessageBlock {
|
||||
return block.type === MessageBlockType.UNKNOWN
|
||||
}
|
||||
|
||||
export function isMessageProcessing(message: Message): boolean {
|
||||
return (
|
||||
message.status === AssistantMessageStatus.PROCESSING ||
|
||||
message.status === AssistantMessageStatus.PENDING ||
|
||||
message.status === AssistantMessageStatus.SEARCHING
|
||||
)
|
||||
}
|
||||
|
||||
Loading…
Reference in New Issue
Block a user