diff --git a/backend/app/services/ai_tree_builder.py b/backend/app/services/ai_tree_builder.py index 59a27a7d..e743de3f 100644 --- a/backend/app/services/ai_tree_builder.py +++ b/backend/app/services/ai_tree_builder.py @@ -38,11 +38,19 @@ HARD RULES: - When you run out of safe in-scope steps, DO NOT GUESS. Emit an "escalate" node. Return ONLY a JSON object for ONE node, one of: -{"node_type":"question","text":""} +{"node_type":"question","text":"","yes_label":" @@ -252,7 +252,7 @@ export function L1WalkTreeVariant({ session, onSessionUpdate, onDone }: Props) { {session.walked_path.map((step, i) => (
  • {step.question ?? step.text} - {step.answer && → {step.answer}} + {step.answer && → {step.answer_label ?? step.answer}} {step.l1_note && {step.l1_note}}
  • ))} diff --git a/frontend/src/types/l1.ts b/frontend/src/types/l1.ts index 69fa25e5..d6665e95 100644 --- a/frontend/src/types/l1.ts +++ b/frontend/src/types/l1.ts @@ -12,6 +12,8 @@ export interface WalkStep { question?: string text?: string answer: string | null + /** Button text the tech clicked (ai_build); falls back to `answer`. */ + answer_label?: string l1_note: string | null } @@ -75,9 +77,12 @@ export interface IntakeResult { category?: string // for 'out_of_scope' } -/** A single node of an AI-built decision tree, returned by /next-node. */ +/** A single node of an AI-built decision tree, returned by /next-node. + * Question nodes carry the literal button texts (yes_label/no_label) so the + * choices always match the question ("Microsoft account" / "Local account", + * not a mismatched Yes/No). The backend defaults them to Yes/No. */ export type TreeNode = - | { node_type: 'question'; id: string; text: string } + | { node_type: 'question'; id: string; text: string; yes_label?: string; no_label?: string } | { node_type: 'instruction'; id: string; text: string } | { node_type: 'resolved'; id: string; text: string } | { node_type: 'escalate'; id: string; reason_category?: string; text: string }