mirror of
https://git.mirrors.martin98.com/https://github.com/bytedance/deer-flow
synced 2025-08-19 15:09:10 +08:00
refactor: rename to animated
This commit is contained in:
parent
28b65d7a93
commit
07f965f0df
@ -10,7 +10,10 @@ import { LoadingAnimation } from "~/components/deer-flow/loading-animation";
|
|||||||
import { Markdown } from "~/components/deer-flow/markdown";
|
import { Markdown } from "~/components/deer-flow/markdown";
|
||||||
import { RainbowText } from "~/components/deer-flow/rainbow-text";
|
import { RainbowText } from "~/components/deer-flow/rainbow-text";
|
||||||
import { RollingText } from "~/components/deer-flow/rolling-text";
|
import { RollingText } from "~/components/deer-flow/rolling-text";
|
||||||
import { ScrollContainer, type ScrollContainerRef } from "~/components/deer-flow/scroll-container";
|
import {
|
||||||
|
ScrollContainer,
|
||||||
|
type ScrollContainerRef,
|
||||||
|
} from "~/components/deer-flow/scroll-container";
|
||||||
import { Tooltip } from "~/components/deer-flow/tooltip";
|
import { Tooltip } from "~/components/deer-flow/tooltip";
|
||||||
import { Button } from "~/components/ui/button";
|
import { Button } from "~/components/ui/button";
|
||||||
import {
|
import {
|
||||||
@ -81,7 +84,9 @@ export function MessageListView({
|
|||||||
scrollContainerRef.current.scrollToBottom();
|
scrollContainerRef.current.scrollToBottom();
|
||||||
}
|
}
|
||||||
}, 500);
|
}, 500);
|
||||||
return () => { clearTimeout(timer); };
|
return () => {
|
||||||
|
clearTimeout(timer);
|
||||||
|
};
|
||||||
}, []);
|
}, []);
|
||||||
|
|
||||||
return (
|
return (
|
||||||
@ -119,7 +124,7 @@ function MessageListItem({
|
|||||||
interruptMessage,
|
interruptMessage,
|
||||||
onFeedback,
|
onFeedback,
|
||||||
onSendMessage,
|
onSendMessage,
|
||||||
onToggleResearch
|
onToggleResearch,
|
||||||
}: {
|
}: {
|
||||||
className?: string;
|
className?: string;
|
||||||
messageId: string;
|
messageId: string;
|
||||||
@ -166,7 +171,10 @@ function MessageListItem({
|
|||||||
} else if (startOfResearch) {
|
} else if (startOfResearch) {
|
||||||
content = (
|
content = (
|
||||||
<div className="w-full px-4">
|
<div className="w-full px-4">
|
||||||
<ResearchCard researchId={message.id} onToggleResearch={onToggleResearch} />
|
<ResearchCard
|
||||||
|
researchId={message.id}
|
||||||
|
onToggleResearch={onToggleResearch}
|
||||||
|
/>
|
||||||
</div>
|
</div>
|
||||||
);
|
);
|
||||||
} else {
|
} else {
|
||||||
@ -221,7 +229,7 @@ function MessageListItem({
|
|||||||
className={cn(
|
className={cn(
|
||||||
`flex w-fit max-w-[85%] flex-col rounded-2xl px-4 py-3 shadow`,
|
`flex w-fit max-w-[85%] flex-col rounded-2xl px-4 py-3 shadow`,
|
||||||
message.role === "user" &&
|
message.role === "user" &&
|
||||||
"text-primary-foreground bg-brand rounded-ee-none",
|
"text-primary-foreground bg-brand rounded-ee-none",
|
||||||
message.role === "assistant" && "bg-card rounded-es-none",
|
message.role === "assistant" && "bg-card rounded-es-none",
|
||||||
className,
|
className,
|
||||||
)}
|
)}
|
||||||
@ -234,7 +242,7 @@ function MessageListItem({
|
|||||||
function ResearchCard({
|
function ResearchCard({
|
||||||
className,
|
className,
|
||||||
researchId,
|
researchId,
|
||||||
onToggleResearch
|
onToggleResearch,
|
||||||
}: {
|
}: {
|
||||||
className?: string;
|
className?: string;
|
||||||
researchId: string;
|
researchId: string;
|
||||||
@ -332,16 +340,17 @@ function PlanCard({
|
|||||||
<Card className={cn("w-full", className)}>
|
<Card className={cn("w-full", className)}>
|
||||||
<CardHeader>
|
<CardHeader>
|
||||||
<CardTitle>
|
<CardTitle>
|
||||||
<Markdown animate>
|
<Markdown animated>
|
||||||
{`### ${plan.title !== undefined && plan.title !== ""
|
{`### ${
|
||||||
? plan.title
|
plan.title !== undefined && plan.title !== ""
|
||||||
: "Deep Research"
|
? plan.title
|
||||||
}`}
|
: "Deep Research"
|
||||||
|
}`}
|
||||||
</Markdown>
|
</Markdown>
|
||||||
</CardTitle>
|
</CardTitle>
|
||||||
</CardHeader>
|
</CardHeader>
|
||||||
<CardContent>
|
<CardContent>
|
||||||
<Markdown className="opacity-80" animate>
|
<Markdown className="opacity-80" animated>
|
||||||
{plan.thought}
|
{plan.thought}
|
||||||
</Markdown>
|
</Markdown>
|
||||||
{plan.steps && (
|
{plan.steps && (
|
||||||
@ -349,10 +358,10 @@ function PlanCard({
|
|||||||
{plan.steps.map((step, i) => (
|
{plan.steps.map((step, i) => (
|
||||||
<li key={`step-${i}`}>
|
<li key={`step-${i}`}>
|
||||||
<h3 className="mb text-lg font-medium">
|
<h3 className="mb text-lg font-medium">
|
||||||
<Markdown animate>{step.title}</Markdown>
|
<Markdown animated>{step.title}</Markdown>
|
||||||
</h3>
|
</h3>
|
||||||
<div className="text-muted-foreground text-sm">
|
<div className="text-muted-foreground text-sm">
|
||||||
<Markdown animate>{step.description}</Markdown>
|
<Markdown animated>{step.description}</Markdown>
|
||||||
</div>
|
</div>
|
||||||
</li>
|
</li>
|
||||||
))}
|
))}
|
||||||
|
@ -75,7 +75,7 @@ function ActivityMessage({ messageId }: { messageId: string }) {
|
|||||||
if (message.agent !== "reporter" && message.agent !== "planner") {
|
if (message.agent !== "reporter" && message.agent !== "planner") {
|
||||||
return (
|
return (
|
||||||
<div className="px-4 py-2">
|
<div className="px-4 py-2">
|
||||||
<Markdown animate>{message.content}</Markdown>
|
<Markdown animated>{message.content}</Markdown>
|
||||||
</div>
|
</div>
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
@ -62,7 +62,7 @@ export function ResearchReportBlock({
|
|||||||
/>
|
/>
|
||||||
) : (
|
) : (
|
||||||
<>
|
<>
|
||||||
<Markdown animate>{message?.content}</Markdown>
|
<Markdown animated>{message?.content}</Markdown>
|
||||||
{message?.isStreaming && <LoadingAnimation className="my-12" />}
|
{message?.isStreaming && <LoadingAnimation className="my-12" />}
|
||||||
</>
|
</>
|
||||||
)}
|
)}
|
||||||
|
@ -24,20 +24,20 @@ export function Markdown({
|
|||||||
children,
|
children,
|
||||||
style,
|
style,
|
||||||
enableCopy,
|
enableCopy,
|
||||||
animate = false,
|
animated = false,
|
||||||
...props
|
...props
|
||||||
}: ReactMarkdownOptions & {
|
}: ReactMarkdownOptions & {
|
||||||
className?: string;
|
className?: string;
|
||||||
enableCopy?: boolean;
|
enableCopy?: boolean;
|
||||||
style?: React.CSSProperties;
|
style?: React.CSSProperties;
|
||||||
animate?: boolean;
|
animated?: boolean;
|
||||||
}) {
|
}) {
|
||||||
const rehypePlugins = useMemo(() => {
|
const rehypePlugins = useMemo(() => {
|
||||||
if (animate) {
|
if (animated) {
|
||||||
return [rehypeKatex, rehypeSplitWordsIntoSpans];
|
return [rehypeKatex, rehypeSplitWordsIntoSpans];
|
||||||
}
|
}
|
||||||
return [rehypeKatex];
|
return [rehypeKatex];
|
||||||
}, [animate]);
|
}, [animated]);
|
||||||
return (
|
return (
|
||||||
<div
|
<div
|
||||||
className={cn(
|
className={cn(
|
||||||
|
Loading…
x
Reference in New Issue
Block a user