Spaces:
Sleeping
Sleeping
axeronis commited on
Commit ·
72e0729
1
Parent(s): bc09d91
Fix: Respect voice_first_required setting in AI responses
Browse files
backend/app/api/webhook.py
CHANGED
|
@@ -1861,8 +1861,8 @@ async def process_ai_response_background(
|
|
| 1861 |
|
| 1862 |
# Smart triggers (subject to frequency limit)
|
| 1863 |
elif not ai_wants_voice and tenant.voice_enabled and not user_requested_no_voice and voice_allowed_by_frequency:
|
| 1864 |
-
# 1. FIRST MESSAGE - greeting (
|
| 1865 |
-
if is_first_message:
|
| 1866 |
voice_trigger_reason = "FIRST_MESSAGE"
|
| 1867 |
ai_wants_voice = True
|
| 1868 |
|
|
|
|
| 1861 |
|
| 1862 |
# Smart triggers (subject to frequency limit)
|
| 1863 |
elif not ai_wants_voice and tenant.voice_enabled and not user_requested_no_voice and voice_allowed_by_frequency:
|
| 1864 |
+
# 1. FIRST MESSAGE - greeting (only if enabled in settings)
|
| 1865 |
+
if is_first_message and getattr(tenant, 'voice_first_required', False):
|
| 1866 |
voice_trigger_reason = "FIRST_MESSAGE"
|
| 1867 |
ai_wants_voice = True
|
| 1868 |
|
backend/app/services/ai_core/response_generator.py
CHANGED
|
@@ -216,9 +216,8 @@ Answer with ONE word only: WANT_VOICE, NO_VOICE, or NEUTRAL""",
|
|
| 216 |
[CURRENT CONTEXT - {current_time}]
|
| 217 |
User Name: {lead.name or 'Unknown'}
|
| 218 |
Psychotype: {lead.psychotype} (Adapt tone accordingly)
|
| 219 |
-
Funnel Stage: {current_stage.name if current_stage else 'General'}
|
| 220 |
-
Goal: {current_stage.ai_goal if current_stage else 'Assist user'}
|
| 221 |
Message Count: {ai_message_count}
|
|
|
|
| 222 |
Is New Session: {is_new_session} (Если True - можешь поздороваться снова, даже если уже здоровался когда-то раньше)
|
| 223 |
Last Interaction: {last_msg_time_str}
|
| 224 |
{conversation_facts}
|
|
@@ -236,7 +235,7 @@ Last Interaction: {last_msg_time_str}
|
|
| 236 |
🧠 ПРИНИМАЙ РЕШЕНИЕ УМНО - анализируй СМЫСЛ и ЭМОЦИИ, а не слова:
|
| 237 |
|
| 238 |
ИСПОЛЬЗУЙ ГОЛОС ТОЛЬКО когда:
|
| 239 |
-
• Это ПЕРВЫЙ ответ в диалоге
|
| 240 |
• Нужно УБЕДИТЬ или снять сомнения (человек колеблется)
|
| 241 |
• Надо ИЗВИНИТЬСЯ искренне (ошибка, жалоба)
|
| 242 |
• Это КЛЮЧЕВОЙ МОМЕНТ сделки (закрытие, финальное предложение)
|
|
|
|
| 216 |
[CURRENT CONTEXT - {current_time}]
|
| 217 |
User Name: {lead.name or 'Unknown'}
|
| 218 |
Psychotype: {lead.psychotype} (Adapt tone accordingly)
|
|
|
|
|
|
|
| 219 |
Message Count: {ai_message_count}
|
| 220 |
+
Voice First Required: {getattr(tenant, 'voice_first_required', False)} (Если True и Message Count=0 - ОБЯЗАТЕЛЬНО используй голос)
|
| 221 |
Is New Session: {is_new_session} (Если True - можешь поздороваться снова, даже если уже здоровался когда-то раньше)
|
| 222 |
Last Interaction: {last_msg_time_str}
|
| 223 |
{conversation_facts}
|
|
|
|
| 235 |
🧠 ПРИНИМАЙ РЕШЕНИЕ УМНО - анализируй СМЫСЛ и ЭМОЦИИ, а не слова:
|
| 236 |
|
| 237 |
ИСПОЛЬЗУЙ ГОЛОС ТОЛЬКО когда:
|
| 238 |
+
• Это ПЕРВЫЙ ответ в диалоге И Voice First Required = True
|
| 239 |
• Нужно УБЕДИТЬ или снять сомнения (человек колеблется)
|
| 240 |
• Надо ИЗВИНИТЬСЯ искренне (ошибка, жалоба)
|
| 241 |
• Это КЛЮЧЕВОЙ МОМЕНТ сделки (закрытие, финальное предложение)
|