smart-bot-factory 0.3.10__tar.gz → 1.0.0__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.

Files changed (66) hide show
  1. {smart_bot_factory-0.3.10 → smart_bot_factory-1.0.0}/PKG-INFO +1 -1
  2. {smart_bot_factory-0.3.10 → smart_bot_factory-1.0.0}/pyproject.toml +1 -1
  3. {smart_bot_factory-0.3.10 → smart_bot_factory-1.0.0}/smart_bot_factory/core/decorators.py +17 -13
  4. {smart_bot_factory-0.3.10 → smart_bot_factory-1.0.0}/smart_bot_factory/event/__init__.py +1 -1
  5. {smart_bot_factory-0.3.10 → smart_bot_factory-1.0.0}/smart_bot_factory/handlers/handlers.py +21 -16
  6. {smart_bot_factory-0.3.10 → smart_bot_factory-1.0.0}/uv.lock +1 -1
  7. smart_bot_factory-0.3.10/.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 -20
  8. smart_bot_factory-0.3.10/.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 -26
  9. smart_bot_factory-0.3.10/.github/workflows/ci.yml +0 -59
  10. smart_bot_factory-0.3.10/.github/workflows/publish-private.yml +0 -34
  11. smart_bot_factory-0.3.10/.github/workflows/publish.yml +0 -31
  12. {smart_bot_factory-0.3.10 → smart_bot_factory-1.0.0}/.gitignore +0 -0
  13. {smart_bot_factory-0.3.10 → smart_bot_factory-1.0.0}/.python-version +0 -0
  14. {smart_bot_factory-0.3.10 → smart_bot_factory-1.0.0}/LICENSE +0 -0
  15. {smart_bot_factory-0.3.10 → smart_bot_factory-1.0.0}/README.md +0 -0
  16. {smart_bot_factory-0.3.10 → smart_bot_factory-1.0.0}/smart_bot_factory/__init__.py +0 -0
  17. {smart_bot_factory-0.3.10 → smart_bot_factory-1.0.0}/smart_bot_factory/admin/__init__.py +0 -0
  18. {smart_bot_factory-0.3.10 → smart_bot_factory-1.0.0}/smart_bot_factory/admin/admin_events.py +0 -0
  19. {smart_bot_factory-0.3.10 → smart_bot_factory-1.0.0}/smart_bot_factory/admin/admin_logic.py +0 -0
  20. {smart_bot_factory-0.3.10 → smart_bot_factory-1.0.0}/smart_bot_factory/admin/admin_manager.py +0 -0
  21. {smart_bot_factory-0.3.10 → smart_bot_factory-1.0.0}/smart_bot_factory/admin/admin_tester.py +0 -0
  22. {smart_bot_factory-0.3.10 → smart_bot_factory-1.0.0}/smart_bot_factory/admin/timeout_checker.py +0 -0
  23. {smart_bot_factory-0.3.10 → smart_bot_factory-1.0.0}/smart_bot_factory/aiogram_calendar/__init__.py +0 -0
  24. {smart_bot_factory-0.3.10 → smart_bot_factory-1.0.0}/smart_bot_factory/aiogram_calendar/common.py +0 -0
  25. {smart_bot_factory-0.3.10 → smart_bot_factory-1.0.0}/smart_bot_factory/aiogram_calendar/dialog_calendar.py +0 -0
  26. {smart_bot_factory-0.3.10 → smart_bot_factory-1.0.0}/smart_bot_factory/aiogram_calendar/schemas.py +0 -0
  27. {smart_bot_factory-0.3.10 → smart_bot_factory-1.0.0}/smart_bot_factory/aiogram_calendar/simple_calendar.py +0 -0
  28. {smart_bot_factory-0.3.10 → smart_bot_factory-1.0.0}/smart_bot_factory/analytics/analytics_manager.py +0 -0
  29. {smart_bot_factory-0.3.10 → smart_bot_factory-1.0.0}/smart_bot_factory/cli.py +0 -0
  30. {smart_bot_factory-0.3.10 → smart_bot_factory-1.0.0}/smart_bot_factory/config.py +0 -0
  31. {smart_bot_factory-0.3.10 → smart_bot_factory-1.0.0}/smart_bot_factory/configs/growthmed-october-24/prompts/1sales_context.txt +0 -0
  32. {smart_bot_factory-0.3.10 → smart_bot_factory-1.0.0}/smart_bot_factory/configs/growthmed-october-24/prompts/2product_info.txt +0 -0
  33. {smart_bot_factory-0.3.10 → smart_bot_factory-1.0.0}/smart_bot_factory/configs/growthmed-october-24/prompts/3objection_handling.txt +0 -0
  34. {smart_bot_factory-0.3.10 → smart_bot_factory-1.0.0}/smart_bot_factory/configs/growthmed-october-24/prompts/final_instructions.txt +0 -0
  35. {smart_bot_factory-0.3.10 → smart_bot_factory-1.0.0}/smart_bot_factory/configs/growthmed-october-24/prompts/help_message.txt +0 -0
  36. {smart_bot_factory-0.3.10 → smart_bot_factory-1.0.0}/smart_bot_factory/configs/growthmed-october-24/prompts/welcome_message.txt +0 -0
  37. {smart_bot_factory-0.3.10 → smart_bot_factory-1.0.0}/smart_bot_factory/configs/growthmed-october-24/reports/test_20250924_064229.txt +0 -0
  38. {smart_bot_factory-0.3.10 → smart_bot_factory-1.0.0}/smart_bot_factory/configs/growthmed-october-24/reports/test_20250924_064335.txt +0 -0
  39. {smart_bot_factory-0.3.10 → smart_bot_factory-1.0.0}/smart_bot_factory/configs/growthmed-october-24/reports/test_20250924_064638.txt +0 -0
  40. {smart_bot_factory-0.3.10 → smart_bot_factory-1.0.0}/smart_bot_factory/configs/growthmed-october-24/tests/quick_scenarios.yaml +0 -0
  41. {smart_bot_factory-0.3.10 → smart_bot_factory-1.0.0}/smart_bot_factory/configs/growthmed-october-24/tests/realistic_scenarios.yaml +0 -0
  42. {smart_bot_factory-0.3.10 → smart_bot_factory-1.0.0}/smart_bot_factory/configs/growthmed-october-24/tests/scenario_examples.yaml +0 -0
  43. {smart_bot_factory-0.3.10 → smart_bot_factory-1.0.0}/smart_bot_factory/configs/growthmed-october-24/welcome_file/welcome_file_msg.txt +0 -0
  44. {smart_bot_factory-0.3.10 → smart_bot_factory-1.0.0}/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
  45. {smart_bot_factory-0.3.10 → smart_bot_factory-1.0.0}/smart_bot_factory/core/bot_utils.py +0 -0
  46. {smart_bot_factory-0.3.10 → smart_bot_factory-1.0.0}/smart_bot_factory/core/conversation_manager.py +0 -0
  47. {smart_bot_factory-0.3.10 → smart_bot_factory-1.0.0}/smart_bot_factory/core/message_sender.py +0 -0
  48. {smart_bot_factory-0.3.10 → smart_bot_factory-1.0.0}/smart_bot_factory/core/router.py +0 -0
  49. {smart_bot_factory-0.3.10 → smart_bot_factory-1.0.0}/smart_bot_factory/core/router_manager.py +0 -0
  50. {smart_bot_factory-0.3.10 → smart_bot_factory-1.0.0}/smart_bot_factory/core/states.py +0 -0
  51. {smart_bot_factory-0.3.10 → smart_bot_factory-1.0.0}/smart_bot_factory/creation/__init__.py +0 -0
  52. {smart_bot_factory-0.3.10 → smart_bot_factory-1.0.0}/smart_bot_factory/creation/bot_builder.py +0 -0
  53. {smart_bot_factory-0.3.10 → smart_bot_factory-1.0.0}/smart_bot_factory/creation/bot_testing.py +0 -0
  54. {smart_bot_factory-0.3.10 → smart_bot_factory-1.0.0}/smart_bot_factory/dashboard/__init__.py +0 -0
  55. {smart_bot_factory-0.3.10 → smart_bot_factory-1.0.0}/smart_bot_factory/integrations/openai_client.py +0 -0
  56. {smart_bot_factory-0.3.10 → smart_bot_factory-1.0.0}/smart_bot_factory/integrations/supabase_client.py +0 -0
  57. {smart_bot_factory-0.3.10 → smart_bot_factory-1.0.0}/smart_bot_factory/message/__init__.py +0 -0
  58. {smart_bot_factory-0.3.10 → smart_bot_factory-1.0.0}/smart_bot_factory/router/__init__.py +0 -0
  59. {smart_bot_factory-0.3.10 → smart_bot_factory-1.0.0}/smart_bot_factory/setup_checker.py +0 -0
  60. {smart_bot_factory-0.3.10 → smart_bot_factory-1.0.0}/smart_bot_factory/supabase/__init__.py +0 -0
  61. {smart_bot_factory-0.3.10 → smart_bot_factory-1.0.0}/smart_bot_factory/supabase/client.py +0 -0
  62. {smart_bot_factory-0.3.10 → smart_bot_factory-1.0.0}/smart_bot_factory/utils/__init__.py +0 -0
  63. {smart_bot_factory-0.3.10 → smart_bot_factory-1.0.0}/smart_bot_factory/utils/debug_routing.py +0 -0
  64. {smart_bot_factory-0.3.10 → smart_bot_factory-1.0.0}/smart_bot_factory/utils/prompt_loader.py +0 -0
  65. {smart_bot_factory-0.3.10 → smart_bot_factory-1.0.0}/smart_bot_factory/utils/user_prompt_loader.py +0 -0
  66. {smart_bot_factory-0.3.10 → smart_bot_factory-1.0.0}/smart_bot_factory/utm_link_generator.py +0 -0
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: smart-bot-factory
3
- Version: 0.3.10
3
+ Version: 1.0.0
4
4
  Summary: Библиотека для создания умных чат-ботов
