fix: localise update reasoning state
This commit is contained in:
@@ -636,20 +636,13 @@ export default function ReasoningWorkspace({
|
||||
variant="initial"
|
||||
/>
|
||||
)}
|
||||
{updateStatus === "loading" && (
|
||||
<LoadingOverlay
|
||||
elapsed={updateElapsed}
|
||||
currentMessage={updateMsg}
|
||||
variant="update"
|
||||
/>
|
||||
)}
|
||||
|
||||
{/* ── Provider unavailable recovery ──────────────── */}
|
||||
{/* ── Provider unavailable recovery (always visible) ───────────── */}
|
||||
{isProviderUnavailable && (
|
||||
<ProviderUnavailableCard onRestart={onRestart} />
|
||||
)}
|
||||
|
||||
{/* ── Malformed response recovery ────────────────── */}
|
||||
{/* ── Malformed response recovery (always visible) ──────────────── */}
|
||||
{isMalformedResponse && (
|
||||
<MalformedResponseCard onRestart={onRestart} />
|
||||
)}
|
||||
@@ -675,15 +668,19 @@ export default function ReasoningWorkspace({
|
||||
{/* ── Investigation summary card ─────────────── */}
|
||||
<InvestigationSummaryPanel graph={graph} selectedQuestion={selectedQ} result={result} updateStatus={updateStatus} />
|
||||
|
||||
{/* ── Active investigation: question + form (top priority) ─ */}
|
||||
{canAnswer && (
|
||||
{/* ── Active investigation context (always visible while question exists) ─ */}
|
||||
{hasSelectedQuestion && (
|
||||
<>
|
||||
<CurrentInvestigationCard selectedQuestion={selectedQ} graph={graph} />
|
||||
</>
|
||||
)}
|
||||
|
||||
{/* Post-update acknowledgement */}
|
||||
{updateStatus === "success" && <UpdateAcknowledgement updateResult={result} />}
|
||||
{/* Post-update acknowledgement — only after success, never during loading */}
|
||||
{updateStatus === "success" && !isUpdating && <UpdateAcknowledgement updateResult={result} />}
|
||||
|
||||
{/* Response form */}
|
||||
{/* ── Response area (replaced by loading / error during reasoning) ─ */}
|
||||
{!isUpdating ? (
|
||||
canAnswer && (
|
||||
<form onSubmit={handleUpdateCaptureAndSubmit} className="space-y-4 rounded-lg border border-gray-200 bg-white p-5">
|
||||
<div>
|
||||
<label htmlFor="rw-answer" className="mb-2 block text-sm font-medium text-gray-700">
|
||||
@@ -701,25 +698,32 @@ export default function ReasoningWorkspace({
|
||||
</div>
|
||||
<div className="flex items-center justify-between">
|
||||
<p className="text-xs text-gray-400">
|
||||
{updateStatus === "loading" ? "Updating..." : "One update turn only in this prototype."}
|
||||
One update turn only in this prototype.
|
||||
</p>
|
||||
<button
|
||||
type="submit"
|
||||
disabled={updateStatus === "loading" || !answer.trim()}
|
||||
disabled={!answer.trim()}
|
||||
className="rounded-lg bg-blue-700 px-5 py-2 text-sm font-medium text-white transition hover:bg-blue-600 disabled:cursor-not-allowed disabled:opacity-40"
|
||||
>
|
||||
{updateStatus === "loading" ? "Updating..." : "Update situation"}
|
||||
Update situation
|
||||
</button>
|
||||
</div>
|
||||
</form>
|
||||
</>
|
||||
)
|
||||
) : (
|
||||
/* ── Local update loading card (replaces response panel) ─ */}
|
||||
<LoadingOverlay
|
||||
elapsed={updateElapsed}
|
||||
currentMessage={updateMsg}
|
||||
variant="update"
|
||||
/>
|
||||
)}
|
||||
|
||||
{/* ── Terminal state: outcome card (no active question) ─ */}
|
||||
{status === "success" && !hasSelectedQuestion && graph && genuineCompletion && (
|
||||
{/* ── Terminal state: outcome card — hidden during update loading ─ */}
|
||||
{!isUpdating && status === "success" && !hasSelectedQuestion && graph && genuineCompletion && (
|
||||
<CompletionCard summary={resolveCurrentSummary(propUnderstanding || graph?.currentSummary || result?.updatedSituationGraph?.currentSummary)} />
|
||||
)}
|
||||
{status === "success" && !hasSelectedQuestion && graph && !genuineCompletion && (
|
||||
{!isUpdating && status === "success" && !hasSelectedQuestion && graph && !genuineCompletion && (
|
||||
<EvidenceLimitCard summary={resolveCurrentSummary(propUnderstanding || graph?.currentSummary || result?.updatedSituationGraph?.currentSummary)} />
|
||||
)}
|
||||
|
||||
@@ -753,7 +757,7 @@ export default function ReasoningWorkspace({
|
||||
Error: {result.error}
|
||||
</div>
|
||||
)}
|
||||
{updateStatus === "error" && result?.updateError && (
|
||||
{updateStatus === "error" && !isProviderUnavailable && !isMalformedResponse && result?.updateError && (
|
||||
<div className="rounded-lg border border-red-300 bg-red-50 px-4 py-3 text-sm text-red-700">
|
||||
Update error: {result.updateError.error || JSON.stringify(result.updateError)}
|
||||
</div>
|
||||
|
||||
@@ -443,7 +443,7 @@ export default function ScenarioForm() {
|
||||
)}
|
||||
|
||||
{/* ── Main result workspace ─────────────────────── */}
|
||||
{(status === "success" || status === "error") && updateStatus !== "loading" && (
|
||||
{(status === "success" || status === "error") && (
|
||||
<ReasoningWorkspace
|
||||
scenario={scenario}
|
||||
status={status}
|
||||
@@ -475,16 +475,6 @@ export default function ScenarioForm() {
|
||||
/>
|
||||
)}
|
||||
|
||||
{/* ── Update loading (reasoning mode) ─────────── */}
|
||||
{updateStatus === "loading" && status === "success" && (
|
||||
<LoadingOverlay
|
||||
isLoading={true}
|
||||
elapsed={updateElapsed}
|
||||
currentMessage={updateMsg}
|
||||
variant="update"
|
||||
/>
|
||||
)}
|
||||
|
||||
{/* ── Continue later banner when session was restored ── */}
|
||||
{status === "success" && result?.updatedAt && (
|
||||
<ContinueLaterBanner onRestart={() => { clearSession(); setStatus("idle"); setResult(null); setAnswer(""); setUpdateStatus("idle"); setCurrentUnderstanding(null); }} />
|
||||
|
||||
Reference in New Issue
Block a user