mirror of
https://github.com/marcogll/talia_bot.git
synced 2026-01-13 13:25:19 +00:00
This commit completely refactors the bot's architecture to use a generic, JSON-driven flow engine, replacing the previous hardcoded `ConversationHandler` logic. Key changes include: - **New Flow Engine:** Introduces `talia_bot/modules/flow_engine.py` to manage conversational state based on definitions in `talia_bot/data/flows.json`. - **Centralized Flow Definitions:** All conversational flows for Admin, Crew, and Client roles are now defined in `talia_bot/data/flows.json`. - **Persistent Conversations:** Adds a `conversations` table to the database (`talia_bot/db.py`) to persist user state, making flows robust across bot restarts. - **Universal Handler:** Refactors `main.py` to use a `universal_handler` that processes all user input (text, audio, documents, callbacks) and routes it through the flow engine. - **Asynchronous Refactoring:** Converts key modules (`vikunja.py`, `llm_engine.py`) to be fully asynchronous using `httpx` and `openai` async clients for better performance. - **Non-Blocking Print Jobs:** Replaces the blocking `asyncio.sleep` in the print confirmation flow with a non-blocking `JobQueue` background task, ensuring the bot remains responsive. - **New Modules:** Adds `mailer.py`, `imap_listener.py`, and `transcription.py` to support the print and audio transcription flows. - **Updated Documentation:** The `README.md` and `.env.example` have been comprehensively updated to reflect the new architecture, configuration, and setup instructions.