fix: copilot node context — use title/question/description over legacy content field

_build_flow_context() was reading node.get('content') which was only
present on old KB-imported steps. Now falls back through title →
question → description → content → label so all node types (decision,
action, solution, procedural step) show correctly in the copilot context.

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
This commit is contained in:
Michael Chihlas
2026-03-11 17:55:26 -04:00
parent 53b6878742
commit 9495b09e72

View File

@@ -51,7 +51,15 @@ def _build_flow_context(tree: Tree, current_node_id: Optional[str]) -> str:
node = _find_node(tree.tree_structure, current_node_id)
if node:
parts.append(f"Current node type: {node.get('type', 'unknown')}")
parts.append(f"Current node: {node.get('content', node.get('label', 'Unknown'))}")
node_label = (
node.get('title')
or node.get('question')
or node.get('description')
or node.get('content')
or node.get('label')
or 'Unknown'
)
parts.append(f"Current node: {node_label}")
# Add options if it's a question/decision node
children = node.get("children", [])
if children and isinstance(children, list):