Add RAG semantic search and proactive event notifications
Implement hybrid knowledge search using Cloudflare Vectorize + Workers AI embeddings (bge-base-en-v1.5, 768d) merged with existing D1 LIKE queries, with graceful degradation when Vectorize is unavailable. Add admin API endpoints for batch/single article indexing. Add 4 proactive notification cron jobs: server status changes, deposit confirmation/rejection alerts, pending payment reminders (1h+), and bank deposit matching notifications — all with DB-column-based deduplication. Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
This commit is contained in:
24
schema.sql
24
schema.sql
@@ -52,6 +52,8 @@ CREATE TABLE IF NOT EXISTS transactions (
|
||||
reference_id INTEGER,
|
||||
confirmed_by INTEGER,
|
||||
confirmed_at DATETIME,
|
||||
status_notified_at DATETIME,
|
||||
reminder_sent_at DATETIME,
|
||||
created_at DATETIME DEFAULT CURRENT_TIMESTAMP,
|
||||
FOREIGN KEY (user_id) REFERENCES users(id),
|
||||
FOREIGN KEY (confirmed_by) REFERENCES users(id)
|
||||
@@ -68,6 +70,7 @@ CREATE TABLE IF NOT EXISTS bank_notifications (
|
||||
transaction_time DATETIME,
|
||||
raw_message TEXT,
|
||||
matched_transaction_id INTEGER,
|
||||
match_notified_at DATETIME,
|
||||
created_at DATETIME DEFAULT CURRENT_TIMESTAMP,
|
||||
FOREIGN KEY (matched_transaction_id) REFERENCES transactions(id)
|
||||
);
|
||||
@@ -107,6 +110,7 @@ CREATE TABLE IF NOT EXISTS servers (
|
||||
provisioned_at DATETIME,
|
||||
terminated_at DATETIME,
|
||||
expires_at DATETIME,
|
||||
last_notified_status TEXT,
|
||||
created_at DATETIME DEFAULT CURRENT_TIMESTAMP,
|
||||
updated_at DATETIME DEFAULT CURRENT_TIMESTAMP,
|
||||
FOREIGN KEY (user_id) REFERENCES users(id)
|
||||
@@ -194,6 +198,8 @@ CREATE TABLE IF NOT EXISTS knowledge_articles (
|
||||
tags TEXT,
|
||||
language TEXT DEFAULT 'ko',
|
||||
is_active INTEGER DEFAULT 1,
|
||||
embedding_indexed INTEGER DEFAULT 0,
|
||||
embedding_indexed_at DATETIME,
|
||||
created_at DATETIME DEFAULT CURRENT_TIMESTAMP,
|
||||
updated_at DATETIME DEFAULT CURRENT_TIMESTAMP
|
||||
);
|
||||
@@ -335,3 +341,21 @@ CREATE INDEX IF NOT EXISTS idx_onboarding_expires ON onboarding_sessions(expires
|
||||
CREATE INDEX IF NOT EXISTS idx_troubleshoot_expires ON troubleshoot_sessions(expires_at);
|
||||
CREATE INDEX IF NOT EXISTS idx_asset_expires ON asset_sessions(expires_at);
|
||||
CREATE INDEX IF NOT EXISTS idx_billing_expires ON billing_sessions(expires_at);
|
||||
|
||||
----------------------------------------------------------------------
|
||||
-- Notification Tracking Columns (Migration)
|
||||
----------------------------------------------------------------------
|
||||
|
||||
-- servers: 상태 변경 알림 추적
|
||||
-- ALTER TABLE servers ADD COLUMN last_notified_status TEXT;
|
||||
|
||||
-- transactions: 입금 승인/거부 알림 + 리마인더 추적
|
||||
-- ALTER TABLE transactions ADD COLUMN status_notified_at DATETIME;
|
||||
-- ALTER TABLE transactions ADD COLUMN reminder_sent_at DATETIME;
|
||||
|
||||
-- bank_notifications: 매칭 알림 추적
|
||||
-- ALTER TABLE bank_notifications ADD COLUMN match_notified_at DATETIME;
|
||||
|
||||
-- Knowledge articles: 임베딩 인덱싱 추적
|
||||
-- ALTER TABLE knowledge_articles ADD COLUMN embedding_indexed INTEGER DEFAULT 0;
|
||||
-- ALTER TABLE knowledge_articles ADD COLUMN embedding_indexed_at DATETIME;
|
||||
|
||||
Reference in New Issue
Block a user