docs: README stage1 + статус Этап 1 (реализовано)
This commit is contained in:
1 parent
f472cafa48
commit
535d54c748
2 files changed
+86
-1
No files matched your search
@@ -0,0 +1,77 @@
|
||||
# content-atom — MVP stage 1
|
||||
|
||||
**extract → Postgres + atom_versions (web) → Qdrant**
|
||||
|
||||
Атомарный контент-конвейер: статья → типизированные атомы → хранение в Postgres → переупаковка под web-канал → эмбеддинги в Qdrant.
|
||||
|
||||
## Стек
|
||||
|
||||
| Компонент | Что | Почему |
|
||||
|---|---|---|
|
||||
| **Postgres (atom-db)** | атомы (истина) | транзакции, `pgvector` |
|
||||
| **Qdrant** | эмбеддинги + дедуп | векторный поиск, dim=1024 |
|
||||
| **bge-m3** | embed-модель | dim=1024, RU, гибридный |
|
||||
| **Ollama** | локальный запуск bge-m3 | offline, ~19ms/atom |
|
||||
|
||||
## Запуск
|
||||
|
||||
### 1. atom-db (Postgres + pgvector)
|
||||
|
||||
```bash
|
||||
docker run -d --name atom-db --restart unless-stopped \
|
||||
-p 5434:5432 \
|
||||
-e POSTGRES_USER=atom -e POSTGRES_DB=content_atom -e POSTGRES_PASSWORD=atompass123 \
|
||||
pgvector/pgvector:pg16
|
||||
```
|
||||
|
||||
Расширение: `CREATE EXTENSION vector;` (pgvector 0.8.x).
|
||||
|
||||
### 2. .env
|
||||
|
||||
```bash
|
||||
cat > .env.stage1 <<'EOF'
|
||||
POSTGRES_HOST=127.0.0.1
|
||||
POSTGRES_PORT=5434
|
||||
POSTGRES_USER=atom
|
||||
POSTGRES_DB=content_atom
|
||||
POSTGRES_PASSWORD=atompass123
|
||||
OLLAMA_URL=http://127.0.0.1:11434
|
||||
EOF
|
||||
```
|
||||
|
||||
### 3. Запуск
|
||||
|
||||
```bash
|
||||
env $(cat .env.stage1 | grep -v '^#' | tr '\n' ' ') \
|
||||
python3 stage1/extract_to_postgres.py \
|
||||
--article article.md --article article2.md \
|
||||
--project rabota-ufa
|
||||
```
|
||||
|
||||
## Что делает
|
||||
|
||||
1. **extract** — разбивает `.md` на блоки, классифицирует по паттернам (claim/stat/qa/hook/cta/instruction/comparison/quote).
|
||||
2. **Postgres** — вставляет атомы в `atoms`, генерирует `atom_versions` под `web_article` (markdown).
|
||||
3. **Qdrant** — эмбеддит bge-m3 (dim=1024), сохраняет в коллекцию `content_atoms`.
|
||||
|
||||
## Результаты
|
||||
|
||||
- 387 атомов из 2 статей → Postgres за 0.4с
|
||||
- 387 atom_versions под web-канал
|
||||
- 387 эмбеддингов в Qdrant за 11.6с (~30ms/atom)
|
||||
|
||||
## atom_id
|
||||
|
||||
UUID (Postgres PRIMARY KEY). `atom_id`-хеш использовался в спейке, но для Postgres нужен UUID.
|
||||
|
||||
## Типы атомов
|
||||
|
||||
`claim` (326), `instruction` (42), `stat` (12), `qa` (5), `comparison` (1), `hook` (1).
|
||||
|
||||
## Schema
|
||||
|
||||
`db/schema.sql` — 5 таблиц: `projects`, `atoms`, `atom_versions`, `jobs`, `runs`.
|
||||
|
||||
## Следующий этап
|
||||
|
||||
**MVP stage 2** — `atom_relations` + `compositions` (второй канал: Telegram, дедup).
|
||||
Reference in new issue
Block a user