fix(confidence-engine): reopen completed focused investigation
This commit is contained in:
@@ -792,7 +792,7 @@ function OpenQuestionsPanel({
|
||||
focused, formulationStep, formulateMsg, processingStep, deconstructMsg, doneForNowIds,
|
||||
startFocused, handleDeconstructSubmit, retryFormulation, setSelectedPresentationItemId,
|
||||
setFocusedPresentationItemId, setFocusedAnswer, focusedAnswer, setDoneForNowIds,
|
||||
setFollowUpQuestion, focusedContributions,
|
||||
setFollowUpQuestion, focusedContributions, focusedInvestigations,
|
||||
}) {
|
||||
const openNodes = (graph?.nodes || []).filter(
|
||||
(n) => n.kind === "unknown" && n.status !== "resolved" && !doneForNowIds.includes(n.id),
|
||||
@@ -800,6 +800,25 @@ function OpenQuestionsPanel({
|
||||
|
||||
if (openNodes.length <= 0) return null;
|
||||
|
||||
// Check whether a node has a completed focused result stored locally.
|
||||
const hasCompletedInvestigation = (nid) => {
|
||||
const inv = focusedInvestigations?.[nid];
|
||||
return Boolean(inv && inv.status === "formulated" && inv.result && typeof inv.question === "string" && inv.question.trim());
|
||||
};
|
||||
|
||||
// When a completed result exists and this node is already selected, reopen it.
|
||||
function handleNodeClick(node) {
|
||||
if (!focused?.question?.trim() || (focused && !hasFocusedContent())) {
|
||||
if (hasCompletedInvestigation(node.id) && selectedPresentationItemId === node.id) {
|
||||
setFocusedPresentationItemId(node.id);
|
||||
return;
|
||||
}
|
||||
setSelectedPresentationItemId(
|
||||
selectedPresentationItemId === node.id ? null : node.id,
|
||||
);
|
||||
}
|
||||
}
|
||||
|
||||
return (
|
||||
<div className="space-y-4">
|
||||
<h2 className="text-[11px] font-semibold tracking-widest uppercase text-gray-500">
|
||||
@@ -813,13 +832,7 @@ function OpenQuestionsPanel({
|
||||
return (
|
||||
<div key={node.id}>
|
||||
<div
|
||||
onClick={() => {
|
||||
if (!focused?.question?.trim() || (focused && !hasFocusedContent())) {
|
||||
setSelectedPresentationItemId(
|
||||
selectedPresentationItemId === node.id ? null : node.id,
|
||||
);
|
||||
}
|
||||
}}
|
||||
onClick={() => handleNodeClick(node)}
|
||||
style={{ cursor: "pointer" }}
|
||||
className="w-full text-left rounded-lg border border-gray-200 px-4 py-3 transition hover:border-gray-300 hover:bg-white"
|
||||
>
|
||||
@@ -1522,6 +1535,7 @@ export default function ReasoningWorkspace({
|
||||
setDoneForNowIds={setDoneForNowIds}
|
||||
setFollowUpQuestion={setFollowUpQuestion}
|
||||
focusedContributions={focusedContributions}
|
||||
focusedInvestigations={focusedInvestigations}
|
||||
/>
|
||||
)}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user