mirror of
https://gitee.com/wanwujie/deer-flow
synced 2026-04-19 04:14:46 +08:00
feat: add reasoning check to message list item rendering
This commit is contained in:
@@ -7,7 +7,11 @@ import {
|
|||||||
MessageResponse as AIElementMessageResponse,
|
MessageResponse as AIElementMessageResponse,
|
||||||
MessageToolbar,
|
MessageToolbar,
|
||||||
} from "@/components/ai-elements/message";
|
} from "@/components/ai-elements/message";
|
||||||
import { extractContentFromMessage, hasToolCalls } from "@/core/messages/utils";
|
import {
|
||||||
|
extractContentFromMessage,
|
||||||
|
hasReasoning,
|
||||||
|
hasToolCalls,
|
||||||
|
} from "@/core/messages/utils";
|
||||||
import { useRehypeSplitWordsIntoSpans } from "@/core/rehype";
|
import { useRehypeSplitWordsIntoSpans } from "@/core/rehype";
|
||||||
import { cn } from "@/lib/utils";
|
import { cn } from "@/lib/utils";
|
||||||
|
|
||||||
@@ -66,6 +70,9 @@ function MessageContent_({
|
|||||||
const rehypePlugins = useRehypeSplitWordsIntoSpans(isLoading);
|
const rehypePlugins = useRehypeSplitWordsIntoSpans(isLoading);
|
||||||
return (
|
return (
|
||||||
<AIElementMessageContent className={className}>
|
<AIElementMessageContent className={className}>
|
||||||
|
{hasReasoning(message) && (
|
||||||
|
<MessageGroup messages={messagesInGroup} isLoading={isLoading} />
|
||||||
|
)}
|
||||||
<AIElementMessageResponse rehypePlugins={rehypePlugins}>
|
<AIElementMessageResponse rehypePlugins={rehypePlugins}>
|
||||||
{extractContentFromMessage(message)}
|
{extractContentFromMessage(message)}
|
||||||
</AIElementMessageResponse>
|
</AIElementMessageResponse>
|
||||||
|
|||||||
@@ -46,9 +46,6 @@ export function groupMessages<T>(
|
|||||||
} else {
|
} else {
|
||||||
// Assistant messages with content (text or images) are shown as a group if they have content
|
// Assistant messages with content (text or images) are shown as a group if they have content
|
||||||
// No matter whether it has tool calls or not
|
// No matter whether it has tool calls or not
|
||||||
if (hasReasoning(message)) {
|
|
||||||
currentGroup.push(message);
|
|
||||||
}
|
|
||||||
yieldCurrentGroup();
|
yieldCurrentGroup();
|
||||||
currentGroup.push(message);
|
currentGroup.push(message);
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user