feat(bot): AI-chat integration — leads, chatbot service, sleep mode + migration 013

- chatbotService: bridge to Next.js admin chat API (localhost:3100) — sleep mode, welcome, LLM replies
- leadService: lead sync from every user message, interaction logging to audit_log
- index.js: unhandled messages route to AI when chatbot_enabled; lead sync on every message
- userHandler/routes: lead capture on /start and catalog; sleep mode redirects to AI dialog
- Migration 013: leads, site_settings, chat_sessions tables (idempotent, chatbot_enabled/sleep_mode default 0)
- messageRouter.dispatch returns boolean (handled/not) for AI fallback
- gitignore db backups
This commit is contained in:
NW
2026-08-08 01:11:14 +01:00
parent a5ea99b39b
commit 62534dbe85
9 changed files with 426 additions and 5 deletions

2
.gitignore vendored
View File

@@ -15,6 +15,8 @@ templates/smartadmin/
db/*.db
db/*.db-wal
db/*.db-shm
db/*.backup-*
db/*.pre-merge-*
# Root-level throwaway scripts
/*.mjs