mirror of
https://gitverse.ru/kpa39l/vesti.git
synced 2026-09-29 18:05:03 +00:00
Session 2026-09-13: unify directions (canon+LLM-fallback, 966/1019), publisher dry_run fix, git repo, archive 8 changes, candidates-mail-ui WIP, docs
This commit is contained in:
@@ -0,0 +1,32 @@
|
||||
## Design
|
||||
|
||||
### services/publisher/app/main.py
|
||||
|
||||
Модель уже имеет `dry_run: bool = False`. В роуте publish (тело):
|
||||
|
||||
```python
|
||||
@app.post("/api/v1/publish")
|
||||
def publish(payload: PublishRequest):
|
||||
# dry_run — тестовый режим: НЕ уходит в Telegram, возвращает эмуляцию
|
||||
if payload.dry_run:
|
||||
results = {
|
||||
ch: {
|
||||
"message_id": 0,
|
||||
"media_message_id": 0,
|
||||
"views": 0,
|
||||
"error": None,
|
||||
}
|
||||
for ch in resolve_channels(payload.channels)
|
||||
}
|
||||
return {"ok": True, "results": results, "dry_run": True}
|
||||
... (реальный путь — как сейчас)
|
||||
```
|
||||
|
||||
При dry_run получатель — resolve_channels(payload.channels or конфиг), т.к. без него
|
||||
непонятно, для какого канала эмулировать (разумно: тот же, что и в реале).
|
||||
|
||||
### Верификация
|
||||
|
||||
- `curl -d '{"card":{...},"dry_run":true}'` → dry_run:true, message_id:0, телеграм НЕ тронут.
|
||||
- `curl -d '{"card":{...},"dry_run":false}'` → как раньше (реальный publish).
|
||||
- docker compose restart vesti-publisher (пересборка: код меняется, нужен образ).
|
||||
Reference in New Issue
Block a user