feat: back next questions with explicit graph unknowns

This commit is contained in:
2026-08-02 19:03:07 +01:00
parent 25a989450c
commit b1c633ba5c
7 changed files with 310 additions and 40 deletions
+13 -1
View File
@@ -498,6 +498,16 @@ function buildBroadInvestigationQuestion(graph) {
return `What changed during that period that could help explain why ${central}?`;
}
function isRelationshipExplanationUnknown(node, graph) {
const text = normaliseText(`${node?.label || ""} ${node?.description || ""}`);
return (
collectObservationNodes(graph).length >= 2 &&
/\b(explain|explanation|divergence|moved differently|difference between|change or event|what changed|why the observations)/.test(
text,
)
);
}
export function formulateTieResolutionQuestion({ graph }) {
const comparability = assessComparability(graph);
if (comparability.comparabilityStatus === "uncertain") {
@@ -909,7 +919,9 @@ export function formulateQuestion({ node, graph, context = {} }) {
let question = investigationStrategy
? buildQuestionFromStrategy(investigationStrategy)
: buildNeutralClarificationQuestion(extractMeaning(node));
: isRelationshipExplanationUnknown(node, graph)
? buildBroadInvestigationQuestion(graph)
: buildNeutralClarificationQuestion(extractMeaning(node));
question = sanitizeQuestionText(question);