feat: implement JSON-driven conversational flow engine

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 is contained in:
google-labs-jules[bot]
2025-12-20 22:55:50 +00:00
parent c6f46ab2c6
commit b0e7209653
9 changed files with 725 additions and 201 deletions

View File

@@ -32,8 +32,20 @@ def setup_database():
)
""")
cursor.execute("""
CREATE TABLE IF NOT EXISTS conversations (
id INTEGER PRIMARY KEY AUTOINCREMENT,
user_id INTEGER NOT NULL,
flow_id TEXT NOT NULL,
current_step_id INTEGER NOT NULL,
collected_data TEXT,
updated_at TIMESTAMP DEFAULT CURRENT_TIMESTAMP,
FOREIGN KEY (user_id) REFERENCES users (telegram_id)
)
""")
conn.commit()
logger.info("Database setup complete. 'users' table is ready.")
logger.info("Database setup complete. 'users' and 'conversations' tables are ready.")
except sqlite3.Error as e:
logger.error(f"Database error during setup: {e}")
finally: