j-js commited on
Commit
cabb78f
·
verified ·
1 Parent(s): 561886c

Update conversation_logic.py

Browse files
Files changed (1) hide show
  1. conversation_logic.py +56 -1
conversation_logic.py CHANGED
@@ -1130,8 +1130,63 @@ class ConversationEngine:
1130
  inferred_category = normalize_category(classification.get("category") or category)
1131
  question_topic = _normalize_classified_topic(classification.get("topic"), inferred_category, solver_input)
1132
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1133
  resolved_intent = intent or detect_intent(user_text, help_mode)
1134
- if input_type == "next_hint":
1135
  resolved_intent = "hint"
1136
  elif input_type == "confusion":
1137
  resolved_intent = "method"
 
1130
  inferred_category = normalize_category(classification.get("category") or category)
1131
  question_topic = _normalize_classified_topic(classification.get("topic"), inferred_category, solver_input)
1132
 
1133
+ if input_type == "topic_query":
1134
+ reply = _build_topic_query_reply(
1135
+ solver_input,
1136
+ question_topic,
1137
+ classification.get("topic") or "",
1138
+ inferred_category,
1139
+ )
1140
+ result = SolverResult(
1141
+ domain="general",
1142
+ solved=False,
1143
+ help_mode="explain",
1144
+ topic=question_topic or "general",
1145
+ used_retrieval=False,
1146
+ used_generator=False,
1147
+ steps=[],
1148
+ teaching_chunks=[],
1149
+ meta={},
1150
+ )
1151
+ state = _update_session_state(
1152
+ state,
1153
+ question_text=solver_input,
1154
+ question_id=question_id,
1155
+ hint_stage=0,
1156
+ user_last_input_type=input_type,
1157
+ built_on_previous_turn=built_on_previous_turn,
1158
+ help_mode="explain",
1159
+ intent="topic_query",
1160
+ topic=question_topic,
1161
+ category=inferred_category,
1162
+ )
1163
+ result.reply = format_reply(
1164
+ reply,
1165
+ tone=tone,
1166
+ verbosity=verbosity,
1167
+ transparency=transparency,
1168
+ help_mode="explain",
1169
+ hint_stage=0,
1170
+ topic=question_topic,
1171
+ )
1172
+ result.meta = {
1173
+ "response_source": "topic_classifier",
1174
+ "help_mode": "explain",
1175
+ "intent": "topic_query",
1176
+ "question_text": solver_input or "",
1177
+ "options_count": len(options_text or []),
1178
+ "category": inferred_category if inferred_category else "General",
1179
+ "user_last_input_type": input_type,
1180
+ "built_on_previous_turn": built_on_previous_turn,
1181
+ "session_state": state,
1182
+ "used_retrieval": False,
1183
+ "used_generator": False,
1184
+ "question_support_used": False,
1185
+ }
1186
+ return result
1187
+
1188
  resolved_intent = intent or detect_intent(user_text, help_mode)
1189
+ if input_type == "next_hint":
1190
  resolved_intent = "hint"
1191
  elif input_type == "confusion":
1192
  resolved_intent = "method"