fix: guard mission_preferences values against non-string types in suggest_search_terms

This commit is contained in:
pyr0ball 2026-03-05 13:40:53 -08:00
parent b841ac5418
commit 4e600c3019

View file

@ -62,8 +62,9 @@ def suggest_search_terms(
nda = ", ".join(user_profile.get("nda_companies", [])) or "none" nda = ", ".join(user_profile.get("nda_companies", [])) or "none"
career_summary = user_profile.get("career_summary", "") or "Not provided" career_summary = user_profile.get("career_summary", "") or "Not provided"
mission_raw = user_profile.get("mission_preferences", {}) or {} mission_raw = user_profile.get("mission_preferences", {}) or {}
# Three exclude angles are intentionally collapsed into one flat suggested_excludes list
mission_str = "\n".join( mission_str = "\n".join(
f" - {k}: {v}" for k, v in mission_raw.items() if v and v.strip() f" - {k}: {v}" for k, v in mission_raw.items() if v and isinstance(v, str) and v.strip()
) or " (none specified)" ) or " (none specified)"
prompt = f"""You are helping a job seeker optimise their search configuration. prompt = f"""You are helping a job seeker optimise their search configuration.