fix: translate into English

This commit is contained in:
Henry Li
2025-06-12 18:42:45 +08:00
parent d00682305f
commit cc7247d02a

View File

@@ -3,7 +3,13 @@
import { LoadingOutlined } from "@ant-design/icons"; import { LoadingOutlined } from "@ant-design/icons";
import { motion } from "framer-motion"; import { motion } from "framer-motion";
import { Download, Headphones, ChevronDown, ChevronRight, Brain } from "lucide-react"; import {
Download,
Headphones,
ChevronDown,
ChevronRight,
Brain,
} from "lucide-react";
import React, { useCallback, useMemo, useRef, useState } from "react"; import React, { useCallback, useMemo, useRef, useState } from "react";
import { LoadingAnimation } from "~/components/deer-flow/loading-animation"; import { LoadingAnimation } from "~/components/deer-flow/loading-animation";
@@ -23,7 +29,11 @@ import {
CardHeader, CardHeader,
CardTitle, CardTitle,
} from "~/components/ui/card"; } from "~/components/ui/card";
import { Collapsible, CollapsibleContent, CollapsibleTrigger } from "~/components/ui/collapsible"; import {
Collapsible,
CollapsibleContent,
CollapsibleTrigger,
} from "~/components/ui/collapsible";
import type { Message, Option } from "~/core/messages"; import type { Message, Option } from "~/core/messages";
import { import {
closeResearch, closeResearch,
@@ -323,59 +333,63 @@ function ThoughtBlock({
} }
return ( return (
<div className={cn("w-full mb-6", className)}> <div className={cn("mb-6 w-full", className)}>
<Collapsible open={isOpen} onOpenChange={setIsOpen}> <Collapsible open={isOpen} onOpenChange={setIsOpen}>
<CollapsibleTrigger asChild> <CollapsibleTrigger asChild>
<Button <Button
variant="ghost" variant="ghost"
className={cn( className={cn(
"w-full justify-start px-6 py-4 h-auto text-left rounded-xl border transition-all duration-200", "h-auto w-full justify-start rounded-xl border px-6 py-4 text-left transition-all duration-200",
"hover:bg-accent hover:text-accent-foreground", "hover:bg-accent hover:text-accent-foreground",
isStreaming isStreaming
? "border-primary/20 bg-primary/5 shadow-sm" ? "border-primary/20 bg-primary/5 shadow-sm"
: "border-border bg-card" : "border-border bg-card",
)} )}
> >
<div className="flex items-center gap-3 w-full"> <div className="flex w-full items-center gap-3">
<Brain <Brain
size={18} size={18}
className={cn( className={cn(
"shrink-0 transition-colors duration-200", "shrink-0 transition-colors duration-200",
isStreaming ? "text-primary" : "text-muted-foreground" isStreaming ? "text-primary" : "text-muted-foreground",
)} )}
/> />
<span className={cn( <span
"font-semibold leading-none transition-colors duration-200", className={cn(
isStreaming ? "text-primary" : "text-foreground" "leading-none font-semibold transition-colors duration-200",
)}> isStreaming ? "text-primary" : "text-foreground",
</span>
{isStreaming && (
<LoadingAnimation className="ml-2 scale-75" />
)} )}
>
Deep Thinking
</span>
{isStreaming && <LoadingAnimation className="ml-2 scale-75" />}
<div className="flex-grow" /> <div className="flex-grow" />
{isOpen ? ( {isOpen ? (
<ChevronDown size={16} className="text-muted-foreground transition-transform duration-200" /> <ChevronDown
size={16}
className="text-muted-foreground transition-transform duration-200"
/>
) : ( ) : (
<ChevronRight size={16} className="text-muted-foreground transition-transform duration-200" /> <ChevronRight
size={16}
className="text-muted-foreground transition-transform duration-200"
/>
)} )}
</div> </div>
</Button> </Button>
</CollapsibleTrigger> </CollapsibleTrigger>
<CollapsibleContent className="mt-3 data-[state=open]:animate-in data-[state=closed]:animate-out data-[state=closed]:fade-out-0 data-[state=open]:fade-in-0 data-[state=closed]:slide-up-2 data-[state=open]:slide-down-2"> <CollapsibleContent className="data-[state=open]:animate-in data-[state=closed]:animate-out data-[state=closed]:fade-out-0 data-[state=open]:fade-in-0 data-[state=closed]:slide-up-2 data-[state=open]:slide-down-2 mt-3">
<Card className={cn( <Card
className={cn(
"transition-all duration-200", "transition-all duration-200",
isStreaming isStreaming ? "border-primary/20 bg-primary/5" : "border-border",
? "border-primary/20 bg-primary/5" )}
: "border-border" >
)}>
<CardContent className="py-6"> <CardContent className="py-6">
<Markdown <Markdown
className={cn( className={cn(
"prose dark:prose-invert max-w-none transition-colors duration-200", "prose dark:prose-invert max-w-none transition-colors duration-200",
isStreaming isStreaming ? "prose-primary" : "opacity-80",
? "prose-primary"
: "opacity-80"
)} )}
animated={isStreaming} animated={isStreaming}
> >
@@ -417,7 +431,9 @@ function PlanCard({
}, [message.content]); }, [message.content]);
const reasoningContent = message.reasoningContent; const reasoningContent = message.reasoningContent;
const hasMainContent = Boolean(message.content && message.content.trim() !== ""); const hasMainContent = Boolean(
message.content && message.content.trim() !== "",
);
// 判断是否正在思考:有推理内容但还没有主要内容 // 判断是否正在思考:有推理内容但还没有主要内容
const isThinking = Boolean(reasoningContent && !hasMainContent); const isThinking = Boolean(reasoningContent && !hasMainContent);
@@ -470,10 +486,14 @@ 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 animated={message.isStreaming}>{step.title}</Markdown> <Markdown animated={message.isStreaming}>
{step.title}
</Markdown>
</h3> </h3>
<div className="text-muted-foreground text-sm"> <div className="text-muted-foreground text-sm">
<Markdown animated={message.isStreaming}>{step.description}</Markdown> <Markdown animated={message.isStreaming}>
{step.description}
</Markdown>
</div> </div>
</li> </li>
))} ))}
@@ -491,7 +511,9 @@ function PlanCard({
{interruptMessage?.options.map((option) => ( {interruptMessage?.options.map((option) => (
<Button <Button
key={option.value} key={option.value}
variant={option.value === "accepted" ? "default" : "outline"} variant={
option.value === "accepted" ? "default" : "outline"
}
disabled={!waitForFeedback} disabled={!waitForFeedback}
onClick={() => { onClick={() => {
if (option.value === "accepted") { if (option.value === "accepted") {