Update conversation_logic.py
Browse files54 unmodified lines555657585960238 unmodified lines299300301302303304305722 unmodified lines10281029103010311032103310341035175 unmodified lines121112121213121412151216121771 unmodified lines128912901291129212931294129512961297129812991300130113028 unmodified lines13111312131313141315131613171318131913201321132221 unmodified lines1344134513461347134813493 unmodified lines13531354135513561357135854 unmodified lines"can i have a hint","next hint","another hint","next step","continue","go on",238 unmodified linesif text in {"hint", "a hint", "give me a hint", "can i have a hint"} or text.startswith("hint:"):return "hint"if text in {"next hint", "another hint", "more hint", "more hints", "next step", "continue", "go on"} or text.startswith("next hint:"):return "next_hint"if any(x in text722 unmodified linesif not fallback_pack:return Falsesupport_source = str(fallback_pack.get("support_source", "")).strip().lower()has_specific_content = support_source in {"question_bank", "question_id", "question_text"}if help_mode in {"hint", "walkthrough", "instruction", "step_by_step", "explain"}:return has_specific_content or bool(fallback_pack)return False175 unmodified linesresult.help_mode = resolved_help_moderesult.meta = result.meta or {}result.meta["hint_stage"] = hint_stageresult.meta["max_stage"] = 3result.meta["recovered_question_text"] = solver_inputresult.meta["question_id"] = question_idresult.meta["classified_topic"] = question_topic if question_topic else "general"71 unmodified linesif input_type in {"hint", "next_hint"}:hint_lines: List[str] = []custom_ladder = _question_specific_hint_ladder(question_text=solver_input,options_text=options_text,classified_topic=question_topic,)if custom_ladder:idx = min(max(hint_stage - 1, 0), len(custom_ladder) - 1)hint_lines = [custom_ladder[idx]]if not hint_lines and explainer_scaffold:ladder = _safe_meta_list(explainer_scaffold.get("hint_ladder", []))8 unmodified lineselif next_hint_text:hint_lines = [next_hint_text]if not hint_lines and fallback_pack:fallback_hints = _safe_meta_list(fallback_pack.get("hint_ladder", []))if fallback_hints:idx = min(max(hint_stage - 1, 0), len(fallback_hints) - 1)hint_lines = [fallback_hints[idx]]if not hint_lines and fallback_reply_core:split_lines = [line.strip("- ").strip() for line in fallback_reply_core.splitlines() if line.strip()]if split_lines:21 unmodified lineselif question_specific_reply_core and (input_type not in {"hint", "next_hint"}and (_is_help_first_mode(resolved_help_mode)or input_type in {"other", "confusion"}3 unmodified lines"how do i solve","what do i do first","what should i do first","how should i start",])54 unmodified lines55565758596061626364656667686970238 unmodified lines309310311312313314315316317318319320321322323324325326327328329330331722 unmodified lines10541055105610571058105910601061106210631064106510661067175 unmodified lines124312441245124612471248124971 unmodified lines1321132213231324132513261327132813291330133113321333133413351336133713381339134013418 unmodified lines13501351135213531354135521 unmodified lines13771378137913801381138213833 unmodified lines1387138813891390139113921393139454 unmodified lines"can i have a hint","next hint","another hint","more hint","more hints","second hint","third hint","second next hint","what do i do first","what should i do first","what do i do next","what should i do next","first step","next step","continue","go on",238 unmodified linesif text in {"hint", "a hint", "give me a hint", "can i have a hint"} or text.startswith("hint:"):return "hint"if any(phrase in textfor phrase in ["next hint","another hint","more hint","more hints","second hint","third hint","second next hint","what do i do next","what should i do next","next step","continue","go on",]) or text.startswith("next hint:"):return "next_hint"if any(x in text722 unmodified linesif not fallback_pack:return Falsesupport_source = str(fallback_pack.get("support_source", "")).strip().lower()has_specific_content = support_source in {"question_bank","question_bank_refined","question_id","question_text","generated_question_specific",}if help_mode in {"hint", "walkthrough", "instruction", "step_by_step", "explain", "method"}:return has_specific_content or bool(fallback_pack)return False175 unmodified linesresult.help_mode = resolved_help_moderesult.meta = result.meta or {}result.meta["hint_stage"] = hint_stageresult.meta["max_stage"] = 4result.meta["recovered_question_text"] = solver_inputresult.meta["question_id"] = question_idresult.meta["classified_topic"] = question_topic if question_topic else "general"71 unmodified linesif input_type in {"hint", "next_hint"}:hint_lines: List[str] = []if fallback_pack:fallback_hints = _safe_meta_list(fallback_pack.get("hint_ladder", []))if fallback_hints:idx = min(max(hint_stage - 1, 0), len(fallback_hints) - 1)hint_lines = [fallback_hints[idx]]if not hint_lines:custom_ladder = _question_specific_hint_ladder(question_text=solver_input,options_text=options_text,classified_topic=question_topic,)if custom_ladder:idx = min(max(hint_stage - 1, 0), len(custom_ladder) - 1)hint_lines = [custom_ladder[idx]]if not hint_lines and explainer_scaffold:ladder = _safe_meta_list(explainer_scaffold.get("hint_ladder", []))8 unmodified lineselif next_hint_text:hint_lines = [next_hint_text]if not hint_lines and fallback_reply_core:split_lines = [line.strip("- ").strip() for line in fallback_reply_core.splitlines() if line.strip()]if split_lines:21 unmodified lineselif question_specific_reply_core and (input_type not in {"hint", "next_hint"}and not (prefer_question_support and fallback_reply_core)and (_is_help_first_mode(resolved_help_mode)or input_type in {"other", "confusion"}3 unmodified lines"how do i solve","what do i do first","what should i do first","what do i do next","what should i do next","how should i start",])
conversation_logic.py+54-18