Add AI chat backend via OpenRouter with knowledge-base fallback

POST /api/public/chat proxies to OpenRouter (model from
OPENROUTER_MODEL, default deepseek/deepseek-v4-flash:nitro) with a
system prompt built from live site config, sponsor queue, and strict
guardrails (no income claims, seed-phrase warnings, Telegram fallback).
Rate-limited per IP. Without OPENROUTER_API_KEY set, or on any API
error, the widget transparently falls back to the built-in knowledge
base, so the chat always works.

Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
This commit is contained in:
martbost
2026-08-12 08:47:02 -05:00
parent 708068a9a7
commit ca5605e056
3 changed files with 72 additions and 2 deletions
+2
View File
@@ -44,3 +44,5 @@ a{color:inherit}.wrap{width:min(1160px,calc(100% - 32px));margin:auto}.nav{heigh
.chat-foot{padding:8px 14px 12px;font-size:12px;color:var(--muted);text-align:center}
.chat-foot a{color:var(--teal)}
.chat-hidden{display:none}
.chat-typing{letter-spacing:3px;animation:chatpulse 1s infinite}
@keyframes chatpulse{50%{opacity:.35}}