smart-bot-factory 0.3.8__tar.gz → 0.3.9__tar.gz
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Potentially problematic release.
This version of smart-bot-factory might be problematic. Click here for more details.
- {smart_bot_factory-0.3.8 → smart_bot_factory-0.3.9}/PKG-INFO +1 -1
- {smart_bot_factory-0.3.8 → smart_bot_factory-0.3.9}/pyproject.toml +1 -1
- {smart_bot_factory-0.3.8 → smart_bot_factory-0.3.9}/smart_bot_factory/core/decorators.py +104 -39
- {smart_bot_factory-0.3.8 → smart_bot_factory-0.3.9}/smart_bot_factory/integrations/supabase_client.py +22 -2
- {smart_bot_factory-0.3.8 → smart_bot_factory-0.3.9}/uv.lock +1 -1
- {smart_bot_factory-0.3.8 → smart_bot_factory-0.3.9}/.github/ISSUE_TEMPLATE//342/234/250-/320/267/320/260/320/277/321/200/320/276/321/201-/321/204/321/203/320/275/320/272/321/206/320/270/320/270.md" +0 -0
- {smart_bot_factory-0.3.8 → smart_bot_factory-0.3.9}/.github/ISSUE_TEMPLATE//360/237/220/233-/320/261/320/260/320/263-/321/200/320/265/320/277/320/276/321/200/321/202.md" +0 -0
- {smart_bot_factory-0.3.8 → smart_bot_factory-0.3.9}/.github/workflows/ci.yml +0 -0
- {smart_bot_factory-0.3.8 → smart_bot_factory-0.3.9}/.github/workflows/publish-private.yml +0 -0
- {smart_bot_factory-0.3.8 → smart_bot_factory-0.3.9}/.github/workflows/publish.yml +0 -0
- {smart_bot_factory-0.3.8 → smart_bot_factory-0.3.9}/.gitignore +0 -0
- {smart_bot_factory-0.3.8 → smart_bot_factory-0.3.9}/.pre-commit-config.yaml +0 -0
- {smart_bot_factory-0.3.8 → smart_bot_factory-0.3.9}/.python-version +0 -0
- {smart_bot_factory-0.3.8 → smart_bot_factory-0.3.9}/LICENSE +0 -0
- {smart_bot_factory-0.3.8 → smart_bot_factory-0.3.9}/README.md +0 -0
- {smart_bot_factory-0.3.8 → smart_bot_factory-0.3.9}/bots/valera/prompts/1sales_context.txt +0 -0
- {smart_bot_factory-0.3.8 → smart_bot_factory-0.3.9}/bots/valera/prompts/2product_info.txt +0 -0
- {smart_bot_factory-0.3.8 → smart_bot_factory-0.3.9}/bots/valera/prompts/3objection_handling.txt +0 -0
- {smart_bot_factory-0.3.8 → smart_bot_factory-0.3.9}/bots/valera/prompts/final_instructions.txt +0 -0
- {smart_bot_factory-0.3.8 → smart_bot_factory-0.3.9}/bots/valera/prompts/help_message.txt +0 -0
- {smart_bot_factory-0.3.8 → smart_bot_factory-0.3.9}/bots/valera/prompts/welcome_message.txt +0 -0
- {smart_bot_factory-0.3.8 → smart_bot_factory-0.3.9}/bots/valera/tests/quick_scenarios.yaml +0 -0
- {smart_bot_factory-0.3.8 → smart_bot_factory-0.3.9}/bots/valera/tests/realistic_scenarios.yaml +0 -0
- {smart_bot_factory-0.3.8 → smart_bot_factory-0.3.9}/bots/valera/tests/scenario_examples.yaml +0 -0
- {smart_bot_factory-0.3.8 → smart_bot_factory-0.3.9}/bots/valera/welcome_files/welcome_file_msg.txt +0 -0
- {smart_bot_factory-0.3.8 → smart_bot_factory-0.3.9}/bots/valera/welcome_files//320/247/320/265/320/272 /320/273/320/270/321/201/321/202 /320/277/320/276 152/320/244/320/227 /320/270 323/320/244/320/227 /320/264/320/273/321/217 /320/274/320/265/320/264/320/270/321/206/320/270/320/275/321/213.pdf" +0 -0
- {smart_bot_factory-0.3.8 → smart_bot_factory-0.3.9}/publish.py +0 -0
- {smart_bot_factory-0.3.8 → smart_bot_factory-0.3.9}/smart_bot_factory/__init__.py +0 -0
- {smart_bot_factory-0.3.8 → smart_bot_factory-0.3.9}/smart_bot_factory/admin/__init__.py +0 -0
- {smart_bot_factory-0.3.8 → smart_bot_factory-0.3.9}/smart_bot_factory/admin/admin_events.py +0 -0
- {smart_bot_factory-0.3.8 → smart_bot_factory-0.3.9}/smart_bot_factory/admin/admin_logic.py +0 -0
- {smart_bot_factory-0.3.8 → smart_bot_factory-0.3.9}/smart_bot_factory/admin/admin_manager.py +0 -0
- {smart_bot_factory-0.3.8 → smart_bot_factory-0.3.9}/smart_bot_factory/admin/admin_tester.py +0 -0
- {smart_bot_factory-0.3.8 → smart_bot_factory-0.3.9}/smart_bot_factory/admin/timeout_checker.py +0 -0
- {smart_bot_factory-0.3.8 → smart_bot_factory-0.3.9}/smart_bot_factory/aiogram_calendar/__init__.py +0 -0
- {smart_bot_factory-0.3.8 → smart_bot_factory-0.3.9}/smart_bot_factory/aiogram_calendar/common.py +0 -0
- {smart_bot_factory-0.3.8 → smart_bot_factory-0.3.9}/smart_bot_factory/aiogram_calendar/dialog_calendar.py +0 -0
- {smart_bot_factory-0.3.8 → smart_bot_factory-0.3.9}/smart_bot_factory/aiogram_calendar/schemas.py +0 -0
- {smart_bot_factory-0.3.8 → smart_bot_factory-0.3.9}/smart_bot_factory/aiogram_calendar/simple_calendar.py +0 -0
- {smart_bot_factory-0.3.8 → smart_bot_factory-0.3.9}/smart_bot_factory/analytics/analytics_manager.py +0 -0
- {smart_bot_factory-0.3.8 → smart_bot_factory-0.3.9}/smart_bot_factory/cli.py +0 -0
- {smart_bot_factory-0.3.8 → smart_bot_factory-0.3.9}/smart_bot_factory/config.py +0 -0
- {smart_bot_factory-0.3.8 → smart_bot_factory-0.3.9}/smart_bot_factory/configs/growthmed-october-24/prompts/1sales_context.txt +0 -0
- {smart_bot_factory-0.3.8 → smart_bot_factory-0.3.9}/smart_bot_factory/configs/growthmed-october-24/prompts/2product_info.txt +0 -0
- {smart_bot_factory-0.3.8 → smart_bot_factory-0.3.9}/smart_bot_factory/configs/growthmed-october-24/prompts/3objection_handling.txt +0 -0
- {smart_bot_factory-0.3.8 → smart_bot_factory-0.3.9}/smart_bot_factory/configs/growthmed-october-24/prompts/final_instructions.txt +0 -0
- {smart_bot_factory-0.3.8 → smart_bot_factory-0.3.9}/smart_bot_factory/configs/growthmed-october-24/prompts/help_message.txt +0 -0
- {smart_bot_factory-0.3.8 → smart_bot_factory-0.3.9}/smart_bot_factory/configs/growthmed-october-24/prompts/welcome_message.txt +0 -0
- {smart_bot_factory-0.3.8 → smart_bot_factory-0.3.9}/smart_bot_factory/configs/growthmed-october-24/reports/test_20250924_064229.txt +0 -0
- {smart_bot_factory-0.3.8 → smart_bot_factory-0.3.9}/smart_bot_factory/configs/growthmed-october-24/reports/test_20250924_064335.txt +0 -0
- {smart_bot_factory-0.3.8 → smart_bot_factory-0.3.9}/smart_bot_factory/configs/growthmed-october-24/reports/test_20250924_064638.txt +0 -0
- {smart_bot_factory-0.3.8 → smart_bot_factory-0.3.9}/smart_bot_factory/configs/growthmed-october-24/tests/quick_scenarios.yaml +0 -0
- {smart_bot_factory-0.3.8 → smart_bot_factory-0.3.9}/smart_bot_factory/configs/growthmed-october-24/tests/realistic_scenarios.yaml +0 -0
- {smart_bot_factory-0.3.8 → smart_bot_factory-0.3.9}/smart_bot_factory/configs/growthmed-october-24/tests/scenario_examples.yaml +0 -0
- {smart_bot_factory-0.3.8 → smart_bot_factory-0.3.9}/smart_bot_factory/configs/growthmed-october-24/welcome_file/welcome_file_msg.txt +0 -0
- {smart_bot_factory-0.3.8 → smart_bot_factory-0.3.9}/smart_bot_factory/configs/growthmed-october-24/welcome_file//320/247/320/265/320/272 /320/273/320/270/321/201/321/202 /320/277/320/276 152/320/244/320/227 /320/270 323/320/244/320/227 /320/264/320/273/321/217 /320/274/320/265/320/264/320/270/321/206/320/270/320/275/321/213.pdf" +0 -0
- {smart_bot_factory-0.3.8 → smart_bot_factory-0.3.9}/smart_bot_factory/core/bot_utils.py +0 -0
- {smart_bot_factory-0.3.8 → smart_bot_factory-0.3.9}/smart_bot_factory/core/conversation_manager.py +0 -0
- {smart_bot_factory-0.3.8 → smart_bot_factory-0.3.9}/smart_bot_factory/core/message_sender.py +0 -0
- {smart_bot_factory-0.3.8 → smart_bot_factory-0.3.9}/smart_bot_factory/core/router.py +0 -0
- {smart_bot_factory-0.3.8 → smart_bot_factory-0.3.9}/smart_bot_factory/core/router_manager.py +0 -0
- {smart_bot_factory-0.3.8 → smart_bot_factory-0.3.9}/smart_bot_factory/core/states.py +0 -0
- {smart_bot_factory-0.3.8 → smart_bot_factory-0.3.9}/smart_bot_factory/creation/__init__.py +0 -0
- {smart_bot_factory-0.3.8 → smart_bot_factory-0.3.9}/smart_bot_factory/creation/bot_builder.py +0 -0
- {smart_bot_factory-0.3.8 → smart_bot_factory-0.3.9}/smart_bot_factory/creation/bot_testing.py +0 -0
- {smart_bot_factory-0.3.8 → smart_bot_factory-0.3.9}/smart_bot_factory/dashboard/__init__.py +0 -0
- {smart_bot_factory-0.3.8 → smart_bot_factory-0.3.9}/smart_bot_factory/event/__init__.py +0 -0
- {smart_bot_factory-0.3.8 → smart_bot_factory-0.3.9}/smart_bot_factory/handlers/handlers.py +0 -0
- {smart_bot_factory-0.3.8 → smart_bot_factory-0.3.9}/smart_bot_factory/integrations/openai_client.py +0 -0
- {smart_bot_factory-0.3.8 → smart_bot_factory-0.3.9}/smart_bot_factory/message/__init__.py +0 -0
- {smart_bot_factory-0.3.8 → smart_bot_factory-0.3.9}/smart_bot_factory/router/__init__.py +0 -0
- {smart_bot_factory-0.3.8 → smart_bot_factory-0.3.9}/smart_bot_factory/setup_checker.py +0 -0
- {smart_bot_factory-0.3.8 → smart_bot_factory-0.3.9}/smart_bot_factory/supabase/__init__.py +0 -0
- {smart_bot_factory-0.3.8 → smart_bot_factory-0.3.9}/smart_bot_factory/supabase/client.py +0 -0
- {smart_bot_factory-0.3.8 → smart_bot_factory-0.3.9}/smart_bot_factory/utils/__init__.py +0 -0
- {smart_bot_factory-0.3.8 → smart_bot_factory-0.3.9}/smart_bot_factory/utils/debug_routing.py +0 -0
- {smart_bot_factory-0.3.8 → smart_bot_factory-0.3.9}/smart_bot_factory/utils/prompt_loader.py +0 -0
- {smart_bot_factory-0.3.8 → smart_bot_factory-0.3.9}/smart_bot_factory/utils/user_prompt_loader.py +0 -0
- {smart_bot_factory-0.3.8 → smart_bot_factory-0.3.9}/smart_bot_factory/utm_link_generator.py +0 -0
- {smart_bot_factory-0.3.8 → smart_bot_factory-0.3.9}/valera.py +0 -0
|
@@ -1310,6 +1310,11 @@ async def save_immediate_event(
|
|
|
1310
1310
|
f"Событие '{event_type}' уже обрабатывалось (once_only=True)"
|
|
1311
1311
|
)
|
|
1312
1312
|
|
|
1313
|
+
# Получаем bot_id
|
|
1314
|
+
bot_id = supabase_client.bot_id
|
|
1315
|
+
if not bot_id:
|
|
1316
|
+
logger.warning("⚠️ bot_id не указан при создании immediate_event")
|
|
1317
|
+
|
|
1313
1318
|
event_record = {
|
|
1314
1319
|
"event_type": event_type,
|
|
1315
1320
|
"event_category": "user_event",
|
|
@@ -1318,12 +1323,9 @@ async def save_immediate_event(
|
|
|
1318
1323
|
"scheduled_at": None, # Немедленное выполнение
|
|
1319
1324
|
"status": "immediate",
|
|
1320
1325
|
"session_id": session_id,
|
|
1326
|
+
"bot_id": bot_id, # Всегда добавляем bot_id
|
|
1321
1327
|
}
|
|
1322
1328
|
|
|
1323
|
-
# 🆕 Добавляем bot_id если указан
|
|
1324
|
-
if supabase_client.bot_id:
|
|
1325
|
-
event_record["bot_id"] = supabase_client.bot_id
|
|
1326
|
-
|
|
1327
1329
|
try:
|
|
1328
1330
|
response = (
|
|
1329
1331
|
supabase_client.client.table("scheduled_events")
|
|
@@ -1375,6 +1377,11 @@ async def save_scheduled_task(
|
|
|
1375
1377
|
|
|
1376
1378
|
scheduled_at = datetime.now(timezone.utc) + timedelta(seconds=delay_seconds)
|
|
1377
1379
|
|
|
1380
|
+
# Получаем bot_id
|
|
1381
|
+
bot_id = supabase_client.bot_id
|
|
1382
|
+
if not bot_id:
|
|
1383
|
+
logger.warning("⚠️ bot_id не указан при создании scheduled_task")
|
|
1384
|
+
|
|
1378
1385
|
event_record = {
|
|
1379
1386
|
"event_type": task_name,
|
|
1380
1387
|
"event_category": "scheduled_task",
|
|
@@ -1383,12 +1390,9 @@ async def save_scheduled_task(
|
|
|
1383
1390
|
"scheduled_at": scheduled_at.isoformat(),
|
|
1384
1391
|
"status": "pending",
|
|
1385
1392
|
"session_id": session_id,
|
|
1393
|
+
"bot_id": bot_id, # Всегда добавляем bot_id
|
|
1386
1394
|
}
|
|
1387
1395
|
|
|
1388
|
-
# 🆕 Добавляем bot_id если указан
|
|
1389
|
-
if supabase_client.bot_id:
|
|
1390
|
-
event_record["bot_id"] = supabase_client.bot_id
|
|
1391
|
-
|
|
1392
1396
|
try:
|
|
1393
1397
|
response = (
|
|
1394
1398
|
supabase_client.client.table("scheduled_events")
|
|
@@ -1445,6 +1449,11 @@ async def save_global_event(
|
|
|
1445
1449
|
scheduled_at = datetime.now(timezone.utc) + timedelta(seconds=delay_seconds)
|
|
1446
1450
|
status = "pending"
|
|
1447
1451
|
|
|
1452
|
+
# Получаем bot_id
|
|
1453
|
+
bot_id = supabase_client.bot_id
|
|
1454
|
+
if not bot_id:
|
|
1455
|
+
logger.warning("⚠️ bot_id не указан при создании global_event")
|
|
1456
|
+
|
|
1448
1457
|
event_record = {
|
|
1449
1458
|
"event_type": handler_type,
|
|
1450
1459
|
"event_category": "global_handler",
|
|
@@ -1452,12 +1461,9 @@ async def save_global_event(
|
|
|
1452
1461
|
"event_data": handler_data,
|
|
1453
1462
|
"scheduled_at": scheduled_at.isoformat() if scheduled_at else None,
|
|
1454
1463
|
"status": status,
|
|
1464
|
+
"bot_id": bot_id, # Всегда добавляем bot_id (глобальные события тоже привязаны к боту)
|
|
1455
1465
|
}
|
|
1456
1466
|
|
|
1457
|
-
# 🆕 Добавляем bot_id если указан (глобальные события тоже привязаны к боту)
|
|
1458
|
-
if supabase_client.bot_id:
|
|
1459
|
-
event_record["bot_id"] = supabase_client.bot_id
|
|
1460
|
-
|
|
1461
1467
|
try:
|
|
1462
1468
|
response = (
|
|
1463
1469
|
supabase_client.client.table("scheduled_events")
|
|
@@ -1503,22 +1509,32 @@ async def update_event_result(
|
|
|
1503
1509
|
update_data["last_error"] = error_message
|
|
1504
1510
|
# Получаем текущее количество попыток
|
|
1505
1511
|
try:
|
|
1506
|
-
|
|
1512
|
+
query = (
|
|
1507
1513
|
supabase_client.client.table("scheduled_events")
|
|
1508
1514
|
.select("retry_count")
|
|
1509
1515
|
.eq("id", event_id)
|
|
1510
|
-
.execute()
|
|
1511
|
-
.data[0]["retry_count"]
|
|
1512
1516
|
)
|
|
1517
|
+
|
|
1518
|
+
# Добавляем фильтр по bot_id если указан
|
|
1519
|
+
if supabase_client.bot_id:
|
|
1520
|
+
query = query.eq("bot_id", supabase_client.bot_id)
|
|
1521
|
+
|
|
1522
|
+
current_retry = query.execute().data[0]["retry_count"]
|
|
1513
1523
|
update_data["retry_count"] = current_retry + 1
|
|
1514
1524
|
except Exception:
|
|
1515
1525
|
logger.debug("Не удалось получить текущее количество попыток, устанавливаем 1")
|
|
1516
1526
|
update_data["retry_count"] = 1
|
|
1517
1527
|
|
|
1518
1528
|
try:
|
|
1519
|
-
supabase_client.client.table("scheduled_events").update(update_data).eq(
|
|
1529
|
+
query = supabase_client.client.table("scheduled_events").update(update_data).eq(
|
|
1520
1530
|
"id", event_id
|
|
1521
|
-
)
|
|
1531
|
+
)
|
|
1532
|
+
|
|
1533
|
+
# Добавляем фильтр по bot_id если указан
|
|
1534
|
+
if supabase_client.bot_id:
|
|
1535
|
+
query = query.eq("bot_id", supabase_client.bot_id)
|
|
1536
|
+
|
|
1537
|
+
query.execute()
|
|
1522
1538
|
logger.info(f"📝 Результат события {event_id} обновлен: {status}")
|
|
1523
1539
|
except Exception as e:
|
|
1524
1540
|
logger.error(f"❌ Ошибка обновления результата события {event_id}: {e}")
|
|
@@ -1613,7 +1629,14 @@ async def background_event_processor():
|
|
|
1613
1629
|
|
|
1614
1630
|
# ========== ОБРАБОТКА АДМИНСКИХ СОБЫТИЙ ==========
|
|
1615
1631
|
if event_category == "admin_event":
|
|
1632
|
+
# Проверяем bot_id
|
|
1633
|
+
if not event.get("bot_id"):
|
|
1634
|
+
logger.warning(f"⚠️ Админское событие {event['id']} не имеет bot_id")
|
|
1635
|
+
|
|
1616
1636
|
try:
|
|
1637
|
+
logger.info(f"🔄 Начало обработки админского события {event['id']}")
|
|
1638
|
+
logger.info(f"📝 Данные события: {event}")
|
|
1639
|
+
|
|
1617
1640
|
# Обрабатываем и получаем результат
|
|
1618
1641
|
result = await process_admin_event(event)
|
|
1619
1642
|
|
|
@@ -1621,22 +1644,37 @@ async def background_event_processor():
|
|
|
1621
1644
|
import json
|
|
1622
1645
|
|
|
1623
1646
|
supabase_client = get_supabase_client()
|
|
1624
|
-
supabase_client
|
|
1625
|
-
|
|
1626
|
-
|
|
1627
|
-
|
|
1628
|
-
|
|
1629
|
-
|
|
1630
|
-
|
|
1631
|
-
|
|
1632
|
-
|
|
1633
|
-
|
|
1634
|
-
|
|
1635
|
-
|
|
1636
|
-
|
|
1647
|
+
if not supabase_client:
|
|
1648
|
+
raise RuntimeError("Не найден supabase_client")
|
|
1649
|
+
|
|
1650
|
+
# Готовим данные для обновления
|
|
1651
|
+
update_data = {
|
|
1652
|
+
"status": "completed",
|
|
1653
|
+
"executed_at": datetime.now(timezone.utc).isoformat(),
|
|
1654
|
+
"result_data": json.dumps(result, ensure_ascii=False) if result else None,
|
|
1655
|
+
}
|
|
1656
|
+
|
|
1657
|
+
# Если у события нет bot_id, но он есть в клиенте - добавляем
|
|
1658
|
+
if not event.get("bot_id") and supabase_client.bot_id:
|
|
1659
|
+
update_data["bot_id"] = supabase_client.bot_id
|
|
1660
|
+
logger.info(f"📝 Добавлен bot_id: {supabase_client.bot_id}")
|
|
1661
|
+
|
|
1662
|
+
# Строим запрос
|
|
1663
|
+
query = (
|
|
1664
|
+
supabase_client.client.table("scheduled_events")
|
|
1665
|
+
.update(update_data)
|
|
1666
|
+
.eq("id", event["id"])
|
|
1667
|
+
)
|
|
1668
|
+
|
|
1669
|
+
# Добавляем фильтр по bot_id если он был в событии
|
|
1670
|
+
if event.get("bot_id"):
|
|
1671
|
+
query = query.eq("bot_id", event["bot_id"])
|
|
1672
|
+
|
|
1673
|
+
# Выполняем обновление
|
|
1674
|
+
query.execute()
|
|
1637
1675
|
|
|
1638
1676
|
logger.info(
|
|
1639
|
-
f"✅ Админское событие {event['id']} выполнено"
|
|
1677
|
+
f"✅ Админское событие {event['id']} выполнено и обновлено в БД"
|
|
1640
1678
|
)
|
|
1641
1679
|
continue
|
|
1642
1680
|
|
|
@@ -1644,18 +1682,45 @@ async def background_event_processor():
|
|
|
1644
1682
|
logger.error(
|
|
1645
1683
|
f"❌ Ошибка обработки админского события {event['id']}: {e}"
|
|
1646
1684
|
)
|
|
1685
|
+
logger.exception("Стек ошибки:")
|
|
1647
1686
|
|
|
1648
|
-
|
|
1649
|
-
|
|
1650
|
-
|
|
1651
|
-
|
|
1687
|
+
try:
|
|
1688
|
+
# Обновляем статус на failed
|
|
1689
|
+
supabase_client = get_supabase_client()
|
|
1690
|
+
if not supabase_client:
|
|
1691
|
+
raise RuntimeError("Не найден supabase_client")
|
|
1692
|
+
|
|
1693
|
+
# Готовим данные для обновления
|
|
1694
|
+
update_data = {
|
|
1652
1695
|
"status": "failed",
|
|
1653
1696
|
"last_error": str(e),
|
|
1654
|
-
"executed_at": datetime.now(
|
|
1655
|
-
timezone.utc
|
|
1656
|
-
).isoformat(),
|
|
1697
|
+
"executed_at": datetime.now(timezone.utc).isoformat(),
|
|
1657
1698
|
}
|
|
1658
|
-
|
|
1699
|
+
|
|
1700
|
+
# Если у события нет bot_id, но он есть в клиенте - добавляем
|
|
1701
|
+
if not event.get("bot_id") and supabase_client.bot_id:
|
|
1702
|
+
update_data["bot_id"] = supabase_client.bot_id
|
|
1703
|
+
logger.info(f"📝 Добавлен bot_id: {supabase_client.bot_id}")
|
|
1704
|
+
|
|
1705
|
+
# Строим запрос
|
|
1706
|
+
query = (
|
|
1707
|
+
supabase_client.client.table("scheduled_events")
|
|
1708
|
+
.update(update_data)
|
|
1709
|
+
.eq("id", event["id"])
|
|
1710
|
+
)
|
|
1711
|
+
|
|
1712
|
+
# Добавляем фильтр по bot_id если он был в событии
|
|
1713
|
+
if event.get("bot_id"):
|
|
1714
|
+
query = query.eq("bot_id", event["bot_id"])
|
|
1715
|
+
|
|
1716
|
+
# Выполняем обновление
|
|
1717
|
+
query.execute()
|
|
1718
|
+
logger.info(f"✅ Статус события {event['id']} обновлен на failed")
|
|
1719
|
+
|
|
1720
|
+
except Exception as update_error:
|
|
1721
|
+
logger.error(f"❌ Ошибка обновления статуса события: {update_error}")
|
|
1722
|
+
logger.exception("Стек ошибки обновления:")
|
|
1723
|
+
|
|
1659
1724
|
continue
|
|
1660
1725
|
|
|
1661
1726
|
# ========== ОБРАБОТКА USER СОБЫТИЙ ==========
|
|
@@ -1515,6 +1515,7 @@ class SupabaseClient:
|
|
|
1515
1515
|
|
|
1516
1516
|
scheduled_datetime = scheduled_datetime.replace(tzinfo=timezone.utc)
|
|
1517
1517
|
|
|
1518
|
+
# Готовим данные для записи
|
|
1518
1519
|
event_record = {
|
|
1519
1520
|
"event_type": event_name,
|
|
1520
1521
|
"event_category": "admin_event",
|
|
@@ -1524,6 +1525,11 @@ class SupabaseClient:
|
|
|
1524
1525
|
"status": "pending",
|
|
1525
1526
|
}
|
|
1526
1527
|
|
|
1528
|
+
# Добавляем bot_id если он указан
|
|
1529
|
+
if self.bot_id:
|
|
1530
|
+
event_record["bot_id"] = self.bot_id
|
|
1531
|
+
logger.info(f"📝 Добавлен bot_id: {self.bot_id} для админского события")
|
|
1532
|
+
|
|
1527
1533
|
response = (
|
|
1528
1534
|
self.client.table("scheduled_events").insert(event_record).execute()
|
|
1529
1535
|
)
|
|
@@ -1549,15 +1555,22 @@ class SupabaseClient:
|
|
|
1549
1555
|
List[Dict]: Список админских событий
|
|
1550
1556
|
"""
|
|
1551
1557
|
try:
|
|
1558
|
+
# Строим базовый запрос
|
|
1552
1559
|
query = (
|
|
1553
1560
|
self.client.table("scheduled_events")
|
|
1554
1561
|
.select("*")
|
|
1555
1562
|
.eq("event_category", "admin_event")
|
|
1556
1563
|
)
|
|
1557
1564
|
|
|
1565
|
+
# Добавляем фильтры
|
|
1558
1566
|
if status:
|
|
1559
1567
|
query = query.eq("status", status)
|
|
1560
1568
|
|
|
1569
|
+
# Фильтруем по bot_id если он указан
|
|
1570
|
+
if self.bot_id:
|
|
1571
|
+
query = query.eq("bot_id", self.bot_id)
|
|
1572
|
+
logger.info(f"🔍 Фильтруем админские события по bot_id: {self.bot_id}")
|
|
1573
|
+
|
|
1561
1574
|
response = query.order("scheduled_at", desc=False).execute()
|
|
1562
1575
|
|
|
1563
1576
|
logger.info(f"Найдено {len(response.data)} админских событий")
|
|
@@ -1578,15 +1591,22 @@ class SupabaseClient:
|
|
|
1578
1591
|
bool: True если активное событие с таким именем существует
|
|
1579
1592
|
"""
|
|
1580
1593
|
try:
|
|
1581
|
-
|
|
1594
|
+
# Строим запрос
|
|
1595
|
+
query = (
|
|
1582
1596
|
self.client.table("scheduled_events")
|
|
1583
1597
|
.select("id", "event_type", "status")
|
|
1584
1598
|
.eq("event_category", "admin_event")
|
|
1585
1599
|
.eq("event_type", event_name)
|
|
1586
1600
|
.eq("status", "pending")
|
|
1587
|
-
.execute()
|
|
1588
1601
|
)
|
|
1589
1602
|
|
|
1603
|
+
# Фильтруем по bot_id если он указан
|
|
1604
|
+
if self.bot_id:
|
|
1605
|
+
query = query.eq("bot_id", self.bot_id)
|
|
1606
|
+
logger.info(f"🔍 Проверка названия события с фильтром по bot_id: {self.bot_id}")
|
|
1607
|
+
|
|
1608
|
+
response = query.execute()
|
|
1609
|
+
|
|
1590
1610
|
exists = len(response.data) > 0
|
|
1591
1611
|
|
|
1592
1612
|
if exists:
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
{smart_bot_factory-0.3.8 → smart_bot_factory-0.3.9}/bots/valera/prompts/3objection_handling.txt
RENAMED
|
File without changes
|
{smart_bot_factory-0.3.8 → smart_bot_factory-0.3.9}/bots/valera/prompts/final_instructions.txt
RENAMED
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
{smart_bot_factory-0.3.8 → smart_bot_factory-0.3.9}/bots/valera/tests/realistic_scenarios.yaml
RENAMED
|
File without changes
|
{smart_bot_factory-0.3.8 → smart_bot_factory-0.3.9}/bots/valera/tests/scenario_examples.yaml
RENAMED
|
File without changes
|
{smart_bot_factory-0.3.8 → smart_bot_factory-0.3.9}/bots/valera/welcome_files/welcome_file_msg.txt
RENAMED
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
{smart_bot_factory-0.3.8 → smart_bot_factory-0.3.9}/smart_bot_factory/admin/admin_manager.py
RENAMED
|
File without changes
|
|
File without changes
|
{smart_bot_factory-0.3.8 → smart_bot_factory-0.3.9}/smart_bot_factory/admin/timeout_checker.py
RENAMED
|
File without changes
|
{smart_bot_factory-0.3.8 → smart_bot_factory-0.3.9}/smart_bot_factory/aiogram_calendar/__init__.py
RENAMED
|
File without changes
|
{smart_bot_factory-0.3.8 → smart_bot_factory-0.3.9}/smart_bot_factory/aiogram_calendar/common.py
RENAMED
|
File without changes
|
|
File without changes
|
{smart_bot_factory-0.3.8 → smart_bot_factory-0.3.9}/smart_bot_factory/aiogram_calendar/schemas.py
RENAMED
|
File without changes
|
|
File without changes
|
{smart_bot_factory-0.3.8 → smart_bot_factory-0.3.9}/smart_bot_factory/analytics/analytics_manager.py
RENAMED
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
{smart_bot_factory-0.3.8 → smart_bot_factory-0.3.9}/smart_bot_factory/core/conversation_manager.py
RENAMED
|
File without changes
|
{smart_bot_factory-0.3.8 → smart_bot_factory-0.3.9}/smart_bot_factory/core/message_sender.py
RENAMED
|
File without changes
|
|
File without changes
|
{smart_bot_factory-0.3.8 → smart_bot_factory-0.3.9}/smart_bot_factory/core/router_manager.py
RENAMED
|
File without changes
|
|
File without changes
|
|
File without changes
|
{smart_bot_factory-0.3.8 → smart_bot_factory-0.3.9}/smart_bot_factory/creation/bot_builder.py
RENAMED
|
File without changes
|
{smart_bot_factory-0.3.8 → smart_bot_factory-0.3.9}/smart_bot_factory/creation/bot_testing.py
RENAMED
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
{smart_bot_factory-0.3.8 → smart_bot_factory-0.3.9}/smart_bot_factory/integrations/openai_client.py
RENAMED
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
{smart_bot_factory-0.3.8 → smart_bot_factory-0.3.9}/smart_bot_factory/utils/debug_routing.py
RENAMED
|
File without changes
|
{smart_bot_factory-0.3.8 → smart_bot_factory-0.3.9}/smart_bot_factory/utils/prompt_loader.py
RENAMED
|
File without changes
|
{smart_bot_factory-0.3.8 → smart_bot_factory-0.3.9}/smart_bot_factory/utils/user_prompt_loader.py
RENAMED
|
File without changes
|
|
File without changes
|
|
File without changes
|