Initial commit: CRM AI Demo bridge + KB knowledge base + infrastructure

- Bridge server with LLM agent tool-use (search_kb, search_products, search_orders, search_inventory, escalate_human)
- pgvector RAG knowledge base (95 FAQ chunks)
- Auto opportunity creation in Twenty CRM
- Auto follow-up task workflow
- Chatwoot AgentBot integration (HMAC, webhook)
- Docker compose infrastructure (PG18, Redis 8.8, node24-alpine)
- Configuration templates (example files) - real secrets excluded via .gitignore
This commit is contained in:
AI Bridge Dev
2026-07-27 15:23:52 +08:00
commit 4a29860b51
37 changed files with 3250 additions and 0 deletions

23
infra/init-db.sh Normal file
View File

@@ -0,0 +1,23 @@
#!/bin/bash
# 共享 postgres 初始化:创建分库 + 在需要的库启用 pgvector 扩展
set -e
set -u
echo "[init-db] 创建分库: chatwoot, twenty, products"
psql -v ON_ERROR_STOP=1 --username "$POSTGRES_USER" <<-EOSQL
CREATE DATABASE chatwoot;
CREATE DATABASE twenty;
CREATE DATABASE products;
EOSQL
echo "[init-db] 在 chatwoot / products 库启用 pgvector 扩展"
psql -v ON_ERROR_STOP=1 --username "$POSTGRES_USER" -d chatwoot <<-EOSQL
CREATE EXTENSION IF NOT EXISTS vector;
EOSQL
psql -v ON_ERROR_STOP=1 --username "$POSTGRES_USER" -d products <<-EOSQL
CREATE EXTENSION IF NOT EXISTS vector;
EOSQL
echo "[init-db] 完成。库列表:"
psql -v ON_ERROR_STOP=1 --username "$POSTGRES_USER" -c "\l"