This commit refactors the application's configuration handling to perfectly match the structure and variable names provided by the user in their `.env` file. This resolves multiple critical discrepancies that would have prevented the bot from functioning correctly.
- **Update `config.py`:** The file `talia_bot/config.py` has been completely rewritten to load environment variables using the names specified by the user (e.g., `TELEGRAM_OWNER_CHAT_ID`, `GOOGLE_CALENDAR_ID`, `VIKUNJA_BASE_URL`).
- **Update Printer Logic:** The `talia_bot/modules/printer.py` module has been updated to use the new `PRINTER_EMAIL` variable and the specific IMAP credentials (`IMAP_USER`, `IMAP_PASSWORD`), rather than reusing SMTP credentials.
- **Update `.env.example`:** The `.env.example` template file has been rewritten to serve as an accurate and well-documented guide that matches the user's `.env` structure.
This change ensures that the bot is now fully synchronized with the user's deployment environment, resolving previous inconsistencies and improving the overall robustness of the configuration.
Implement the first two items from the product roadmap:
1. **Remote Printing Service:**
* Create a new `printer.py` module to handle sending files via SMTP and checking status via IMAP.
* Add a document handler in `main.py` to allow admin users to send files to the bot for printing.
* Add a `/check_print_status` command for admins to monitor the print job status.
* Add SMTP/IMAP configuration variables to `config.py` and `.env.example`.
2. **Sales RAG Flow:**
* Implement a `sales_rag.py` module to generate personalized sales pitches.
* The sales flow uses a Retrieval-Augmented Generation (RAG) approach, retrieving relevant services from `services.json` to create a detailed prompt for the LLM.
* The existing `flow_engine.py` is modified to trigger the sales pitch generation upon completion of the `client_sales_funnel` flow.
* Update `main.py` to handle the flow engine's responses and send the generated pitch to the user.
* Update `client_sales_funnel.json` to be triggered by a button in the client menu.
This commit provides a complete and clean implementation of the JSON-driven flow engine to resolve persistent issues with missing files in previous commits.
This commit includes:
- All individual flow definition files in the `talia_bot/data/flows/` directory.
- The `talia_bot/data/services.json` file.
- The `talia_bot/modules/flow_engine.py` module with corrected logic for handling user responses and robust role assignment.
- All other necessary backend modules that were missing after the environment reset.
This comprehensive commit ensures that all required files are present and correctly implemented, providing a stable foundation for the new modular conversational architecture. All code has been reviewed and corrected based on feedback.
This commit delivers the complete and final implementation of the new conversational flow engine, addressing all feedback from previous code reviews.
- **Adds Critical Data Files:** Creates `talia_bot/data/flows.json` and `talia_bot/data/services.json`, resolving the critical blocking issue and making the bot fully functional.
- **Corrects Vikunja Flow:** The `admin_project_management` flow in `flows.json` now correctly includes a step to select a task after selecting a project. The resolution logic in `main.py` is updated to use the correct `task_id`.
- **Implements All Resolutions:** The `handle_flow_resolution` function in `main.py` is now complete, with functional logic for all resolution types, including robust date/time parsing for calendar events and branching logic for idea capture.
- **Fixes and Cleanup:** Corrects the OpenAI API call in the `transcription.py` module and removes all legacy `ConversationHandler` code from `vikunja.py` and `main.py`.
- **Configuration and Docs:** The project configuration (`config.py`, `.env.example`) and documentation (`README.md`) are fully updated to reflect the final state of the new architecture.
Replaces hardcoded ConversationHandlers with a generic flow engine that reads conversation definitions from talia_bot/data/flows.json.
- Adds a 'conversations' table to the database to persist user state, making flows robust against restarts.
- Implements a central 'universal_handler' in main.py to process all user inputs (text, voice, callbacks, documents) through the new engine.
- Refactors Vikunja, LLM, and Calendar modules to be asynchronous and support the new architecture.
- Adds a new 'transcription' module for OpenAI Whisper and a 'mailer' module for the print flow.
- Implements the full logic for all specified user flows, including project/task management, calendar blocking, idea capture (with branching logic), and the RAG-based client sales funnel.
- Cleans up legacy code and handlers.
This commit implements the first phase of the new architectural vision for the Talia Bot.
Key changes include:
- Renamed the main application directory from `app` to `talia_bot` and updated all associated imports and configurations (`Dockerfile`, tests).
- Replaced the static, `.env`-based permission system with a dynamic, database-driven role management system.
- Introduced a `db.py` module to manage a SQLite database (`users.db`) for user persistence.
- Updated `identity.py` to fetch roles ('admin', 'crew', 'client') from the database.
- Rewrote the `README.md` and `.env.example` to align with the new project specification.
- Refactored the LLM module into the new `modules` structure.