5
5
  Author-email: Kopatych <eserov73@gmail.com>
6
6
  License: MIT
@@ -1,6 +1,6 @@
1
1
  [project]
2
2
  name = "smart-bot-factory"
3
- version = "0.3.10"
3
+ version = "1.0.0"
4
4
  description = "Библиотека для создания умных чат-ботов"
5
5
  authors = [
6
6
  {name = "Kopatych", email = "eserov73@gmail.com"}
@@ -7,7 +7,7 @@ import logging
7
7
  import re
8
8
  from datetime import datetime, timedelta, timezone
9
9
  from functools import wraps
10
- from typing import Any, Callable, Dict, Union
10
+ from typing import Any, Callable, Dict, Optional, Union
11
11
 
12
12
  logger = logging.getLogger(__name__)
13
13
 
@@ -2176,12 +2176,13 @@ async def check_event_already_processed(
2176
2176
  return False
2177
2177
 
2178
2178
 
2179
- async def process_admin_event(event: Dict):
2179
+ async def process_admin_event(event: Dict, single_user_id: Optional[int] = None):
2180
2180
  """
2181
2181
  Обрабатывает одно админское событие - скачивает файлы из Storage и отправляет пользователям
2182
2182
 
2183
2183
  Args:
2184
2184
  event: Событие из БД с данными для отправки
2185
+ single_user_id: ID пользователя для тестовой отправки. Если указан, сообщение будет отправлено только ему
2185
2186
  """
2186
2187
  import json
2187
2188
  import shutil
@@ -2265,17 +2266,20 @@ async def process_admin_event(event: Dict):
2265
2266
  raise
2266
2267
 
2267
2268
  # 2. Получаем пользователей
2268
- users = await supabase_client.get_users_by_segment(segment)
2269
-
2270
- if not users:
2271
- logger.warning(f"⚠️ Нет пользователей для сегмента '{segment}'")
2272
- return {
2273
- "success_count": 0,
2274
- "failed_count": 0,
2275
- "total_users": 0,
2276
- "segment": segment or "Все",
2277
- "warning": "Нет пользователей",
2278
- }
2269
+ if single_user_id:
2270
+ users = [{"telegram_id": single_user_id}]
2271
+ logger.info(f"🔍 Тестовая отправка для пользователя {single_user_id}")
2272
+ else:
2273
+ users = await supabase_client.get_users_by_segment(segment)
2274
+ if not users:
2275
+ logger.warning(f"⚠️ Нет пользователей для сегмента '{segment}'")
2276
+ return {
2277
+ "success_count": 0,
2278
+ "failed_count": 0,
2279
+ "total_users": 0,
2280
+ "segment": segment or "Все",
2281
+ "warning": "Нет пользователей",
2282
+ }
2279
2283
 
2280
2284
  success_count = 0
2281
2285
  failed_count = 0
@@ -4,4 +4,4 @@ Event модули smart_bot_factory
4
4
 
5
5
  from ..core.decorators import event_handler, global_handler, schedule_task
6
6
 
7
- __all__ = ["event_handler", "schedule_task", "global_handler"]
7
+ __all__ = ["event_handler", "schedule_task", "global_handler"]
@@ -79,7 +79,7 @@ async def timeup_handler(message: Message, state: FSMContext):
79
79
  """Обработчик команды /timeup (или /вперед) - тестирование запланированных событий"""
80
80
  from datetime import datetime
81
81
 
82
- from ..core.decorators import process_scheduled_event, update_event_result
82
+ from ..core.decorators import process_scheduled_event, update_event_result, process_admin_event
83
83
 
84
84
  supabase_client = get_global_var("supabase_client")
85
85
 
@@ -148,22 +148,27 @@ async def timeup_handler(message: Message, state: FSMContext):
148
148
  )
149
149
 
150
150
  # Выполняем событие
151
- if event_category != "admin_event":
151
+ if event_category == "admin_event":
152
+ # Для админских событий используем тестовую отправку только текущему пользователю
153
+ await process_admin_event(event, single_user_id=message.from_user.id)
154
+ # Не отмечаем админское событие как выполненное при тестовой отправке
155
+ success_count += 1
156
+ results.append(f"✅ {event_label} (тестовая отправка)")
157
+ logger.info(f"✅ Событие {event_id} протестировано для пользователя {message.from_user.id}")
158
+ else:
152
159
  await process_scheduled_event(event)
153
-
154
- # Помечаем как выполненное
155
- if event_category != "admin_event" or event_category != "global_handler":
156
- await update_event_result(
157
- event_id,
158
- "completed",
159
- {
160
- "executed": True,
161
- "test_mode": True,
162
- "tested_by_user": message.from_user.id,
163
- "tested_at": datetime.now().isoformat(),
164
- },
165
- )
166
- if event_category != "admin_event":
160
+ # Помечаем как выполненное только не-админские события
161
+ if event_category != "global_handler":
162
+ await update_event_result(
163
+ event_id,
164
+ "completed",
165
+ {
166
+ "executed": True,
167
+ "test_mode": True,
168
+ "tested_by_user": message.from_user.id,
169
+ "tested_at": datetime.now().isoformat(),
170
+ },
171
+ )
167
172
  success_count += 1
168
173
  results.append(f"✅ {event_label}")
169
174
  logger.info(f"✅ Событие {event_id} успешно выполнено")
@@ -1670,7 +1670,7 @@ wheels = [
1670
1670
 
1671
1671
  [[package]]
1672
1672
  name = "smart-bot-factory"
1673
- version = "0.3.9"
1673
+ version = "0.3.11.dev2"
1674
1674
  source = { editable = "." }
1675
1675
  dependencies = [
1676
1676
  { name = "aiofiles" },
@@ -1,20 +0,0 @@
1
- ---
2
- name: "✨ Запрос функции"
3
- about: Предложить новую функцию или улучшение
4
- title: ''
5
- labels: enhancement
6
- assignees: ''
7
-
8
- ---
9
-
10
- ## 🎯 Описание функции
11
- Что вы хотите добавить/улучшить?
12
-
13
- ## 💡 Мотивация
14
- Какую проблему это решит?
15
-
16
- ## 📋 Детали реализации
17
- Как вы видите это решение?
18
-
19
- ## 🔄 Альтернативы
20
- Рассматривали ли другие варианты?
@@ -1,26 +0,0 @@
1
- ---
2
- name: "\U0001F41B Баг репорт"
3
- about: Сообщить об ошибке
4
- title: ''
5
- labels: bug
6
- assignees: ''
7
-
8
- ---
9
-
10
- ## 🐛 Описание проблемы
11
- Опишите что пошло не так
12
-
13
- ## 🔄 Как воспроизвести
14
- 1. Пользователь написал...
15
- 2. Бот ответил...
16
- 3. Произошла ошибка...
17
-
18
- ## ✅ Ожидаемое поведение
19
- Что должно было произойти
20
-
21
- ## 📱 Окружение
22
- - **Bot ID:** (например, growthmed-october-24)
23
- - **Время:** (когда произошло)
24
- - **User ID:** (если известен)
25
-
26
- ## 📋 Логи
@@ -1,59 +0,0 @@
1
- name: CI
2
-
3
- on:
4
- push:
5
- branches: [ main ]
6
- pull_request:
7
- branches: [ main ]
8
-
9
- jobs:
10
- test:
11
- runs-on: ubuntu-latest
12
- strategy:
13
- matrix:
14
- python-version: ["3.12", "3.13"]
15
-
16
- steps:
17
- - uses: actions/checkout@v4
18
-
19
- - name: Set up Python ${{ matrix.python-version }}
20
- uses: actions/setup-python@v5
21
- with:
22
- python-version: ${{ matrix.python-version }}
23
-
24
- - name: Install dependencies
25
- run: |
26
- python -m pip install --upgrade pip
27
- pip install -e .
28
-
29
- - name: Run tests
30
- run: |
31
- pytest --cov=smart_bot_factory tests/
32
-
33
- - name: Upload coverage to Codecov
34
- uses: codecov/codecov-action@v4
35
- with:
36
- token: ${{ secrets.CODECOV_TOKEN }}
37
- fail_ci_if_error: true
38
-
39
- lint:
40
- runs-on: ubuntu-latest
41
-
42
- steps:
43
- - uses: actions/checkout@v4
44
-
45
- - name: Set up Python
46
- uses: actions/setup-python@v5
47
- with:
48
- python-version: "3.12"
49
-
50
- - name: Install dependencies
51
- run: |
52
- python -m pip install --upgrade pip
53
- pip install flake8 black isort
54
-
55
- - name: Check code style
56
- run: |
57
- flake8 src/smart_bot_factory tests
58
- black --check src/smart_bot_factory tests
59
- isort --check-only src/smart_bot_factory tests
@@ -1,34 +0,0 @@
1
- name: Publish to GitHub Packages
2
-
3
- on:
4
- release:
5
- types: [published]
6
-
7
- jobs:
8
- publish:
9
- runs-on: ubuntu-latest
10
- permissions:
11
- contents: read
12
- packages: write
13
-
14
- steps:
15
- - uses: actions/checkout@v4
16
-
17
- - name: Set up Python
18
- uses: actions/setup-python@v4
19
- with:
20
- python-version: "3.9"
21
-
22
- - name: Install build tools
23
- run: |
24
- python -m pip install --upgrade pip
25
- pip install build twine
26
-
27
- - name: Build package
28
- run: python -m build
29
-
30
- - name: Publish to GitHub Packages
31
- env:
32
- GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
33
- run: |
34
- python -m twine upload --repository-url https://maven.pkg.github.com/${{ github.repository }} dist/*
@@ -1,31 +0,0 @@
1
- name: Publish to PyPI
2
-
3
- on:
4
- release:
5
- types: [published]
6
-
7
- jobs:
8
- publish:
9
- runs-on: ubuntu-latest
10
- steps:
11
- - uses: actions/checkout@v4
12
-
13
- - name: Set up Python
14
- uses: actions/setup-python@v4
15
- with:
16
- python-version: "3.9"
17
-
18
- - name: Install build tools
19
- run: |
20
- python -m pip install --upgrade pip
21
- pip install build twine
22
-
23
- - name: Build package
24
- run: python -m build
25
-
26
- - name: Publish to PyPI
27
- env:
28
- TWINE_USERNAME: __token__
29
- TWINE_PASSWORD: ${{ secrets.PYPI_API_TOKEN }}
30
- run: |
31
- twine upload dist/*