Nelly-43 commited on
Commit
d89ddb6
Β·
verified Β·
1 Parent(s): e5a561e

Update app_web.py

Browse files
Files changed (1) hide show
  1. app_web.py +23 -22
app_web.py CHANGED
@@ -179,6 +179,11 @@ def render_chat():
179
  cat_cfg = cfg.get("query_categorization", {})
180
  max_history = cat_cfg.get("max_history", 6)
181
 
 
 
 
 
 
182
  # ── Check if this is a clarification response ───────────────────
183
  unresolved = st.session_state.unresolved_category
184
  if unresolved is not None:
@@ -273,23 +278,24 @@ def render_chat():
273
  st.session_state.messages.append({"role": "user", "content": resolution_msg})
274
 
275
  with st.chat_message("assistant"):
276
- selection = qcat_result.get("sub-action", ["explain"])
277
- selected_options = [options.get(s) for s in selection]
278
- opts = {
279
- "rewrite": True if "rewrite" in selected_options else False,
280
- "explain": True if "explain" in selected_options else False,
281
- "suggestfix": True if "suggestfix" in selected_options else False,
282
- # "capture": True if "capture" in selected_options else False,
283
- # "verbose": True if "verbose" in selected_options else False,
284
- "lines": None#lines if "lines" in selected_options else None
285
- }
286
- print("prompt: ", prompt)
287
- print("updated_prompt: ", combined_cat)
288
- result = explain_(qcat_result.get("action"), combined_cat, cfg, file_path, opts)
289
- print("result: ", result)
290
- st.session_state.messages.append({"role": "assistant", "content": result})
291
- st.markdown(result)
292
- return
 
293
 
294
  # ── Check if this is a clarification response ───────────────────
295
  pending = st.session_state.pending_clarification
@@ -309,11 +315,6 @@ def render_chat():
309
  original_query = prompt
310
  st.session_state.clarification_rounds = 0
311
 
312
- # ── Query understanding ─────────────────────────────────────────
313
- qu_cfg = cfg.get("query_understanding", {})
314
- qu_enabled = qu_cfg.get("enabled", True)
315
- max_history = qu_cfg.get("max_history", 6)
316
-
317
  search_query = combined
318
  display_query = combined
319
  route = "vector"
 
179
  cat_cfg = cfg.get("query_categorization", {})
180
  max_history = cat_cfg.get("max_history", 6)
181
 
182
+ # ── Query understanding ─────────────────────────────────────────
183
+ qu_cfg = cfg.get("query_understanding", {})
184
+ qu_enabled = qu_cfg.get("enabled", True)
185
+ max_history = qu_cfg.get("max_history", 6)
186
+
187
  # ── Check if this is a clarification response ───────────────────
188
  unresolved = st.session_state.unresolved_category
189
  if unresolved is not None:
 
278
  st.session_state.messages.append({"role": "user", "content": resolution_msg})
279
 
280
  with st.chat_message("assistant"):
281
+ st.markdown(resolution_msg)
282
+ return
283
+
284
+ selection = qcat_result.get("sub-action", ["explain"])
285
+ if selection != "unresolved" or isinstance(selection, list):
286
+ qu_enabled = False
287
+ selected_options = [options.get(s) for s in selection]
288
+ opts = {
289
+ "rewrite": True if "rewrite" in selected_options else False,
290
+ "explain": True if "explain" in selected_options else False,
291
+ "suggestfix": True if "suggestfix" in selected_options else False,
292
+ # "capture": True if "capture" in selected_options else False,
293
+ # "verbose": True if "verbose" in selected_options else False,
294
+ "lines": None#lines if "lines" in selected_options else None
295
+ }
296
+ result = explain_(qcat_result.get("action"), combined_cat, cfg, file_path, opts)
297
+ st.session_state.messages.append({"role": "assistant", "content": result})
298
+ st.markdown(result)
299
 
300
  # ── Check if this is a clarification response ───────────────────
301
  pending = st.session_state.pending_clarification
 
315
  original_query = prompt
316
  st.session_state.clarification_rounds = 0
317
 
 
 
 
 
 
318
  search_query = combined
319
  display_query = combined
320
  route = "vector"