-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathconversation_view.py
57 lines (41 loc) · 1.91 KB
/
conversation_view.py
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
from datetime import datetime
import streamlit as st
from data_utils import get_conversation_data, get_conversation_objections
from utils import get_session, format_datetime
session = get_session()
@st.dialog("Conversation Details", width="large")
def conversation_view():
conversation_id = st.session_state.conversation_id
if conversation_id is None:
st.write("Please select a conversation to view")
return
with st.container():
conversation_data = get_conversation_data(conversation_id, session)
if len(conversation_data) > 0:
conversation_data = conversation_data.iloc[0]
with st.container():
name = conversation_data['NAME']
st.markdown(f"### {name}")
date_time = conversation_data['DATETIME']
st.markdown(f"##### {format_datetime(date_time)}")
with st.container():
c1, c2 = st.columns(2)
with c1:
stage = conversation_data['STAGE']
st.markdown(f"#### Stage: {stage}")
with c2:
account_name = conversation_data['ACCOUNT_NAME']
st.markdown(f"#### Account: {account_name}")
short_bullet_points = conversation_data['SHORT_BULLET_POINTS']
st.markdown(f"#### Short Bullet Points")
bullets = short_bullet_points.split("\n")
for bullet in bullets:
st.markdown(f"- {bullet}")
objections = get_conversation_objections(conversation_id, session)
if len(objections) > 0:
st.markdown("### Objections")
for index, row in objections.iterrows():
st.markdown(f"#### {row['OBJECTION']}")
st.markdown(row['OBJECTION_RESPONSE'])
else:
st.markdown("No objections found for this conversation")