Rollback to working commit
Browse files- app.py +18 -69
- personas.py +4 -4
app.py
CHANGED
|
@@ -82,96 +82,45 @@ with gr.Blocks() as demo:
|
|
| 82 |
# Inject custom CSS
|
| 83 |
gr.HTML("""
|
| 84 |
<style>
|
| 85 |
-
@import url('https://fonts.googleapis.com/css2?family=Inter:wght@400;500;600;700&display=swap');
|
| 86 |
-
|
| 87 |
-
* {
|
| 88 |
-
font-family: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif !important;
|
| 89 |
-
}
|
| 90 |
-
|
| 91 |
.gradio-container {
|
| 92 |
-
background:
|
| 93 |
-
}
|
| 94 |
-
|
| 95 |
-
.gr-box, .gr-form, .gr-panel {
|
| 96 |
-
background-color: #ffffff !important;
|
| 97 |
-
border-radius: 12px !important;
|
| 98 |
-
box-shadow: 0 2px 8px rgba(0,0,0,0.08) !important;
|
| 99 |
}
|
| 100 |
-
|
| 101 |
button.primary {
|
| 102 |
-
background-color: #
|
| 103 |
-
border-color: #
|
| 104 |
-
font-weight: 500 !important;
|
| 105 |
-
transition: all 0.2s ease !important;
|
| 106 |
}
|
| 107 |
-
|
| 108 |
button.primary:hover {
|
| 109 |
-
background-color: #
|
| 110 |
-
transform: translateY(-1px);
|
| 111 |
-
box-shadow: 0 4px 12px rgba(37, 99, 235, 0.3) !important;
|
| 112 |
}
|
| 113 |
-
|
| 114 |
.message.user {
|
| 115 |
-
background-color: #
|
| 116 |
-
color: #1a1a1a !important;
|
| 117 |
-
border-left: 3px solid #2563eb !important;
|
| 118 |
}
|
| 119 |
-
|
| 120 |
.message.bot {
|
| 121 |
-
background-color: #
|
| 122 |
-
color: #1a1a1a !important;
|
| 123 |
-
border-left: 3px solid #60a5fa !important;
|
| 124 |
}
|
| 125 |
-
|
| 126 |
h1 {
|
| 127 |
-
color: #
|
| 128 |
text-align: center;
|
| 129 |
-
font-weight: 700 !important;
|
| 130 |
-
letter-spacing: -0.02em;
|
| 131 |
}
|
| 132 |
-
|
| 133 |
-
h2, h3, h4, h5, h6 {
|
| 134 |
-
color: #334155 !important;
|
| 135 |
-
font-weight: 600 !important;
|
| 136 |
-
}
|
| 137 |
-
|
| 138 |
.gr-markdown {
|
| 139 |
text-align: center;
|
| 140 |
-
color: #475569 !important;
|
| 141 |
}
|
| 142 |
-
|
| 143 |
.gr-radio {
|
| 144 |
-
background-color:
|
| 145 |
-
padding:
|
| 146 |
-
border-radius:
|
| 147 |
-
box-shadow: 0 2px
|
| 148 |
-
}
|
| 149 |
-
|
| 150 |
-
label {
|
| 151 |
-
color: #334155 !important;
|
| 152 |
-
font-weight: 600 !important;
|
| 153 |
-
}
|
| 154 |
-
|
| 155 |
-
.gr-input, .gr-text-input {
|
| 156 |
-
border-radius: 8px !important;
|
| 157 |
-
border: 2px solid #e2e8f0 !important;
|
| 158 |
-
color: #1a1a1a !important;
|
| 159 |
-
}
|
| 160 |
-
|
| 161 |
-
.gr-input:focus, .gr-text-input:focus {
|
| 162 |
-
border-color: #2563eb !important;
|
| 163 |
-
box-shadow: 0 0 0 3px rgba(37, 99, 235, 0.1) !important;
|
| 164 |
}
|
| 165 |
</style>
|
| 166 |
""")
|
| 167 |
|
| 168 |
gr.Markdown(
|
| 169 |
"""
|
| 170 |
-
# Customer Support AI Assistant
|
| 171 |
|
| 172 |
Welcome! I'm here to help with **orders**, **billing**, **technical support**, and **product recommendations**.
|
| 173 |
|
| 174 |
-
Select a support mode below and start chatting. I'm available 24/7 to assist you
|
| 175 |
"""
|
| 176 |
)
|
| 177 |
|
|
@@ -181,7 +130,7 @@ with gr.Blocks() as demo:
|
|
| 181 |
persona_selector = gr.Radio(
|
| 182 |
choices=list(PERSONAS.keys()),
|
| 183 |
value=list(PERSONAS.keys())[0],
|
| 184 |
-
label="Choose Assistant Type",
|
| 185 |
info="Select the type of customer service assistant you'd like to talk to"
|
| 186 |
)
|
| 187 |
|
|
@@ -191,7 +140,7 @@ with gr.Blocks() as demo:
|
|
| 191 |
value=[
|
| 192 |
{
|
| 193 |
"role": "assistant",
|
| 194 |
-
"content": "Hello! I'm your Customer Support Assistant. How can I help you today?"
|
| 195 |
}
|
| 196 |
]
|
| 197 |
)
|
|
@@ -204,10 +153,10 @@ with gr.Blocks() as demo:
|
|
| 204 |
)
|
| 205 |
send_btn = gr.Button("Send", variant="primary", scale=1)
|
| 206 |
|
| 207 |
-
clear_btn = gr.Button("Clear
|
| 208 |
|
| 209 |
# Quick action examples
|
| 210 |
-
gr.Markdown("**Quick Actions** - Click any example to get started:")
|
| 211 |
gr.Examples(
|
| 212 |
examples=[
|
| 213 |
["Track my order #12345"],
|
|
@@ -235,7 +184,7 @@ with gr.Blocks() as demo:
|
|
| 235 |
return [
|
| 236 |
{
|
| 237 |
"role": "assistant",
|
| 238 |
-
"content": "Hello! I'm your Customer Support Assistant. How can I help you today?"
|
| 239 |
}
|
| 240 |
]
|
| 241 |
|
|
|
|
| 82 |
# Inject custom CSS
|
| 83 |
gr.HTML("""
|
| 84 |
<style>
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 85 |
.gradio-container {
|
| 86 |
+
background-color: #F5FAFF !important;
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 87 |
}
|
|
|
|
| 88 |
button.primary {
|
| 89 |
+
background-color: #1A73E8 !important;
|
| 90 |
+
border-color: #1A73E8 !important;
|
|
|
|
|
|
|
| 91 |
}
|
|
|
|
| 92 |
button.primary:hover {
|
| 93 |
+
background-color: #1557B0 !important;
|
|
|
|
|
|
|
| 94 |
}
|
|
|
|
| 95 |
.message.user {
|
| 96 |
+
background-color: #EDEDED !important;
|
|
|
|
|
|
|
| 97 |
}
|
|
|
|
| 98 |
.message.bot {
|
| 99 |
+
background-color: #E8F1FF !important;
|
|
|
|
|
|
|
| 100 |
}
|
|
|
|
| 101 |
h1 {
|
| 102 |
+
color: #1A73E8 !important;
|
| 103 |
text-align: center;
|
|
|
|
|
|
|
| 104 |
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 105 |
.gr-markdown {
|
| 106 |
text-align: center;
|
|
|
|
| 107 |
}
|
|
|
|
| 108 |
.gr-radio {
|
| 109 |
+
background-color: white;
|
| 110 |
+
padding: 15px;
|
| 111 |
+
border-radius: 8px;
|
| 112 |
+
box-shadow: 0 2px 4px rgba(0,0,0,0.05);
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 113 |
}
|
| 114 |
</style>
|
| 115 |
""")
|
| 116 |
|
| 117 |
gr.Markdown(
|
| 118 |
"""
|
| 119 |
+
# πΌ Customer Support AI Assistant
|
| 120 |
|
| 121 |
Welcome! I'm here to help with **orders**, **billing**, **technical support**, and **product recommendations**.
|
| 122 |
|
| 123 |
+
Select a support mode below and start chatting. I'm available 24/7 to assist you!
|
| 124 |
"""
|
| 125 |
)
|
| 126 |
|
|
|
|
| 130 |
persona_selector = gr.Radio(
|
| 131 |
choices=list(PERSONAS.keys()),
|
| 132 |
value=list(PERSONAS.keys())[0],
|
| 133 |
+
label="π Choose Assistant Type",
|
| 134 |
info="Select the type of customer service assistant you'd like to talk to"
|
| 135 |
)
|
| 136 |
|
|
|
|
| 140 |
value=[
|
| 141 |
{
|
| 142 |
"role": "assistant",
|
| 143 |
+
"content": "π Hello! I'm your Customer Support Assistant. How can I help you today?"
|
| 144 |
}
|
| 145 |
]
|
| 146 |
)
|
|
|
|
| 153 |
)
|
| 154 |
send_btn = gr.Button("Send", variant="primary", scale=1)
|
| 155 |
|
| 156 |
+
clear_btn = gr.Button("π§Ή Clear conversation")
|
| 157 |
|
| 158 |
# Quick action examples
|
| 159 |
+
gr.Markdown("**π‘ Quick Actions** - Click any example to get started:")
|
| 160 |
gr.Examples(
|
| 161 |
examples=[
|
| 162 |
["Track my order #12345"],
|
|
|
|
| 184 |
return [
|
| 185 |
{
|
| 186 |
"role": "assistant",
|
| 187 |
+
"content": "π Hello! I'm your Customer Support Assistant. How can I help you today?"
|
| 188 |
}
|
| 189 |
]
|
| 190 |
|
personas.py
CHANGED
|
@@ -5,7 +5,7 @@ for specific customer service use cases.
|
|
| 5 |
"""
|
| 6 |
|
| 7 |
PERSONAS = {
|
| 8 |
-
"Order Assistant": (
|
| 9 |
"You are a helpful Order Assistant focused on helping customers with orders, "
|
| 10 |
"tracking, shipping, delivery, returns, and exchanges. "
|
| 11 |
"When relevant, politely ask for order ID or tracking number to provide accurate help. "
|
|
@@ -15,7 +15,7 @@ PERSONAS = {
|
|
| 15 |
"You ONLY answer the user's last message."
|
| 16 |
),
|
| 17 |
|
| 18 |
-
"Billing & Pricing Assistant": (
|
| 19 |
"You are a helpful Billing & Pricing Assistant focused on costs, invoices, "
|
| 20 |
"refunds, payment plans, and pricing questions. "
|
| 21 |
"Explain prices, fees, and billing details clearly and step-by-step. "
|
|
@@ -25,7 +25,7 @@ PERSONAS = {
|
|
| 25 |
"You ONLY answer the user's last message."
|
| 26 |
),
|
| 27 |
|
| 28 |
-
"Sales & Opportunities Advisor": (
|
| 29 |
"You are a helpful Sales & Opportunities Advisor focused on understanding customer needs "
|
| 30 |
"and recommending suitable plans, products, or upgrade options. "
|
| 31 |
"Ask clarifying questions about the customer's needs and goals when helpful. "
|
|
@@ -36,7 +36,7 @@ PERSONAS = {
|
|
| 36 |
"You ONLY answer the user's last message."
|
| 37 |
),
|
| 38 |
|
| 39 |
-
"Technical Support": (
|
| 40 |
"You are a helpful Technical Support specialist focused on troubleshooting technical issues, "
|
| 41 |
"system configurations, and technical questions. "
|
| 42 |
"Provide step-by-step troubleshooting guidance when needed. "
|
|
|
|
| 5 |
"""
|
| 6 |
|
| 7 |
PERSONAS = {
|
| 8 |
+
"π¦ Order Assistant": (
|
| 9 |
"You are a helpful Order Assistant focused on helping customers with orders, "
|
| 10 |
"tracking, shipping, delivery, returns, and exchanges. "
|
| 11 |
"When relevant, politely ask for order ID or tracking number to provide accurate help. "
|
|
|
|
| 15 |
"You ONLY answer the user's last message."
|
| 16 |
),
|
| 17 |
|
| 18 |
+
"π³ Billing & Pricing Assistant": (
|
| 19 |
"You are a helpful Billing & Pricing Assistant focused on costs, invoices, "
|
| 20 |
"refunds, payment plans, and pricing questions. "
|
| 21 |
"Explain prices, fees, and billing details clearly and step-by-step. "
|
|
|
|
| 25 |
"You ONLY answer the user's last message."
|
| 26 |
),
|
| 27 |
|
| 28 |
+
"π― Sales & Opportunities Advisor": (
|
| 29 |
"You are a helpful Sales & Opportunities Advisor focused on understanding customer needs "
|
| 30 |
"and recommending suitable plans, products, or upgrade options. "
|
| 31 |
"Ask clarifying questions about the customer's needs and goals when helpful. "
|
|
|
|
| 36 |
"You ONLY answer the user's last message."
|
| 37 |
),
|
| 38 |
|
| 39 |
+
"π§ Technical Support": (
|
| 40 |
"You are a helpful Technical Support specialist focused on troubleshooting technical issues, "
|
| 41 |
"system configurations, and technical questions. "
|
| 42 |
"Provide step-by-step troubleshooting guidance when needed. "
|