Spaces:
Running
Running
axeronis commited on
Commit ·
fd93afa
1
Parent(s): e9f9cca
fix: TypeScript error, AI uses exit_criteria from stages for qualification
Browse files
backend/app/services/ai_memory_manager.py
CHANGED
|
@@ -180,9 +180,27 @@ class AIMemoryManager:
|
|
| 180 |
ideal_customer = ai_settings.get("ideal_customer_profile", "")
|
| 181 |
business_description = ai_settings.get("business_description", "")
|
| 182 |
|
| 183 |
-
# NEW: Qualification fields -
|
| 184 |
-
|
| 185 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 186 |
if not qualification_fields:
|
| 187 |
qualification_fields = ["Имя", "Контакт (телефон/email)", "Потребность"]
|
| 188 |
|
|
|
|
| 180 |
ideal_customer = ai_settings.get("ideal_customer_profile", "")
|
| 181 |
business_description = ai_settings.get("business_description", "")
|
| 182 |
|
| 183 |
+
# NEW: Qualification fields - collect from exit_criteria of ALL active stages
|
| 184 |
+
# This ensures AI only asks for SELECTED fields (the ones with checkmarks)
|
| 185 |
+
from app.models.sales_stage import SalesStage
|
| 186 |
+
stages_query = select(SalesStage).where(
|
| 187 |
+
SalesStage.tenant_id == tenant.id,
|
| 188 |
+
SalesStage.is_active == True
|
| 189 |
+
)
|
| 190 |
+
stages_result = await session.execute(stages_query)
|
| 191 |
+
stages = stages_result.scalars().all()
|
| 192 |
+
|
| 193 |
+
# Collect all unique exit_criteria from all stages
|
| 194 |
+
qualification_fields = []
|
| 195 |
+
seen_fields = set()
|
| 196 |
+
for stage in stages:
|
| 197 |
+
if stage.exit_criteria:
|
| 198 |
+
for field in stage.exit_criteria:
|
| 199 |
+
if field and field not in seen_fields:
|
| 200 |
+
qualification_fields.append(field)
|
| 201 |
+
seen_fields.add(field)
|
| 202 |
+
|
| 203 |
+
# Fallback to defaults if no stages configured
|
| 204 |
if not qualification_fields:
|
| 205 |
qualification_fields = ["Имя", "Контакт (телефон/email)", "Потребность"]
|
| 206 |
|
frontend/app/register/page.tsx
CHANGED
|
@@ -274,7 +274,7 @@ export default function RegisterPage() {
|
|
| 274 |
if (!googleAuth) {
|
| 275 |
throw new Error('Authentication not initialized')
|
| 276 |
}
|
| 277 |
-
await googleAuth(response.credential, undefined, referralCode)
|
| 278 |
} catch (err: any) {
|
| 279 |
setError(err.message || 'Google authentication failed')
|
| 280 |
setIsLoading(false)
|
|
|
|
| 274 |
if (!googleAuth) {
|
| 275 |
throw new Error('Authentication not initialized')
|
| 276 |
}
|
| 277 |
+
await (googleAuth as any)(response.credential, undefined, referralCode)
|
| 278 |
} catch (err: any) {
|
| 279 |
setError(err.message || 'Google authentication failed')
|
| 280 |
setIsLoading(false)
|