Spaces:
Sleeping
Sleeping
Update app.py
Browse files
app.py
CHANGED
@@ -30,13 +30,13 @@ candidate_tasks = [
|
|
30 |
]
|
31 |
|
32 |
intent_solutions = {
|
33 |
-
"top up balance": "Your balance is
|
34 |
-
"reactivate service": "Service suspended due to unpaid
|
35 |
-
"change mobile plan": "You're on Basic (
|
36 |
-
"check account status": "Data: 3.2GB/5GB. Balance:
|
37 |
-
"ask for billing support": "Last bill:
|
38 |
"cancel subscription": "Contract ends: 2025-06-30. No penalty after this date.",
|
39 |
-
"upgrade device": "Eligible for upgrade. New iPhone plan:
|
40 |
"report service outage": "Signal issues detected (ZIP: XXX). Engineers notified."
|
41 |
}
|
42 |
|
@@ -87,7 +87,7 @@ def get_emotion_score(emotion):
|
|
87 |
# Streamlit UI Logic
|
88 |
# ------------------------------
|
89 |
st.set_page_config(page_title="Smart Customer Support Assistant", layout="centered")
|
90 |
-
st.title("
|
91 |
|
92 |
# Session state to store chat
|
93 |
if 'chat' not in st.session_state:
|
@@ -143,7 +143,7 @@ with col2:
|
|
143 |
# If human support needed
|
144 |
if st.session_state.system_result:
|
145 |
st.markdown("---")
|
146 |
-
st.subheader("
|
147 |
|
148 |
# Agent editable response
|
149 |
st.session_state.agent_reply = st.text_area("Compose your reply:", value=st.session_state.agent_reply)
|
@@ -154,12 +154,12 @@ if st.session_state.system_result:
|
|
154 |
st.session_state.system_result = None
|
155 |
|
156 |
# Context info
|
157 |
-
st.markdown("####
|
158 |
st.markdown(f"- **Emotion:** {st.session_state.system_result['emotion'].capitalize()}")
|
159 |
st.markdown(f"- **Tone:** {st.session_state.system_result['tone']}")
|
160 |
|
161 |
# Suggested replies
|
162 |
-
st.markdown("####
|
163 |
for intent in st.session_state.system_result['intents']:
|
164 |
st.markdown(f"**• {intent.capitalize()}**")
|
165 |
suggestion = f"Thank you for contacting us. I understand your concern. {intent_solutions[intent]} {intent_closings[intent]}"
|
|
|
30 |
]
|
31 |
|
32 |
intent_solutions = {
|
33 |
+
"top up balance": "Your balance is ¥12. Promo: recharge ¥100 get ¥5 bonus.",
|
34 |
+
"reactivate service": "Service suspended due to unpaid ¥38. Recharge to restore in 30 mins.",
|
35 |
+
"change mobile plan": "You're on Basic (¥68/5GB). Suggest Plus (¥98/20GB).",
|
36 |
+
"check account status": "Data: 3.2GB/5GB. Balance: ¥12. Calls left: 22 mins.",
|
37 |
+
"ask for billing support": "Last bill: ¥96 (Mar). Includes ¥16 overage.",
|
38 |
"cancel subscription": "Contract ends: 2025-06-30. No penalty after this date.",
|
39 |
+
"upgrade device": "Eligible for upgrade. New iPhone plan: ¥399/month.",
|
40 |
"report service outage": "Signal issues detected (ZIP: XXX). Engineers notified."
|
41 |
}
|
42 |
|
|
|
87 |
# Streamlit UI Logic
|
88 |
# ------------------------------
|
89 |
st.set_page_config(page_title="Smart Customer Support Assistant", layout="centered")
|
90 |
+
st.title("Smart Customer Support Assistant (for Agents Only)")
|
91 |
|
92 |
# Session state to store chat
|
93 |
if 'chat' not in st.session_state:
|
|
|
143 |
# If human support needed
|
144 |
if st.session_state.system_result:
|
145 |
st.markdown("---")
|
146 |
+
st.subheader("Agent Response Panel")
|
147 |
|
148 |
# Agent editable response
|
149 |
st.session_state.agent_reply = st.text_area("Compose your reply:", value=st.session_state.agent_reply)
|
|
|
154 |
st.session_state.system_result = None
|
155 |
|
156 |
# Context info
|
157 |
+
st.markdown("#### Customer Status")
|
158 |
st.markdown(f"- **Emotion:** {st.session_state.system_result['emotion'].capitalize()}")
|
159 |
st.markdown(f"- **Tone:** {st.session_state.system_result['tone']}")
|
160 |
|
161 |
# Suggested replies
|
162 |
+
st.markdown("#### Detected Customer Needs")
|
163 |
for intent in st.session_state.system_result['intents']:
|
164 |
st.markdown(f"**• {intent.capitalize()}**")
|
165 |
suggestion = f"Thank you for contacting us. I understand your concern. {intent_solutions[intent]} {intent_closings[intent]}"
|