Press n or j to go to the next uncovered block, b, p or k for the previous block.
| 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 | 15x 15x 15x 3x 1x 15x 1x 15x 5x 15x 4x 3x | import { RETRIEVAL_STAGE, StatusBadge } from "@/components/detail";
import { RetrievalReport, TriageChoice } from "@/objects/Model";
import { routeLabel } from "@/util/systemNodeTrace";
import React from "react";
/**
* What a system stage's trace says about how it decided, beside what it
* produced: the route the gate's triage chose before the gate's own rules
* changed it, whether the knowledge inventory triage read was whole, and
* what the retrieval pipeline ran without.
*
* Each used to be in svc-ai's log only. A forced retrieval read as triage's
* choice, and a turn whose relevance judge had failed answered from passages
* nobody checked, with nothing in the trace to say so.
*/
const noteCls = "text-[11px] text-gray-500 dark:text-gray-400 leading-relaxed";
const lineCls = "font-mono text-[10px] text-gray-500 dark:text-gray-400 leading-relaxed break-words";
/** Triage's own route, and each change the gate made on the way to the
* route above it. */
export const TriageChoiceNote: React.FC<{ triage: Required<TriageChoice> }> = ({
triage,
}) => (
<div className="space-y-0.5">
<p className={noteCls}>{`Triage chose: ${routeLabel(triage.route, triage.retrieval_type)}`}</p>
{triage.source === "fallback" && (
<p className={noteCls}>
Triage did not answer, so this route was read from the request.
</p>
)}
{triage.adjustments.map((line, i) => (
<p key={i} className={lineCls}>{`↳ ${line}`}</p>
))}
</div>
);
/** The knowledge inventory triage read was not whole: a count, a document
* list or a graph schema could not be read. Not a failure of the turn. */
export const KnowledgeInventoryNote: React.FC = () => (
<p className={`${noteCls} italic`}>
The knowledge inventory could not be read in full, so routing may have
seen less than the knowledge bases hold.
</p>
);
/**
* A retrieval stage that ran with less (`RETRIEVAL_STAGE`'s `degraded`): a
* gap to notice, not evidence the answer is wrong — the relevance judge
* fails open, keeping its passages unjudged.
*/
const StageGap: React.FC<{ label: string; detail: string }> = ({ label, detail }) => (
<div className="flex items-start gap-1.5 flex-wrap">
<StatusBadge status="degraded" scale={RETRIEVAL_STAGE} label={label} />
<span className={`${lineCls} min-w-0`}>{detail}</span>
</div>
);
/** What the retrieval pipeline ran without, and what its judge ruled out. */
export const RetrievalReportNotes: React.FC<{ report: Required<RetrievalReport> }> = ({
report,
}) => (
<div className="space-y-1">
{report.planner_failure && (
<StageGap label="Query planner failed" detail={report.planner_failure} />
)}
{report.judge_failure && (
<>
<StageGap label="Relevance judge failed" detail={report.judge_failure} />
<p className={noteCls}>Its passages were kept without a relevance check.</p>
</>
)}
{report.degraded.map((line, i) => (
<StageGap key={i} label="Semantic search unavailable" detail={line} />
))}
{report.judged_out > 0 && (
<p className={noteCls}>
{`${report.judged_out} passage${report.judged_out === 1 ? "" : "s"} ruled out as not relevant`}
</p>
)}
</div>
);
|