Site assistant (Marty 2026-11-15): chat widget in the ViralAdBlitz look on every page, CANNED + FACTS from this repo's code (Boost $5/500 views, 10% x 5 + 50% company, 20 places, 30-day delivery, ad limits, verified views), retrieval over the shared network knowledge base on the hub (netkb.js publishes this site's entries and reads the others', home entries boosted), OpenRouter deepseek-v4-flash with reasoning off, account problems hand off to network support. kb.json is a MySQL document. qa/chatbot.test.mjs 195 pass, smoke 198/198
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
@@ -31,6 +31,7 @@ const proof = require('./proof');
|
||||
const netsites = require('./netsites');
|
||||
const vabnas = require('./vabnas');
|
||||
const lstrack = require('./lstrack');
|
||||
const chatbot = require('./chatbot'); // the site assistant (2026-11-15): chatcore.js + kb.js + the network knowledge base (netkb.js)
|
||||
|
||||
const PUB = path.join(__dirname, 'public');
|
||||
const ADDR_RE = /^0x[0-9a-fA-F]{40}$/;
|
||||
@@ -214,6 +215,7 @@ const server = http.createServer(async (req, res) => {
|
||||
try {
|
||||
if (req.method === 'GET' && (p.startsWith('/sso/') || p === '/api/sso/status') && await networksso.handle(req, res, u)) return;
|
||||
if ((p === '/api/promo-kit' || p === '/promote') && promokit.handle(req, res, u, sendFile)) return;
|
||||
if ((p.startsWith('/api/chat') || p.startsWith('/api/admin/kb')) && await chatbot.handle(req, res, p, u, { json, readBody, isAdmin })) return;
|
||||
|
||||
if (req.method === 'GET' || req.method === 'HEAD') {
|
||||
if (p === '/health') return json(res, 200, { ok: true, store: docstore.isOn() ? 'mysql' : 'files' });
|
||||
@@ -471,6 +473,7 @@ const server = http.createServer(async (req, res) => {
|
||||
shop.init(C);
|
||||
vabnas.init({ boosts: () => wire.purchases(), remaining: b => wire.remaining(b), ad: id => store.ad(id) });
|
||||
setInterval(() => { if (store.prune()) wire.rebuild(); }, 3600000).unref();
|
||||
chatbot.init(); // after docstore.init: kb.json is a MySQL document
|
||||
lstrack.init(C, store); // LinkSpin tracked links for text ads: retry sweep (fails soft while LinkSpin is down or does not know the endpoint)
|
||||
{ let busy = false; const tick = () => { if (busy) return; busy = true; lstrack.sweep(25).catch(() => {}).finally(() => { busy = false; }); };
|
||||
setTimeout(tick, Number(process.env.LS_SWEEP_FIRST_MS || 20000)).unref(); setInterval(tick, Number(process.env.LS_SWEEP_MS || 120000)).unref(); }
|
||||
|
||||
Reference in New Issue
Block a user