fix: preserve plain-language current understanding

This commit is contained in:
2026-08-04 18:43:50 +01:00
parent b343844954
commit 9e0fca8f53
2 changed files with 31 additions and 6 deletions
+22 -4
View File
@@ -179,7 +179,9 @@ function EvidenceLimitCard() {
}
// ── Current understanding card ────────────────────────────────
function CurrentUnderstandingCard({ currentSummary }) {
function CurrentUnderstandingCard({ currentSummary, plainLanguage }) {
if (plainLanguage) return <PlainLanguageCard summary={plainLanguage} />;
const summary = resolveCurrentSummary(currentSummary);
if (!summary) return null;
@@ -194,6 +196,20 @@ function CurrentUnderstandingCard({ currentSummary }) {
);
}
// ── Plain-language understanding card (from pipeline summary) ──
function PlainLanguageCard({ summary }) {
if (!summary) return null;
return (
<div className="rounded-lg border border-gray-200 bg-white p-5">
<h2 className="mb-3 text-sm font-semibold uppercase tracking-wide text-gray-500">
Current understanding
</h2>
<p className="text-sm leading-relaxed text-gray-700">{summary}</p>
</div>
);
}
// ── Investigation history card (readable notebook style) ──────
function InvestigationHistoryCard({ turn }) {
const isCollapsed = turn._collapsed;
@@ -356,6 +372,7 @@ export default function ReasoningWorkspace({
scenario,
status,
updateStatus,
currentUnderstanding: propUnderstanding,
result,
answer,
setAnswer,
@@ -425,10 +442,11 @@ export default function ReasoningWorkspace({
const genuineCompletion = hasGenuineCompletion(graph);
// Determine whether the Current Understanding card should render:
// — shows while there is an actual summary from any graph snapshot, or
// — when there is a durable plain-language understanding, or
// — when there is an actual summary from any graph snapshot, or
// — when the investigation has reached a terminal state with no active question.
const hasCurrentSummaryCondition =
Boolean(graph?.currentSummary || result?.updatedSituationGraph?.currentSummary) || !hasSelectedQuestion;
Boolean(propUnderstanding || graph?.currentSummary || result?.updatedSituationGraph?.currentSummary) || !hasSelectedQuestion;
return (
<div className="space-y-6">
@@ -502,7 +520,7 @@ export default function ReasoningWorkspace({
{status === "success" && !hasSelectedQuestion && graph && !genuineCompletion && <EvidenceLimitCard />}
{/* ── Supporting sections (same order for active and terminal) ─ */}
{hasCurrentSummaryCondition && <CurrentUnderstandingCard currentSummary={graph?.currentSummary || result?.updatedSituationGraph?.currentSummary} />}
{hasCurrentSummaryCondition && <CurrentUnderstandingCard currentSummary={graph?.currentSummary || result?.updatedSituationGraph?.currentSummary} plainLanguage={propUnderstanding || null} />}
<OriginalSituation scenario={scenario} centralStatement={graph?.centralStatement} />