Spaces:
Sleeping
Sleeping
Commit
·
1596990
1
Parent(s):
33764ea
Update app.py
Browse files
app.py
CHANGED
|
@@ -195,20 +195,24 @@ def generate_response(model, context, user_input, intent, lead_info, archetype):
|
|
| 195 |
except: return "..."
|
| 196 |
|
| 197 |
def generate_greeting(model, start_node_text, lead_info):
|
| 198 |
-
"""Генерує ПЕРШЕ
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 199 |
|
| 200 |
prompt = f"""
|
| 201 |
-
ROLE: Professional Sales Rep named {
|
| 202 |
-
CLIENT: {
|
| 203 |
-
TYPE: {lead_info
|
| 204 |
|
| 205 |
-
GOAL: Start
|
| 206 |
|
| 207 |
INSTRUCTIONS:
|
| 208 |
-
-
|
| 209 |
-
- If
|
| 210 |
-
-
|
| 211 |
-
- Make it sound natural, not robotic.
|
| 212 |
- Language: Ukrainian.
|
| 213 |
|
| 214 |
OUTPUT: Just the spoken greeting.
|
|
@@ -216,7 +220,7 @@ def generate_greeting(model, start_node_text, lead_info):
|
|
| 216 |
try:
|
| 217 |
return model.generate_content(prompt).text.strip()
|
| 218 |
except:
|
| 219 |
-
return f"Доброго дня, це {
|
| 220 |
|
| 221 |
|
| 222 |
# --- UI COMPONENTS ---
|
|
@@ -345,7 +349,7 @@ elif st.session_state.page == "setup":
|
|
| 345 |
# Зберігаємо все, включаючи ім'я бота
|
| 346 |
st.session_state.lead_info = {
|
| 347 |
"bot_name": bot_name,
|
| 348 |
-
"
|
| 349 |
"company": company,
|
| 350 |
"type": type_,
|
| 351 |
"context": context
|
|
|
|
| 195 |
except: return "..."
|
| 196 |
|
| 197 |
def generate_greeting(model, start_node_text, lead_info):
|
| 198 |
+
"""Генерує ПЕРШЕ повідомлення"""
|
| 199 |
+
|
| 200 |
+
# Використовуємо .get(), щоб уникнути помилок, якщо ключа немає
|
| 201 |
+
bot_name = lead_info.get('bot_name', 'Олексій')
|
| 202 |
+
client_name = lead_info.get('name', 'Клієнт') # <--- ТУТ ТЕЖ МАЄ БУТИ 'name'
|
| 203 |
+
company = lead_info.get('company', 'Компанія')
|
| 204 |
|
| 205 |
prompt = f"""
|
| 206 |
+
ROLE: Professional Sales Rep named {bot_name}.
|
| 207 |
+
CLIENT: {client_name} from {company}.
|
| 208 |
+
TYPE: {lead_info.get('type')} ({lead_info.get('context')}).
|
| 209 |
|
| 210 |
+
GOAL: Start conversation based on instruction: "{start_node_text}".
|
| 211 |
|
| 212 |
INSTRUCTIONS:
|
| 213 |
+
- Always state your name ({bot_name}) and company (SellMe AI).
|
| 214 |
+
- If B2B: Be formal.
|
| 215 |
+
- If B2C: Be friendly.
|
|
|
|
| 216 |
- Language: Ukrainian.
|
| 217 |
|
| 218 |
OUTPUT: Just the spoken greeting.
|
|
|
|
| 220 |
try:
|
| 221 |
return model.generate_content(prompt).text.strip()
|
| 222 |
except:
|
| 223 |
+
return f"Доброго дня, це {bot_name} з SellMe. Маєте хвилинку?"
|
| 224 |
|
| 225 |
|
| 226 |
# --- UI COMPONENTS ---
|
|
|
|
| 349 |
# Зберігаємо все, включаючи ім'я бота
|
| 350 |
st.session_state.lead_info = {
|
| 351 |
"bot_name": bot_name,
|
| 352 |
+
"name": name, # <--- ВИПРАВИЛИ НА "name"
|
| 353 |
"company": company,
|
| 354 |
"type": type_,
|
| 355 |
"context": context
|