Spaces:
Runtime error

File size: 4,805 Bytes
83db2e6
9504d46
83db2e6
9504d46
83db2e6
9504d46
83db2e6
 
 
 
9504d46
 
 
83db2e6
 
 
 
 
9504d46
83db2e6
9504d46
83db2e6
9504d46
83db2e6
9504d46
83db2e6
9504d46
 
83db2e6
 
 
 
 
9504d46
 
 
83db2e6
 
 
9504d46
83db2e6
9504d46
83db2e6
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
9504d46
 
 
83db2e6
 
 
 
 
 
 
9504d46
 
83db2e6
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
9504d46
83db2e6
 
 
 
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118

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.")