"use client"; import { CheckIcon, Loader2Icon } from "lucide-react"; import type { AssistantPhase, SearchStep } from "../lib/askConversation"; // The retrieval→answer feedback, shown while a turn is in flight (before the // first answer token). A restrained terminal-flavoured trace: each search the // model runs appears as its own row — a spinner while running, a check with the // match count when done — so multi-step "search, read, search again" is visible. // Once the answer starts streaming this returns null and the text takes over. export function PipelineStatus({ phase, steps, }: { phase?: AssistantPhase; steps: SearchStep[]; }) { if (phase !== "gathering" && phase !== "answering") return null; const thinking = phase === "gathering" && steps.length === 0; return (
{thinking && (
Reading your question…
)} {steps.map((s, i) => { const isFetch = s.kind === "fetch"; return (
{s.count === undefined ? ( ) : ( )} {isFetch ? "reading" : "searching"} {isFetch ? s.query : `“${s.query}”`} {s.count !== undefined && ( {isFetch ? `· ${s.count} line${s.count === 1 ? "" : "s"}` : `· ${s.count} result${s.count === 1 ? "" : "s"}`} )}
); })} {phase === "answering" && (
Writing answer…
)}
); }