mirror of
https://gitee.com/wanwujie/deer-flow
synced 2026-05-02 02:00:45 +08:00
FIX/Adapt message box to handle long text in frontend (#466)
* fix:ui * fix:ui bug --------- Co-authored-by: Willem Jiang <willem.jiang@gmail.com>
This commit is contained in:
@@ -185,7 +185,7 @@ function MessageListItem({
|
|||||||
)}
|
)}
|
||||||
>
|
>
|
||||||
<MessageBubble message={message}>
|
<MessageBubble message={message}>
|
||||||
<div className="flex w-full flex-col text-wrap break-words">
|
<div className="flex w-full flex-col break-words">
|
||||||
<Markdown
|
<Markdown
|
||||||
className={cn(
|
className={cn(
|
||||||
message.role === "user" &&
|
message.role === "user" &&
|
||||||
@@ -233,11 +233,12 @@ function MessageBubble({
|
|||||||
return (
|
return (
|
||||||
<div
|
<div
|
||||||
className={cn(
|
className={cn(
|
||||||
`group flex w-fit max-w-[85%] flex-col rounded-2xl px-4 py-3 text-nowrap shadow`,
|
"group flex w-auto max-w-[90vw] flex-col rounded-2xl px-4 py-3 break-words",
|
||||||
message.role === "user" && "bg-brand rounded-ee-none",
|
message.role === "user" && "bg-brand rounded-ee-none",
|
||||||
message.role === "assistant" && "bg-card rounded-es-none",
|
message.role === "assistant" && "bg-card rounded-es-none",
|
||||||
className,
|
className,
|
||||||
)}
|
)}
|
||||||
|
style={{ wordBreak: "break-all" }}
|
||||||
>
|
>
|
||||||
{children}
|
{children}
|
||||||
</div>
|
</div>
|
||||||
@@ -492,27 +493,46 @@ function PlanCard({
|
|||||||
</CardTitle>
|
</CardTitle>
|
||||||
</CardHeader>
|
</CardHeader>
|
||||||
<CardContent>
|
<CardContent>
|
||||||
|
<div style={{ wordBreak: 'break-all', whiteSpace: 'normal' }}>
|
||||||
<Markdown className="opacity-80" animated={message.isStreaming}>
|
<Markdown className="opacity-80" animated={message.isStreaming}>
|
||||||
{plan.thought}
|
{plan.thought}
|
||||||
</Markdown>
|
</Markdown>
|
||||||
{plan.steps && (
|
{plan.steps && (
|
||||||
<ul className="my-2 flex list-decimal flex-col gap-4 border-l-[2px] pl-8">
|
<ul className="my-2 flex list-decimal flex-col gap-4 border-l-[2px] pl-8">
|
||||||
{plan.steps.map((step, i) => (
|
{plan.steps.map((step, i) => (
|
||||||
<li key={`step-${i}`}>
|
<li key={`step-${i}`} style={{ wordBreak: 'break-all', whiteSpace: 'normal' }}>
|
||||||
<h3 className="mb text-lg font-medium">
|
<div className="flex items-start gap-2">
|
||||||
|
<div className="flex-1">
|
||||||
|
<h3 className="mb flex items-center gap-2 text-lg font-medium">
|
||||||
<Markdown animated={message.isStreaming}>
|
<Markdown animated={message.isStreaming}>
|
||||||
{step.title}
|
{step.title}
|
||||||
</Markdown>
|
</Markdown>
|
||||||
|
{step.tools && step.tools.length > 0 && (
|
||||||
|
<Tooltip
|
||||||
|
title={`Uses ${step.tools.length} MCP tool${step.tools.length > 1 ? "s" : ""}`}
|
||||||
|
>
|
||||||
|
<div className="flex items-center gap-1 rounded-full bg-blue-100 px-2 py-1 text-xs text-blue-800">
|
||||||
|
<Wrench size={12} />
|
||||||
|
<span>{step.tools.length}</span>
|
||||||
|
</div>
|
||||||
|
</Tooltip>
|
||||||
|
)}
|
||||||
</h3>
|
</h3>
|
||||||
<div className="text-muted-foreground text-sm">
|
<div className="text-muted-foreground text-sm" style={{ wordBreak: 'break-all', whiteSpace: 'normal' }}>
|
||||||
<Markdown animated={message.isStreaming}>
|
<Markdown animated={message.isStreaming}>
|
||||||
{step.description}
|
{step.description}
|
||||||
</Markdown>
|
</Markdown>
|
||||||
</div>
|
</div>
|
||||||
|
{step.tools && step.tools.length > 0 && (
|
||||||
|
<ToolsDisplay tools={step.tools} />
|
||||||
|
)}
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
</li>
|
</li>
|
||||||
))}
|
))}
|
||||||
</ul>
|
</ul>
|
||||||
)}
|
)}
|
||||||
|
</div>
|
||||||
</CardContent>
|
</CardContent>
|
||||||
<CardFooter className="flex justify-end">
|
<CardFooter className="flex justify-end">
|
||||||
{!message.isStreaming && interruptMessage?.options?.length && (
|
{!message.isStreaming && interruptMessage?.options?.length && (
|
||||||
|
|||||||
@@ -185,7 +185,7 @@ const MessageInput = forwardRef<MessageInputRef, MessageInputProps>(
|
|||||||
<EditorContent
|
<EditorContent
|
||||||
immediatelyRender={false}
|
immediatelyRender={false}
|
||||||
extensions={extensions}
|
extensions={extensions}
|
||||||
className="border-muted h-full w-full overflow-auto"
|
className="border-muted h-full w-full overflow-auto break-words"
|
||||||
editorProps={{
|
editorProps={{
|
||||||
attributes: {
|
attributes: {
|
||||||
class:
|
class:
|
||||||
|
|||||||
@@ -304,3 +304,12 @@ span[style] > strong {
|
|||||||
mark[style] > strong {
|
mark[style] > strong {
|
||||||
color: inherit;
|
color: inherit;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
.prose ol, .prose ul {
|
||||||
|
margin-left: 1.2em;
|
||||||
|
color: #b0b0b0;
|
||||||
|
font-size: 0.98em;
|
||||||
|
}
|
||||||
|
.prose ol > li::marker, .prose ul > li::marker {
|
||||||
|
color: #b0b0b0;
|
||||||
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user