fix(web): scope answer loading placeholder to the last message (#18284)

This commit is contained in:
chanx
2026-08-14 18:22:20 +08:00
committed by GitHub
parent 6445390c24
commit ed4e1c03c0
5 changed files with 7 additions and 2 deletions

View File

@@ -142,7 +142,7 @@ const MarkdownContent = ({
});
// let text = content;
if (text === '') {
if (text === '' && loading) {
text = t('chat.searching');
}
const nextText = replaceTextByOldReg(text);

View File

@@ -51,6 +51,7 @@ interface IProps extends Partial<IRemoveMessageById>, IRegenerateMessage {
index: number;
showLikeButton?: boolean;
showLoudspeaker?: boolean;
isLast?: boolean;
}
const MessageItem = ({
@@ -68,6 +69,7 @@ const MessageItem = ({
showLoudspeaker = true,
visibleAvatar = true,
nickname,
isLast = false,
}: IProps) => {
const { theme } = useTheme();
const isAssistant = item.role === MessageType.Assistant;
@@ -164,7 +166,7 @@ const MessageItem = ({
{ '!bg-bg-card': !isAssistant },
)}
>
{sendLoading && isEmpty(messageContent) ? (
{sendLoading && isLast && isEmpty(messageContent) ? (
<LoadingDots className="text-text-secondary" />
) : (
<MarkdownContent

View File

@@ -304,6 +304,7 @@ const ChatCard = forwardRef(function ChatCard(
reference={messageReferences.get(message) ?? EmptyReference}
// clickDocumentButton={clickDocumentButton}
index={i}
isLast={i === derivedMessages.length - 1}
removeMessageById={removeMessageById}
regenerateMessage={regenerateMessage}
sendLoading={sendLoading}

View File

@@ -101,6 +101,7 @@ export function SingleChatBox({ conversation }: IProps) {
reference={messageReferences.get(message) ?? EmptyReference}
clickDocumentButton={clickDocumentButton}
index={i}
isLast={i === messages.length - 1}
removeMessageById={removeMessageById}
regenerateMessage={regenerateMessage}
sendLoading={sendLoading}

View File

@@ -88,6 +88,7 @@ const ChatContainer = () => {
derivedMessages?.length - 1 === i
}
index={i}
isLast={i === derivedMessages.length - 1}
clickDocumentButton={clickDocumentButton}
showLikeButton={false}
showLoudspeaker={false}