Update formatting.py
Browse files- formatting.py +38 -1
formatting.py
CHANGED
|
@@ -266,4 +266,41 @@ class QuestionFallbackRouter:
|
|
| 266 |
}
|
| 267 |
|
| 268 |
|
| 269 |
-
question_fallback_router = QuestionFallbackRouter()
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 266 |
}
|
| 267 |
|
| 268 |
|
| 269 |
+
question_fallback_router = QuestionFallbackRouter()
|
| 270 |
+
|
| 271 |
+
def format_explainer_response(
|
| 272 |
+
result,
|
| 273 |
+
tone: float,
|
| 274 |
+
verbosity: float,
|
| 275 |
+
transparency: float,
|
| 276 |
+
help_mode: str = "explain",
|
| 277 |
+
hint_stage: int = 0,
|
| 278 |
+
) -> str:
|
| 279 |
+
"""
|
| 280 |
+
Fallback wrapper so old conversation_logic still works.
|
| 281 |
+
Routes everything through format_reply.
|
| 282 |
+
"""
|
| 283 |
+
|
| 284 |
+
if not result:
|
| 285 |
+
return "Start by identifying what the question is asking."
|
| 286 |
+
|
| 287 |
+
core_lines = []
|
| 288 |
+
|
| 289 |
+
# Try to extract useful text from result
|
| 290 |
+
if hasattr(result, "summary") and result.summary:
|
| 291 |
+
core_lines.append(result.summary)
|
| 292 |
+
|
| 293 |
+
if hasattr(result, "teaching_points") and result.teaching_points:
|
| 294 |
+
core_lines.extend(result.teaching_points)
|
| 295 |
+
|
| 296 |
+
core = "\n".join(core_lines).strip()
|
| 297 |
+
|
| 298 |
+
return format_reply(
|
| 299 |
+
core=core,
|
| 300 |
+
tone=tone,
|
| 301 |
+
verbosity=verbosity,
|
| 302 |
+
transparency=transparency,
|
| 303 |
+
help_mode=help_mode,
|
| 304 |
+
hint_stage=hint_stage,
|
| 305 |
+
topic=getattr(result, "topic", None),
|
| 306 |
+
)
|