Nelly-43 commited on
Commit
12cafeb
Β·
verified Β·
1 Parent(s): e4cf12f

Update app_web.py

Browse files
Files changed (1) hide show
  1. app_web.py +22 -13
app_web.py CHANGED
@@ -240,20 +240,29 @@ def render_chat():
240
  options = {"explain the error":"explain",
241
  "suggest fix(es) for the error":"suggestfix"}
242
 
243
- selection = st.multiselect("Please let me know what you need help with:", options.keys())
244
- opts = {
245
- "rewrite": True if "rewrite" in selection else False,
246
- "explain": True if "explain" in selection else False,
247
- "suggestfix": True if "suggestfix" in selection else False,
248
- # "capture": True if "capture" in selection else False,
249
- # "verbose": True if "verbose" in selection else False,
250
- "lines": None#lines if "lines" in selection else None
251
- }
252
- result = explain_(qcat_result.get("action"), prompt, cfg, file_path, opts)
253
-
254
  with st.chat_message("assistant"):
255
- st.markdown(result)
256
- return
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
257
 
258
  # ── Check if this is a clarification response ───────────────────
259
  pending = st.session_state.pending_clarification
 
240
  options = {"explain the error":"explain",
241
  "suggest fix(es) for the error":"suggestfix"}
242
 
 
 
 
 
 
 
 
 
 
 
 
243
  with st.chat_message("assistant"):
244
+ selection = st.multiselect("Please let me know what you need help with:",
245
+ options.keys())
246
+
247
+ if st.button("Continue"):
248
+ if selection:
249
+ choice_text = f"Help me {'and '.join(selection)}"
250
+ st.session_state.messages.append({"role": "user", "content": choice_text})
251
+ selected_options = [options.get(s) for s in selection]
252
+ opts = {
253
+ "rewrite": True if "rewrite" in selected_options else False,
254
+ "explain": True if "explain" in selected_options else False,
255
+ "suggestfix": True if "suggestfix" in selected_options else False,
256
+ # "capture": True if "capture" in selected_options else False,
257
+ # "verbose": True if "verbose" in selected_options else False,
258
+ "lines": None#lines if "lines" in selected_options else None
259
+ }
260
+ result = explain_(qcat_result.get("action"), prompt, cfg, file_path, opts)
261
+ st.session_state.messages.append({"role": "assistant", "content": result})
262
+ st.markdown(result)
263
+ return
264
+ else:
265
+ st.warning("Please select at least one option you need help with.")
266
 
267
  # ── Check if this is a clarification response ───────────────────
268
  pending = st.session_state.pending_clarification