fix(webui): align message actions and simplify compaction notices

This commit is contained in:
chengyongru authored and chengyongru committed 2026-09-10 15:33:35 +08:00
1 parent 39a817e72d
commit a3e9d0f9a9
14 files changed
+29 -33

No files matched your search

@@ -1,4 +1,3 @@
import { Archive, CircleAlert, LoaderCircle } from "lucide-react";
import { useTranslation } from "react-i18next";
import { cn } from "@/lib/utils";
@@ -11,17 +10,12 @@ interface ContextCompactionNoticeProps {
export function ContextCompactionNotice({ compaction }: ContextCompactionNoticeProps) {
const { t } = useTranslation();
const title = compaction.phase === "started"
? t("thread.compaction.started", { defaultValue: "Compressing context…" })
? t("thread.compaction.started", { defaultValue: "Compressing context" })
: compaction.phase === "failed"
? t("thread.compaction.failed", { defaultValue: "Context compaction failed" })
: compaction.phase === "cancelled"
? t("thread.compaction.cancelled", { defaultValue: "Context compaction cancelled" })
: t("thread.compaction.succeeded", { defaultValue: "Context compacted" });
const Icon = compaction.phase === "started"
? LoaderCircle
: compaction.phase === "failed"
? CircleAlert
: Archive;
return (
<div
@@ -29,23 +23,18 @@ export function ContextCompactionNotice({ compaction }: ContextCompactionNoticeP
aria-live={compaction.announce ? "polite" : undefined}
aria-busy={compaction.phase === "started"}
data-context-compaction={compaction.phase}
className="mx-auto flex w-full max-w-[49.5rem] items-center gap-2.5 py-1 text-xs text-muted-foreground"
className="mx-auto flex w-full max-w-[49.5rem] items-center justify-center gap-3 py-2 text-xs text-muted-foreground"
>
<span
<span aria-hidden className="h-px min-w-4 max-w-16 flex-1 bg-border/60" />
<p
className={cn(
"flex size-6 shrink-0 items-center justify-center rounded-full bg-muted/60",
compaction.phase === "failed" && "text-destructive",
"min-w-0 text-center leading-5",
compaction.phase === "failed" && "text-destructive/80",
)}
>
<Icon
className={cn(
"size-3.5",
compaction.phase === "started" && "animate-spin motion-reduce:animate-none",
)}
aria-hidden
/>
</span>
<p className="min-w-0 font-medium leading-5 text-foreground/80">{title}</p>
{title}
</p>
<span aria-hidden className="h-px min-w-4 max-w-16 flex-1 bg-border/60" />
</div>
);
}