Add parser builder: one-shot DeepSeek profile for Telegram extract_mode=profile.
Generate static HeuristicProfile in CA admin, preview and run without LLM on each post via shared interpreter in CP batch and listener. Co-authored-by: Cursor <cursoragent@cursor.com>
This commit is contained in:
@@ -184,7 +184,9 @@ async def run(job_id, source_config, *, ctx) -> tuple[list[dict], str | None]
|
||||
|
||||
Опционально: `extract_mode: llm` (DeepSeek) для telegram/crawl4ai в batch.
|
||||
|
||||
Подробности: [centers/parsing/ARCHITECTURE.md](../centers/parsing/ARCHITECTURE.md).
|
||||
**Конструктор парсера** (`/parser-builder`): менеджер вставляет образец поста → DeepSeek один раз строит `HeuristicProfile` (статичные regex/правила) → job с `extract_mode=profile`. Runtime (batch + listener) применяет только профиль, без LLM. Кастомные пользовательские таблицы — roadmap (подмена `target-fields`).
|
||||
|
||||
Подробности: [centers/parsing/ARCHITECTURE.md](../centers/parsing/ARCHITECTURE.md), [centers/analytics/ARCHITECTURE.md](../centers/analytics/ARCHITECTURE.md).
|
||||
|
||||
### 2.4. Distribution (ПИ)
|
||||
|
||||
@@ -206,6 +208,7 @@ async def run(job_id, source_config, *, ctx) -> tuple[list[dict], str | None]
|
||||
| `contracts/ingest.py` | `IngestEventItem` / payload ingest |
|
||||
| `contracts/sources.py` | Валидация `source_config` по `source_type` |
|
||||
| `contracts/queues.py` | `SOURCE_FAMILY` → ключ очереди |
|
||||
| `contracts/heuristic_profile.py` | Статичный профиль конструктора + `apply_profile` |
|
||||
|
||||
Правило: меняете форму события / конфиг источника / очередь — сначала `contracts/`, потом CA/CP/UI.
|
||||
|
||||
|
||||
+3
-1
@@ -57,12 +57,14 @@ Listener добавляет флаг `listener: true` на стороне CA API
|
||||
|
||||
| source_type | Модель | Главные поля |
|
||||
|-------------|--------|--------------|
|
||||
| `telegram` | `TelegramSourceConfig` | `channel`, `limit`, `extract_mode` (`heuristic`\|`llm`) |
|
||||
| `telegram` | `TelegramSourceConfig` | `channel`, `limit`, `extract_mode` (`heuristic`\|`llm`\|`profile`), `heuristic_profile` |
|
||||
| `crawl4ai` | `Crawl4AISourceConfig` | `urls`, `extract_mode`, `extract_schema`, `domain_profile` |
|
||||
| `viina` | `ViinaSourceConfig` | `urls` / `texts`, `input_mode` |
|
||||
|
||||
Реестр: `CONFIG_MODELS` + `parse_source_config(source_type, raw)`.
|
||||
|
||||
Профиль конструктора: `contracts/heuristic_profile.py` (`HeuristicProfile`, `apply_profile`).
|
||||
|
||||
---
|
||||
|
||||
## Очереди (`queues.py`)
|
||||
|
||||
+2
-1
@@ -5,7 +5,7 @@
|
||||
- Docker + Docker Compose
|
||||
- Файл `.env` (из `.env.example`)
|
||||
- Для Telegram: `data/telegram.session` + `TELEGRAM_API_ID` / `TELEGRAM_API_HASH`
|
||||
- Опционально: `DEEPSEEK_API_KEY` для `extract_mode: llm`
|
||||
- Опционально: `DEEPSEEK_API_KEY` для `extract_mode: llm` (воркеры) и конструктора парсера на `ca-api`
|
||||
|
||||
## Быстрый старт
|
||||
|
||||
@@ -109,6 +109,7 @@ docker compose logs -f cp-workers-web
|
||||
| Frontend 000 / нет контейнеров | `docker compose up -d` (без `--build`, если registry недоступен, но образы уже есть) |
|
||||
| Job не берётся | Смотреть `ENABLED_ADAPTERS` / `WORKER_FAMILIES` нужного сервиса |
|
||||
| LLM не работает | `DEEPSEEK_API_KEY` в `.env`, перезапуск `cp-workers` / `cp-workers-web` |
|
||||
| Generate в конструкторе 503 | `DEEPSEEK_API_KEY` в `.env` + `env_file` у `ca-api`, перезапуск `ca-api` |
|
||||
| Изменения UI не видны | Пересобрать `ca-frontend` |
|
||||
|
||||
## Границы при разработке
|
||||
|
||||
Reference in New Issue
Block a user