Commit 5a00c065 by Archer Committed by GitHub

fix: chatitem animation (#6965)

* fix: chatitem animation

* fix: chatitem animation
parent fb38d14f
......@@ -126,8 +126,8 @@ const AIContentCard = React.memo(function AIContentCard({
onOpenCiteModal: (e?: OnOpenCiteModalProps) => void;
}) {
const lastValue = chatValue[chatValue.length - 1];
const lastIsText = lastValue?.text;
const lastIsReasoning = lastValue?.reasoning;
const lastHasText = !!lastValue?.text?.content?.trim();
const lastHasReasoning = !!lastValue?.reasoning?.content?.trim();
return (
<Flex flexDirection={'column'}>
{chatValue.map((value, i) => {
......@@ -154,7 +154,7 @@ const AIContentCard = React.memo(function AIContentCard({
})}
{/* 生成中占位动画(含断线续传拉流期间最后一条非文本时的 shimmer) */}
{isLastChild && !lastIsText && !lastIsReasoning && isChatting && (
{isLastChild && !lastHasText && !lastHasReasoning && isChatting && (
<Box className={markdownStyles.animation}></Box>
)}
......
......@@ -38,30 +38,32 @@ const AIResponseBox = ({
const tools = value.tools || (value.tool ? [value.tool] : undefined);
const disableStreamingInteraction = isChatting && isLastChild;
const skills = value.skills;
const reasoningContent = value.reasoning?.content || '';
const textContent = value.text?.content || '';
if (value.hideInUI) return null;
const responseBlocks: React.ReactNode[] = [];
if ('reasoning' in value && value.reasoning && !value.hideReason) {
if (reasoningContent && !value.hideReason) {
responseBlocks.push(
<RenderReasoningContent
key="reasoning"
isChatting={isChatting}
isLastResponseValue={isLastResponseValue}
content={value.reasoning.content}
isLastResponseValue={isLastResponseValue && !textContent && !tools}
content={reasoningContent}
isDisabled={disableStreamingInteraction}
/>
);
}
if ('text' in value && value.text) {
if (value.text && textContent) {
responseBlocks.push(
<RenderText
key="text"
chatItemDataId={chatItemDataId}
showAnimation={isChatting && isLastResponseValue}
text={value.text.content}
text={textContent}
onOpenCiteModal={onOpenCiteModal}
isDisabled={disableStreamingInteraction}
/>
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or sign in to comment