Spaces:
Runtime error
Runtime error
Upload 4 files
Browse files37 unmodified lines383940414243442 unmodified lines4748495051525311 unmodified lines65666768697071727374754 unmodified lines808182838485868788899037 unmodified linescol1, col2 = st.columns([1, 1])with col1:if st.button("Generate RTM Report"):with st.spinner("Generating RTM Report..."):rtm_text = generate_rtm(company, website, workspace=workspace)st.session_state["rtm_text"] = rtm_text2 unmodified linesjson.dump(rtm_storage, f, indent=2)st.success("RTM Report generated and saved.")with col2:if st.button("Refresh RTM"):if company in rtm_storage:with st.spinner("Refreshing RTM Report..."):rtm_text = generate_rtm(company, website, workspace=workspace)11 unmodified linesst.subheader("Step 3: Generate Contact-Specific Prospecting Message")linkedin_url_raw = st.text_input("Prospect's LinkedIn URL")persona = st.selectbox("Prospect Persona (optional)", ["", "Engineering Leader", "Operations Leader", "IT Executive"])prospect_context = st.text_area("Relevant Info (optional)")if st.button("Generate Prospecting Message"):with st.spinner("Generating message..."):linkedin_url = sanitize_linkedin_url(linkedin_url_raw)enriched_context = f"{prospect_context}\n\nPersona: {persona}"st.session_state["prospecting_msg"] = generate_prospecting_message(linkedin_url, enriched_context, st.session_state["rtm_text"], workspace=workspace4 unmodified linesst.text_area("Prospecting Message", st.session_state["prospecting_msg"], height=300)if st.session_state["prospecting_msg"]:if st.button("Generate Follow-Up Message"):with st.spinner("Generating follow-up..."):enriched_context = f"{prospect_context}\n\nPersona: {persona}\n\nContext: This is a follow-up message."st.session_state["followup_msg"] = generate_prospecting_message(linkedin_url, enriched_context, st.session_state["rtm_text"], workspace=workspace, is_followup=True)st.success("Follow-up message generated.")37 unmodified lines383940414243442 unmodified lines4748495051525311 unmodified lines65666768697071727374757677784 unmodified lines838485868788899091929337 unmodified linescol1, col2 = st.columns([1, 1])with col1:if st.button("🛠 Generate RTM Report"):with st.spinner("Generating RTM Report..."):rtm_text = generate_rtm(company, website, workspace=workspace)st.session_state["rtm_text"] = rtm_text2 unmodified linesjson.dump(rtm_storage, f, indent=2)st.success("RTM Report generated and saved.")with col2:if st.button("🔄 Refresh RTM"):if company in rtm_storage:with st.spinner("Refreshing RTM Report..."):rtm_text = generate_rtm(company, website, workspace=workspace)11 unmodified linesst.subheader("Step 3: Generate Contact-Specific Prospecting Message")linkedin_url_raw = st.text_input("Prospect's LinkedIn URL")persona = st.selectbox("Prospect Persona (optional)", ["", "Engineering Leader", "Operations Leader", "IT Executive"])custom_persona = st.text_input("Or enter a custom persona (optional)", "")persona = custom_persona if custom_persona else personaprospect_context = st.text_area("Relevant Info (optional)")if st.button("✉️ Generate Prospecting Message"):with st.spinner("Generating message..."):linkedin_url = sanitize_linkedin_url(linkedin_url_raw)st.session_state["linkedin_url"] = linkedin_urlenriched_context = f"{prospect_context}\n\nPersona: {persona}"st.session_state["prospecting_msg"] = generate_prospecting_message(linkedin_url, enriched_context, st.session_state["rtm_text"], workspace=workspace4 unmodified linesst.text_area("Prospecting Message", st.session_state["prospecting_msg"], height=300)if st.session_state["prospecting_msg"]:if st.button("🔁 Generate Follow-Up Message"):with st.spinner("Generating follow-up..."):enriched_context = f"{prospect_context}\n\nPersona: {persona}\n\nContext: This is a follow-up message."st.session_state["followup_msg"] = generate_prospecting_message(st.session_state.get("linkedin_url", ""), enriched_context, st.session_state["rtm_text"], workspace=workspace, is_followup=True)st.success("Follow-up message generated.")
66 unmodified lines6768697071727374757614 unmodified lines91929394959697989910066 unmodified linesif not check_cooldown(workspace, action):return "🔥 The engine is running hot — give it a couple seconds to cool down before running again."prompt = f"""You are generating a Reason-to-Meet (RTM) report.Company: {company}Website: {website}Use web search: {'Yes' if use_serper else 'No'}"""log_event(workspace, "llm_rtm_prompt_sent", {"company": company, "prompt": prompt})try:14 unmodified linesreturn "🔥 The engine is running hot — give it a couple seconds to cool down before running again."linkedin_url = sanitize_linkedin_url(linkedin_url)prompt = f"""You are writing a {'follow-up' if is_followup else 'prospecting'} message.LinkedIn URL: {linkedin_url}Context: {context}RTM Info: {rtm_context}"""event_type = "llm_prospect_prompt_sent" if not is_followup else "llm_followup_prompt_sent"log_event(workspace, event_type, {"linkedin": linkedin_url, "prompt": prompt})66 unmodified lines676869707172737475767714 unmodified lines929394959697989910010110210310410510610710810911011111211311466 unmodified linesif not check_cooldown(workspace, action):return "🔥 The engine is running hot — give it a couple seconds to cool down before running again."prompt = f"""You are a strategic researcher creating an internal Reason-to-Meet (RTM) report for a sales team at PagerDuty.Company: {company}Website: {website}Use only reliable information found through analysis and verified sources.Be concise, avoid assumptions, and label sections clearly."""log_event(workspace, "llm_rtm_prompt_sent", {"company": company, "prompt": prompt})try:14 unmodified linesreturn "🔥 The engine is running hot — give it a couple seconds to cool down before running again."linkedin_url = sanitize_linkedin_url(linkedin_url)tone = "This is a follow-up message to a previous outreach." if is_followup else "This is the first outreach message."prompt = f"""You are a helpful sales assistant writing a concise, highly personalized message for an Enterprise Account Executive at PagerDuty.Sender Context: Enterprise Account Executive at PagerDutyLinkedIn URL of the prospect: {linkedin_url}Context from user: {context}Company RTM info (internal use only, not to be copied directly): {rtm_context}Instructions:- Reference key details from the prospect’s role, company, and recent activity if provided.- DO NOT include phrases like “Hope this finds you well” or other generic openers.- Avoid repeating the recipient’s title or role unless relevant to the message's purpose.- Write in a clear, professional tone (no filler, no “Subject:” lines, no formal signature block).- Focus on delivering a compelling reason to connect that aligns with PagerDuty’s value to their organization.{tone}Output:Message only. Do not add headers, sign-offs, or extra formatting."""event_type = "llm_prospect_prompt_sent" if not is_followup else "llm_followup_prompt_sent"log_event(workspace, event_type, {"linkedin": linkedin_url, "prompt": prompt})
app.py+8-5
utils.py+20-6