mirror of
https://github.com/marcogll/talia_bot.git
synced 2026-01-14 04:55:19 +00:00
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:
@@ -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:
|
||||
|
||||
Reference in New Issue
Block a user