fix(frontend): restore readable model activity timeline
This commit is contained in:
@@ -8,10 +8,17 @@ import { Button } from "../components/ui/button";
|
||||
import { isNearBottom } from "./activityScroll";
|
||||
|
||||
const VISIBLE_MODEL_ACTIVITY_KINDS: ReadonlySet<ActivityKind> = new Set([
|
||||
"prompt",
|
||||
"thinking",
|
||||
"status",
|
||||
"assistant",
|
||||
]);
|
||||
|
||||
const ACTIVITY_LABELS: Readonly<Partial<Record<ActivityKind, string>>> = {
|
||||
prompt: "Question",
|
||||
thinking: "Reasoning",
|
||||
assistant: "Response",
|
||||
};
|
||||
|
||||
export function isVisibleModelActivity(entry: ActivityEntry): boolean {
|
||||
return VISIBLE_MODEL_ACTIVITY_KINDS.has(entry.kind);
|
||||
}
|
||||
@@ -36,54 +43,14 @@ function MarkdownBody({ entry }: { entry: ActivityEntry }) {
|
||||
);
|
||||
}
|
||||
|
||||
function ActivityBody({ entry }: { entry: ActivityEntry }) {
|
||||
if (entry.kind === "assistant" || entry.kind === "thinking") {
|
||||
return <MarkdownBody entry={entry} />;
|
||||
}
|
||||
|
||||
if (entry.kind === "status") {
|
||||
const tone =
|
||||
entry.level === "error"
|
||||
? "text-destructive"
|
||||
: entry.level === "warning"
|
||||
? "text-amber-600"
|
||||
: "text-foreground";
|
||||
return <p className={`whitespace-pre-wrap break-words text-sm leading-relaxed ${tone}`}>{entry.text}</p>;
|
||||
}
|
||||
|
||||
if (entry.kind === "lifecycle") {
|
||||
return <p className="whitespace-pre-wrap break-words text-sm leading-relaxed text-muted-foreground">{entry.text}</p>;
|
||||
}
|
||||
|
||||
return <p className="whitespace-pre-wrap break-words text-sm leading-relaxed text-foreground">{entry.text}</p>;
|
||||
}
|
||||
|
||||
function ActivityRow({ entry }: { entry: ActivityEntry }) {
|
||||
return (
|
||||
<article className="border-b border-border/50 py-3 last:border-b-0">
|
||||
<div className="mb-1.5 flex flex-wrap items-center gap-1.5 text-[0.65rem] font-semibold uppercase tracking-[0.08em] text-muted-foreground">
|
||||
{entry.phase && <span>{entry.phase}</span>}
|
||||
<span>{entry.kind}</span>
|
||||
{entry.status && (
|
||||
<span className={entry.status === "failed" ? "text-destructive" : undefined}>
|
||||
{entry.status}
|
||||
</span>
|
||||
)}
|
||||
{entry.level && (
|
||||
<span
|
||||
className={
|
||||
entry.level === "error"
|
||||
? "text-destructive"
|
||||
: entry.level === "warning"
|
||||
? "text-amber-600"
|
||||
: undefined
|
||||
}
|
||||
>
|
||||
{entry.level}
|
||||
</span>
|
||||
)}
|
||||
<article className="border-b border-border/50 py-2 last:border-b-0">
|
||||
<div className="mb-1 flex flex-wrap items-center gap-1 text-[0.65rem] font-semibold uppercase tracking-[0.08em] text-muted-foreground">
|
||||
<span className="text-foreground/80">{ACTIVITY_LABELS[entry.kind]}</span>
|
||||
{entry.phase && <span aria-label={`Phase ${entry.phase}`}>{entry.phase}</span>}
|
||||
</div>
|
||||
<ActivityBody entry={entry} />
|
||||
<MarkdownBody entry={entry} />
|
||||
</article>
|
||||
);
|
||||
}
|
||||
@@ -104,7 +71,7 @@ export function ModelActivityPanel({ onClose }: { onClose: () => void }) {
|
||||
|
||||
return (
|
||||
<aside className="flex w-2/5 shrink-0 flex-col border-r border-border bg-sidebar">
|
||||
<div className="flex items-center justify-between border-b border-border/60 px-3 py-3">
|
||||
<div className="flex items-center justify-between border-b border-border/60 px-3 py-2">
|
||||
<h2 className="font-heading text-sm font-semibold text-foreground">Model activity</h2>
|
||||
<Button size="icon-sm" variant="ghost" aria-label="Close model activity" onClick={onClose}>
|
||||
<X className="size-4" />
|
||||
|
||||
Reference in New Issue
Block a user