Spaces:
Runtime error

rtm-generator / app.py
bobrod20's picture
Upload app.py
83db2e6 verified
Raw History Blame Contribute Delete
4.81 kB
import streamlit as st
from utils import generate_rtm, generate_prospecting_message, generate_followup_message
from prospect_memory import get_prospect_memory, save_prospect_message, remove_prospect_message
from rtm_memory import get_rtm_memory, save_rtm_report, remove_rtm_report
st.set_page_config(page_title="Reason to Meet", layout="wide")
st.markdown("## πŸ“Œ Reason to Meet")
st.info("""**What is this app?**
Reason to Meet helps Enterprise Account Executives create strategic insights and outreach messaging.
It generates:
- A comprehensive business research summary for a target account (called the "Reason to Meet")
- Personalized prospecting messages tied to that research
All messages are grounded in public information and aligned to PagerDuty's value proposition.""")
# Step 1: Workspace Name
st.markdown("### Step 1: Enter Your Workspace Name")
workspace = st.text_input("Workspace", value=st.session_state.get("workspace", ""))
if workspace:
st.session_state["workspace"] = workspace
# Step 2: RTM Generator
st.markdown("### Step 2: Generate Reason to Meet Report")
company = st.text_input("Company Name")
website = st.text_input("Company Website (include https://)")
rtm_store = get_rtm_memory(workspace) if workspace else {}
rtm_text = ""
if st.button("πŸ” Generate RTM Report"):
with st.spinner("Generating RTM Report..."):
try:
rtm_text = generate_rtm(company, website)
if workspace and company:
save_rtm_report(workspace, company, rtm_text)
st.success(f"Saved RTM for {company}. Reselect from the dropdown to view.")
except Exception as e:
st.error(f"Failed to generate RTM for {company}: {e}")
if workspace:
saved_companies = list(rtm_store.keys())
selected_company = st.selectbox("πŸ“‚ View Saved RTM Reports", [""] + saved_companies)
if selected_company:
rtm_text = rtm_store[selected_company]
st.markdown("#### πŸ“„ Reason to Meet Report")
st.code(rtm_text, language="markdown")
col1, col2 = st.columns(2)
with col1:
if st.button("πŸ”„ Refresh RTM"):
try:
rtm_text = generate_rtm(selected_company, "")
save_rtm_report(workspace, selected_company, rtm_text)
st.success(f"RTM for {selected_company} refreshed.")
except Exception as e:
st.error(f"Failed to refresh RTM: {e}")
with col2:
if st.button("πŸ—‘οΈ Remove RTM"):
remove_rtm_report(workspace, selected_company)
st.warning(f"Removed RTM for {selected_company}.")
# Step 3: Prospect Messaging
st.markdown("### Step 3: Generate Contact-Specific Prospecting Message")
linkedin_url = st.text_input("Prospect LinkedIn URL")
prospect_context = st.text_area("Relevant Info (optional)")
persona = st.selectbox("Prospect Persona (optional)", ["", "CIO", "CTO", "COO", "CISO", "VP Engineering", "VP Infrastructure", "VP SRE", "VP Platform", "SVP Operations", "Head of DevOps"])
custom_title = st.text_input("Custom Prospect Title (optional)")
ghostwriter_url = st.text_input("Ghostwriter LinkedIn URL (optional)")
# Store per workspace + prospect
prospect_store = get_prospect_memory(workspace) if workspace else {}
prospecting_output = ""
if st.button("βœ‰οΈ Generate Prospecting Message"):
try:
prospecting_output = generate_prospecting_message(
linkedin_url,
prospect_context,
rtm_text,
workspace=workspace,
custom_title=custom_title,
ghostwriter_url=ghostwriter_url,
is_followup=False
)
if workspace and linkedin_url:
save_prospect_message(workspace, linkedin_url, prospecting_output)
except Exception as e:
st.error(f"Failed to generate prospecting message: {e}")
if st.button("β†ͺ️ Generate Follow-Up Message"):
try:
prospecting_output = generate_prospecting_message(
linkedin_url,
prospect_context,
rtm_text,
workspace=workspace,
custom_title=custom_title,
ghostwriter_url=ghostwriter_url,
is_followup=True
)
if workspace and linkedin_url:
save_prospect_message(workspace, linkedin_url, prospecting_output)
except Exception as e:
st.error(f"Failed to generate follow-up message: {e}")
if prospecting_output:
st.markdown("#### βœ‰οΈ Generated Message")
st.code(prospecting_output, language="markdown")
if st.button("πŸ—‘οΈ Remove Prospect Message"):
if workspace and linkedin_url:
remove_prospect_message(workspace, linkedin_url)
st.warning("Prospect message removed.")