27 lines
3.7 KiB
Markdown
27 lines
3.7 KiB
Markdown
# Social Post Writer Bot — development
|
|
|
|
The bot prepares social-media posts only when the user explicitly asks. It transcribes Russian voice notes with APInex STT, classifies intent with an LLM, and uses Gemini 3.8 Flash via APInex to write/revise posts or infer Tone of Voice from a screenshot. A post request/revision returns three separate messages. The bot shows the Telegram typing indicator while classifying, transcribing, reading images, and generating. It stores no conversation history.
|
|
|
|
- Runtime: Python 3.12, aiogram 3.x
|
|
- Release version is stored in `VERSION` and incremented for each code change; dev sends a version notice on boot.
|
|
- In development, processing errors are returned to the user with a concise, secret-redacted reason.
|
|
- Coolify: project `Social Post Writer Bot`, environment `development`, server `spb-easy-dale`
|
|
- Gitea: `admin/social-post-writer-bot`, branch `dev`
|
|
- API key and model variables are stored only in Coolify: `APINEX_API_KEY`, `APINEX_STT_MODEL`, `APINEX_INTENT_CLASSIFIER_MODEL`, `APINEX_POST_WRITER_MODEL`, `APINEX_IMAGE_TONE_MODEL`, `APINEX_TTS_MODEL`.
|
|
- APInex call and parsing logs live in SQLite at `/app/data/social_writer.sqlite3` for 30 days. They store user input/output JSON and error details; system prompt text is omitted in favor of a prompt name and SHA-256. Inline image base64 and binary audio are omitted. Treat log contents as private user data.
|
|
- `/clear` полностью очищает данные текущего пользователя: Tone of Voice, тексты со скриншотов, историю постов, историю идей и настройки; API-логи сохраняются.
|
|
- `/idea` и русские запросы на идеи возвращают одну идею одним сообщением и сохраняют её для исключения повторов.
|
|
- `/idea_voice` озвучивает одну идею через APInex TTS (`/v1/tools/voice/tts`) и отправляет MP3 как Telegram voice message. Голос задаётся переменной Coolify `APINEX_TTS_MODEL` (по умолчанию `aura-2-thalia-en`). В опубликованном каталоге APInex русский голос пока не указан; качество русской речи отдельно проверим следующим шагом.
|
|
- User-facing service text is always Russian; generated post variants follow the requested post language. Verbatim technical error detail may remain in its original language.
|
|
- LLM model env defaults are `gemini-3.8-flash`; STT model defaults to APInex `nova-2`.
|
|
- Per-user Tone of Voice lives in SQLite at `/app/data/social_writer.sqlite3`; persistent Coolify storage must be mounted at `/app/data`.
|
|
- The Tone of Voice response shows the extracted style instructions.
|
|
- Each generated post is sent as its own message containing only the post text; retain the model's line breaks, paragraphs and emojis, without headings or explanations.
|
|
- A screenshot gallery is processed once as one update. APInex transcribes the visible posts without rewriting; OCR text is appended to per-user SQLite samples, and the style profile is regenerated from accumulated examples plus the prior profile. Duplicate texts are stored once.
|
|
- The immutable post-writer system prompt applies the writing/editorial brief; the per-user screenshot-derived ToV is passed separately as input data and can tune style only, never overriding system rules or supplying facts.
|
|
- Telegram screenshots are sent to APInex as inline base64 data URLs; source images are not persisted. Recognized post text is stored separately for each Telegram user to preserve style samples.
|
|
|
|
## Local tests
|
|
|
|
Run `python -m unittest discover -s tests -v`.
|