feat: make investigation history readable

This commit is contained in:
2026-08-04 17:14:50 +01:00
parent 2fd12b124c
commit c3faf53823
+23 -18
View File
@@ -193,29 +193,33 @@ function CurrentFocusCard({ graph }) {
);
}
// ── Investigation history card ────────────────────────────────
// ── Investigation history card (readable notebook style) ───────
function InvestigationHistoryCard({ turn }) {
const qSnippet = turn.question.length > 80
? turn.question.slice(0, 80) + "…"
: turn.question;
const isCollapsed = turn._collapsed;
return (
<details className="rounded-lg border border-gray-100 bg-gray-50/60 px-4 py-3" key={turn.id}>
<summary className="cursor-pointer text-xs font-semibold uppercase tracking-wide text-gray-400 hover:text-gray-600">
{new Date(turn.timestamp).toLocaleString(undefined, {
month: "short",
day: "numeric",
hour: "2-digit",
minute: "2-digit",
})} {qSnippet}
<details
className="rounded-lg border border-gray-100 bg-gray-50/60"
key={turn.id}
open={!isCollapsed}
>
<summary className="cursor-pointer px-4 py-2 text-sm font-medium text-gray-700 hover:text-gray-900">
{isCollapsed ? "Q: " : "✓ "}
{turn.question.length > 60 && !isCollapsed
? turn.question.slice(0, 60) + "…"
: turn.question}
{!isCollapsed && (
<span className="ml-2 text-xs font-normal text-gray-400"> answered</span>
)}
</summary>
<div className="mt-2 space-y-2 text-sm">
<p><strong>Question</strong></p>
<p>{turn.question}</p>
<p><strong>You answered</strong></p>
<div className="px-4 pb-3 pt-1 space-y-2">
<p><strong>Your answer</strong></p>
<p className="text-gray-700">{turn.answer}</p>
{turn.acknowledgement && (
<>
<hr className="border-gray-200" />
<p><strong>What changed</strong></p>
<p className="italic text-gray-500">{turn.acknowledgement}</p>
</>
@@ -229,6 +233,8 @@ function InvestigationHistoryCard({ turn }) {
function InvestigationHistory({ turns }) {
if (!turns || turns.length === 0) return null;
const latestId = turns[turns.length - 1].id;
return (
<div className="space-y-3">
<h2 className="text-xs font-bold uppercase tracking-wider text-gray-400">
@@ -236,7 +242,7 @@ function InvestigationHistory({ turns }) {
</h2>
<div className="space-y-2">
{turns.map((turn) => (
<InvestigationHistoryCard key={turn.id} turn={turn} />
<InvestigationHistoryCard key={turn.id} turn={{ ...turn, _collapsed: turn.id !== latestId }} />
))}
</div>
</div>
@@ -403,7 +409,6 @@ export default function ReasoningWorkspace({
question: q,
answer: answerText.trim(),
acknowledgement: null,
timestamp: Date.now(),
};
};