saitejatirunagari Claude Opus 4.6 commited on
Commit
0a411cc
Β·
1 Parent(s): e42000f

fix(ui): prevent resume upload rerun loop, show start button on all steps

Browse files

Resume upload caused infinite st.rerun() because the file_uploader
retains files across reruns. Added `not has_resume` guard. Moved the
Start button from step-7-only to the sidebar so it's always accessible.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>

Files changed (1) hide show
  1. ui.py +19 -18
ui.py CHANGED
@@ -943,7 +943,7 @@ if show_config:
943
  label_visibility="collapsed",
944
  help="Supported format: PDF. Max size: 10MB.",
945
  )
946
- if resume_file:
947
  os.makedirs("data/resume", exist_ok=True)
948
  with open("data/resume/resume.pdf", "wb") as f:
949
  f.write(resume_file.read())
@@ -1240,23 +1240,6 @@ Or run `python connect_google.py` for OAuth-based setup.
1240
  if st.button(f"Next β†’", use_container_width=True, type="primary", key="nav_next"):
1241
  st.session_state.setup_step = current_step + 1
1242
  st.rerun()
1243
- else:
1244
- # Last step β€” show launch button
1245
- can_start = has_resume and bool(roles) and bool(locations) and bool(ever_jobs_platforms)
1246
- start = st.button(
1247
- "πŸš€ Launch Search",
1248
- disabled=st.session_state.running or not can_start,
1249
- use_container_width=True,
1250
- type="primary",
1251
- key="start_btn",
1252
- )
1253
- if not can_start:
1254
- missing = []
1255
- if not has_resume: missing.append("resume")
1256
- if not roles: missing.append("roles")
1257
- if not locations: missing.append("locations")
1258
- if not ever_jobs_platforms: missing.append("platforms")
1259
- st.caption(f"Missing: {', '.join(missing)}")
1260
 
1261
  # ────────────────────────────────────────────────────────────────────
1262
  # RIGHT SIDEBAR β€” Run Readiness Panel
@@ -1330,6 +1313,24 @@ Or run `python connect_google.py` for OAuth-based setup.
1330
  <div class="badge-row">{badges_html}</div>
1331
  </div>""")
1332
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1333
  else:
1334
  roles = st.session_state.get("_last_roles", _cfg("_cfg_roles"))
1335
  locations = st.session_state.get("_last_locations", _cfg("_cfg_locations"))
 
943
  label_visibility="collapsed",
944
  help="Supported format: PDF. Max size: 10MB.",
945
  )
946
+ if resume_file and not has_resume:
947
  os.makedirs("data/resume", exist_ok=True)
948
  with open("data/resume/resume.pdf", "wb") as f:
949
  f.write(resume_file.read())
 
1240
  if st.button(f"Next β†’", use_container_width=True, type="primary", key="nav_next"):
1241
  st.session_state.setup_step = current_step + 1
1242
  st.rerun()
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1243
 
1244
  # ────────────────────────────────────────────────────────────────────
1245
  # RIGHT SIDEBAR β€” Run Readiness Panel
 
1313
  <div class="badge-row">{badges_html}</div>
1314
  </div>""")
1315
 
1316
+ # Start Search CTA β€” always visible in sidebar
1317
+ st.markdown("---")
1318
+ can_start = has_resume and bool(roles) and bool(locations) and bool(ever_jobs_platforms)
1319
+ start = st.button(
1320
+ "πŸš€ Start AI Job Search" if not st.session_state.running else "⏳ Running…",
1321
+ disabled=st.session_state.running or not can_start,
1322
+ use_container_width=True,
1323
+ type="primary",
1324
+ key="start_btn",
1325
+ )
1326
+ if not can_start:
1327
+ missing = []
1328
+ if not has_resume: missing.append("resume")
1329
+ if not roles: missing.append("roles")
1330
+ if not locations: missing.append("locations")
1331
+ if not ever_jobs_platforms: missing.append("platforms")
1332
+ st.caption(f"Missing: {', '.join(missing)}")
1333
+
1334
  else:
1335
  roles = st.session_state.get("_last_roles", _cfg("_cfg_roles"))
1336
  locations = st.session_state.get("_last_locations", _cfg("_cfg_locations"))