Spaces:
Sleeping
Sleeping
Update main.py
Browse files
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 |
-
|
| 1030 |
-
if
|
| 1031 |
-
|
| 1032 |
-
|
| 1033 |
-
|
| 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 []))
|