mirror of
https://github.com/marcogll/talia_bot.git
synced 2026-01-14 04:55:19 +00:00
feat: Implement JSON-based conversational flow engine
This commit introduces a new `FlowEngine` to manage conversational flows based on JSON definitions. Key changes: - Created `talia_bot/modules/flow_engine.py` to handle the logic of parsing and executing flows. - Added a `conversations` table to the database to persist user state during flows. - Created the `talia_bot/data/flows` directory and added a sample `create_project.json` flow. - Integrated the `FlowEngine` into `main.py` with a `universal_handler` that routes user input to the engine or to legacy handlers.
This commit is contained in:
@@ -32,8 +32,18 @@ def setup_database():
|
||||
)
|
||||
""")
|
||||
|
||||
# Create the conversations table for the flow engine
|
||||
cursor.execute("""
|
||||
CREATE TABLE IF NOT EXISTS conversations (
|
||||
user_id INTEGER PRIMARY KEY,
|
||||
flow_id TEXT NOT NULL,
|
||||
current_step_id INTEGER NOT NULL,
|
||||
collected_data TEXT
|
||||
)
|
||||
""")
|
||||
|
||||
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