Skip to content

CanvasAnvil is an open source AI diagram maker and flowchart generator - an infinite-canvas diagram editor and self-hosted drawio alternative that writes editable .drawio files. Text to diagram, then fix nodes, layout and labels in place. Also AI presentations, interior design CAD/BOM, posters and infographics.

fix(ui): unify the type, unclip the deck thumbnails, lift attachments out of the bubble

codingFeng10176aa4be33989
diff --git a/client/index.css b/client/index.css
index fbda825..4fdb3c0 100644
--- a/client/index.css
+++ b/client/index.css
@@ -136,9 +136,13 @@
-moz-osx-font-smoothing: grayscale;
}
- /* Display face carries headings; UI text stays on the sans. */
+ /* Headings keep the UI stack and only tighten their tracking.
+
+ The display serif has no CJK glyphs, so a Chinese heading fell through to
+ a system serif (SimSun) while everything around it stayed on the sans --
+ visibly two typefaces in one interface, and it hit generated markdown
+ headings too, not just chrome. One family, one texture. */
h1, h2, h3 {
- font-family: theme("fontFamily.display");
letter-spacing: -0.015em;
}
}
@@ -191,37 +195,6 @@
box-shadow: inset 0 0 0 1px hsl(var(--border) / 0.7);
}
- /* ---------------------------------------------------------------------
- Streaming caret.
-
- Sits at the end of the text the model is still writing. Attached with
- ::after rather than by splicing a node into the markdown output, so the
- renderer stays untouched and the caret lands on whatever the last block
- happens to be.
-
- Lists get it on their final item instead -- an ::after on the <ul> itself
- would break to its own line. `pre` and `table` are excluded: a blinking
- block inside a code fence or a table cell reads as content.
- --------------------------------------------------------------------- */
- .streaming-caret > :last-child:not(ul):not(ol):not(pre):not(table)::after,
- .streaming-caret > ul:last-child > li:last-child::after,
- .streaming-caret > ol:last-child > li:last-child::after {
- content: "";
- display: inline-block;
- width: 0.42em;
- height: 1.05em;
- margin-left: 0.1em;
- vertical-align: -0.19em;
- border-radius: 1px;
- background: hsl(var(--primary));
- animation: caret-blink 1.05s steps(1, end) infinite;
- }
-
- @keyframes caret-blink {
- 0%, 45% { opacity: 1; }
- 55%, 100% { opacity: 0; }
- }
-
/* Wide tables scroll inside the message instead of stretching the panel. */
.prose-scroll-x {
overflow-x: auto;
diff --git a/client/pages/portal/PortalPage.tsx b/client/pages/portal/PortalPage.tsx
index b7f7383..613eece 100644
--- a/client/pages/portal/PortalPage.tsx
+++ b/client/pages/portal/PortalPage.tsx
@@ -431,10 +431,10 @@ function SimpleCanvasDetailPage({
>
<Stagger className="self-center" stagger={0.055}>
<StaggerItem>
- <h1 className={cn("font-display font-semibold text-foreground", isEnglish ? "text-[clamp(34px,3.5vw,50px)] leading-[1.05]" : "text-[clamp(40px,4.4vw,62px)] leading-[1.08]")}>{config.title}</h1>
+ <h1 className={cn("font-semibold text-foreground", isEnglish ? "text-[clamp(34px,3.5vw,50px)] leading-[1.05]" : "text-[clamp(40px,4.4vw,62px)] leading-[1.08]")}>{config.title}</h1>
</StaggerItem>
<StaggerItem>
- <h2 className={cn("font-display font-semibold leading-tight text-primary-strong", isEnglish ? "mt-2 text-[clamp(18px,1.75vw,23px)]" : "mt-2.5 text-[clamp(22px,2.2vw,30px)]")}>{config.subtitle}</h2>
+ <h2 className={cn("font-semibold leading-tight text-primary-strong", isEnglish ? "mt-2 text-[clamp(18px,1.75vw,23px)]" : "mt-2.5 text-[clamp(22px,2.2vw,30px)]")}>{config.subtitle}</h2>
</StaggerItem>
<StaggerItem>
<p className={cn("max-w-[620px] text-muted-foreground", isEnglish ? "mt-4 text-[clamp(15px,1.2vw,16px)] leading-7" : "mt-5 text-[17px] leading-8")}>{config.intro}</p>
@@ -466,7 +466,7 @@ function SimpleCanvasDetailPage({
</StaggerItem>
<StaggerItem className={cn(isEnglish ? "mt-6" : "mt-7")}>
- <div className={cn("max-w-[540px] font-display font-semibold text-primary-strong", isEnglish ? "mb-2 text-[16px] leading-6" : "mb-2.5 text-[19px] leading-7")}>{config.slogan}</div>
+ <div className={cn("max-w-[540px] font-semibold text-primary-strong", isEnglish ? "mb-2 text-[16px] leading-6" : "mb-2.5 text-[19px] leading-7")}>{config.slogan}</div>
{/* The brush-stroke plate stays — a hand-made mark suits the brand.
Only the palette moves from blueprint blue to clay. */}
<button
@@ -682,7 +682,7 @@ export function PortalPage({ onEnterWorkspace }: PortalPageProps) {
<section className="max-w-[650px] px-2">
<Stagger stagger={0.07}>
<StaggerItem>
- <h1 className="font-display text-[clamp(34px,4vw,58px)] font-semibold leading-[1.1] tracking-[-0.02em] text-foreground">
+ <h1 className="text-[clamp(34px,4vw,58px)] font-semibold leading-[1.1] tracking-[-0.02em] text-foreground">
<span className="block">{copy.titleA}</span>
<span className="block">
<span>{copy.titleB}</span>
@@ -786,7 +786,7 @@ export function PortalPage({ onEnterWorkspace }: PortalPageProps) {
<div className="absolute inset-8 rounded-full bg-[radial-gradient(circle,hsl(var(--card))_0%,hsl(var(--sunken))_100%)] shadow-[inset_0_0_0_8px_hsl(var(--primary)/0.05),0_0_0_2px_hsl(var(--primary)/0.07)]" />
<div className="absolute inset-0 flex flex-col items-center justify-center">
<BrandIcon className="h-20 w-20" />
- <div className="mt-3 font-display text-2xl font-semibold text-foreground">{copy.hub}</div>
+ <div className="mt-3 text-2xl font-semibold text-foreground">{copy.hub}</div>
<div className="mt-1.5 text-sm text-muted-foreground">{copy.hubSub}</div>
</div>
</motion.div>
@@ -851,7 +851,7 @@ export function PortalPage({ onEnterWorkspace }: PortalPageProps) {
onClick={(event) => event.stopPropagation()}
>
<div className="mb-4 flex items-center justify-between gap-4">
- <div className="font-display text-[22px] font-semibold text-foreground">{previewImage.title}</div>
+ <div className="text-[22px] font-semibold text-foreground">{previewImage.title}</div>
<button
className="flex h-10 w-10 items-center justify-center rounded-full border border-border/70 bg-sunken text-muted-foreground transition-[background-color,color,transform] duration-fast ease-out-soft hover:bg-accent hover:text-foreground active:scale-95"
onClick={() => setPreviewImage(null)}
diff --git a/client/shared/chat/index.ts b/client/shared/chat/index.ts
index 52b008d..7f005cb 100644
--- a/client/shared/chat/index.ts
+++ b/client/shared/chat/index.ts
@@ -1,5 +1,6 @@
export * from "@/shared/chat/shimmer";
export * from "@/shared/chat/message-image";
+export * from "@/shared/chat/message-attachments";
export * from "@/shared/chat/reasoning";
export * from "@/shared/chat/button-with-tooltip";
export * from "@/shared/chat/reset-warning-modal";
diff --git a/client/shared/chat/message-attachments.tsx b/client/shared/chat/message-attachments.tsx
new file mode 100644
index 0000000..a1016c0
--- /dev/null
+++ b/client/shared/chat/message-attachments.tsx
@@ -0,0 +1,69 @@
+import { FileText } from "lucide-react";
+import { cn } from "@/shared/lib/utils";
+import { MessageImage } from "@/shared/chat/message-image";
+
+export type AttachedImage = { url: string; name?: string };
+export type AttachedFile = { filename?: string; fileType?: "pdf" | "text"; charCount?: number };
+
+/**
+ * What the user attached, shown as a strip directly above their bubble.
+ *
+ * These used to render inside the bubble, which made a short question with a
+ * screenshot look like a mostly-empty card wrapped around a picture. Keeping
+ * them outside lets the bubble stay the size of the sentence and lines the
+ * attachments up with it on the right.
+ */
+export function MessageAttachments({
+ images = [],
+ files = [],
+ align = "end",
+ className,
+}: {
+ images?: AttachedImage[];
+ files?: AttachedFile[];
+ align?: "start" | "end";
+ className?: string;
+}) {
+ if (images.length === 0 && files.length === 0) return null;
+
+ return (
+ <div
+ className={cn(
+ "flex w-full flex-wrap gap-2",
+ align === "end" ? "justify-end" : "justify-start",
+ className,
+ )}
+ >
+ {images.map((image, index) => (
+ <MessageImage
+ key={`att-img-${index}`}
+ src={image.url}
+ alt={image.name || "attachment"}
+ // Compact here: the strip is a reference to what was sent, not the
+ // place to read it. The lightbox is one click away.
+ className="w-[104px] shrink-0 [&_img]:h-[104px] [&_img]:w-full [&_img]:object-cover"
+ />
+ ))}
+
+ {files.map((file, index) => (
+ <span
+ key={`att-file-${index}`}
+ title={file.filename}
+ className="inline-flex max-w-[200px] items-center gap-2 rounded-xl border border-border/70 bg-card px-2.5 py-2 shadow-xs"
+ >
+ <span className="flex h-7 w-7 shrink-0 items-center justify-center rounded-lg bg-muted text-muted-foreground">
+ <FileText className="h-4 w-4" />
+ </span>
+ <span className="min-w-0">
+ <span className="block truncate text-xs font-medium text-foreground">
+ {file.filename || "file"}
+ </span>
+ <span className="block text-[10px] uppercase tracking-wide text-muted-foreground">
+ {file.fileType === "pdf" ? "PDF" : "TXT"}
+ </span>
+ </span>
+ </span>
+ ))}
+ </div>
+ );
+}
diff --git a/client/shared/ui/dialog.tsx b/client/shared/ui/dialog.tsx
index 029ed32..97fb6d3 100644
--- a/client/shared/ui/dialog.tsx
+++ b/client/shared/ui/dialog.tsx
@@ -111,7 +111,7 @@ const DialogTitle = React.forwardRef<
<DialogPrimitive.Title
ref={ref}
data-slot="dialog-title"
- className={cn("font-display text-xl leading-tight font-semibold tracking-[-0.015em]", className)}
+ className={cn("text-xl leading-tight font-semibold tracking-[-0.015em]", className)}
{...props}
/>
)
diff --git a/client/shared/ui/scale-to-fit.tsx b/client/shared/ui/scale-to-fit.tsx
new file mode 100644
index 0000000..7925d16
--- /dev/null
+++ b/client/shared/ui/scale-to-fit.tsx
@@ -0,0 +1,63 @@
+import { useLayoutEffect, useRef, useState, type ReactNode } from "react";
+import { cn } from "@/shared/lib/utils";
+
+/**
+ * Renders children at a fixed design size, scaled to fit the parent box.
+ *
+ * For content that can only lay itself out at explicit pixel dimensions -- a
+ * slide scene, say -- and therefore cannot be asked to fill an arbitrary
+ * container. Pure CSS cannot do this: `scale()` needs a unitless ratio, and
+ * `calc(100cqw / 240)` yields a length, so the declaration is simply dropped.
+ * Hence the measurement.
+ */
+export function ScaleToFit({
+ width,
+ height,
+ children,
+ className,
+}: {
+ width: number;
+ height: number;
+ children: ReactNode;
+ className?: string;
+}) {
+ const boxRef = useRef<HTMLDivElement>(null);
+ const [scale, setScale] = useState(0);
+
+ useLayoutEffect(() => {
+ const box = boxRef.current;
+ if (!box || !width || !height) return;
+
+ const measure = (w: number, h: number) => {
+ if (!w || !h) return;
+ setScale(Math.min(w / width, h / height));
+ };
+
+ measure(box.clientWidth, box.clientHeight);
+
+ if (typeof ResizeObserver === "undefined") return;
+ const observer = new ResizeObserver((entries) => {
+ const rect = entries[0]?.contentRect;
+ if (rect) measure(rect.width, rect.height);
+ });
+ observer.observe(box);
+ return () => observer.disconnect();
+ }, [width, height]);
+
+ return (
+ <div ref={boxRef} className={cn("absolute inset-0 overflow-hidden", className)}>
+ {/* Hidden until measured, so nothing flashes at full size first. */}
+ <div
+ style={{
+ width,
+ height,
+ transform: `scale(${scale})`,
+ transformOrigin: "top left",
+ visibility: scale ? "visible" : "hidden",
+ }}
+ >
+ {children}
+ </div>
+ </div>
+ );
+}
diff --git a/client/workspaces/cad/chat/ChatMessageDisplay.tsx b/client/workspaces/cad/chat/ChatMessageDisplay.tsx
index b8a62b0..d486dd0 100644
--- a/client/workspaces/cad/chat/ChatMessageDisplay.tsx
+++ b/client/workspaces/cad/chat/ChatMessageDisplay.tsx
@@ -2,7 +2,7 @@ import React, { useRef, useEffect, useState, useCallback } from 'react';
import { Check, ChevronDown, ChevronUp, Copy, Cpu, FileCode, FileText, Minus, Pencil, Plus, Play, RotateCcw } from "lucide-react";
import ReactMarkdown from "react-markdown";
import remarkGfm from 'remark-gfm';
-import { MessageImage, Reasoning, ReasoningContent, ReasoningTrigger, Shimmer } from "@/shared/chat";
+import { MessageAttachments, MessageImage, Reasoning, ReasoningContent, ReasoningTrigger, Shimmer } from "@/shared/chat";
import { ScrollArea } from "@/shared/ui/scroll-area";
import { CodeBlock } from "@/workspaces/cad/chat/code-block";
import { useUiLanguage } from "@/shared/i18n";
@@ -452,6 +452,19 @@ export function ChatMessageDisplay({
message.role === "user" ? "items-end" : "items-start"
)}
>
+ {/* What the user attached sits above the bubble, the way
+ it does on claude.ai -- inside, a one-line question
+ with a screenshot became a mostly-empty card. */}
+ {message.role === "user" && (
+ <MessageAttachments
+ images={probeImages}
+ files={probeSections
+ .filter((s) => s.type === "file")
+ .map((s) => ({ filename: s.filename, fileType: s.fileType }))}
+ className="order-0 mb-1.5"
+ />
+ )}
+
{/* Content Bubble */}
<div className={cn(
"order-1 w-full min-w-0 max-w-full overflow-hidden text-sm leading-relaxed",
@@ -582,7 +595,7 @@ export function ChatMessageDisplay({
const sections = splitTextIntoFileSections(text);
return (
<div className="w-full min-w-0 space-y-3">
- {images.length > 0 && (
+ {message.role !== "user" && images.length > 0 && (
<div className="space-y-2">
{images.map((img, i) => (
<MessageImage
@@ -739,13 +752,12 @@ export function ChatMessageDisplay({
</div>
);
}
- const renderMarkdown = (key: string, content: string, withCaret = false) => (
+ const renderMarkdown = (key: string, content: string) => (
<div key={key} className={cn(
// No `dark:prose-invert`: the prose variables are driven
// from the tokens now, and invert would overwrite them
// with the plugin's own greys.
- "prose prose-sm max-w-none break-words [overflow-wrap:anywhere] [&>*:first-child]:mt-0 [&>*:last-child]:mb-0",
- withCaret && "streaming-caret"
+ "prose prose-sm max-w-none break-words [overflow-wrap:anywhere] [&>*:first-child]:mt-0 [&>*:last-child]:mb-0"
)}>
<ReactMarkdown
remarkPlugins={[remarkGfm]}
@@ -838,14 +850,7 @@ export function ChatMessageDisplay({
<div className="w-full min-w-0 max-w-full overflow-hidden break-words [overflow-wrap:anywhere] py-1 text-sm leading-relaxed text-foreground">
<div className="space-y-3">
{textSegments.map((seg, segIdx) =>
- renderMarkdown(
- `${message.id}-assistant-markdown-${idx}-${segIdx}`,
- seg.content,
- status === "streaming" &&
- isLastAssistantMessage &&
- codeSegments.length === 0 &&
- segIdx === textSegments.length - 1,
- )
+ renderMarkdown(`${message.id}-assistant-markdown-${idx}-${segIdx}`, seg.content)
)}
</div>
</div>
@@ -990,6 +995,14 @@ export function ChatMessageDisplay({
<div className="order-2 flex items-center gap-1 mt-2 px-1">
{message.role === "user" && !isEditing && userMessageText && (
<>
+ <button
+ type="button"
+ onClick={() => copyMessageToClipboard(message.id, getUserOriginalText(message))}
+ className="p-1.5 rounded-lg transition-[color,background-color,opacity,transform] duration-fast ease-out-soft active:scale-90 focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring/30 text-muted-foreground/70 hover:text-foreground hover:bg-accent"
+ title={tr("复制", "Copy")}
+ >
+ {copiedMessageId === message.id ? <Check className="h-3.5 w-3.5 text-success" /> : <Copy className="h-3.5 w-3.5" />}
+ </button>
{onEditMessage && isLastUserMessage && (
<button
type="button"
@@ -1003,14 +1016,6 @@ export function ChatMessageDisplay({
<Pencil className="h-3.5 w-3.5" />
</button>
)}
- <button
- type="button"
- onClick={() => copyMessageToClipboard(message.id, getUserOriginalText(message))}
- className="p-1.5 rounded-lg transition-[color,background-color,opacity,transform] duration-fast ease-out-soft active:scale-90 focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring/30 text-muted-foreground/70 hover:text-foreground hover:bg-accent"
- title={tr("复制", "Copy")}
- >
- {copiedMessageId === message.id ? <Check className="h-3.5 w-3.5 text-success" /> : <Copy className="h-3.5 w-3.5" />}
- </button>
</>
)}
{message.role === "assistant" && (
diff --git a/client/workspaces/flow/chat/ChatMessageDisplay.tsx b/client/workspaces/flow/chat/ChatMessageDisplay.tsx
index 05f9cbd..93ca9c4 100644
--- a/client/workspaces/flow/chat/ChatMessageDisplay.tsx
+++ b/client/workspaces/flow/chat/ChatMessageDisplay.tsx
@@ -885,28 +885,6 @@ export function ChatMessageDisplay({
{message.role === "user" &&
!isEditing && (
<div className="order-2 flex items-center gap-1 self-end">
- {onEditMessage &&
- isLastUserMessage && (
- <button
- type="button"
- onClick={() => {
- setEditingMessageId(
- message.id,
- )
- setEditText(
- getUserOriginalText(
- message,
- ),
- )
- }}
- className="p-1.5 rounded-lg transition-[color,background-color,opacity,transform] duration-fast ease-out-soft active:scale-90 focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring/30 text-muted-foreground/70 hover:text-foreground hover:bg-accent"
- title={t(
- "message.edit",
- )}
- >
- <Pencil className="h-3.5 w-3.5" />
- </button>
- )}
<button
type="button"
onClick={() =>
@@ -945,6 +923,28 @@ export function ChatMessageDisplay({
<Copy className="h-3.5 w-3.5" />
)}
</button>
+ {onEditMessage &&
+ isLastUserMessage && (
+ <button
+ type="button"
+ onClick={() => {
+ setEditingMessageId(
+ message.id,
+ )
+ setEditText(
+ getUserOriginalText(
+ message,
+ ),
+ )
+ }}
+ className="p-1.5 rounded-lg transition-[color,background-color,opacity,transform] duration-fast ease-out-soft active:scale-90 focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring/30 text-muted-foreground/70 hover:text-foreground hover:bg-accent"
+ title={t(
+ "message.edit",
+ )}
+ >
+ <Pencil className="h-3.5 w-3.5" />
+ </button>
+ )}
</div>
)}
<div
@@ -1068,11 +1068,6 @@ export function ChatMessageDisplay({
key={`${message.id}-textsection-${partIndex}-${sectionIndex}`}
className={cn(
"prose prose-sm max-w-none break-words [&>*:first-child]:mt-0 [&>*:last-child]:mb-0",
- // Caret only on the tail of the message still being written.
- status === "streaming" &&
- isLastAssistantMessage &&
- sectionIndex === sections.length - 1 &&
- "streaming-caret",
)}
>
<ReactMarkdown
diff --git a/client/workspaces/flow/lib/translations.ts b/client/workspaces/flow/lib/translations.ts
index 5ba3092..15fb27d 100644
--- a/client/workspaces/flow/lib/translations.ts
+++ b/client/workspaces/flow/lib/translations.ts
@@ -29,7 +29,8 @@ const messages = {
// ChatMessageDisplay
"message.sending": { zh: "正在发送消息...", en: "Sending message..." },
"message.parsing_files": { zh: "正在解析文件...", en: "Parsing files..." },
- "message.thinking": { zh: "AI 正在思考并生成结果...", en: "AI is thinking and generating response..." },
+ // Kept identical to the CAD and PPT panels so the three read as one product.
+ "message.thinking": { zh: "思考中...", en: "Thinking..." },
"chat.drop_to_attach": { zh: "松开以添加文件", en: "Drop to attach" },
"message.copy": { zh: "复制消息", en: "Copy message" },
"message.copied": { zh: "已复制", en: "Copied!" },
diff --git a/client/workspaces/ppt/canvas/views/DeckView.tsx b/client/workspaces/ppt/canvas/views/DeckView.tsx
index 3807004..f68d945 100644
--- a/client/workspaces/ppt/canvas/views/DeckView.tsx
+++ b/client/workspaces/ppt/canvas/views/DeckView.tsx
@@ -12,6 +12,7 @@ import {
X,
} from "lucide-react";
import { motion } from "motion/react";
+import { ScaleToFit } from "@/shared/ui/scale-to-fit";
import {
ContextMenu,
ContextMenuContent,
@@ -286,7 +287,12 @@ export function DeckView({
) : null}
{/* Thumbnail Preview */}
{hasGeneratedImage ? (
- renderScaledSlideScene(slide, false, 240, 135)
+ // The scene lays out at a fixed 240x135 while this slot is
+ // whatever the rail leaves it -- so it used to overflow by
+ // ~7% and have its right and bottom edges clipped.
+ <ScaleToFit width={240} height={135}>
+ {renderScaledSlideScene(slide, false, 240, 135)}
+ </ScaleToFit>
) : (
<div className="w-full h-full p-2 flex flex-col bg-white text-[#141413] overflow-hidden text-[6px]">
{deck.templateImage && (
diff --git a/client/workspaces/ppt/chat/ChatMessageDisplay.tsx b/client/workspaces/ppt/chat/ChatMessageDisplay.tsx
index 1fe5d80..72d4ae4 100644
--- a/client/workspaces/ppt/chat/ChatMessageDisplay.tsx
+++ b/client/workspaces/ppt/chat/ChatMessageDisplay.tsx
@@ -2,7 +2,7 @@ import React, { useRef, useEffect, useState, useCallback } from 'react';
import { Check, ChevronDown, ChevronUp, Copy, FileCode, FileText, Pencil, RotateCcw } from "lucide-react";
import ReactMarkdown from "react-markdown";
import remarkGfm from 'remark-gfm';
-import { MessageImage, Reasoning, ReasoningContent, ReasoningTrigger, Shimmer } from "@/shared/chat";
+import { MessageAttachments, MessageImage, Reasoning, ReasoningContent, ReasoningTrigger, Shimmer } from "@/shared/chat";
import { ScrollArea } from "@/shared/ui/scroll-area";
import { CodeBlock } from "@/workspaces/ppt/chat/code-block";
import { useUiLanguage } from "@/shared/i18n";
@@ -267,6 +267,19 @@ export function ChatMessageDisplay({
message.role === "assistant" ? "w-full max-w-full items-start" : "max-w-[85%] items-end"
)}
>
+ {/* What the user attached sits above the bubble, the way
+ it does on claude.ai -- inside, a one-line question
+ with a screenshot became a mostly-empty card. */}
+ {message.role === "user" && (
+ <MessageAttachments
+ images={probeImages}
+ files={probeSections
+ .filter((s) => s.type === "file")
+ .map((s) => ({ filename: s.filename, fileType: s.fileType }))}
+ className="mb-1.5"
+ />
+ )}
+
{/* Content Bubble.
The assistant speaks onto the page: no card,
@@ -398,7 +411,7 @@ export function ChatMessageDisplay({
const sections = splitTextIntoFileSections(text);
return (
<div className="space-y-3">
- {images.length > 0 && (
+ {message.role !== "user" && images.length > 0 && (
<div className="space-y-2">
{images.map((img, i) => (
<MessageImage
@@ -558,11 +571,6 @@ export function ChatMessageDisplay({
return (
<div key={idx} className={cn(
"prose prose-sm max-w-none break-words",
- // Only the tail of the message being written gets the caret.
- status === "streaming" &&
- isLastAssistantMessage &&
- idx === sections.length - 1 &&
- "streaming-caret",
)}>
<ReactMarkdown
remarkPlugins={[remarkGfm]}
@@ -645,6 +653,14 @@ export function ChatMessageDisplay({
<div className="flex items-center gap-1 mt-2 px-1">
{message.role === "user" && !isEditing && userMessageText && (
<>
+ <button
+ type="button"
+ onClick={() => copyMessageToClipboard(message.id, getUserOriginalText(message))}
+ className="p-1.5 rounded-lg transition-[color,background-color,opacity,transform] duration-fast ease-out-soft active:scale-90 focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring/30 text-muted-foreground/70 hover:text-foreground hover:bg-accent"
+ title={tr("复制", "Copy")}
+ >
+ {copiedMessageId === message.id ? <Check className="h-3.5 w-3.5 text-success" /> : <Copy className="h-3.5 w-3.5" />}
+ </button>
{onEditMessage && isLastUserMessage && (
<button
type="button"
@@ -658,14 +674,6 @@ export function ChatMessageDisplay({
<Pencil className="h-3.5 w-3.5" />
</button>
)}
- <button
- type="button"
- onClick={() => copyMessageToClipboard(message.id, getUserOriginalText(message))}
- className="p-1.5 rounded-lg transition-[color,background-color,opacity,transform] duration-fast ease-out-soft active:scale-90 focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring/30 text-muted-foreground/70 hover:text-foreground hover:bg-accent"
- title={tr("复制", "Copy")}
- >
- {copiedMessageId === message.id ? <Check className="h-3.5 w-3.5 text-success" /> : <Copy className="h-3.5 w-3.5" />}
- </button>
</>
)}
{message.role === "assistant" && (
diff --git a/tailwind.config.js b/tailwind.config.js
index 7a86706..a1a7eae 100644
--- a/tailwind.config.js
+++ b/tailwind.config.js
@@ -107,8 +107,9 @@ export default {
maxWidth: "none",
lineHeight: "1.72",
+ // Assistant headings stay on the UI stack: the display serif has
+ // no CJK coverage, so Chinese headings dropped to a system serif.
"h1, h2, h3, h4": {
- fontFamily: 'theme("fontFamily.display")',
letterSpacing: "-0.015em",
fontWeight: "600",
},