srilakshu012456 commited on
Commit
0384218
·
verified ·
1 Parent(s): 6579639

Update main.py

Browse files
Files changed (1) hide show
  1. main.py +8 -6
main.py CHANGED
@@ -1026,12 +1026,14 @@ async def chat_with_ai(input_data: ChatInput):
1026
  context_preformatted = False
1027
 
1028
  if best_doc and detected_intent == "steps":
1029
- full_steps = get_best_steps_section_text(best_doc)
1030
- if not full_steps:
1031
- sec = (top_meta or {}).get("section")
1032
- if sec:
1033
- full_steps = get_section_text(best_doc, sec)
1034
-
 
 
1035
  if full_steps:
1036
  numbered_full = _ensure_numbering(full_steps)
1037
  raw_actions = set((kb_results.get("actions") or []))
 
1026
  context_preformatted = False
1027
 
1028
  if best_doc and detected_intent == "steps":
1029
+ sec = (top_meta or {}).get("section")
1030
+ if sec:
1031
+ # Prefer the exact section of the top hit
1032
+ full_steps = get_section_text(best_doc, sec)
1033
+ else:
1034
+ # Fallback to all steps (rare)
1035
+ full_steps = get_best_steps_section_text(best_doc)
1036
+
1037
  if full_steps:
1038
  numbered_full = _ensure_numbering(full_steps)
1039
  raw_actions = set((kb_results.get("actions") or []))